It looks like the version of this routine is Xenial is not impacted
since it hasn't received this refactor patch which constrains the
allocation to 16 bytes: 03b5929ebb20 ("nvme: rewrite discard support").
I will remove the Xenial nomination.

** Description changed:

+ [Impact]
+ 
+ Discard requests can fail on a non-compliant nvme device meaning that
+ prescribed maintenance use of fstrim will be unsuccessful and unused
+ blocks are no longer properly disposed of.
+ 
+ [Test case]
+ 
+ Run fstrim (from bug report, ran as root: fstrim -v /)
+ 
+ Expected result: "/: 758.3 GiB (814159003648 bytes) trimmed" -- will
+ vary depending on the blocks that are unused for your system
+ 
+ Unpatched actual result: "fstrim: /: FITRIM ioctl failed: Input/output
+ error"
+ 
+ [Regression Potential]
+ 
+ This patch only increases the size of a memory allocation and does not
+ add any changes in logic for error handling or normal flow of control.
+ This routine already handles the case where the memory allocation fails.
+ Because of this, it is a low risk change.
+ 
+ Original bug description below:
+ --------------------------------------
+ 
  /dev/nvme0n1 Sabrent Rocket 4.0 1TB firmware RKT401.1
  
  on Ubuntu 19.10 with an ASRock 300 Deskmini motherboard and a Ryzen
  3400G CPU. The filesystem is ext4:
  
  Linux elemental 5.3.0-24-generic #26-Ubuntu SMP Thu Nov 14 01:33:18 UTC
  2019 x86_64 x86_64 x86_64 GNU/Linux
  
  UUID=c1812230-91be-4a18-8055-c3b7c82fbbd8 / ext4 defaults 0 0
  /dev/nvme0n1p2 on / type ext4 (rw,relatime)
  
  When I run fstrim -v / as root, I get the following error message at the
  command line:
  
  seth@elemental:~$ sudo fstrim -v /
  fstrim: /: FITRIM ioctl failed: Input/output error
  
  and the following kernel messages are logged:
  
  [ 136.309115] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT 
domain=0x0000 address=0x0 flags=0x0000]
  [ 136.309129] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT 
domain=0x0000 address=0x700 flags=0x0000]
  [ 136.309139] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT 
domain=0x0000 address=0x680 flags=0x0000]
  [ 136.309150] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT 
domain=0x0000 address=0x300 flags=0x0000]
  [ 136.309162] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT 
domain=0x0000 address=0x200 flags=0x0000]
  [ 136.309171] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT 
domain=0x0000 address=0x580 flags=0x0000]
  [ 136.309180] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT 
domain=0x0000 address=0x100 flags=0x0000]
  [ 136.309189] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT 
domain=0x0000 address=0x400 flags=0x0000]
  [ 136.309198] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT 
domain=0x0000 address=0x380 flags=0x0000]
  [ 136.309207] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT 
domain=0x0000 address=0x780 flags=0x0000]
  [ 136.309216] amd_iommu_report_page_fault: 1 callbacks suppressed
  [ 136.309218] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 
domain=0x0000 address=0x180 flags=0x0000]
  [ 136.309228] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 
domain=0x0000 address=0x500 flags=0x0000]
  [ 136.309238] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 
domain=0x0000 address=0x480 flags=0x0000]
  [ 136.309250] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 
domain=0x0000 address=0x280 flags=0x0000]
  [ 136.309259] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 
domain=0x0000 address=0x600 flags=0x0000]
  [ 136.309269] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 
domain=0x0000 address=0x80 flags=0x0000]
  [ 136.309279] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 
domain=0x0000 address=0x980 flags=0x0000]
  [ 136.309291] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 
domain=0x0000 address=0x900 flags=0x0000]
  [ 136.309301] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 
domain=0x0000 address=0x880 flags=0x0000]
  [ 136.309311] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 
domain=0x0000 address=0xa00 flags=0x0000]
  [ 136.309762] blk_update_request: I/O error, dev nvme0n1, sector 1141976 op 
0x3:(DISCARD) flags 0x800 phys_seg 1 prio class 0
  
- 
- I have tried setting iommu passthrough on boot but this doesn’t seem to help:
+ I have tried setting iommu passthrough on boot but this doesn’t seem to
+ help:
  
  GRUB_CMDLINE_LINUX_DEFAULT="amd_iommu=pt avic=1”
  
  This is possibly related to:
  
  https://bugzilla.kernel.org/show_bug.cgi?id=202665
  
http://git.infradead.org/nvme.git/commitdiff/530436c45ef2e446c12538a400e465929a0b3ade?hp=400b6a7b13a3fd71cff087139ce45dd1e5fff444

** No longer affects: linux (Ubuntu Xenial)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1856603

Title:
  fstrim on nvme / AMD CPU fails and produces kernel error messages

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1856603/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to