Fixing kernel error AMD-Vi: Event logged IO_PAGE_FAULT on Ryzen Machine
1 2 3 4 5 6 |
Oct 29 07:40:01 mypc-PC anacron[3153]: Job `cron.weekly' started Oct 29 07:40:01 mypc-PC anacron[2414]: Updated timestamp for job `cron.weekly' to 2019-10-29 Oct 29 07:40:01 mypc-PC kernel: [1207844.240253] AMD-Vi: Event logged [IO_PAGE_FAULT device=1b:00.0 domain=0x000d address=0x0000000000000000 flags=0x0000] Oct 29 07:40:01 mypc-PC kernel: [1207844.240260] AMD-Vi: Event logged [IO_PAGE_FAULT device=1b:00.0 domain=0x000d address=0x0000000000000400 flags=0x0000] Oct 29 07:40:01 mypc-PC kernel: [1207844.240347] AMD-Vi: Event logged [IO_PAGE_FAULT device=1b:00.0 domain=0x000d address=0x0000000000000000 flags=0x0000] Oct 29 07:40:01 mypc-PC kernel: [1207844.240349] AMD-Vi: Event logged [IO_PAGE_FAULT device=1b:00.0 domain=0x000d address=0x0000000000000200 flags=0x0000] |
My pc was periodically shut down on 7:40 am JST. I tryied to figure out why.
I checked the log in /var/log/syslog
. There was a lot of the same errors shown as preceding text.
It seems to be caused by fstrim
command triggered by anacron.weekly
job. That’s why it happens in a certain period. When I manually executed fstrim --all
, the errors was raised too.
Then, I found the bug repport in the bugzilla homepage.
202665 – NVMe AMD-Vi IO_PAGE_FAULT only with hardware IOMMU and fstrim/discard
That said it happened because of kernel bugs caused by a machine with Ryzen CPU.
目次
My Environment
1 2 3 4 5 |
Ubuntu 16.04 x64 kernel 4.4.0-166.195 CPU : AMD Ryzen 7 2700X Eight-Core Processor Motherboard : X470 GAMING PLUS (MS-7B79) m.2 SSD: Sillicon Powwer P34A80 |
Easy solution
Easiest solution is put soft
option to iommu
in the kernel setting such as putting iommu=soft
in Grub default. Still I don’t know much about how software iommu works, but it seems to make a delay to map files because it uses software rendering. I rather would like to use hardware rendering.
Fix the Kernel bug and build custom kernel.
That was really painful but I finanlly made it work. All I need is to apply the diff file like below to the kernel. The fix was mentioned in the bug repport page.
1 2 3 4 5 6 7 8 9 10 11 12 |
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 6cbde30..a8bd71c 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -470,7 +470,7 @@ static blk_status_t nvme_setup_discard(struct nvme_ns *ns, struct request *req, struct nvme_dsm_range *range; struct bio *bio; - range = kmalloc_array(segments, sizeof(*range), GFP_ATOMIC); + range = kmalloc_array(256, sizeof(*range), GFP_ATOMIC); if (!range) return BLK_STS_RESOURCE; |
However, if you are using kernel 4.4, there is no kmalloc_array
in the core.c
file. So you need to upgrade your kernel if you are using Ubuntu 16.04 or find your own way.
1 |
sudo apt install linux-generic-hwe-16.04 |
After executing preceding command, you can use kernel 4.15.0, which is used by Ubuntu 18.04.
I made a docker image to build the kernel 4.15.0 for ubuntu 16.04. Make sure the branch is ubuntu16.04-kernel4.15.0
.
Docker Image
GitHub – fx-kirin/docker-ubuntu-kernel-build at ubuntu16.04-kernel4.15.0
I also tried to build kernel 4.15 for Ubuntu 18.04. The branch name is ubuntu18.04
. The patch file there is not ready to apply the fix, but it can build the kernel. So if you want to use it, please carefully check the way to apply patch in ubuntu16.04-kernel4.15.0
.
Docker command
1 2 |
docker build -t kernel-build-16.04-4.15.0 . docker run -it --rm -v ~/kbuild/ubuntu16.04/kernel4.15.0:/data -v ~/linux-patches/ubuntu16.04/kernel4.15.0/:/patches -e KERNEL_MAJOR=4.15.0 -e BUILD_CLEAN=Yes kernel-build-16.04-4.15.0 |
You put the patch file fix-nvme_18_04.patch
to ~/linux-patches/ubuntu16.04/kernel4.15.0/
, then you can build the patched kernel. Then copy all .deb
files to your PC and install them with sudo dpkg -i *.deb
command. If it fails, you should to try execute sudo apt intall -f
command and try it again.
Result
After this patch, fstrim
command works perfectly. Congrats.
Note
The interesting thing is that , if you want to use custom version name, you have to change the version name in the file changelog
normally in debian.master
directory (but this time, it is debian.hwe
because I am using HWE Ubuntu).
And custom version name must not contain hyphen -
. see here



About Fx-Kirin
2009年10月にFXを開始、翌年2010年5月から脱サラをしてFX業界に専念。 2012年10月頃から本格的に勝ち始め、一月で資産を倍にする、2年半月間負けなし等、安定した収支で2013年11月に生涯FX収支が1億を超える。 投資スタイルはシステムトレード。プログラミングの知識がほぼない状態から、独学で自分がしたいと思うことであればほぼ実現することが可能なレベルまで成長。好きな言語はRuby, Python。必要となればC++からVBA、Pascal等なんでも行う。MT4/MT5のプログラミングも得意。 2011年にはFXで稼いだ資金をもとにシンガポールに移住し、留学も兼ねて起業をチャレンジするほど、ビジネスを興すことに熱意がある。国内の業者を主に使い始めたことから、2012年に帰国。零細株式会社経営中。
- Web |
- More Posts (410)
Adsense
関連記事
-
-
Run Jupyter Notebook on start up of Ubuntu with screen command
make .screen folder. Without this, you might meet an
-
-
Sakura VPS Ubuntu 12.04 に Ruby on rails と PHP、 メールサーバ構築までまとめてみる。 その1
何回やっても躓くサーバー建て。勉強を兼ねてまとめてみることにする。 OSの再インストール さくらの管理画面から、再イン
-
-
Rails whenever gemを使ってCronによりrakeコマンドを定期実行させると、bundle コマンドが見つかりません bundle: command not foundになる
http://stackoverflow.com/questions/9482298/rails-cron-whene
-
-
SAKURAで借りたUbuntu VPS にメールサーバを立てるときのメモ
作業メモブログとなりつつあるここ。当人は120万円のドローダウンで泣いてます。さて、本題。sudo apt-get i
-
-
Sakura VPS Ubuntu 12.04 に Ruby on rails と PHP、 メールサーバ構築までまとめてみる。 その5
Ilohamail の設定 http://www.kazutoyo.com/ubuntu/?page_id=571W
-
-
chmod で やらかしてしまったときの対処法
メモ書きです。 find | xargs とかを普通にやってしまうと、すぐに arguments too long
-
-
Linux Wine に Java 8 JDK を入れる
Java JDK をダウンロードしてくる Java SE Development Kit 8 - Downloads[
-
-
Ubuntu で仮想ディスプレイを使う
雑多な備忘録ですが、せっかくなので残しておきます。 Ubuntu 18.04 の resolv.conf を直す ~
-
-
Sakura VPS Ubuntu 12.04 に Ruby on rails と PHP、 メールサーバ構築までまとめてみる。 その2
ApacheとPHPのインストール sudo apt-get install apache2 php5 php5-gd
-
-
Sakura VPS Ubuntu 12.04 に Ruby on rails と PHP、 メールサーバ構築までまとめてみる。 その3
postfixのインストール http://www.kazutoyo.com/ubuntu/?page_id=279
- PREV
- Ubuntu で仮想ディスプレイを使う
- NEXT
- joblib によって謎のバグが起こる
Adsense
NEW ENTRY
-
- Linux Mint 20 での日本語の設定について。
フォントの設定とかはいろいろなところで触れられているので、他にない情報だけ。 TL;DR F
-
- joblib によって謎のバグが起こる
joblib 0.14.1 にて確認.0.13.2 だと起こらない.import joblib を消
-
- Fixing kernel error AMD-Vi: Event logged IO_PAGE_FAULT on Ryzen Machine
My pc was periodically shut down on 7:40 am JS
-
- Ubuntu で仮想ディスプレイを使う
雑多な備忘録ですが、せっかくなので残しておきます。 Ubuntu 18.04 の resolv.c
-
- PYPIへの登録を10秒でできるようになる方法
pip 使ってますよね Pythonを使っている人であれば、pip installでライブラリ
Twitter
RSS
カテゴリー
-
人気記事一覧
任意のインジケータのシグナルでアラートやメール機能を追加する 522ビュー
まだBokehで消耗してるの?これからはPandas-Bokehを使おうぜ 219ビュー
Pythonで簡単自動化!PyAutoGuiが便利すぎて感動したのでご紹介 212ビュー
Ubuntu で仮想ディスプレイを使う 183ビュー
Pythonのsocketでプロセス間通信をして価格データ等を送信する 122ビュー
Add Alert and SendMailの改造 114ビュー
Synology DS216j の MySQL に外部からつなぐ 103ビュー