AMD iopt levels question
I don't recall, is there a reason amd_iommu doesn't initialize the io page tables to the number of levels supported on the system?
I was looking at an issue recently with an i40e controller where someone had a set of them in a bond. When it would fail over to another device, the device would make a request to map as part of that, and the domain would transition into the 64-bit iova address space. When that happens the i40e would start generating requests causing io page faults to monotonically increasing addresses starting at 0x0, repeatedly causing event log resets.
I didn't have a system where I could reproduce with bonded group of them, but I could induce the behavior of the i40e generating the dma requests by doing horrible things like throwing a bunch of io at it from a remote system, and then mess with ring buffer sizes for the device. I was able to capture a vmcore, and near as I could tell it is during a window where the DTE gets updated as part of increasing the io page table levels, a UR would be sent back to the i40e in response to a request, and the controller would start sending these dma requests.
With the HATS support in the kernel now would it make sense to initialize pgtable->mode to amd_iommu_hpt_level if it is set?
Regards,
Jerry
Hi Jerry,
Quoted 2 lines · Jerry Snitselaar
I don't recall, is there a reason
amd_iommudoesn't initialize the io page tables to the number of levels supported on the system?
Its because HW supports increasing level dynamically and for performance reason we start w/ 3 level.
Quoted 8 lines
I was looking at an issue recently with an i40e controller where someone had a set of them in a bond. When it would fail over to another device, the device would make a request to map as part of that, and the domain would transition into the 64-bit iova address space. When that happens the i40e would start generating requests causing io page faults to monotonically increasing addresses starting at
0x0, repeatedly causing event log resets.
I didn't get the problem. Why will it start from address 0x0? Our default is 3 level. Even when its increasing the page table level, it shouldn't hit fault for existing maps.
Quoted 11 lines
I didn't have a system where I could reproduce with bonded group of them, but I could induce the behavior of the i40e generating the dma requests by doing horrible things like throwing a bunch of io at it from a remote system, and then mess with ring buffer sizes for the device. I was able to capture a vmcore, and near as I could tell it is during a window where the DTE gets updated as part of increasing the io page table levels, a UR would be sent back to the i40e in response to a request, and the controller would start sending these dma requests.
Quoted 2 lines
With the HATS support in the kernel now would it make sense to initialize
pgtable->modetoamd_iommu_hpt_levelif it is set?
Are you referring to upstream code with generic page table support?
-Vasant
Quoted 18 lines · Vasant Hegde
Hi Jerry,
Quoted 2 lines · Jerry Snitselaar
I don't recall, is there a reason
amd_iommudoesn't initialize the io page tables to the number of levels supported on the system?Its because HW supports increasing level dynamically and for performance reason we start w/ 3 level.
Quoted 8 lines
I was looking at an issue recently with an i40e controller where someone had a set of them in a bond. When it would fail over to another device, the device would make a request to map as part of that, and the domain would transition into the 64-bit iova address space. When that happens the i40e would start generating requests causing io page faults to monotonically increasing addresses starting at
0x0, repeatedly causing event log resets.
Quoted 4 lines
I didn't get the problem. Why will it start from address
0x0? Our default is 3 level. Even when its increasing the page table level, it shouldn't hit fault for existing maps.
I don't think the 0x0 is from the iova management code, but potentially the firmware on these controllers, and I don't think it is generating faults from any valid dma addresses, except potentially for permission errors. It is just into this state where it clears some register, and it is walking the entire iova address space for the domain. The vast majority of the callbacks are suppressed, plus the event log needs to keep restarting, but in one of the logs it had walked up past the 32-bit boundary with the requests before they dealt with the system. To be clear I think the problem is with the controller, not the iommu code. Using iommu.forcedac works around the issue. I tried to see if I could make it happen with some other controller, and had no luck with that. It was just a thought that there is the window when it is doing the DTE update due to the page level increase where the IOMMU will reject requests.
Quoted 12 lines
Quoted 12 lines
I didn't have a system where I could reproduce with bonded group of them, but I could induce the behavior of the i40e generating the dma requests by doing horrible things like throwing a bunch of io at it from a remote system, and then mess with ring buffer sizes for the device. I was able to capture a vmcore, and near as I could tell it is during a window where the DTE gets updated as part of increasing the io page table levels, a UR would be sent back to the i40e in response to a request, and the controller would start sending these dma requests.
Quoted 7 lines
Quoted 2 lines
With the HATS support in the kernel now would it make sense to initialize
pgtable->modetoamd_iommu_hpt_levelif it is set?Are you referring to upstream code with generic page table support?
-Vasant
The dangers of looking at a downstream issue, and writing email. Sorry about that. The original reported issue was a downstream release with earlier code. I'd reproduced the behavior from the i40e with a build of 7.0-rc1 at the time, but I'm verifying now if it still happens with a current build. So with the generic_pt code it would be cfg->starting_level. Really though this is something for Intel to look into with that controller. Console log below to show what it looks like when the i40e goes off the rails.
Regards,
Jerry
---
[root@lenovo-sd535v3-04 ~]# uname -r
7.1.0-0.rc7.260611g9716c086c8e8.50.eln157.x86_64
start sending traffic to the system
mess with the mtu and tx/rx ring sizes
...
[ 3175.119566] i40e 0000:81:00.0 ens1f0np0: Changing Tx descriptor count from 512 to 8160.
[ 3175.133364] i40e 0000:81:00.0 ens1f0np0: Changing Rx descriptor count from 512 to 8160
[ 3175.264538] i40e 0000:81:00.0: Using 64-bit DMA addresses
[ 3175.270271] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x14 flags=0x0000]
[ 3175.281573] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x1014 flags=0x0000]
[ 3175.292722] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x2014 flags=0x0050]
[ 3175.303870] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x3014 flags=0x0050]
[ 3175.315017] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x3214 flags=0x0050]
[ 3175.326166] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x3414 flags=0x0050]
[ 3175.337313] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x3614 flags=0x0050]
[ 3175.410119] i40e 0000:81:00.0: VSI seid 390 Tx ring 0 disable timeout
[root@lenovo-sd535v3-04 ~]# [ 3193.727720] i40e 0000:81:00.0 ens1f0np0: NETDEV WATCHDOG: CPU: 128: transmit queue 86 timed out 5504 ms
[ 3193.738292] i40e 0000:81:00.0 ens1f0np0: tx_timeout: VSI_seid: 390, Q 86, NTC: 0x0, HWB: 0x0, NTU: 0x2, TAIL: 0x0, INT: 0x1
[ 3193.750798] i40e 0000:81:00.0 ens1f0np0: tx_timeout recovery level 1, txqueue 86
[ 3193.811965] i40e 0000:81:00.0: VSI seid 390 Tx ring 0 disable timeout
[ 3194.033833] i40e 0000:81:00.0: VSI seid 392 Tx ring 767 disable timeout
[ 3194.274965] i40e 0000:81:00.1: VSI seid 391 Tx ring 0 disable timeout
[ 3194.341842] i40e 0000:81:00.1: VSI seid 393 Tx ring 767 disable timeout
[ 3197.343334] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x3814 flags=0x0000]
[ 3197.354485] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x4014 flags=0x0000]
[ 3197.365633] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x5014 flags=0x0000]
[ 3197.376781] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x6014 flags=0x0000]
[ 3197.387929] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x7014 flags=0x0000]
[ 3197.399076] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x8014 flags=0x0000]
[ 3197.410227] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x8a14 flags=0x0000]
[ 3197.421376] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x9014 flags=0x0000]
[ 3197.432523] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x9a14 flags=0x0000]
[ 3197.443670] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0xa014 flags=0x0000]
[ 3197.457770] AMD-Vi: IOMMU Event log restarting
[ 3197.465917] AMD-Vi: IOMMU Event log restarting
[ 3197.474064] AMD-Vi: IOMMU Event log restarting
[ 3197.482210] AMD-Vi: IOMMU Event log restarting
[ 3197.490358] AMD-Vi: IOMMU Event log restarting
[ 3197.498504] AMD-Vi: IOMMU Event log restarting
[ 3197.506644] AMD-Vi: IOMMU Event log restarting
[ 3197.514793] AMD-Vi: IOMMU Event log restarting
[ 3197.522941] AMD-Vi: IOMMU Event log restarting
[ 3197.531086] AMD-Vi: IOMMU Event log restarting
[ 3200.145031] i40e 0000:81:00.0: capability discovery failed, err -EIO aq_err LIBIE_AQ_RC_OK
[ 3200.410262] i40e 0000:81:00.0: ignoring delete macvlan error on PF, err -EIO, aq_err LIBIE_AQ_RC_OK
[ 3202.343533] amd_iommu_report_page_fault: 815972 callbacks suppressed
[ 3202.343535] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x94b843014 flags=0x0000]
[ 3202.363252] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x94b843814 flags=0x0000]
[ 3202.391691] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x94b844014 flags=0x0000]
[ 3202.420100] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x94b844814 flags=0x0000]
[ 3202.443571] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x94b845014 flags=0x0000]
[ 3202.455260] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x94b845814 flags=0x0000]
[ 3202.466946] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x94b846014 flags=0x0000]
[ 3202.478627] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x94b846814 flags=0x0000]
[ 3202.490307] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x94b847014 flags=0x0000]
[ 3202.501987] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x94b847c14 flags=0x0000]
... lots of event log restarts and io page fault messages ...
[ 3242.351205] amd_iommu_report_page_fault: 802222 callbacks suppressed
[ 3242.351206] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x53b3cb8814 flags=0x0000]
[ 3242.386829] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x53b3cb9014 flags=0x0000]
[ 3242.415291] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x53b3cb9814 flags=0x0000]
[ 3242.431241] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x53b3cba014 flags=0x0000]
[ 3242.443004] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x53b3cba814 flags=0x0000]
[ 3242.454768] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x53b3cbb014 flags=0x0000]
[ 3242.466529] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x53b3cbbe14 flags=0x0000]
[ 3242.478292] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x53b3cbc014 flags=0x0000]
[ 3242.490054] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x53b3cbc614 flags=0x0000]
[ 3242.501821] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x53b3cbce14 flags=0x0000]
[ 3242.529911] amd_iommu_restart_log: 1502 callbacks suppressed
[ 3242.529912] AMD-Vi: IOMMU Event log restarting
[ 3242.544484] AMD-Vi: IOMMU Event log restarting
[ 3242.552667] AMD-Vi: IOMMU Event log restarting
[ 3242.560844] AMD-Vi: IOMMU Event log restarting
[ 3242.569018] AMD-Vi: IOMMU Event log restarting
[ 3242.577193] AMD-Vi: IOMMU Event log restarting
[ 3242.585368] AMD-Vi: IOMMU Event log restarting
[ 3242.593543] AMD-Vi: IOMMU Event log restarting
[ 3242.601719] AMD-Vi: IOMMU Event log restarting
[ 3242.609892] AMD-Vi: IOMMU Event log restarting
[ 3247.352164] amd_iommu_report_page_fault: 802273 callbacks suppressed
[ 3247.352165] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x5d0163f814 flags=0x0000]
[ 3247.387790] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x5d01640014 flags=0x0000]
[ 3247.416251] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x5d01640814 flags=0x0000]
[ 3247.431201] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x5d01641014 flags=0x0000]
[ 3247.442964] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x5d01641814 flags=0x0000]
[ 3247.454729] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x5d01642014 flags=0x0000]
[ 3247.466492] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x5d01642814 flags=0x0000]
[ 3247.478255] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x5d01643014 flags=0x0000]
[ 3247.490016] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x5d01643814 flags=0x0000]
[ 3247.501779] i40e 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0011 address=0x5d01644014 flags=0x0000]With forcedac set:
[root@lenovo-sd535v3-04 ~]# uname -r
7.1.0-0.rc7.260611g9716c086c8e8.50.eln157.x86_64
[root@lenovo-sd535v3-04 ~]# ip link set ens1f0np0 mtu 9000
start scp of iso on remote system to i40e system
[root@lenovo-sd535v3-04 ~]# ethtool -G ens1f0np0 rx 8160 tx 8160
[ 80.033523] i40e 0000:81:00.0 ens1f0np0: Changing Tx descriptor count from 512 to 8160.
[ 80.047691] i40e 0000:81:00.0 ens1f0np0: Changing Rx descriptor count from 512 to 8160
[root@lenovo-sd535v3-04 ~]#
[root@lenovo-sd535v3-04 ~]# cat /proc/cmdline
BOOT_IMAGE=(hd0,gpt2)/vmlinuz-7.1.0-0.rc7.260611g9716c086c8e8.50.eln157.x86_64 root=/dev/mapper/rhel_lenovo--sd535v3--04-root ro crashkernel=2G-64G:256M,64G-:512M resume=UUID=12da0907-a209-4e4a-a294-ea9a06817efe rd.lvm.lv=rhel_lenovo-sd535v3-04/root rd.lvm.lv=rhel_lenovo-sd535v3-04/swap console=tty0 console=ttyS0,115200n81 iommu.forcedac=1Quoted 9 lines · Jerry Snitselaar
I didn't have a system where I could reproduce with bonded group of them, but I could induce the behavior of the i40e generating the dma requests by doing horrible things like throwing a bunch of io at it from a remote system, and then mess with ring buffer sizes for the device. I was able to capture a vmcore, and near as I could tell it is during a window where the DTE gets updated as part of increasing the io page table levels, a UR would be sent back to the i40e in response to a request, and the controller would start sending these dma requests.
IIRC there were some bugs around this flow that were races with the DTE/IOPTE changes and concurrent DMA. I belive the current upstream kernel has fixed them all.
You shouldn't get an kind of UR during the increasing process for any in-use valid dma_addr_t.
Jason