❌ FAIL: Test report for kernel 5.13.0-rc7 (arm-next, 8ab9b1a9)
Subsystems (3)
Hello,
We ran automated tests on a recent commit from this kernel tree:
Kernel repo: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git
Commit: 8ab9b1a98a22 - Merge branch 'for-next/core' into for-kernelci
The results of these automated tests are provided below.
Overall result: FAILED (see details below)
Merge: OK
Compile: OK
Tests: FAILED
All kernel binaries, config files, and logs are available for download here:
One or more kernel tests failed:
aarch64:
❌ LTPWe hope that these logs can help you find the problem quickly. For the full detail on our testing procedures, please scroll to the bottom of this message.
Please reply to this email if you have any questions about the tests that we ran or if you have any suggestions on how to make future tests more effective.
,-. ,-.
( C ) ( K ) Continuous
`-',-.`-' Kernel
( I ) Integration
`-'______________________________________________________________________________
Compile testing
---------------
We compiled the kernel for 1 architecture:
aarch64:
make options: make -j24 INSTALL_MOD_STRIP=1 targz-pkg
Hardware testing
----------------
We booted each kernel and ran the following tests:
aarch64:
Host 1:
✅ Boot test
✅ ACPI table test
✅ ACPI enabled test
❌ LTP
✅ CIFS Connectathon
✅ POSIX pjd-fstest suites
✅ Loopdev Sanity
✅ jvm - jcstress tests
✅ Memory: fork_mem
✅ Memory function: memfd_create
✅ AMTU (Abstract Machine Test Utility) ✅ Networking bridge: sanity
✅ Ethernet drivers sanity
✅ Networking socket: fuzz
✅ Networking: igmp conformance test
✅ Networking route: pmtu
✅ Networking route_func - local
✅ Networking route_func - forward
✅ Networking TCP: keepalive test
✅ Networking UDP: socket
✅ Networking cki netfilter test
✅ Networking tunnel: geneve basic test ✅ Networking tunnel: gre basic
✅ L2TP basic test
✅ Networking tunnel: vxlan basic
✅ Networking ipsec: basic netns - transport ✅ Networking ipsec: basic netns - tunnel ✅ Libkcapi AF_ALG test
✅ pciutils: update pci ids test
✅ ALSA PCM loopback test
✅ ALSA Control (mixer) Userspace Element test ✅ storage: SCSI VPD
✅ trace: ftrace/tracer
🚧 ✅ xarray-idr-radixtree-test
🚧 ✅ i2c: i2cdetect sanity
🚧 ✅ Firmware test suite
🚧 ✅ Memory function: kaslr
🚧 ✅ audit: audit testsuite test
Host 2:
✅ Boot test
✅ xfstests - ext4
✅ xfstests - xfs
✅ selinux-policy: serge-testsuite
✅ storage: software RAID testing
✅ Storage: swraid mdadm raid_module test 🚧 ❌ Podman system integration test - as root 🚧 ❌ Podman system integration test - as user 🚧 ✅ xfstests - btrfs
🚧 ✅ IPMI driver test
🚧 ✅ IPMItool loop stress test
🚧 ✅ Storage blktests
🚧 ✅ Storage block - filesystem fio test 🚧 ✅ Storage block - queue scheduler test 🚧 ✅ Storage nvme - tcp
🚧 ✅ Storage: lvm device-mapper test 🚧 ❌ stress: stress-ng
Test sources: https://gitlab.com/cki-project/kernel-tests
💚 Pull requests are welcome for new tests or improvements to existing tests!
Aborted tests
-------------
Tests that didn't complete running successfully are marked with ⚡⚡⚡. If this was caused by an infrastructure issue, we try to mark that explicitly in the report.
Waived tests
------------
If the test run included waived tests, they are marked with 🚧. Such tests are executed but their results are not taken into account. Tests are waived when their results are not reliable enough, e.g. when they're just introduced or are being fixed.
Testing timeout
---------------
We aim to provide a report within reasonable timeframe. Tests that haven't finished running yet are marked with ⏱.
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Will Deacon
maintainerQuoted 12 lines · CKI Project
We ran automated tests on a recent commit from this kernel tree:
Kernel repo: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git
Commit:8ab9b1a98a22- Merge branch 'for-next/core' into for-kernelciThe results of these automated tests are provided below.
Overall result: FAILED (see details below)
Merge: OK
Compile: OK
Tests: FAILED
Quoted 8 lines
All kernel binaries, config files, and logs are available for download here:
One or more kernel tests failed:
aarch64: ❌ LTP
I think this is fixed by:
https://lore.kernel.org/lkml/[email protected]/
Quoted 2 lines
🚧 ❌ Podman system integration test - as root 🚧 ❌ Podman system integration test - as user
These don't seem kernel related? (fails to retrieve an image afaict)
Quoted 9 lines
🚧 ✅ xfstests - btrfs
🚧 ✅ IPMI driver test
🚧 ✅ IPMItool loop stress test
🚧 ✅ Storage blktests
🚧 ✅ Storage block - filesystem fio test
🚧 ✅ Storage block - queue scheduler test
🚧 ✅ Storage nvme - tcp
🚧 ✅ Storage: lvm device-mapper test
🚧 ❌ stress: stress-ng
Oh no, this looks like another alignment fault in memcpy:
[13330.651903] Unable to handle kernel paging request at virtual address ffff8000534705ff [13330.651914] Mem abort info: [13330.651918] ESR = 0x96000021 [13330.651922] EC = 0x25: DABT (current EL), IL = 32 bits [13330.651928] SET = 0, FnV = 0 [13330.651931] EA = 0, S1PTW = 0 [13330.651933] FSC = 0x21: alignment fault [13330.651938] Data abort info: [13330.651940] ISV = 0, ISS = 0x00000021 [13330.651941] CM = 0, WnR = 0 [13330.651943] swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000f3e6b000 [13330.651945] [ffff8000534705ff] pgd=1000008ffcfff003, p4d=1000008ffcfff003, pud=100000088e57d003, pmd=10000008d0aeb003, pte=006800008021370f [13330.651956] Internal error: Oops: 96000021 [#1] SMP [13330.651961] Modules linked in: unix_diag binfmt_misc fcrypt sm4_generic crc32_generic md4 michael_mic nhpoly1305_neon nhpoly1305 poly1305_generic libpoly1305 poly1305_neon rmd160 sha3_generic sm3_generic streebog_generic wp512 blowfish_generic blowfish_common cast5_generic des_generic libdes chacha_generic chacha_neon libchacha camellia_generic cast6_generic cast_common serpent_generic twofish_generic twofish_common dm_thin_pool dm_persistent_data dm_bio_prison nvme nvme_core ipmi_watchdog ipmi_poweroff loop tun af_key crypto_user scsi_transport_iscsi xt_multiport ip_gre ip_tunnel gre overlay xt_CONNSECMARK xt_SECMARK nft_counter xt_state xt_conntrack nft_compat ah6 ah4 nft_objref nft_ct nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables nfnetlink jfs sctp ip6_udp_tunnel udp_tunnel dm_log_writes dm_flakey rfkill mlx5_ib ib_uverbs ib_core sunrpc coresight_etm4x i2c_smbus coresight_replicator coresight_tpiu coresight_tmc joydev mlx5_core acpi_ipmi psample ipmi_ssif mlxfw ipmi_devintf [13330.652076] ipmi_msghandler coresight_funnel thunderx2_pmu coresight vfat fat fuse zram ip_tables xfs ast crct10dif_ce i2c_algo_bit ghash_ce drm_vram_helper drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cec drm_ttm_helper ttm drm gpio_xlp i2c_xlp9xx uas usb_storage aes_neon_bs [last unloaded: nvmet] [13330.652123] CPU: 115 PID: 188446 Comm: stress-ng Tainted: G OEL 5.13.0-rc7 #1 [13330.652129] Hardware name: HPE Apollo 70 /C01_APACHE_MB , BIOS L50_5.13_1.15 05/08/2020 [13330.652133] pstate: 80400009 (Nzcv daif +PAN -UAO -TCO BTYPE=--) [13330.652139] pc : __memcpy+0x168/0x250 [13330.652150] lr : memory_read_from_buffer+0x58/0x80 [13330.652161] sp : ffff800063ef3c20 [13330.652163] x29: ffff800063ef3c20 x28: ffff0008b1380000 x27: 0000000000000000 [13330.652170] x26: 0000000000000000 x25: 0000000000000000 x24: ffff00080a960fe0 [13330.652176] x23: ffff800063ef3d28 x22: 000000000000063f x21: ffff800063ef3c88 [13330.652181] x20: 000000000000063f x19: 000000000000063f x18: 0000000000000000 [13330.652186] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [13330.652191] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 [13330.652196] x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 [13330.652200] x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000 [13330.652206] x5 : ffff000d0fb0063f x4 : ffff80005347063f x3 : ffff000d0fb005c0 [13330.652212] x2 : ffffffffffffffef x1 : ffff800053470600 x0 : ffff000d0fb00000 [13330.652218] Call trace: [13330.652221] __memcpy+0x168/0x250 [13330.652225] acpi_data_show+0x5c/0x8c [13330.652232] sysfs_kf_bin_read+0x78/0xa0 [13330.652238] kernfs_file_read_iter+0x9c/0x1a4 [13330.652241] kernfs_fop_read_iter+0x34/0x50 [13330.652244] new_sync_read+0xdc/0x154 [13330.652253] vfs_read+0x158/0x1e4 [13330.652260] ksys_read+0x64/0xec [13330.652266] __arm64_sys_read+0x28/0x34 [13330.652273] invoke_syscall+0x50/0x120 [13330.652280] el0_svc_common.constprop.0+0x4c/0xd4 [13330.652284] do_el0_svc+0x30/0x9c [13330.652286] el0_svc+0x2c/0x54 [13330.652294] el0t_64_sync_handler+0x1a4/0x1b0 [13330.652296] el0t_64_sync+0x19c/0x1a0 [13330.652303] Code: a984346c a9c4342c f1010042 54fffee8 (a97c3c8e) [13330.652307] ---[ end trace 227d4380f57145d4 ]---
So maybe this issue isn't limited to weird modules, after all...
Will
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On 2021-06-25 10:52, Veronika Kabatova wrote:
[...]
Quoted 55 lines
Quoted 55 lines
Quoted 1 line
❌ stress: stress-ng
Oh no, this looks like another alignment fault in memcpy:
[13330.651903] Unable to handle kernel paging request at virtual address ffff8000534705ff [13330.651914] Mem abort info: [13330.651918] ESR = 0x96000021 [13330.651922] EC = 0x25: DABT (current EL), IL = 32 bits [13330.651928] SET = 0, FnV = 0 [13330.651931] EA = 0, S1PTW = 0 [13330.651933] FSC = 0x21: alignment fault [13330.651938] Data abort info: [13330.651940] ISV = 0, ISS = 0x00000021 [13330.651941] CM = 0, WnR = 0 [13330.651943] swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000f3e6b000 [13330.651945] [ffff8000534705ff] pgd=1000008ffcfff003, p4d=1000008ffcfff003, pud=100000088e57d003, pmd=10000008d0aeb003, pte=006800008021370f [13330.651956] Internal error: Oops: 96000021 [#1] SMP [13330.651961] Modules linked in: unix_diag binfmt_misc fcrypt sm4_generic crc32_generic md4 michael_mic nhpoly1305_neon nhpoly1305 poly1305_generic libpoly1305 poly1305_neon rmd160 sha3_generic sm3_generic streebog_generic wp512 blowfish_generic blowfish_common cast5_generic des_generic libdes chacha_generic chacha_neon libchacha camellia_generic cast6_generic cast_common serpent_generic twofish_generic twofish_common dm_thin_pool dm_persistent_data dm_bio_prison nvme nvme_core ipmi_watchdog ipmi_poweroff loop tun af_key crypto_user scsi_transport_iscsi xt_multiport ip_gre ip_tunnel gre overlay xt_CONNSECMARK xt_SECMARK nft_counter xt_state xt_conntrack nft_compat ah6 ah4 nft_objref nft_ct nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables nfnetlink jfs sctp ip6_udp_tunnel udp_tunnel dm_log_writes dm_flakey rfkill mlx5_ib ib_uverbs ib_core sunrpc coresight_etm4x i2c_smbus coresight_replicator coresight_tpiu coresight_tmc joydev mlx5_core acpi_ipmi psample ipmi_ssif mlxfw ! ipmi_devintf [13330.652076] ipmi_msghandler coresight_funnel thunderx2_pmu coresight vfat fat fuse zram ip_tables xfs ast crct10dif_ce i2c_algo_bit ghash_ce drm_vram_helper drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cec drm_ttm_helper ttm drm gpio_xlp i2c_xlp9xx uas usb_storage aes_neon_bs [last unloaded: nvmet] [13330.652123] CPU: 115 PID: 188446 Comm: stress-ng Tainted: G OEL 5.13.0-rc7 #1 [13330.652129] Hardware name: HPE Apollo 70 /C01_APACHE_MB , BIOS L50_5.13_1.15 05/08/2020 [13330.652133] pstate: 80400009 (Nzcv daif +PAN -UAO -TCO BTYPE=--) [13330.652139] pc : __memcpy+0x168/0x250 [13330.652150] lr : memory_read_from_buffer+0x58/0x80 [13330.652161] sp : ffff800063ef3c20 [13330.652163] x29: ffff800063ef3c20 x28: ffff0008b1380000 x27: 0000000000000000 [13330.652170] x26: 0000000000000000 x25: 0000000000000000 x24: ffff00080a960fe0 [13330.652176] x23: ffff800063ef3d28 x22: 000000000000063f x21: ffff800063ef3c88 [13330.652181] x20: 000000000000063f x19: 000000000000063f x18: 0000000000000000 [13330.652186] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [13330.652191] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 [13330.652196] x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 [13330.652200] x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000 [13330.652206] x5 : ffff000d0fb0063f x4 : ffff80005347063f x3 : ffff000d0fb005c0 [13330.652212] x2 : ffffffffffffffef x1 : ffff800053470600 x0 : ffff000d0fb00000 [13330.652218] Call trace: [13330.652221] __memcpy+0x168/0x250 [13330.652225] acpi_data_show+0x5c/0x8c [13330.652232] sysfs_kf_bin_read+0x78/0xa0 [13330.652238] kernfs_file_read_iter+0x9c/0x1a4 [13330.652241] kernfs_fop_read_iter+0x34/0x50 [13330.652244] new_sync_read+0xdc/0x154 [13330.652253] vfs_read+0x158/0x1e4 [13330.652260] ksys_read+0x64/0xec [13330.652266] __arm64_sys_read+0x28/0x34 [13330.652273] invoke_syscall+0x50/0x120 [13330.652280] el0_svc_common.constprop.0+0x4c/0xd4 [13330.652284] do_el0_svc+0x30/0x9c [13330.652286] el0_svc+0x2c/0x54 [13330.652294] el0t_64_sync_handler+0x1a4/0x1b0 [13330.652296] el0t_64_sync+0x19c/0x1a0 [13330.652303] Code: a984346c a9c4342c f1010042 54fffee8 (a97c3c8e) [13330.652307] ---[ end trace 227d4380f57145d4 ]---
Quoted 6 lines
Quoted 2 lines
So maybe this issue isn't limited to weird modules, after all...
It ran on the machine from the same set that we were able to reproduce it on previously. If you or anyone else have an idea on how to stabilize the reproducibility or have a debug patch we'll be happy to try it.
Possibly it depends on the individual machines' firmware exactly how the relevant bits of their ACPI tables are aligned in memory?
I've started digging into that callstack - it may not be a "weird module" but it's definitely crusty ACPI code... a238317ce818 ("ACPI: Clean up acpi_os_map/unmap_memory() to eliminate __iomem.") looks frankly a bit questionable in its decision to blithely cast away __iomem, but then the rationale in aafc65c731fe ("ACPI: add arm64 to the platforms that use ioremap") seems particularly dubious on top of that (especially given this end result).
At a wild guess, I'm wondering if this may be sufficient:
----->8-----
drivers/acpi/osl.c +1 -1
@@ -277,7 +277,7 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)return NULL ; } -#if defined(CONFIG_IA64 ) || defined(CONFIG_ARM64 ) +#if defined(CONFIG_IA64 )/* ioremap will take care of cache attributes */ #define should_use_kmap (pfn) 0#else
-----8<-----
otherwise we might need to refactor acpi_os_map_memory() to properly use memremap() instead of bodging the ioremap() path.
My actual ACPI-capable dev board has a trashed filesystem at the moment, but I guess I can try an ACPI VM with QEMU to poke further.
Robin.
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Catalin Marinas
maintainerQuoted 83 lines · Robin Murphy
On 2021-06-25 10:52, Veronika Kabatova wrote:
[...]Quoted 55 lines
Quoted 55 lines
Quoted 1 line
❌ stress: stress-ng
Oh no, this looks like another alignment fault in memcpy:
[13330.651903] Unable to handle kernel paging request at virtual address ffff8000534705ff [13330.651914] Mem abort info: [13330.651918] ESR = 0x96000021 [13330.651922] EC = 0x25: DABT (current EL), IL = 32 bits [13330.651928] SET = 0, FnV = 0 [13330.651931] EA = 0, S1PTW = 0 [13330.651933] FSC = 0x21: alignment fault [13330.651938] Data abort info: [13330.651940] ISV = 0, ISS = 0x00000021 [13330.651941] CM = 0, WnR = 0 [13330.651943] swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000f3e6b000 [13330.651945] [ffff8000534705ff] pgd=1000008ffcfff003, p4d=1000008ffcfff003, pud=100000088e57d003, pmd=10000008d0aeb003, pte=006800008021370f [13330.651956] Internal error: Oops: 96000021 [#1] SMP [13330.651961] Modules linked in: unix_diag binfmt_misc fcrypt sm4_generic crc32_generic md4 michael_mic nhpoly1305_neon nhpoly1305 poly1305_generic libpoly1305 poly1305_neon rmd160 sha3_generic sm3_generic streebog_generic wp512 blowfish_generic blowfish_common cast5_generic des_generic libdes chacha_generic chacha_neon libchacha camellia_generic cast6_generic cast_common serpent_generic twofish_generic twofish_common dm_thin_pool dm_persistent_data dm_bio_prison nvme nvme_core ipmi_watchdog ipmi_poweroff loop tun af_key crypto_user scsi_transport_iscsi xt_multiport ip_gre ip_tunnel gre overlay xt_CONNSECMARK xt_SECMARK nft_counter xt_state xt_conntrack nft_compat ah6 ah4 nft_objref nft_ct nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables nfnetlink jfs sctp ip6_udp_tunnel udp_tunnel dm_log_writes dm_flakey rfkill mlx5_ib ib_uverbs ib_core sunrpc coresight_etm4x i2c_smbus coresight_replicator coresight_tpiu coresight_tmc joydev mlx5_core acpi_ipmi psample ipmi_ssif mlxfw ! ipmi_devintf [13330.652076] ipmi_msghandler coresight_funnel thunderx2_pmu coresight vfat fat fuse zram ip_tables xfs ast crct10dif_ce i2c_algo_bit ghash_ce drm_vram_helper drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cec drm_ttm_helper ttm drm gpio_xlp i2c_xlp9xx uas usb_storage aes_neon_bs [last unloaded: nvmet] [13330.652123] CPU: 115 PID: 188446 Comm: stress-ng Tainted: G OEL 5.13.0-rc7 #1 [13330.652129] Hardware name: HPE Apollo 70 /C01_APACHE_MB , BIOS L50_5.13_1.15 05/08/2020 [13330.652133] pstate: 80400009 (Nzcv daif +PAN -UAO -TCO BTYPE=--) [13330.652139] pc : __memcpy+0x168/0x250 [13330.652150] lr : memory_read_from_buffer+0x58/0x80 [13330.652161] sp : ffff800063ef3c20 [13330.652163] x29: ffff800063ef3c20 x28: ffff0008b1380000 x27: 0000000000000000 [13330.652170] x26: 0000000000000000 x25: 0000000000000000 x24: ffff00080a960fe0 [13330.652176] x23: ffff800063ef3d28 x22: 000000000000063f x21: ffff800063ef3c88 [13330.652181] x20: 000000000000063f x19: 000000000000063f x18: 0000000000000000 [13330.652186] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [13330.652191] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 [13330.652196] x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 [13330.652200] x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000 [13330.652206] x5 : ffff000d0fb0063f x4 : ffff80005347063f x3 : ffff000d0fb005c0 [13330.652212] x2 : ffffffffffffffef x1 : ffff800053470600 x0 : ffff000d0fb00000 [13330.652218] Call trace: [13330.652221] __memcpy+0x168/0x250 [13330.652225] acpi_data_show+0x5c/0x8c [13330.652232] sysfs_kf_bin_read+0x78/0xa0 [13330.652238] kernfs_file_read_iter+0x9c/0x1a4 [13330.652241] kernfs_fop_read_iter+0x34/0x50 [13330.652244] new_sync_read+0xdc/0x154 [13330.652253] vfs_read+0x158/0x1e4 [13330.652260] ksys_read+0x64/0xec [13330.652266] __arm64_sys_read+0x28/0x34 [13330.652273] invoke_syscall+0x50/0x120 [13330.652280] el0_svc_common.constprop.0+0x4c/0xd4 [13330.652284] do_el0_svc+0x30/0x9c [13330.652286] el0_svc+0x2c/0x54 [13330.652294] el0t_64_sync_handler+0x1a4/0x1b0 [13330.652296] el0t_64_sync+0x19c/0x1a0 [13330.652303] Code: a984346c a9c4342c f1010042 54fffee8 (a97c3c8e) [13330.652307] ---[ end trace 227d4380f57145d4 ]---Quoted 6 lines
Quoted 2 lines
So maybe this issue isn't limited to weird modules, after all...
It ran on the machine from the same set that we were able to reproduce it on previously. If you or anyone else have an idea on how to stabilize the reproducibility or have a debug patch we'll be happy to try it.
Possibly it depends on the individual machines' firmware exactly how the relevant bits of their ACPI tables are aligned in memory?
I've started digging into that callstack - it may not be a "weird module" but it's definitely crusty ACPI code...
a238317ce818("ACPI: Clean up acpi_os_map/unmap_memory() to eliminate__iomem.") looks frankly a bit questionable in its decision to blithely cast away__iomem, but then the rationale inaafc65c731fe("ACPI: add arm64 to the platforms that use ioremap") seems particularly dubious on top of that (especially given this end result).At a wild guess, I'm wondering if this may be sufficient:
----->8-----
drivers/acpi/osl.c +0
-0
drivers/acpi/osl.c acpi_map_lookup_virt(void __iomem *virt, acpi_size size)
Quoted 9 lines
drivers/acpi/osl.c +1
-2@@ -277,7 +277,7 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)return NULL ; } -#if defined(CONFIG_IA64 ) || defined(CONFIG_ARM64 ) +#if defined(CONFIG_IA64 )/* ioremap will take care of cache attributes */ #define should_use_kmap (pfn) 0#else -----8<-----
I thought the same but shouldn't acpi_os_ioremap() map it with the right attributes? It uses the EFI maps to check what kind of memory this is.
Signature · 6 lines
Catalin _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 87 lines · Catalin Marinas
Quoted 86 lines · Robin Murphy
On 2021-06-25 10:52, Veronika Kabatova wrote:
[...]Quoted 55 lines
Quoted 55 lines
Quoted 1 line
❌ stress: stress-ng
Oh no, this looks like another alignment fault in memcpy:
[13330.651903] Unable to handle kernel paging request at virtual address ffff8000534705ff [13330.651914] Mem abort info: [13330.651918] ESR = 0x96000021 [13330.651922] EC = 0x25: DABT (current EL), IL = 32 bits [13330.651928] SET = 0, FnV = 0 [13330.651931] EA = 0, S1PTW = 0 [13330.651933] FSC = 0x21: alignment fault [13330.651938] Data abort info: [13330.651940] ISV = 0, ISS = 0x00000021 [13330.651941] CM = 0, WnR = 0 [13330.651943] swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000f3e6b000 [13330.651945] [ffff8000534705ff] pgd=1000008ffcfff003, p4d=1000008ffcfff003, pud=100000088e57d003, pmd=10000008d0aeb003, pte=006800008021370f [13330.651956] Internal error: Oops: 96000021 [#1] SMP [13330.651961] Modules linked in: unix_diag binfmt_misc fcrypt sm4_generic crc32_generic md4 michael_mic nhpoly1305_neon nhpoly1305 poly1305_generic libpoly1305 poly1305_neon rmd160 sha3_generic sm3_generic streebog_generic wp512 blowfish_generic blowfish_common cast5_generic des_generic libdes chacha_generic chacha_neon libchacha camellia_generic cast6_generic cast_common serpent_generic twofish_generic twofish_common dm_thin_pool dm_persistent_data dm_bio_prison nvme nvme_core ipmi_watchdog ipmi_poweroff loop tun af_key crypto_user scsi_transport_iscsi xt_multiport ip_gre ip_tunnel gre overlay xt_CONNSECMARK xt_SECMARK nft_counter xt_state xt_conntrack nft_compat ah6 ah4 nft_objref nft_ct nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables nfnetlink jfs sctp ip6_udp_tunnel udp_tunnel dm_log_writes dm_flakey rfkill mlx5_ib ib_uverbs ib_core sunrpc coresight_etm4x i2c_smbus coresight_replicator coresight_tpiu coresight_tmc joydev mlx5_core acpi_ipmi psample ipmi_ssif mlxfw ! ipmi_devintf [13330.652076] ipmi_msghandler coresight_funnel thunderx2_pmu coresight vfat fat fuse zram ip_tables xfs ast crct10dif_ce i2c_algo_bit ghash_ce drm_vram_helper drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cec drm_ttm_helper ttm drm gpio_xlp i2c_xlp9xx uas usb_storage aes_neon_bs [last unloaded: nvmet] [13330.652123] CPU: 115 PID: 188446 Comm: stress-ng Tainted: G OEL 5.13.0-rc7 #1 [13330.652129] Hardware name: HPE Apollo 70 /C01_APACHE_MB , BIOS L50_5.13_1.15 05/08/2020 [13330.652133] pstate: 80400009 (Nzcv daif +PAN -UAO -TCO BTYPE=--) [13330.652139] pc : __memcpy+0x168/0x250 [13330.652150] lr : memory_read_from_buffer+0x58/0x80 [13330.652161] sp : ffff800063ef3c20 [13330.652163] x29: ffff800063ef3c20 x28: ffff0008b1380000 x27: 0000000000000000 [13330.652170] x26: 0000000000000000 x25: 0000000000000000 x24: ffff00080a960fe0 [13330.652176] x23: ffff800063ef3d28 x22: 000000000000063f x21: ffff800063ef3c88 [13330.652181] x20: 000000000000063f x19: 000000000000063f x18: 0000000000000000 [13330.652186] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [13330.652191] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 [13330.652196] x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 [13330.652200] x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000 [13330.652206] x5 : ffff000d0fb0063f x4 : ffff80005347063f x3 : ffff000d0fb005c0 [13330.652212] x2 : ffffffffffffffef x1 : ffff800053470600 x0 : ffff000d0fb00000 [13330.652218] Call trace: [13330.652221] __memcpy+0x168/0x250 [13330.652225] acpi_data_show+0x5c/0x8c [13330.652232] sysfs_kf_bin_read+0x78/0xa0 [13330.652238] kernfs_file_read_iter+0x9c/0x1a4 [13330.652241] kernfs_fop_read_iter+0x34/0x50 [13330.652244] new_sync_read+0xdc/0x154 [13330.652253] vfs_read+0x158/0x1e4 [13330.652260] ksys_read+0x64/0xec [13330.652266] __arm64_sys_read+0x28/0x34 [13330.652273] invoke_syscall+0x50/0x120 [13330.652280] el0_svc_common.constprop.0+0x4c/0xd4 [13330.652284] do_el0_svc+0x30/0x9c [13330.652286] el0_svc+0x2c/0x54 [13330.652294] el0t_64_sync_handler+0x1a4/0x1b0 [13330.652296] el0t_64_sync+0x19c/0x1a0 [13330.652303] Code: a984346c a9c4342c f1010042 54fffee8 (a97c3c8e) [13330.652307] ---[ end trace 227d4380f57145d4 ]---Quoted 6 lines
Quoted 2 lines
So maybe this issue isn't limited to weird modules, after all...
It ran on the machine from the same set that we were able to reproduce it on previously. If you or anyone else have an idea on how to stabilize the reproducibility or have a debug patch we'll be happy to try it.
Possibly it depends on the individual machines' firmware exactly how the relevant bits of their ACPI tables are aligned in memory?
I've started digging into that callstack - it may not be a "weird module" but it's definitely crusty ACPI code...
a238317ce818("ACPI: Clean up acpi_os_map/unmap_memory() to eliminate__iomem.") looks frankly a bit questionable in its decision to blithely cast away__iomem, but then the rationale inaafc65c731fe("ACPI: add arm64 to the platforms that use ioremap") seems particularly dubious on top of that (especially given this end result).At a wild guess, I'm wondering if this may be sufficient:
----->8-----
drivers/acpi/osl.c +0
-0@@ -277,7 +277,7 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)return NULL ; }
Quoted 9 lines
drivers/acpi/osl.c acpi_map_lookup_virt(void __iomem *virt, acpi_size size)
Quoted 6 lines
drivers/acpi/osl.c +1
-2-#if defined(CONFIG_IA64 ) || defined(CONFIG_ARM64 ) +#if defined(CONFIG_IA64 )/* ioremap will take care of cache attributes */ #define should_use_kmap (pfn) 0#else -----8<-----I thought the same but shouldn't
acpi_os_ioremap()map it with the right attributes? It uses the EFI maps to check what kind of memory this is.
Oh crikey, I missed that branch of the rabbit hole... I guess that must mean that the tables being poked here are *not* covered by the EFI memory map, so page_is_ram() is unlikely to help either :(
Robin.
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
[ +ACPI audience ]
Quoted 99 lines · Robin Murphy
Quoted 88 lines · Catalin Marinas
Quoted 87 lines · Robin Murphy
On 2021-06-25 10:52, Veronika Kabatova wrote:
[...]Quoted 55 lines
Quoted 55 lines
Quoted 1 line
❌ stress: stress-ng
Oh no, this looks like another alignment fault in memcpy:
[13330.651903] Unable to handle kernel paging request at virtual address ffff8000534705ff [13330.651914] Mem abort info: [13330.651918] ESR = 0x96000021 [13330.651922] EC = 0x25: DABT (current EL), IL = 32 bits [13330.651928] SET = 0, FnV = 0 [13330.651931] EA = 0, S1PTW = 0 [13330.651933] FSC = 0x21: alignment fault [13330.651938] Data abort info: [13330.651940] ISV = 0, ISS = 0x00000021 [13330.651941] CM = 0, WnR = 0 [13330.651943] swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000f3e6b000 [13330.651945] [ffff8000534705ff] pgd=1000008ffcfff003, p4d=1000008ffcfff003, pud=100000088e57d003, pmd=10000008d0aeb003, pte=006800008021370f [13330.651956] Internal error: Oops: 96000021 [#1] SMP [13330.651961] Modules linked in: unix_diag binfmt_misc fcrypt sm4_generic crc32_generic md4 michael_mic nhpoly1305_neon nhpoly1305 poly1305_generic libpoly1305 poly1305_neon rmd160 sha3_generic sm3_generic streebog_generic wp512 blowfish_generic blowfish_common cast5_generic des_generic libdes chacha_generic chacha_neon libchacha camellia_generic cast6_generic cast_common serpent_generic twofish_generic twofish_common dm_thin_pool dm_persistent_data dm_bio_prison nvme nvme_core ipmi_watchdog ipmi_poweroff loop tun af_key crypto_user scsi_transport_iscsi xt_multiport ip_gre ip_tunnel gre overlay xt_CONNSECMARK xt_SECMARK nft_counter xt_state xt_conntrack nft_compat ah6 ah4 nft_objref nft_ct nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables nfnetlink jfs sctp ip6_udp_tunnel udp_tunnel dm_log_writes dm_flakey rfkill mlx5_ib ib_uverbs ib_core sunrpc coresight_etm4x i2c_smbus coresight_replicator coresight_tpiu coresight_tmc joydev mlx5_core acpi_ipmi psample ipmi_ssif mlxfw ! ipmi_devintf [13330.652076] ipmi_msghandler coresight_funnel thunderx2_pmu coresight vfat fat fuse zram ip_tables xfs ast crct10dif_ce i2c_algo_bit ghash_ce drm_vram_helper drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cec drm_ttm_helper ttm drm gpio_xlp i2c_xlp9xx uas usb_storage aes_neon_bs [last unloaded: nvmet] [13330.652123] CPU: 115 PID: 188446 Comm: stress-ng Tainted: G OEL 5.13.0-rc7 #1 [13330.652129] Hardware name: HPE Apollo 70 /C01_APACHE_MB , BIOS L50_5.13_1.15 05/08/2020 [13330.652133] pstate: 80400009 (Nzcv daif +PAN -UAO -TCO BTYPE=--) [13330.652139] pc : __memcpy+0x168/0x250 [13330.652150] lr : memory_read_from_buffer+0x58/0x80 [13330.652161] sp : ffff800063ef3c20 [13330.652163] x29: ffff800063ef3c20 x28: ffff0008b1380000 x27: 0000000000000000 [13330.652170] x26: 0000000000000000 x25: 0000000000000000 x24: ffff00080a960fe0 [13330.652176] x23: ffff800063ef3d28 x22: 000000000000063f x21: ffff800063ef3c88 [13330.652181] x20: 000000000000063f x19: 000000000000063f x18: 0000000000000000 [13330.652186] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [13330.652191] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 [13330.652196] x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 [13330.652200] x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000 [13330.652206] x5 : ffff000d0fb0063f x4 : ffff80005347063f x3 : ffff000d0fb005c0 [13330.652212] x2 : ffffffffffffffef x1 : ffff800053470600 x0 : ffff000d0fb00000 [13330.652218] Call trace: [13330.652221] __memcpy+0x168/0x250 [13330.652225] acpi_data_show+0x5c/0x8c [13330.652232] sysfs_kf_bin_read+0x78/0xa0 [13330.652238] kernfs_file_read_iter+0x9c/0x1a4 [13330.652241] kernfs_fop_read_iter+0x34/0x50 [13330.652244] new_sync_read+0xdc/0x154 [13330.652253] vfs_read+0x158/0x1e4 [13330.652260] ksys_read+0x64/0xec [13330.652266] __arm64_sys_read+0x28/0x34 [13330.652273] invoke_syscall+0x50/0x120 [13330.652280] el0_svc_common.constprop.0+0x4c/0xd4 [13330.652284] do_el0_svc+0x30/0x9c [13330.652286] el0_svc+0x2c/0x54 [13330.652294] el0t_64_sync_handler+0x1a4/0x1b0 [13330.652296] el0t_64_sync+0x19c/0x1a0 [13330.652303] Code: a984346c a9c4342c f1010042 54fffee8 (a97c3c8e) [13330.652307] ---[ end trace 227d4380f57145d4 ]---Quoted 6 lines
Quoted 2 lines
So maybe this issue isn't limited to weird modules, after all...
It ran on the machine from the same set that we were able to reproduce it on previously. If you or anyone else have an idea on how to stabilize the reproducibility or have a debug patch we'll be happy to try it.
Possibly it depends on the individual machines' firmware exactly how the relevant bits of their ACPI tables are aligned in memory?
I've started digging into that callstack - it may not be a "weird module" but it's definitely crusty ACPI code...
a238317ce818("ACPI: Clean up acpi_os_map/unmap_memory() to eliminate__iomem.") looks frankly a bit questionable in its decision to blithely cast away__iomem, but then the rationale inaafc65c731fe("ACPI: add arm64 to the platforms that use ioremap") seems particularly dubious on top of that (especially given this end result).At a wild guess, I'm wondering if this may be sufficient:
----->8-----
drivers/acpi/osl.c +0
-0@@ -277,7 +277,7 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size) return NULL; }Quoted 9 lines
Quoted 6 lines
drivers/acpi/osl.c +1
-1-#if defined(CONFIG_IA64 ) || defined(CONFIG_ARM64 ) +#if defined(CONFIG_IA64 ) /* ioremap will take care of cache attributes */ #define should_use_kmap(pfn) 0#else
-----8<-----I thought the same but shouldn't
acpi_os_ioremap()map it with the right attributes? It uses the EFI maps to check what kind of memory this is.
Quoted 1 line
Oh crikey, I missed that branch of the rabbit hole... I guess that must mean that the tables being poked here are *not* covered by the EFI memory map, so
page_is_ram()is unlikely to help either :(
After picking through the UEFI spec I think I've now got a clearer picture of what's happening, but I'm not sure where it goes from here...
The spec implies that it *is* legitimate for runtime-loaded ACPI tables to lie outside the EFI memory map, and that case they must be assumed to be uncached, so the behaviour of acpi_os_ioremap() is correct. Given the definition of uncached for arm64 memory types though, that means that callers of acpi_os_map_memory() still have to be prepared to get an __iomem pointer back even if they know they're mapping a table rather than some random bit of MMIO for an AML method.
Therefore in this case it seems the blame lies partway between acpi_os_map_memory() for casting away __iomem and acpi_data_show() for letting an arbitrary offset lead to an arbitrarily-aligned memcpy(), but I don't know what the best way to fix it is. Either way I've satisfied myself that it's not an issue with the arm64 code itself - I do wonder whether this might also be a problem on IA-64 given ACPI_MISALIGNMENT_NOT_SUPPORTED, and I guess RISC-V may have alignment concerns as well.
Robin.
Quoted 150 lines · Robin Murphy
[ +ACPI audience ]
Quoted 143 lines · Robin Murphy
Quoted 132 lines · Catalin Marinas
Quoted 131 lines · Robin Murphy
On 2021-06-25 10:52, Veronika Kabatova wrote:
[...]Quoted 96 lines
Quoted 96 lines
Quoted 1 line
❌ stress: stress-ng
Oh no, this looks like another alignment fault in memcpy:
[13330.651903] Unable to handle kernel paging request at virtual address ffff8000534705ff [13330.651914] Mem abort info: [13330.651918] ESR = 0x96000021 [13330.651922] EC = 0x25: DABT (current EL), IL = 32 bits [13330.651928] SET = 0, FnV = 0 [13330.651931] EA = 0, S1PTW = 0 [13330.651933] FSC = 0x21: alignment fault [13330.651938] Data abort info: [13330.651940] ISV = 0, ISS = 0x00000021 [13330.651941] CM = 0, WnR = 0 [13330.651943] swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000f3e6b000 [13330.651945] [ffff8000534705ff] pgd=1000008ffcfff003, p4d=1000008ffcfff003, pud=100000088e57d003, pmd=10000008d0aeb003, pte=006800008021370f [13330.651956] Internal error: Oops: 96000021 [#1] SMP [13330.651961] Modules linked in: unix_diag binfmt_miscfcrypt
sm4_genericcrc32_genericmd4michael_micnhpoly1305_neonnhpoly1305poly1305_genericlibpoly1305poly1305_neonrmd160sha3_genericsm3_genericstreebog_genericwp512blowfish_genericblowfish_commoncast5_genericdes_genericlibdeschacha_genericchacha_neonlibchachacamellia_genericcast6_genericcast_commonserpent_generictwofish_generictwofish_commondm_thin_pooldm_persistent_datadm_bio_prisonnvmenvme_coreipmi_watchdogipmi_poweroffloop tunaf_keycrypto_userscsi_transport_iscsixt_multiportip_greip_tunnelgre overlayxt_CONNSECMARKxt_SECMARKnft_counterxt_statext_conntracknft_compatah6 ah4nft_objrefnft_ctnf_conntracknf_defrag_ipv6nf_defrag_ipv4nf_tablesnfnetlink jfs sctpip6_udp_tunneludp_tunneldm_log_writesdm_flakeyrfkillmlx5_ibib_uverbsib_coresunrpccoresight_etm4xi2c_smbuscoresight_replicatorcoresight_tpiucoresight_tmcjoydevmlx5_coreacpi_ipmipsampleipmi_ssifmlxfw !
ipmi_devintf[13330.652076] ipmi_msghandler coresight_funnel
thunderx2_pmucoresight vfat fat fuse zramip_tablesxfs astcrct10dif_cei2c_algo_bitghash_cedrm_vram_helperdrm_kms_helpersyscopyarea sysfillrect sysimgbltfb_sys_fopscecdrm_ttm_helperttm drmgpio_xlpi2c_xlp9xxuasusb_storageaes_neon_bs[last unloaded:
nvmet][13330.652123] CPU: 115 PID: 188446 Comm: stress-ng Tainted: G OEL 5.13.0-rc7 #1 [13330.652129] Hardware name: HPE Apollo 70 /C01_APACHE_MB , BIOS L50_5.13_1.15 05/08/2020 [13330.652133] pstate: 80400009 (Nzcv daif +PAN -UAO -TCO BTYPE=--) [13330.652139] pc : __memcpy+0x168/0x250 [13330.652150] lr : memory_read_from_buffer+0x58/0x80 [13330.652161] sp : ffff800063ef3c20 [13330.652163] x29: ffff800063ef3c20 x28: ffff0008b1380000 x27: 0000000000000000 [13330.652170] x26: 0000000000000000 x25: 0000000000000000 x24: ffff00080a960fe0 [13330.652176] x23: ffff800063ef3d28 x22: 000000000000063f x21: ffff800063ef3c88 [13330.652181] x20: 000000000000063f x19: 000000000000063f x18: 0000000000000000 [13330.652186] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [13330.652191] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 [13330.652196] x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 [13330.652200] x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000 [13330.652206] x5 : ffff000d0fb0063f x4 : ffff80005347063f x3 : ffff000d0fb005c0 [13330.652212] x2 : ffffffffffffffef x1 : ffff800053470600 x0 : ffff000d0fb00000 [13330.652218] Call trace: [13330.652221] __memcpy+0x168/0x250 [13330.652225] acpi_data_show+0x5c/0x8c [13330.652232] sysfs_kf_bin_read+0x78/0xa0 [13330.652238] kernfs_file_read_iter+0x9c/0x1a4 [13330.652241] kernfs_fop_read_iter+0x34/0x50 [13330.652244] new_sync_read+0xdc/0x154 [13330.652253] vfs_read+0x158/0x1e4 [13330.652260] ksys_read+0x64/0xec [13330.652266] __arm64_sys_read+0x28/0x34 [13330.652273] invoke_syscall+0x50/0x120 [13330.652280] el0_svc_common.constprop.0+0x4c/0xd4 [13330.652284] do_el0_svc+0x30/0x9c [13330.652286] el0_svc+0x2c/0x54 [13330.652294] el0t_64_sync_handler+0x1a4/0x1b0 [13330.652296] el0t_64_sync+0x19c/0x1a0 [13330.652303] Code: a984346c a9c4342c f1010042 54fffee8 (a97c3c8e) [13330.652307] ---[ end trace 227d4380f57145d4 ]---Quoted 7 lines
Quoted 2 lines
So maybe this issue isn't limited to weird modules, after all...
It ran on the machine from the same set that we were able to reproduce it on previously. If you or anyone else have an idea on how to stabilize
the reproducibility or have a debug patch we'll be happy to try it.Possibly it depends on the individual machines' firmware exactly how the relevant bits of their ACPI tables are aligned in memory?
I've started digging into that callstack - it may not be a "weird module"
but it's definitely crusty ACPI code...a238317ce818("ACPI: Clean up acpi_os_map/unmap_memory() to eliminate__iomem.") looks frankly a bit questionable in its decision to blithely cast away__iomem, but then the rationale inaafc65c731fe("ACPI: add arm64 to the platforms that use ioremap") seems particularly dubious on top of that (especially given this
end result).At a wild guess, I'm wondering if this may be sufficient:
----->8-----
drivers/acpi/osl.c +0
-0@@ -277,7 +277,7 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size) return NULL; }Quoted 9 lines
Quoted 6 lines
drivers/acpi/osl.c +1
-1-#if defined(CONFIG_IA64 ) || defined(CONFIG_ARM64 ) +#if defined(CONFIG_IA64 ) /* ioremap will take care of cache attributes */ #define should_use_kmap(pfn) 0#else
-----8<-----I thought the same but shouldn't
acpi_os_ioremap()map it with the right attributes? It uses the EFI maps to check what kind of memory this is.Quoted 3 lines
Oh crikey, I missed that branch of the rabbit hole... I guess that must mean that the tables being poked here are *not* covered by the EFI memory map, so
page_is_ram()is unlikely to help either :(
Quoted 6 lines
After picking through the UEFI spec I think I've now got a clearer picture of what's happening, but I'm not sure where it goes from here...
The spec implies that it *is* legitimate for runtime-loaded ACPI tables to lie outside the EFI memory map, and that case they must be assumed to be uncached, so the behaviour of
acpi_os_ioremap()is correct.
I'd agree with the reasoning, it would be good to pinpoint whether that's what actually triggers the issue.
I'd like to replicate it if possible (it is TX2 HW but firmware config is likely to differ from the HW I have at hand), the test command line that triggers the fault would be useful as a starting point.
Furthermore, is this a v5.13-rc* regression ? If so it would be good to bisect it - I can't recollect arm64 changes that could have introduced this regression in the last cycle but I may have missed something.
Quoted 5 lines
Given the definition of uncached for arm64 memory types though, that means that callers of
acpi_os_map_memory()still have to be prepared to get an__iomempointer back even if they know they're mapping a table rather than some random bit of MMIO for an AML method.
Quoted 7 lines
Therefore in this case it seems the blame lies partway between
acpi_os_map_memory()for casting away__iomemandacpi_data_show()for letting an arbitrary offset lead to an arbitrarily-alignedmemcpy(), but I don't know what the best way to fix it is. Either way I've satisfied myself that it's not an issue with the arm64 code itself - I do wonder whether this might also be a problem on IA-64 givenACPI_MISALIGNMENT_NOT_SUPPORTED, and I guess RISC-V may have alignment concerns as well.
Yes agreed but see above, this code has been there for aeons if it is a v5.13-rc* regression it must be something else that actually triggered it (test/FW config).
Thanks for looking into this.
Lorenzo
Quoted 166 lines · Lorenzo Pieralisi
Quoted 150 lines · Robin Murphy
[ +ACPI audience ]
Quoted 143 lines · Robin Murphy
Quoted 132 lines · Catalin Marinas
Quoted 131 lines · Robin Murphy
On 2021-06-25 10:52, Veronika Kabatova wrote:
[...]Quoted 96 lines
Quoted 96 lines
Quoted 1 line
❌ stress: stress-ng
Oh no, this looks like another alignment fault in memcpy:
[13330.651903] Unable to handle kernel paging request at virtual address ffff8000534705ff [13330.651914] Mem abort info: [13330.651918] ESR = 0x96000021 [13330.651922] EC = 0x25: DABT (current EL), IL = 32 bits [13330.651928] SET = 0, FnV = 0 [13330.651931] EA = 0, S1PTW = 0 [13330.651933] FSC = 0x21: alignment fault [13330.651938] Data abort info: [13330.651940] ISV = 0, ISS = 0x00000021 [13330.651941] CM = 0, WnR = 0 [13330.651943] swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000f3e6b000 [13330.651945] [ffff8000534705ff] pgd=1000008ffcfff003, p4d=1000008ffcfff003, pud=100000088e57d003, pmd=10000008d0aeb003, pte=006800008021370f [13330.651956] Internal error: Oops: 96000021 [#1] SMP [13330.651961] Modules linked in: unix_diag binfmt_miscfcrypt
sm4_genericcrc32_genericmd4michael_micnhpoly1305_neonnhpoly1305poly1305_genericlibpoly1305poly1305_neonrmd160sha3_genericsm3_genericstreebog_genericwp512blowfish_genericblowfish_commoncast5_genericdes_genericlibdeschacha_genericchacha_neonlibchachacamellia_genericcast6_genericcast_commonserpent_generictwofish_generictwofish_commondm_thin_pooldm_persistent_datadm_bio_prisonnvmenvme_coreipmi_watchdogipmi_poweroffloop tunaf_keycrypto_userscsi_transport_iscsixt_multiportip_greip_tunnelgre overlayxt_CONNSECMARKxt_SECMARKnft_counterxt_statext_conntracknft_compatah6 ah4nft_objrefnft_ctnf_conntracknf_defrag_ipv6nf_defrag_ipv4nf_tablesnfnetlink jfs sctpip6_udp_tunneludp_tunneldm_log_writesdm_flakeyrfkillmlx5_ibib_uverbsib_coresunrpccoresight_etm4xi2c_smbuscoresight_replicatorcoresight_tpiucoresight_tmcjoydevmlx5_coreacpi_ipmipsampleipmi_ssifmlxfw !
ipmi_devintf[13330.652076] ipmi_msghandler coresight_funnel
thunderx2_pmucoresight vfat fat fuse zramip_tablesxfs astcrct10dif_cei2c_algo_bitghash_cedrm_vram_helperdrm_kms_helpersyscopyarea sysfillrect sysimgbltfb_sys_fopscecdrm_ttm_helperttm drmgpio_xlpi2c_xlp9xxuasusb_storageaes_neon_bs[last unloaded:
nvmet][13330.652123] CPU: 115 PID: 188446 Comm: stress-ng Tainted: G OEL 5.13.0-rc7 #1 [13330.652129] Hardware name: HPE Apollo 70 /C01_APACHE_MB , BIOS L50_5.13_1.15 05/08/2020 [13330.652133] pstate: 80400009 (Nzcv daif +PAN -UAO -TCO BTYPE=--) [13330.652139] pc : __memcpy+0x168/0x250 [13330.652150] lr : memory_read_from_buffer+0x58/0x80 [13330.652161] sp : ffff800063ef3c20 [13330.652163] x29: ffff800063ef3c20 x28: ffff0008b1380000 x27: 0000000000000000 [13330.652170] x26: 0000000000000000 x25: 0000000000000000 x24: ffff00080a960fe0 [13330.652176] x23: ffff800063ef3d28 x22: 000000000000063f x21: ffff800063ef3c88 [13330.652181] x20: 000000000000063f x19: 000000000000063f x18: 0000000000000000 [13330.652186] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [13330.652191] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 [13330.652196] x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 [13330.652200] x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000 [13330.652206] x5 : ffff000d0fb0063f x4 : ffff80005347063f x3 : ffff000d0fb005c0 [13330.652212] x2 : ffffffffffffffef x1 : ffff800053470600 x0 : ffff000d0fb00000 [13330.652218] Call trace: [13330.652221] __memcpy+0x168/0x250 [13330.652225] acpi_data_show+0x5c/0x8c [13330.652232] sysfs_kf_bin_read+0x78/0xa0 [13330.652238] kernfs_file_read_iter+0x9c/0x1a4 [13330.652241] kernfs_fop_read_iter+0x34/0x50 [13330.652244] new_sync_read+0xdc/0x154 [13330.652253] vfs_read+0x158/0x1e4 [13330.652260] ksys_read+0x64/0xec [13330.652266] __arm64_sys_read+0x28/0x34 [13330.652273] invoke_syscall+0x50/0x120 [13330.652280] el0_svc_common.constprop.0+0x4c/0xd4 [13330.652284] do_el0_svc+0x30/0x9c [13330.652286] el0_svc+0x2c/0x54 [13330.652294] el0t_64_sync_handler+0x1a4/0x1b0 [13330.652296] el0t_64_sync+0x19c/0x1a0 [13330.652303] Code: a984346c a9c4342c f1010042 54fffee8 (a97c3c8e) [13330.652307] ---[ end trace 227d4380f57145d4 ]---Quoted 7 lines
Quoted 2 lines
So maybe this issue isn't limited to weird modules, after all...
It ran on the machine from the same set that we were able to reproduce it on previously. If you or anyone else have an idea on how to stabilize
the reproducibility or have a debug patch we'll be happy to try it.Possibly it depends on the individual machines' firmware exactly how the relevant bits of their ACPI tables are aligned in memory?
I've started digging into that callstack - it may not be a "weird module"
but it's definitely crusty ACPI code...a238317ce818("ACPI: Clean up acpi_os_map/unmap_memory() to eliminate__iomem.") looks frankly a bit questionable in its decision to blithely cast away__iomem, but then the rationale inaafc65c731fe("ACPI: add arm64 to the platforms that use ioremap") seems particularly dubious on top of that (especially given this
end result).At a wild guess, I'm wondering if this may be sufficient:
----->8-----
drivers/acpi/osl.c +0
-0@@ -277,7 +277,7 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size) return NULL; }Quoted 9 lines
Quoted 6 lines
drivers/acpi/osl.c +1
-1-#if defined(CONFIG_IA64 ) || defined(CONFIG_ARM64 ) +#if defined(CONFIG_IA64 ) /* ioremap will take care of cache attributes */ #define should_use_kmap(pfn) 0#else
-----8<-----I thought the same but shouldn't
acpi_os_ioremap()map it with the right attributes? It uses the EFI maps to check what kind of memory this is.Quoted 3 lines
Oh crikey, I missed that branch of the rabbit hole... I guess that must mean that the tables being poked here are *not* covered by the EFI memory map, so
page_is_ram()is unlikely to help either :(Quoted 6 lines
After picking through the UEFI spec I think I've now got a clearer picture of what's happening, but I'm not sure where it goes from here...
The spec implies that it *is* legitimate for runtime-loaded ACPI tables to lie outside the EFI memory map, and that case they must be assumed to be uncached, so the behaviour of
acpi_os_ioremap()is correct.I'd agree with the reasoning, it would be good to pinpoint whether that's what actually triggers the issue.
I'd like to replicate it if possible (it is TX2 HW but firmware config is likely to differ from the HW I have at hand), the test command line that triggers the fault would be useful as a starting point.
Quoted 4 lines
Furthermore, is this a v5.13-rc* regression ? If so it would be good to bisect it - I can't recollect arm64 changes that could have introduced this regression in the last cycle but I may have missed something.
The actual change which has brought this to light is the update to arm64's memcpy() routine for 5.13 - the new version is more aggressive at making unaligned loads from the source buffer, so now triggers alignment faults more readily when (wrongly) used on iomem mappings in places that were getting away with it by chance under the previous implementation (see also [1], for example).
Thanks,
Robin.
[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
Quoted 21 lines
Quoted 5 lines
Given the definition of uncached for arm64 memory types though, that means that callers of
acpi_os_map_memory()still have to be prepared to get an__iomempointer back even if they know they're mapping a table rather than some random bit of MMIO for an AML method.Quoted 7 lines
Therefore in this case it seems the blame lies partway between
acpi_os_map_memory()for casting away__iomemandacpi_data_show()for letting an arbitrary offset lead to an arbitrarily-alignedmemcpy(), but I don't know what the best way to fix it is. Either way I've satisfied myself that it's not an issue with the arm64 code itself - I do wonder whether this might also be a problem on IA-64 givenACPI_MISALIGNMENT_NOT_SUPPORTED, and I guess RISC-V may have alignment concerns as well.Yes agreed but see above, this code has been there for aeons if it is a v5.13-rc* regression it must be something else that actually triggered it (test/FW config).
Thanks for looking into this.
Lorenzo
Catalin Marinas
maintainerQuoted 15 lines · Robin Murphy
Quoted 14 lines · Lorenzo Pieralisi
Quoted 13 lines · Robin Murphy
[ +ACPI audience ]
Quoted 10 lines · Robin Murphy
Quoted 9 lines · Catalin Marinas
Quoted 8 lines · Robin Murphy
On 2021-06-25 10:52, Veronika Kabatova wrote:
[...]Quoted 6 lines
Quoted 6 lines
Quoted 1 line
❌ stress: stress-ng
Oh no, this looks like another alignment fault in memcpy:
[13330.651903] Unable to handle kernel paging request atvirtual address
ffff8000534705ff
[...]
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 19 lines
Quoted 19 lines
[13330.652218] Call trace: [13330.652221] __memcpy+0x168/0x250 [13330.652225] acpi_data_show+0x5c/0x8c [13330.652232] sysfs_kf_bin_read+0x78/0xa0 [13330.652238] kernfs_file_read_iter+0x9c/0x1a4 [13330.652241] kernfs_fop_read_iter+0x34/0x50 [13330.652244] new_sync_read+0xdc/0x154 [13330.652253] vfs_read+0x158/0x1e4 [13330.652260] ksys_read+0x64/0xec [13330.652266] __arm64_sys_read+0x28/0x34 [13330.652273] invoke_syscall+0x50/0x120 [13330.652280] el0_svc_common.constprop.0+0x4c/0xd4 [13330.652284] do_el0_svc+0x30/0x9c [13330.652286] el0_svc+0x2c/0x54 [13330.652294] el0t_64_sync_handler+0x1a4/0x1b0 [13330.652296] el0t_64_sync+0x19c/0x1a0 [13330.652303] Code: a984346c a9c4342c f1010042 54fffee8 (a97c3c8e) [13330.652307] ---[ end trace 227d4380f57145d4 ]---Quoted 5 lines
Quoted 1 line
So maybe this issue isn't limited to weird modules, after all...
It ran on the machine from the same set that we were able to reproduce it on previously. If you or anyone else have an idea on how
to stabilize the reproducibility or have a debug patch we'll be happy to try it.Possibly it depends on the individual machines' firmware exactly how the relevant bits of their ACPI tables are aligned in memory?
I've started digging into that callstack - it may not be a "weird module" but it's definitely crusty ACPI code...
a238317ce818("ACPI: Clean up acpi_os_map/unmap_memory() to eliminate__iomem.") looks frankly a bit questionable in its decision to blithely cast away__iomem, but then the rationale inaafc65c731fe("ACPI: add arm64 to the platforms that use ioremap") seems particularly dubious on top of that (especially given this end result).
[...]
Quoted 20 lines
Quoted 15 lines
Quoted 6 lines
After picking through the UEFI spec I think I've now got a clearer picture of what's happening, but I'm not sure where it goes from here...
The spec implies that it *is* legitimate for runtime-loaded ACPI tables to lie outside the EFI memory map, and that case they must be assumed to be uncached, so the behaviour of
acpi_os_ioremap()is correct.I'd agree with the reasoning, it would be good to pinpoint whether that's what actually triggers the issue.
I'd like to replicate it if possible (it is TX2 HW but firmware config is likely to differ from the HW I have at hand), the test command line that triggers the fault would be useful as a starting point.
Quoted 4 lines
Furthermore, is this a v5.13-rc* regression ? If so it would be good to bisect it - I can't recollect arm64 changes that could have introduced this regression in the last cycle but I may have missed something.
Quoted 6 lines
The actual change which has brought this to light is the update to arm64's
memcpy()routine for 5.13 - the new version is more aggressive at making unaligned loads from the source buffer, so now triggers alignment faults more readily when (wrongly) used on iomem mappings in places that were getting away with it by chance under the previous implementation (see also [1], for example).
I wouldn't revert any of the memcpy() stuff as it just uncovered an existing bug in how the ACPI tables are handled. Could we actually hit a similar issue with C code parsing the ACPI tables?
Is there a way to map the ACPI tables as Normal Noncacheable (ioremap_wc)? Presumably no-one sane would place ACPI tables in memory that's sensitive to the access size.
Signature · 1 line
Catalin
Quoted 160 lines · Robin Murphy
Quoted 158 lines · Lorenzo Pieralisi
Quoted 156 lines · Robin Murphy
[ +ACPI audience ]
Quoted 143 lines · Robin Murphy
Quoted 132 lines · Catalin Marinas
Quoted 131 lines · Robin Murphy
On 2021-06-25 10:52, Veronika Kabatova wrote:
[...]Quoted 96 lines
Quoted 96 lines
Quoted 1 line
❌ stress: stress-ng
Oh no, this looks like another alignment fault in memcpy:
[13330.651903] Unable to handle kernel paging request at virtual address ffff8000534705ff [13330.651914] Mem abort info: [13330.651918] ESR = 0x96000021 [13330.651922] EC = 0x25: DABT (current EL), IL = 32 bits [13330.651928] SET = 0, FnV = 0 [13330.651931] EA = 0, S1PTW = 0 [13330.651933] FSC = 0x21: alignment fault [13330.651938] Data abort info: [13330.651940] ISV = 0, ISS = 0x00000021 [13330.651941] CM = 0, WnR = 0 [13330.651943] swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000f3e6b000 [13330.651945] [ffff8000534705ff] pgd=1000008ffcfff003, p4d=1000008ffcfff003, pud=100000088e57d003, pmd=10000008d0aeb003, pte=006800008021370f [13330.651956] Internal error: Oops: 96000021 [#1] SMP [13330.651961] Modules linked in: unix_diag binfmt_miscfcrypt
sm4_genericcrc32_genericmd4michael_micnhpoly1305_neonnhpoly1305poly1305_genericlibpoly1305poly1305_neonrmd160sha3_genericsm3_genericstreebog_genericwp512blowfish_genericblowfish_commoncast5_genericdes_genericlibdeschacha_genericchacha_neonlibchachacamellia_genericcast6_genericcast_commonserpent_generictwofish_generictwofish_commondm_thin_pooldm_persistent_datadm_bio_prisonnvmenvme_coreipmi_watchdogipmi_poweroffloop tunaf_keycrypto_userscsi_transport_iscsixt_multiportip_greip_tunnelgre overlayxt_CONNSECMARKxt_SECMARKnft_counterxt_statext_conntracknft_compatah6 ah4nft_objrefnft_ctnf_conntracknf_defrag_ipv6nf_defrag_ipv4nf_tablesnfnetlink jfs sctpip6_udp_tunneludp_tunneldm_log_writesdm_flakeyrfkillmlx5_ibib_uverbsib_coresunrpccoresight_etm4xi2c_smbuscoresight_replicatorcoresight_tpiucoresight_tmcjoydevmlx5_coreacpi_ipmipsampleipmi_ssifmlxfw !
ipmi_devintf[13330.652076] ipmi_msghandler coresight_funnel
thunderx2_pmucoresight vfat fat fuse zramip_tablesxfs astcrct10dif_cei2c_algo_bitghash_cedrm_vram_helperdrm_kms_helpersyscopyarea sysfillrect sysimgbltfb_sys_fopscecdrm_ttm_helperttm drmgpio_xlpi2c_xlp9xxuasusb_storageaes_neon_bs[last unloaded:
nvmet][13330.652123] CPU: 115 PID: 188446 Comm: stress-ng Tainted: G OEL 5.13.0-rc7 #1 [13330.652129] Hardware name: HPE Apollo 70 /C01_APACHE_MB , BIOS L50_5.13_1.15 05/08/2020 [13330.652133] pstate: 80400009 (Nzcv daif +PAN -UAO -TCO BTYPE=--) [13330.652139] pc : __memcpy+0x168/0x250 [13330.652150] lr : memory_read_from_buffer+0x58/0x80 [13330.652161] sp : ffff800063ef3c20 [13330.652163] x29: ffff800063ef3c20 x28: ffff0008b1380000 x27: 0000000000000000 [13330.652170] x26: 0000000000000000 x25: 0000000000000000 x24: ffff00080a960fe0 [13330.652176] x23: ffff800063ef3d28 x22: 000000000000063f x21: ffff800063ef3c88 [13330.652181] x20: 000000000000063f x19: 000000000000063f x18: 0000000000000000 [13330.652186] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [13330.652191] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 [13330.652196] x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 [13330.652200] x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000 [13330.652206] x5 : ffff000d0fb0063f x4 : ffff80005347063f x3 : ffff000d0fb005c0 [13330.652212] x2 : ffffffffffffffef x1 : ffff800053470600 x0 : ffff000d0fb00000 [13330.652218] Call trace: [13330.652221] __memcpy+0x168/0x250 [13330.652225] acpi_data_show+0x5c/0x8c [13330.652232] sysfs_kf_bin_read+0x78/0xa0 [13330.652238] kernfs_file_read_iter+0x9c/0x1a4 [13330.652241] kernfs_fop_read_iter+0x34/0x50 [13330.652244] new_sync_read+0xdc/0x154 [13330.652253] vfs_read+0x158/0x1e4 [13330.652260] ksys_read+0x64/0xec [13330.652266] __arm64_sys_read+0x28/0x34 [13330.652273] invoke_syscall+0x50/0x120 [13330.652280] el0_svc_common.constprop.0+0x4c/0xd4 [13330.652284] do_el0_svc+0x30/0x9c [13330.652286] el0_svc+0x2c/0x54 [13330.652294] el0t_64_sync_handler+0x1a4/0x1b0 [13330.652296] el0t_64_sync+0x19c/0x1a0 [13330.652303] Code: a984346c a9c4342c f1010042 54fffee8 (a97c3c8e) [13330.652307] ---[ end trace 227d4380f57145d4 ]---Quoted 7 lines
Quoted 2 lines
So maybe this issue isn't limited to weird modules, after all...
It ran on the machine from the same set that we were able to reproduce it on previously. If you or anyone else have an idea on how to stabilize
the reproducibility or have a debug patch we'll be happy to try it.Possibly it depends on the individual machines' firmware exactly how the relevant bits of their ACPI tables are aligned in memory?
I've started digging into that callstack - it may not be a "weird module"
but it's definitely crusty ACPI code...a238317ce818("ACPI: Clean up acpi_os_map/unmap_memory() to eliminate__iomem.") looks frankly a bit questionable in its decision to blithely cast away__iomem, but then the rationale inaafc65c731fe("ACPI: add arm64 to the platforms that use ioremap") seems particularly dubious on top of that (especially given this
end result).At a wild guess, I'm wondering if this may be sufficient:
----->8-----
drivers/acpi/osl.c +0
-0@@ -277,7 +277,7 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)return NULL ; }Quoted 9 lines
Quoted 6 lines
drivers/acpi/osl.c +1
-1-#if defined(CONFIG_IA64 ) || defined(CONFIG_ARM64 ) +#if defined(CONFIG_IA64 )/* ioremap will take care of cache attributes */ #define should_use_kmap (pfn) 0#else-----8<-----
I thought the same but shouldn't
acpi_os_ioremap()map it with the right attributes? It uses the EFI maps to check what kind of memory this is.Quoted 3 lines
Oh crikey, I missed that branch of the rabbit hole... I guess that must mean that the tables being poked here are *not* covered by the EFI memory map, so
page_is_ram()is unlikely to help either :(After picking through the UEFI spec I think I've now got a clearer picture of what's happening, but I'm not sure where it goes from here...
The spec implies that it *is* legitimate for runtime-loaded ACPI tables to lie outside the EFI memory map, and that case they must be assumed to be uncached, so the behaviour of
acpi_os_ioremap()is correct.
Quoted 8 lines
Quoted 8 lines
I'd agree with the reasoning, it would be good to pinpoint whether that's what actually triggers the issue.
I'd like to replicate it if possible (it is TX2 HW but firmware config is likely to differ from the HW I have at hand), the test command line that triggers the fault would be useful as a starting point.
The failure is always triggered during stress testing, see source at
https://gitlab.com/cki-project/kernel-tests/-/tree/main/stress/stress-ng
The runtest file is specific to run in our lab, but all it does is running subsets of the upstream test (see the "*.stressors" files). Upstream test version is V0.12.05 and the version wasn't changed since long before we started hitting the problem. The failures were observed on both Fedora 33 and 34 releases, I don't think the distro choice matters but mentioning it just in case.
It doesn't reproduce 100%, anytime we tried to reproduce it on purpose we couldn't trigger the issue. As if it knew we're watching...
Quoted 5 lines
Quoted 4 lines
Furthermore, is this a v5.13-rc* regression ? If so it would be good to bisect it - I can't recollect arm64 changes that could have introduced this regression in the last cycle but I may have missed something.
Quoted 7 lines
The actual change which has brought this to light is the update to arm64's
memcpy()routine for 5.13 - the new version is more aggressive at making unaligned loads from the source buffer, so now triggers alignment faults more readily when (wrongly) used on iomem mappings in places that were getting away with it by chance under the previous implementation (see also [1], for example).
We dug into the history of runs, the first record we have is from the mainline commit eb6bbacc46720b8b from April 28. The previously tested commit fafe1e39ed213221c0bce doesn't hit any problems when running stress-ng. Unfortunately we don't have logs from that first failed run anymore as they are only saved for 6 weeks, the first logs we still have are from May 11 from mainline commit c90b1834703f13b3a:
Veronika
Quoted 28 lines
Thanks,
Robin.[1]
https://lore.kernel.org/linux-arm-kernel/[email protected]/Quoted 21 lines
Quoted 5 lines
Given the definition of uncached for arm64 memory types though, that means that callers of
acpi_os_map_memory()still have to be prepared to get an__iomempointer back even if they know they're mapping a table rather than some random bit of MMIO for an AML method.Quoted 7 lines
Therefore in this case it seems the blame lies partway between
acpi_os_map_memory()for casting away__iomemandacpi_data_show()for letting an arbitrary offset lead to an arbitrarily-alignedmemcpy(), but I don't know what the best way to fix it is. Either way I've satisfied myself that it's not an issue with the arm64 code itself - I do wonder whether this might also be a problem on IA-64 givenACPI_MISALIGNMENT_NOT_SUPPORTED, and I guess RISC-V may have alignment concerns as well.Yes agreed but see above, this code has been there for aeons if it is a v5.13-rc* regression it must be something else that actually triggered it (test/FW config).
Thanks for looking into this.
Lorenzo
Quoted 181 lines · Veronika Kabatova
Quoted 160 lines · Robin Murphy
Quoted 158 lines · Lorenzo Pieralisi
Quoted 156 lines · Robin Murphy
[ +ACPI audience ]
Quoted 143 lines · Robin Murphy
Quoted 132 lines · Catalin Marinas
Quoted 131 lines · Robin Murphy
On 2021-06-25 10:52, Veronika Kabatova wrote:
[...]Quoted 96 lines
Quoted 96 lines
Quoted 1 line
❌ stress: stress-ng
Oh no, this looks like another alignment fault in memcpy:
[13330.651903] Unable to handle kernel paging request at virtual address ffff8000534705ff [13330.651914] Mem abort info: [13330.651918] ESR = 0x96000021 [13330.651922] EC = 0x25: DABT (current EL), IL = 32 bits [13330.651928] SET = 0, FnV = 0 [13330.651931] EA = 0, S1PTW = 0 [13330.651933] FSC = 0x21: alignment fault [13330.651938] Data abort info: [13330.651940] ISV = 0, ISS = 0x00000021 [13330.651941] CM = 0, WnR = 0 [13330.651943] swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000f3e6b000 [13330.651945] [ffff8000534705ff] pgd=1000008ffcfff003, p4d=1000008ffcfff003, pud=100000088e57d003, pmd=10000008d0aeb003, pte=006800008021370f [13330.651956] Internal error: Oops: 96000021 [#1] SMP [13330.651961] Modules linked in: unix_diag binfmt_miscfcrypt
sm4_genericcrc32_genericmd4michael_micnhpoly1305_neonnhpoly1305poly1305_genericlibpoly1305poly1305_neonrmd160sha3_genericsm3_genericstreebog_genericwp512blowfish_genericblowfish_commoncast5_genericdes_genericlibdeschacha_genericchacha_neonlibchachacamellia_genericcast6_genericcast_commonserpent_generictwofish_generictwofish_commondm_thin_pooldm_persistent_datadm_bio_prisonnvmenvme_coreipmi_watchdogipmi_poweroffloop tunaf_keycrypto_userscsi_transport_iscsixt_multiportip_greip_tunnelgre overlayxt_CONNSECMARKxt_SECMARKnft_counterxt_statext_conntracknft_compatah6 ah4nft_objrefnft_ctnf_conntracknf_defrag_ipv6nf_defrag_ipv4nf_tablesnfnetlink jfs sctpip6_udp_tunneludp_tunneldm_log_writesdm_flakeyrfkillmlx5_ibib_uverbsib_coresunrpccoresight_etm4xi2c_smbuscoresight_replicatorcoresight_tpiucoresight_tmcjoydevmlx5_coreacpi_ipmipsampleipmi_ssifmlxfw !
ipmi_devintf[13330.652076] ipmi_msghandler coresight_funnel
thunderx2_pmucoresight vfat fat fuse zramip_tablesxfs astcrct10dif_cei2c_algo_bitghash_cedrm_vram_helperdrm_kms_helpersyscopyarea sysfillrect sysimgbltfb_sys_fopscecdrm_ttm_helperttm drmgpio_xlpi2c_xlp9xxuasusb_storageaes_neon_bs[last unloaded:
nvmet][13330.652123] CPU: 115 PID: 188446 Comm: stress-ng Tainted: G OEL 5.13.0-rc7 #1 [13330.652129] Hardware name: HPE Apollo 70 /C01_APACHE_MB , BIOS L50_5.13_1.15 05/08/2020 [13330.652133] pstate: 80400009 (Nzcv daif +PAN -UAO -TCO BTYPE=--) [13330.652139] pc : __memcpy+0x168/0x250 [13330.652150] lr : memory_read_from_buffer+0x58/0x80 [13330.652161] sp : ffff800063ef3c20 [13330.652163] x29: ffff800063ef3c20 x28: ffff0008b1380000 x27: 0000000000000000 [13330.652170] x26: 0000000000000000 x25: 0000000000000000 x24: ffff00080a960fe0 [13330.652176] x23: ffff800063ef3d28 x22: 000000000000063f x21: ffff800063ef3c88 [13330.652181] x20: 000000000000063f x19: 000000000000063f x18: 0000000000000000 [13330.652186] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [13330.652191] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 [13330.652196] x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 [13330.652200] x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000 [13330.652206] x5 : ffff000d0fb0063f x4 : ffff80005347063f x3 : ffff000d0fb005c0 [13330.652212] x2 : ffffffffffffffef x1 : ffff800053470600 x0 : ffff000d0fb00000 [13330.652218] Call trace: [13330.652221] __memcpy+0x168/0x250 [13330.652225] acpi_data_show+0x5c/0x8c [13330.652232] sysfs_kf_bin_read+0x78/0xa0 [13330.652238] kernfs_file_read_iter+0x9c/0x1a4 [13330.652241] kernfs_fop_read_iter+0x34/0x50 [13330.652244] new_sync_read+0xdc/0x154 [13330.652253] vfs_read+0x158/0x1e4 [13330.652260] ksys_read+0x64/0xec [13330.652266] __arm64_sys_read+0x28/0x34 [13330.652273] invoke_syscall+0x50/0x120 [13330.652280] el0_svc_common.constprop.0+0x4c/0xd4 [13330.652284] do_el0_svc+0x30/0x9c [13330.652286] el0_svc+0x2c/0x54 [13330.652294] el0t_64_sync_handler+0x1a4/0x1b0 [13330.652296] el0t_64_sync+0x19c/0x1a0 [13330.652303] Code: a984346c a9c4342c f1010042 54fffee8 (a97c3c8e) [13330.652307] ---[ end trace 227d4380f57145d4 ]---Quoted 7 lines
Quoted 2 lines
So maybe this issue isn't limited to weird modules, after all...
It ran on the machine from the same set that we were able to reproduce it on previously. If you or anyone else have an idea on how to stabilize
the reproducibility or have a debug patch we'll be happy to try it.Possibly it depends on the individual machines' firmware exactly how the relevant bits of their ACPI tables are aligned in memory?
I've started digging into that callstack - it may not be a "weird module"
but it's definitely crusty ACPI code...a238317ce818("ACPI: Clean up acpi_os_map/unmap_memory() to eliminate__iomem.") looks frankly a bit questionable in its decision to blithely cast away__iomem, but then the rationale inaafc65c731fe("ACPI: add arm64 to the platforms that use ioremap") seems particularly dubious on top of that (especially given this
end result).At a wild guess, I'm wondering if this may be sufficient:
----->8-----
drivers/acpi/osl.c +0
-0@@ -277,7 +277,7 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)return NULL ; }Quoted 9 lines
Quoted 6 lines
drivers/acpi/osl.c +1
-1-#if defined(CONFIG_IA64 ) || defined(CONFIG_ARM64 ) +#if defined(CONFIG_IA64 )/* ioremap will take care of cache attributes */ #define should_use_kmap (pfn) 0#else-----8<-----
I thought the same but shouldn't
acpi_os_ioremap()map it with the right attributes? It uses the EFI maps to check what kind of memory this is.Quoted 3 lines
Oh crikey, I missed that branch of the rabbit hole... I guess that must mean that the tables being poked here are *not* covered by the EFI memory map, so
page_is_ram()is unlikely to help either :(After picking through the UEFI spec I think I've now got a clearer picture of what's happening, but I'm not sure where it goes from here...
The spec implies that it *is* legitimate for runtime-loaded ACPI tables to lie outside the EFI memory map, and that case they must be assumed to be uncached, so the behaviour of
acpi_os_ioremap()is correct.Quoted 8 lines
Quoted 8 lines
I'd agree with the reasoning, it would be good to pinpoint whether that's what actually triggers the issue.
I'd like to replicate it if possible (it is TX2 HW but firmware config is likely to differ from the HW I have at hand), the test command line that triggers the fault would be useful as a starting point.
The failure is always triggered during stress testing, see source at
https://gitlab.com/cki-project/kernel-tests/-/tree/main/stress/stress-ng
The runtest file is specific to run in our lab, but all it does is running subsets of the upstream test (see the "*.stressors" files). Upstream test version is V0.12.05 and the version wasn't changed since long before we started hitting the problem. The failures were observed on both Fedora 33 and 34 releases, I don't think the distro choice matters but mentioning it just in case.
Quoted 2 lines
It doesn't reproduce 100%, anytime we tried to reproduce it on purpose we couldn't trigger the issue. As if it knew we're watching...
Ah, from that I can only assume that this must be stress-ng's --sysfs test reading things at random, so not only would it have to be on a machine whose firmware presents the right thing in the right way but the random test conditions would also have to line up to poke it the "right" (wrong) way too.
As a temporary workaround for the CI flakes, might it be possible to configure stress-ng to stay away from just these ACPI "data" files?
Robin.
Quoted 54 lines
Quoted 5 lines
Quoted 4 lines
Furthermore, is this a v5.13-rc* regression ? If so it would be good to bisect it - I can't recollect arm64 changes that could have introduced this regression in the last cycle but I may have missed something.
Quoted 7 lines
The actual change which has brought this to light is the update to arm64's
memcpy()routine for 5.13 - the new version is more aggressive at making unaligned loads from the source buffer, so now triggers alignment faults more readily when (wrongly) used on iomem mappings in places that were getting away with it by chance under the previous implementation (see also [1], for example).We dug into the history of runs, the first record we have is from the mainline commit
eb6bbacc46720b8bfrom April 28. The previously tested commitfafe1e39ed213221c0bcedoesn't hit any problems when running stress-ng. Unfortunately we don't have logs from that first failed run anymore as they are only saved for 6 weeks, the first logs we still have are from May 11 from mainline commitc90b1834703f13b3a:Veronika
Quoted 28 lines
Thanks,
Robin.[1]
https://lore.kernel.org/linux-arm-kernel/[email protected]/Quoted 21 lines
Quoted 5 lines
Given the definition of uncached for arm64 memory types though, that means that callers of
acpi_os_map_memory()still have to be prepared to get an__iomempointer back even if they know they're mapping a table rather than some random bit of MMIO for an AML method.Quoted 7 lines
Therefore in this case it seems the blame lies partway between
acpi_os_map_memory()for casting away__iomemandacpi_data_show()for letting an arbitrary offset lead to an arbitrarily-alignedmemcpy(), but I don't know what the best way to fix it is. Either way I've satisfied myself that it's not an issue with the arm64 code itself - I do wonder whether this might also be a problem on IA-64 givenACPI_MISALIGNMENT_NOT_SUPPORTED, and I guess RISC-V may have alignment concerns as well.Yes agreed but see above, this code has been there for aeons if it is a v5.13-rc* regression it must be something else that actually triggered it (test/FW config).
Thanks for looking into this.
Lorenzo
Quoted 186 lines · Robin Murphy
Quoted 181 lines · Veronika Kabatova
Quoted 160 lines · Robin Murphy
Quoted 158 lines · Lorenzo Pieralisi
Quoted 156 lines · Robin Murphy
[ +ACPI audience ]
Quoted 143 lines · Robin Murphy
Quoted 132 lines · Catalin Marinas
Quoted 131 lines · Robin Murphy
On 2021-06-25 10:52, Veronika Kabatova wrote:
[...]Quoted 96 lines
Quoted 96 lines
Quoted 1 line
❌ stress: stress-ng
Oh no, this looks like another alignment fault in memcpy:
[13330.651903] Unable to handle kernel paging request at virtual address ffff8000534705ff [13330.651914] Mem abort info: [13330.651918] ESR = 0x96000021 [13330.651922] EC = 0x25: DABT (current EL), IL = 32 bits [13330.651928] SET = 0, FnV = 0 [13330.651931] EA = 0, S1PTW = 0 [13330.651933] FSC = 0x21: alignment fault [13330.651938] Data abort info: [13330.651940] ISV = 0, ISS = 0x00000021 [13330.651941] CM = 0, WnR = 0 [13330.651943] swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000f3e6b000 [13330.651945] [ffff8000534705ff] pgd=1000008ffcfff003, p4d=1000008ffcfff003, pud=100000088e57d003, pmd=10000008d0aeb003, pte=006800008021370f [13330.651956] Internal error: Oops: 96000021 [#1] SMP [13330.651961] Modules linked in: unix_diag binfmt_miscfcrypt
sm4_genericcrc32_genericmd4michael_micnhpoly1305_neonnhpoly1305poly1305_genericlibpoly1305poly1305_neonrmd160sha3_genericsm3_genericstreebog_genericwp512blowfish_genericblowfish_commoncast5_genericdes_genericlibdeschacha_genericchacha_neonlibchachacamellia_genericcast6_genericcast_commonserpent_generictwofish_generictwofish_commondm_thin_pooldm_persistent_datadm_bio_prisonnvmenvme_coreipmi_watchdogipmi_poweroffloop tunaf_keycrypto_userscsi_transport_iscsixt_multiportip_greip_tunnelgre overlayxt_CONNSECMARKxt_SECMARKnft_counterxt_statext_conntracknft_compatah6 ah4nft_objrefnft_ctnf_conntracknf_defrag_ipv6nf_defrag_ipv4nf_tablesnfnetlink jfs sctpip6_udp_tunneludp_tunneldm_log_writesdm_flakeyrfkillmlx5_ibib_uverbsib_coresunrpccoresight_etm4xi2c_smbuscoresight_replicatorcoresight_tpiucoresight_tmcjoydevmlx5_coreacpi_ipmipsampleipmi_ssifmlxfw !
ipmi_devintf[13330.652076] ipmi_msghandler coresight_funnel
thunderx2_pmucoresight vfat fat fuse zramip_tablesxfs astcrct10dif_cei2c_algo_bitghash_cedrm_vram_helperdrm_kms_helpersyscopyarea sysfillrect sysimgbltfb_sys_fopscecdrm_ttm_helperttm drmgpio_xlpi2c_xlp9xxuasusb_storageaes_neon_bs[last unloaded:
nvmet][13330.652123] CPU: 115 PID: 188446 Comm: stress-ng Tainted: G OEL 5.13.0-rc7 #1 [13330.652129] Hardware name: HPE Apollo 70 /C01_APACHE_MB , BIOS L50_5.13_1.15 05/08/2020 [13330.652133] pstate: 80400009 (Nzcv daif +PAN -UAO -TCO BTYPE=--) [13330.652139] pc : __memcpy+0x168/0x250 [13330.652150] lr : memory_read_from_buffer+0x58/0x80 [13330.652161] sp : ffff800063ef3c20 [13330.652163] x29: ffff800063ef3c20 x28: ffff0008b1380000 x27: 0000000000000000 [13330.652170] x26: 0000000000000000 x25: 0000000000000000 x24: ffff00080a960fe0 [13330.652176] x23: ffff800063ef3d28 x22: 000000000000063f x21: ffff800063ef3c88 [13330.652181] x20: 000000000000063f x19: 000000000000063f x18: 0000000000000000 [13330.652186] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [13330.652191] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 [13330.652196] x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 [13330.652200] x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000 [13330.652206] x5 : ffff000d0fb0063f x4 : ffff80005347063f x3 : ffff000d0fb005c0 [13330.652212] x2 : ffffffffffffffef x1 : ffff800053470600 x0 : ffff000d0fb00000 [13330.652218] Call trace: [13330.652221] __memcpy+0x168/0x250 [13330.652225] acpi_data_show+0x5c/0x8c [13330.652232] sysfs_kf_bin_read+0x78/0xa0 [13330.652238] kernfs_file_read_iter+0x9c/0x1a4 [13330.652241] kernfs_fop_read_iter+0x34/0x50 [13330.652244] new_sync_read+0xdc/0x154 [13330.652253] vfs_read+0x158/0x1e4 [13330.652260] ksys_read+0x64/0xec [13330.652266] __arm64_sys_read+0x28/0x34 [13330.652273] invoke_syscall+0x50/0x120 [13330.652280] el0_svc_common.constprop.0+0x4c/0xd4 [13330.652284] do_el0_svc+0x30/0x9c [13330.652286] el0_svc+0x2c/0x54 [13330.652294] el0t_64_sync_handler+0x1a4/0x1b0 [13330.652296] el0t_64_sync+0x19c/0x1a0 [13330.652303] Code: a984346c a9c4342c f1010042 54fffee8 (a97c3c8e) [13330.652307] ---[ end trace 227d4380f57145d4 ]---Quoted 7 lines
Quoted 2 lines
So maybe this issue isn't limited to weird modules, after all...
It ran on the machine from the same set that we were able to reproduce it on previously. If you or anyone else have an idea on how to stabilize
the reproducibility or have a debug patch we'll be happy to try it.Possibly it depends on the individual machines' firmware exactly how the relevant bits of their ACPI tables are aligned in memory?
I've started digging into that callstack - it may not be a "weird module"
but it's definitely crusty ACPI code...a238317ce818("ACPI: Clean up acpi_os_map/unmap_memory() to eliminate__iomem.") looks frankly a bit questionable in its decision to blithely cast away__iomem, but then the rationale inaafc65c731fe("ACPI: add arm64 to the platforms that use ioremap") seems particularly dubious on top of that (especially given this
end result).At a wild guess, I'm wondering if this may be sufficient:
----->8-----
drivers/acpi/osl.c +0
-0@@ -277,7 +277,7 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)return NULL ; }Quoted 9 lines
Quoted 6 lines
drivers/acpi/osl.c +1
-1-#if defined(CONFIG_IA64 ) || defined(CONFIG_ARM64 ) +#if defined(CONFIG_IA64 )/* ioremap will take care of cache attributes */ #define should_use_kmap (pfn) 0#else-----8<-----
I thought the same but shouldn't
acpi_os_ioremap()map it with the right attributes? It uses the EFI maps to check what kind of memory this is.Quoted 3 lines
Oh crikey, I missed that branch of the rabbit hole... I guess that must mean that the tables being poked here are *not* covered by the EFI memory map, so
page_is_ram()is unlikely to help either :(After picking through the UEFI spec I think I've now got a clearer picture of what's happening, but I'm not sure where it goes from here...
The spec implies that it *is* legitimate for runtime-loaded ACPI tables to lie outside the EFI memory map, and that case they must be assumed to be uncached, so the behaviour of
acpi_os_ioremap()is correct.Quoted 8 lines
Quoted 8 lines
I'd agree with the reasoning, it would be good to pinpoint whether that's what actually triggers the issue.
I'd like to replicate it if possible (it is TX2 HW but firmware config is likely to differ from the HW I have at hand), the test command line that triggers the fault would be useful as a starting point.
The failure is always triggered during stress testing, see source at
https://gitlab.com/cki-project/kernel-tests/-/tree/main/stress/stress-ng
The runtest file is specific to run in our lab, but all it does is running subsets of the upstream test (see the "*.stressors" files). Upstream test version is V0.12.05 and the version wasn't changed since long before we started hitting the problem. The failures were observed on both Fedora 33 and 34 releases, I don't think the distro choice matters but mentioning it just in case.
Quoted 2 lines
It doesn't reproduce 100%, anytime we tried to reproduce it on purpose we couldn't trigger the issue. As if it knew we're watching...
Quoted 9 lines
Ah, from that I can only assume that this must be stress-ng's --sysfs test reading things at random, so not only would it have to be on a machine whose firmware presents the right thing in the right way but the random test conditions would also have to line up to poke it the "right" (wrong) way too.
As a temporary workaround for the CI flakes, might it be possible to configure stress-ng to stay away from just these ACPI "data" files?
The test is already waived so failures hit during the test do *not* affect the aggregate CI results. It's also the last executed test on the machine so it doesn't block further testing.
Veronika
Quoted 57 lines
Robin.
Quoted 54 lines
Quoted 5 lines
Quoted 4 lines
Furthermore, is this a v5.13-rc* regression ? If so it would be good to bisect it - I can't recollect arm64 changes that could have introduced this regression in the last cycle but I may have missed something.
Quoted 7 lines
The actual change which has brought this to light is the update to arm64's
memcpy()routine for 5.13 - the new version is more aggressive at making unaligned loads from the source buffer, so now triggers alignment faults more readily when (wrongly) used on iomem mappings in places that were getting away with it by chance under the previous implementation (see also [1], for example).We dug into the history of runs, the first record we have is from the mainline commit
eb6bbacc46720b8bfrom April 28. The previously tested commitfafe1e39ed213221c0bcedoesn't hit any problems when running stress-ng. Unfortunately we don't have logs from that first failed run anymore as they are only saved for 6 weeks, the first logs we still have are from May 11 from mainline commitc90b1834703f13b3a:Veronika
Quoted 28 lines
Thanks,
Robin.[1]
https://lore.kernel.org/linux-arm-kernel/[email protected]/Quoted 21 lines
Quoted 5 lines
Given the definition of uncached for arm64 memory types though, that means that callers of
acpi_os_map_memory()still have to be prepared to get an__iomempointer back even if they know they're mapping a table rather than some random bit of MMIO for an AML method.Quoted 7 lines
Therefore in this case it seems the blame lies partway between
acpi_os_map_memory()for casting away__iomemandacpi_data_show()for letting an arbitrary offset lead to an arbitrarily-alignedmemcpy(), but I don't know what the best way to fix it is. Either way I've satisfied myself that it's not an issue with the arm64 code itself - I do wonder whether this might also be a problem on IA-64 givenACPI_MISALIGNMENT_NOT_SUPPORTED, and I guess RISC-V may have alignment concerns as well.Yes agreed but see above, this code has been there for aeons if it is a v5.13-rc* regression it must be something else that actually triggered it (test/FW config).
Thanks for looking into this.
Lorenzo
Quoted 80 lines · Catalin Marinas
Quoted 15 lines · Robin Murphy
Quoted 14 lines · Lorenzo Pieralisi
Quoted 13 lines · Robin Murphy
[ +ACPI audience ]
Quoted 10 lines · Robin Murphy
Quoted 9 lines · Catalin Marinas
Quoted 8 lines · Robin Murphy
On 2021-06-25 10:52, Veronika Kabatova wrote:
[...]Quoted 6 lines
Quoted 6 lines
Quoted 1 line
❌ stress: stress-ng
Oh no, this looks like another alignment fault in memcpy:
[13330.651903] Unable to handle kernel paging request atvirtual address
ffff8000534705ff[...]
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 19 lines
Quoted 19 lines
[13330.652218] Call trace: [13330.652221] __memcpy+0x168/0x250 [13330.652225] acpi_data_show+0x5c/0x8c [13330.652232] sysfs_kf_bin_read+0x78/0xa0 [13330.652238] kernfs_file_read_iter+0x9c/0x1a4 [13330.652241] kernfs_fop_read_iter+0x34/0x50 [13330.652244] new_sync_read+0xdc/0x154 [13330.652253] vfs_read+0x158/0x1e4 [13330.652260] ksys_read+0x64/0xec [13330.652266] __arm64_sys_read+0x28/0x34 [13330.652273] invoke_syscall+0x50/0x120 [13330.652280] el0_svc_common.constprop.0+0x4c/0xd4 [13330.652284] do_el0_svc+0x30/0x9c [13330.652286] el0_svc+0x2c/0x54 [13330.652294] el0t_64_sync_handler+0x1a4/0x1b0 [13330.652296] el0t_64_sync+0x19c/0x1a0 [13330.652303] Code: a984346c a9c4342c f1010042 54fffee8 (a97c3c8e) [13330.652307] ---[ end trace 227d4380f57145d4 ]---Quoted 5 lines
Quoted 1 line
So maybe this issue isn't limited to weird modules, after all...
It ran on the machine from the same set that we were able to reproduce it on previously. If you or anyone else have an idea on how
to stabilize the reproducibility or have a debug patch we'll be happy to try it.Possibly it depends on the individual machines' firmware exactly how the relevant bits of their ACPI tables are aligned in memory?
I've started digging into that callstack - it may not be a "weird module" but it's definitely crusty ACPI code...
a238317ce818("ACPI: Clean up acpi_os_map/unmap_memory() to eliminate__iomem.") looks frankly a bit questionable in its decision to blithely cast away__iomem, but then the rationale inaafc65c731fe("ACPI: add arm64 to the platforms that use ioremap") seems particularly dubious on top of that (especially given this end result).[...]
Quoted 20 lines
Quoted 15 lines
Quoted 6 lines
After picking through the UEFI spec I think I've now got a clearer picture of what's happening, but I'm not sure where it goes from here...
The spec implies that it *is* legitimate for runtime-loaded ACPI tables to lie outside the EFI memory map, and that case they must be assumed to be uncached, so the behaviour of
acpi_os_ioremap()is correct.I'd agree with the reasoning, it would be good to pinpoint whether that's what actually triggers the issue.
I'd like to replicate it if possible (it is TX2 HW but firmware config is likely to differ from the HW I have at hand), the test command line that triggers the fault would be useful as a starting point.
Quoted 4 lines
Furthermore, is this a v5.13-rc* regression ? If so it would be good to bisect it - I can't recollect arm64 changes that could have introduced this regression in the last cycle but I may have missed something.
Quoted 6 lines
The actual change which has brought this to light is the update to arm64's
memcpy()routine for 5.13 - the new version is more aggressive at making unaligned loads from the source buffer, so now triggers alignment faults more readily when (wrongly) used on iomem mappings in places that were getting away with it by chance under the previous implementation (see also [1], for example).
Quoted 3 lines
I wouldn't revert any of the
memcpy()stuff as it just uncovered an existing bug in how the ACPI tables are handled. Could we actually hit a similar issue with C code parsing the ACPI tables?
I agree - I don't think a revert should be considered, this looks like a long standing ACPI bug.
This needs debugging but I believe that it all depends on the table being in the EFI map or not. I'd help a lot if I managed to reproduce the bug for a given set-up so that we can check which table is causing it.
Quoted 2 lines
Is there a way to map the ACPI tables as Normal Noncacheable (
ioremap_wc)?
That's a good point. IIUC UEFI 2.9 (2.3.6) requires tables loaded at runtime (see above - I really would like to understand what table is triggering this bug) that are not in the EFI memory map and whose attributes cannot be retrieved through ACPI descriptors to be considered non-cacheable.
The question is whether [arm64] acpi_os_ioremap() can be changed so that the above is mapped to Normal NC rather than device-nGnRnE; this may cause surprises the other way around (given that dev-nGnRnE is an all encompassing fallback - again IIUC, I believe Ard knows better than me if he has time to chime in).
We need a reproducer and some tracing in the ACPI code.
Lorenzo
Quoted 2 lines
Presumably no-one sane would place ACPI tables in memory that's sensitive to the access size.
Quoted 102 lines · Lorenzo Pieralisi
Quoted 80 lines · Catalin Marinas
Quoted 15 lines · Robin Murphy
Quoted 14 lines · Lorenzo Pieralisi
Quoted 13 lines · Robin Murphy
[ +ACPI audience ]
Quoted 10 lines · Robin Murphy
Quoted 9 lines · Catalin Marinas
Quoted 8 lines · Robin Murphy
On 2021-06-25 10:52, Veronika Kabatova wrote:
[...]Quoted 6 lines
Quoted 6 lines
Quoted 1 line
❌ stress: stress-ng
Oh no, this looks like another alignment fault in memcpy:
[13330.651903] Unable to handle kernel paging request atvirtual address
ffff8000534705ff[...]
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 19 lines
Quoted 19 lines
[13330.652218] Call trace: [13330.652221] __memcpy+0x168/0x250 [13330.652225] acpi_data_show+0x5c/0x8c [13330.652232] sysfs_kf_bin_read+0x78/0xa0 [13330.652238] kernfs_file_read_iter+0x9c/0x1a4 [13330.652241] kernfs_fop_read_iter+0x34/0x50 [13330.652244] new_sync_read+0xdc/0x154 [13330.652253] vfs_read+0x158/0x1e4 [13330.652260] ksys_read+0x64/0xec [13330.652266] __arm64_sys_read+0x28/0x34 [13330.652273] invoke_syscall+0x50/0x120 [13330.652280] el0_svc_common.constprop.0+0x4c/0xd4 [13330.652284] do_el0_svc+0x30/0x9c [13330.652286] el0_svc+0x2c/0x54 [13330.652294] el0t_64_sync_handler+0x1a4/0x1b0 [13330.652296] el0t_64_sync+0x19c/0x1a0 [13330.652303] Code: a984346c a9c4342c f1010042 54fffee8 (a97c3c8e) [13330.652307] ---[ end trace 227d4380f57145d4 ]---Quoted 5 lines
Quoted 1 line
So maybe this issue isn't limited to weird modules, after all...
It ran on the machine from the same set that we were able to reproduce it on previously. If you or anyone else have an idea on how
to stabilize the reproducibility or have a debug patch we'll be happy to try it.Possibly it depends on the individual machines' firmware exactly how the relevant bits of their ACPI tables are aligned in memory?
I've started digging into that callstack - it may not be a "weird module" but it's definitely crusty ACPI code...
a238317ce818("ACPI: Clean up acpi_os_map/unmap_memory() to eliminate__iomem.") looks frankly a bit questionable in its decision to blithely cast away__iomem, but then the rationale inaafc65c731fe("ACPI: add arm64 to the platforms that use ioremap") seems particularly dubious on top of that (especially given this end result).[...]
Quoted 20 lines
Quoted 15 lines
Quoted 6 lines
After picking through the UEFI spec I think I've now got a clearer picture of what's happening, but I'm not sure where it goes from here...
The spec implies that it *is* legitimate for runtime-loaded ACPI tables to lie outside the EFI memory map, and that case they must be assumed to be uncached, so the behaviour of
acpi_os_ioremap()is correct.I'd agree with the reasoning, it would be good to pinpoint whether that's what actually triggers the issue.
I'd like to replicate it if possible (it is TX2 HW but firmware config is likely to differ from the HW I have at hand), the test command line that triggers the fault would be useful as a starting point.
Quoted 4 lines
Furthermore, is this a v5.13-rc* regression ? If so it would be good to bisect it - I can't recollect arm64 changes that could have introduced this regression in the last cycle but I may have missed something.
Quoted 6 lines
The actual change which has brought this to light is the update to arm64's
memcpy()routine for 5.13 - the new version is more aggressive at making unaligned loads from the source buffer, so now triggers alignment faults more readily when (wrongly) used on iomem mappings in places that were getting away with it by chance under the previous implementation (see also [1], for example).Quoted 3 lines
I wouldn't revert any of the
memcpy()stuff as it just uncovered an existing bug in how the ACPI tables are handled. Could we actually hit a similar issue with C code parsing the ACPI tables?I agree - I don't think a revert should be considered, this looks like a long standing ACPI bug.
This needs debugging but I believe that it all depends on the table being in the EFI map or not. I'd help a lot if I managed to reproduce the bug for a given set-up so that we can check which table is causing it.
Quoted 2 lines
Is there a way to map the ACPI tables as Normal Noncacheable (
ioremap_wc)?That's a good point. IIUC UEFI 2.9 (2.3.6) requires tables loaded at runtime (see above - I really would like to understand what table is triggering this bug) that are not in the EFI memory map and whose attributes cannot be retrieved through ACPI descriptors to be considered non-cacheable.
Quoted 7 lines
The question is whether [arm64]
acpi_os_ioremap()can be changed so that the above is mapped to Normal NC rather than device-nGnRnE; this may cause surprises the other way around (given that dev-nGnRnE is an all encompassing fallback - again IIUC, I believe Ard knows better than me if he has time to chime in).We need a reproducer and some tracing in the ACPI code.
Having looked even more at the sysfs code, I think this might not actually be an ACPI table per se, but specifically only the Generic Error Status Block pointed to by the BERT (so maybe it also requires the machine to have experienced a boot-time error to be present?). ACPI merely says that this is "a range of addressable memory" and "System firmware must report this memory range as firmware reserved", so I have no idea whether there's any specific expectation of how it's supposed to be mapped.
Robin.
Quoted 112 lines · Robin Murphy
Quoted 102 lines · Lorenzo Pieralisi
Quoted 80 lines · Catalin Marinas
Quoted 15 lines · Robin Murphy
Quoted 14 lines · Lorenzo Pieralisi
Quoted 13 lines · Robin Murphy
[ +ACPI audience ]
Quoted 10 lines · Robin Murphy
Quoted 9 lines · Catalin Marinas
Quoted 8 lines · Robin Murphy
On 2021-06-25 10:52, Veronika Kabatova wrote:
[...]Quoted 6 lines
Quoted 6 lines
Quoted 1 line
❌ stress: stress-ng
Oh no, this looks like another alignment fault in memcpy:
[13330.651903] Unable to handle kernel paging request atvirtual address
ffff8000534705ff[...]
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 19 lines
Quoted 19 lines
[13330.652218] Call trace: [13330.652221] __memcpy+0x168/0x250 [13330.652225] acpi_data_show+0x5c/0x8c [13330.652232] sysfs_kf_bin_read+0x78/0xa0 [13330.652238] kernfs_file_read_iter+0x9c/0x1a4 [13330.652241] kernfs_fop_read_iter+0x34/0x50 [13330.652244] new_sync_read+0xdc/0x154 [13330.652253] vfs_read+0x158/0x1e4 [13330.652260] ksys_read+0x64/0xec [13330.652266] __arm64_sys_read+0x28/0x34 [13330.652273] invoke_syscall+0x50/0x120 [13330.652280] el0_svc_common.constprop.0+0x4c/0xd4 [13330.652284] do_el0_svc+0x30/0x9c [13330.652286] el0_svc+0x2c/0x54 [13330.652294] el0t_64_sync_handler+0x1a4/0x1b0 [13330.652296] el0t_64_sync+0x19c/0x1a0 [13330.652303] Code: a984346c a9c4342c f1010042 54fffee8 (a97c3c8e) [13330.652307] ---[ end trace 227d4380f57145d4 ]---Quoted 5 lines
Quoted 1 line
So maybe this issue isn't limited to weird modules, after all...
It ran on the machine from the same set that we were able to reproduce it on previously. If you or anyone else have an idea on how
to stabilize the reproducibility or have a debug patch we'll be happy to try it.Possibly it depends on the individual machines' firmware exactly how the relevant bits of their ACPI tables are aligned in memory?
I've started digging into that callstack - it may not be a "weird module" but it's definitely crusty ACPI code...
a238317ce818("ACPI: Clean up acpi_os_map/unmap_memory() to eliminate__iomem.") looks frankly a bit questionable in its decision to blithely cast away__iomem, but then the rationale inaafc65c731fe("ACPI: add arm64 to the platforms that use ioremap") seems particularly dubious on top of that (especially given this end result).[...]
Quoted 20 lines
Quoted 15 lines
Quoted 6 lines
After picking through the UEFI spec I think I've now got a clearer picture of what's happening, but I'm not sure where it goes from here...
The spec implies that it *is* legitimate for runtime-loaded ACPI tables to lie outside the EFI memory map, and that case they must be assumed to be uncached, so the behaviour of
acpi_os_ioremap()is correct.I'd agree with the reasoning, it would be good to pinpoint whether that's what actually triggers the issue.
I'd like to replicate it if possible (it is TX2 HW but firmware config is likely to differ from the HW I have at hand), the test command line that triggers the fault would be useful as a starting point.
Quoted 4 lines
Furthermore, is this a v5.13-rc* regression ? If so it would be good to bisect it - I can't recollect arm64 changes that could have introduced this regression in the last cycle but I may have missed something.
Quoted 6 lines
The actual change which has brought this to light is the update to arm64's
memcpy()routine for 5.13 - the new version is more aggressive at making unaligned loads from the source buffer, so now triggers alignment faults more readily when (wrongly) used on iomem mappings in places that were getting away with it by chance under the previous implementation (see also [1], for example).Quoted 3 lines
I wouldn't revert any of the
memcpy()stuff as it just uncovered an existing bug in how the ACPI tables are handled. Could we actually hit a similar issue with C code parsing the ACPI tables?I agree - I don't think a revert should be considered, this looks like a long standing ACPI bug.
This needs debugging but I believe that it all depends on the table being in the EFI map or not. I'd help a lot if I managed to reproduce the bug for a given set-up so that we can check which table is causing it.
Quoted 2 lines
Is there a way to map the ACPI tables as Normal Noncacheable (
ioremap_wc)?That's a good point. IIUC UEFI 2.9 (2.3.6) requires tables loaded at runtime (see above - I really would like to understand what table is triggering this bug) that are not in the EFI memory map and whose attributes cannot be retrieved through ACPI descriptors to be considered non-cacheable.
Quoted 7 lines
The question is whether [arm64]
acpi_os_ioremap()can be changed so that the above is mapped to Normal NC rather than device-nGnRnE; this may cause surprises the other way around (given that dev-nGnRnE is an all encompassing fallback - again IIUC, I believe Ard knows better than me if he has time to chime in).We need a reproducer and some tracing in the ACPI code.
Quoted 9 lines
Having looked even more at the sysfs code, I think this might not actually be an ACPI table per se, but specifically only the Generic Error Status Block pointed to by the BERT (so maybe it also requires the machine to have experienced a boot-time error to be present?). ACPI merely says that this is "a range of addressable memory" and "System firmware must report this memory range as firmware reserved", so I have no idea whether there's any specific expectation of how it's supposed to be mapped.
Thanks for digging that up.
If the memory in question is firmware reserved, it should appear in the EFI memory map, and have the memory type attributes set, in which case acpi_os_ioremap() should do the right thing.
IIRC (but I don't have time to check - I'm on vacation), the ACPI core code does have separate code paths internally, but they are all brought out via acpi_os_ioremap() where MMIO and memory are combined again. Perhaps we should start looking at addressing this?
So how does the sysfs code find the contents of this file? If some code is interpreting the BERT, could it be updated to use memory semantics explicitly when dumping the error status block?
Quoted 123 lines · Ard Biesheuvel
Quoted 112 lines · Robin Murphy
Quoted 102 lines · Lorenzo Pieralisi
Quoted 80 lines · Catalin Marinas
Quoted 15 lines · Robin Murphy
Quoted 14 lines · Lorenzo Pieralisi
Quoted 13 lines · Robin Murphy
[ +ACPI audience ]
Quoted 10 lines · Robin Murphy
Quoted 9 lines · Catalin Marinas
Quoted 8 lines · Robin Murphy
On 2021-06-25 10:52, Veronika Kabatova wrote:
[...]Quoted 6 lines
Quoted 6 lines
Quoted 1 line
❌ stress: stress-ng
Oh no, this looks like another alignment fault in memcpy:
[13330.651903] Unable to handle kernel paging request atvirtual address
ffff8000534705ff[...]
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 19 lines
Quoted 19 lines
[13330.652218] Call trace: [13330.652221] __memcpy+0x168/0x250 [13330.652225] acpi_data_show+0x5c/0x8c [13330.652232] sysfs_kf_bin_read+0x78/0xa0 [13330.652238] kernfs_file_read_iter+0x9c/0x1a4 [13330.652241] kernfs_fop_read_iter+0x34/0x50 [13330.652244] new_sync_read+0xdc/0x154 [13330.652253] vfs_read+0x158/0x1e4 [13330.652260] ksys_read+0x64/0xec [13330.652266] __arm64_sys_read+0x28/0x34 [13330.652273] invoke_syscall+0x50/0x120 [13330.652280] el0_svc_common.constprop.0+0x4c/0xd4 [13330.652284] do_el0_svc+0x30/0x9c [13330.652286] el0_svc+0x2c/0x54 [13330.652294] el0t_64_sync_handler+0x1a4/0x1b0 [13330.652296] el0t_64_sync+0x19c/0x1a0 [13330.652303] Code: a984346c a9c4342c f1010042 54fffee8 (a97c3c8e) [13330.652307] ---[ end trace 227d4380f57145d4 ]---Quoted 5 lines
Quoted 1 line
So maybe this issue isn't limited to weird modules, after all...
It ran on the machine from the same set that we were able to reproduce it on previously. If you or anyone else have an idea on how
to stabilize the reproducibility or have a debug patch we'll be happy to try it.Possibly it depends on the individual machines' firmware exactly how the relevant bits of their ACPI tables are aligned in memory?
I've started digging into that callstack - it may not be a "weird module" but it's definitely crusty ACPI code...
a238317ce818("ACPI: Clean up acpi_os_map/unmap_memory() to eliminate__iomem.") looks frankly a bit questionable in its decision to blithely cast away__iomem, but then the rationale inaafc65c731fe("ACPI: add arm64 to the platforms that use ioremap") seems particularly dubious on top of that (especially given this end result).[...]
Quoted 20 lines
Quoted 15 lines
Quoted 6 lines
After picking through the UEFI spec I think I've now got a clearer picture of what's happening, but I'm not sure where it goes from here...
The spec implies that it *is* legitimate for runtime-loaded ACPI tables to lie outside the EFI memory map, and that case they must be assumed to be uncached, so the behaviour of
acpi_os_ioremap()is correct.I'd agree with the reasoning, it would be good to pinpoint whether that's what actually triggers the issue.
I'd like to replicate it if possible (it is TX2 HW but firmware config is likely to differ from the HW I have at hand), the test command line that triggers the fault would be useful as a starting point.
Quoted 4 lines
Furthermore, is this a v5.13-rc* regression ? If so it would be good to bisect it - I can't recollect arm64 changes that could have introduced this regression in the last cycle but I may have missed something.
Quoted 6 lines
The actual change which has brought this to light is the update to arm64's
memcpy()routine for 5.13 - the new version is more aggressive at making unaligned loads from the source buffer, so now triggers alignment faults more readily when (wrongly) used on iomem mappings in places that were getting away with it by chance under the previous implementation (see also [1], for example).Quoted 3 lines
I wouldn't revert any of the
memcpy()stuff as it just uncovered an existing bug in how the ACPI tables are handled. Could we actually hit a similar issue with C code parsing the ACPI tables?I agree - I don't think a revert should be considered, this looks like a long standing ACPI bug.
This needs debugging but I believe that it all depends on the table being in the EFI map or not. I'd help a lot if I managed to reproduce the bug for a given set-up so that we can check which table is causing it.
Quoted 2 lines
Is there a way to map the ACPI tables as Normal Noncacheable (
ioremap_wc)?That's a good point. IIUC UEFI 2.9 (2.3.6) requires tables loaded at runtime (see above - I really would like to understand what table is triggering this bug) that are not in the EFI memory map and whose attributes cannot be retrieved through ACPI descriptors to be considered non-cacheable.
Quoted 7 lines
The question is whether [arm64]
acpi_os_ioremap()can be changed so that the above is mapped to Normal NC rather than device-nGnRnE; this may cause surprises the other way around (given that dev-nGnRnE is an all encompassing fallback - again IIUC, I believe Ard knows better than me if he has time to chime in).We need a reproducer and some tracing in the ACPI code.
Quoted 9 lines
Having looked even more at the sysfs code, I think this might not actually be an ACPI table per se, but specifically only the Generic Error Status Block pointed to by the BERT (so maybe it also requires the machine to have experienced a boot-time error to be present?). ACPI merely says that this is "a range of addressable memory" and "System firmware must report this memory range as firmware reserved", so I have no idea whether there's any specific expectation of how it's supposed to be mapped.
Quoted 4 lines
Thanks for digging that up.
If the memory in question is firmware reserved, it should appear in the EFI memory map, and have the memory type attributes set, in which
Thanks a lot Ard for chiming in.
How are those memory type attributes determined by firmware ?
Quoted 1 line
case
acpi_os_ioremap()should do the right thing.
The question is what the right thing is or reworded what those attributes are supposed to be for the Boot Error Region in question (as Robin reported, ACPI specs 6.4, 18.3.1, "the Boot Error Region is a range of addressable memory" and "..must report this memory range as firmware reserved").
Quoted 4 lines
IIRC (but I don't have time to check - I'm on vacation), the ACPI core code does have separate code paths internally, but they are all brought out via
acpi_os_ioremap()where MMIO and memory are combined again. Perhaps we should start looking at addressing this?
BTW, commit in question:
git log -p 7dae6326ed76
I believe you mean, if the OS maps an address with acpi_os_map_memory(), we must convey the "memory" information to the arm64 back-end (instead of falling back to acpi_os_ioremap()) so that the back-end can map it with "memory" semantics (ie by choosing attributes that may need to override the EFI memory map ones) ?
In current code, even if the BERT were mapped with acpi_os_map_iomem() this would change nothing since it's acpi_os_ioremap() that runs the rule (backed up by EFI memory map region info).
Quoted 3 lines
So how does the sysfs code find the contents of this file? If some code is interpreting the BERT, could it be updated to use memory semantics explicitly when dumping the error status block?
See the commit above. Do you mean replacing the mapping function in acpi_data_show() with something explicit eg ioremap_wc() through a back-end specific implementation ?
Thanks,
Lorenzo
Quoted 125 lines · Lorenzo Pieralisi
Quoted 123 lines · Ard Biesheuvel
Quoted 121 lines · Robin Murphy
Quoted 102 lines · Lorenzo Pieralisi
Quoted 80 lines · Catalin Marinas
Quoted 15 lines · Robin Murphy
Quoted 14 lines · Lorenzo Pieralisi
Quoted 13 lines · Robin Murphy
[ +ACPI audience ]
Quoted 10 lines · Robin Murphy
Quoted 9 lines · Catalin Marinas
Quoted 8 lines · Robin Murphy
On 2021-06-25 10:52, Veronika Kabatova wrote:
[...]Quoted 6 lines
Quoted 6 lines
❌ stress: stress-ng
Oh no, this looks like another alignment fault in memcpy:
[13330.651903] Unable to handle kernel paging request at
virtual address ffff8000534705ff[...]
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 19 lines
Quoted 19 lines
[13330.652218] Call trace:
[13330.652221] __memcpy+0x168/0x250
[13330.652225] acpi_data_show+0x5c/0x8c
[13330.652232] sysfs_kf_bin_read+0x78/0xa0
[13330.652238] kernfs_file_read_iter+0x9c/0x1a4
[13330.652241] kernfs_fop_read_iter+0x34/0x50
[13330.652244] new_sync_read+0xdc/0x154
[13330.652253] vfs_read+0x158/0x1e4
[13330.652260] ksys_read+0x64/0xec
[13330.652266] __arm64_sys_read+0x28/0x34
[13330.652273] invoke_syscall+0x50/0x120
[13330.652280] el0_svc_common.constprop.0+0x4c/0xd4
[13330.652284] do_el0_svc+0x30/0x9c
[13330.652286] el0_svc+0x2c/0x54
[13330.652294] el0t_64_sync_handler+0x1a4/0x1b0
[13330.652296] el0t_64_sync+0x19c/0x1a0
[13330.652303] Code: a984346c a9c4342c f1010042 54fffee8 (a97c3c8e)
[13330.652307] ---[ end trace 227d4380f57145d4 ]---Quoted 5 lines
Quoted 1 line
So maybe this issue isn't limited to weird modules, after all...
It ran on the machine from the same set that we were able to reproduce it on previously. If you or anyone else have an idea on how
to stabilize the reproducibility or have a debug patch we'll be happy to try it.Possibly it depends on the individual machines' firmware exactly how the relevant bits of their ACPI tables are aligned in memory?
I've started digging into that callstack - it may not be a "weird module" but it's definitely crusty ACPI code...
a238317ce818("ACPI: Clean up acpi_os_map/unmap_memory() to eliminate__iomem.") looks frankly a bit questionable in its decision to blithely cast away__iomem, but then the rationale inaafc65c731fe("ACPI: add arm64 to the platforms that use ioremap") seems particularly dubious on top of that (especially given this end result).[...]
Quoted 20 lines
Quoted 15 lines
Quoted 6 lines
After picking through the UEFI spec I think I've now got a clearer picture of what's happening, but I'm not sure where it goes from here...
The spec implies that it *is* legitimate for runtime-loaded ACPI tables to lie outside the EFI memory map, and that case they must be assumed to be uncached, so the behaviour of
acpi_os_ioremap()is correct.I'd agree with the reasoning, it would be good to pinpoint whether that's what actually triggers the issue.
I'd like to replicate it if possible (it is TX2 HW but firmware config is likely to differ from the HW I have at hand), the test command line that triggers the fault would be useful as a starting point.
Quoted 4 lines
Furthermore, is this a v5.13-rc* regression ? If so it would be good to bisect it - I can't recollect arm64 changes that could have introduced this regression in the last cycle but I may have missed something.
Quoted 6 lines
The actual change which has brought this to light is the update to arm64's
memcpy()routine for 5.13 - the new version is more aggressive at making unaligned loads from the source buffer, so now triggers alignment faults more readily when (wrongly) used on iomem mappings in places that were getting away with it by chance under the previous implementation (see also [1], for example).Quoted 3 lines
I wouldn't revert any of the
memcpy()stuff as it just uncovered an existing bug in how the ACPI tables are handled. Could we actually hit a similar issue with C code parsing the ACPI tables?I agree - I don't think a revert should be considered, this looks like a long standing ACPI bug.
This needs debugging but I believe that it all depends on the table being in the EFI map or not. I'd help a lot if I managed to reproduce the bug for a given set-up so that we can check which table is causing it.
Quoted 2 lines
Is there a way to map the ACPI tables as Normal Noncacheable (
ioremap_wc)?That's a good point. IIUC UEFI 2.9 (2.3.6) requires tables loaded at runtime (see above - I really would like to understand what table is triggering this bug) that are not in the EFI memory map and whose attributes cannot be retrieved through ACPI descriptors to be considered non-cacheable.
Quoted 7 lines
The question is whether [arm64]
acpi_os_ioremap()can be changed so that the above is mapped to Normal NC rather than device-nGnRnE; this may cause surprises the other way around (given that dev-nGnRnE is an all encompassing fallback - again IIUC, I believe Ard knows better than me if he has time to chime in).We need a reproducer and some tracing in the ACPI code.
Having looked even more at the sysfs code, I think this might not actually be an ACPI table per se, but specifically only the Generic Error Status Block pointed to by the BERT (so maybe it also requires the machine to have experienced a boot-time error to be present?). ACPI merely says that this is "a range of addressable memory" and "System firmware must report this memory range as firmware reserved", so I have no idea whether there's any specific expectation of how it's supposed to be mapped.
Quoted 9 lines
Quoted 4 lines
Thanks for digging that up.
If the memory in question is firmware reserved, it should appear in the EFI memory map, and have the memory type attributes set, in which
Thanks a lot Ard for chiming in.
How are those memory type attributes determined by firmware ?
It depends on the implementation, but in typical EDK2 based UEFI/PI firmware, the memory attributes are assigned to the whole of DRAM, and simply inherited by the allocated regions as they are being created.
However, in the case of error records, I can imagine there may be cases where the regions are deliberately defined as uncached, to ensure the error metadata does not linger somewhere in the cache hierarchy where other agents are not able to see it.
Quoted 8 lines
Quoted 1 line
case
acpi_os_ioremap()should do the right thing.The question is what the right thing is or reworded what those attributes are supposed to be for the Boot Error Region in question (as Robin reported, ACPI specs 6.4, 18.3.1, "the Boot Error Region is a range of addressable memory" and "..must report this memory range as firmware reserved").
That only defines the memory type, not the attributes. I don't think we should be too presciptive here, but simply ensure that the OS has all the info it needs to infer whether uncached means normal-nc or device.
Quoted 7 lines
Quoted 4 lines
IIRC (but I don't have time to check - I'm on vacation), the ACPI core code does have separate code paths internally, but they are all brought out via
acpi_os_ioremap()where MMIO and memory are combined again. Perhaps we should start looking at addressing this?BTW, commit in question:
Quoted 8 lines
git log -p
7dae6326ed76I believe you mean, if the OS maps an address with
acpi_os_map_memory(), we must convey the "memory" information to the arm64 back-end (instead of falling back toacpi_os_ioremap()) so that the back-end can map it with "memory" semantics (ie by choosing attributes that may need to override the EFI memory map ones) ?
Yes.
Quoted 4 lines
In current code, even if the BERT were mapped with
acpi_os_map_iomem()this would change nothing since it'sacpi_os_ioremap()that runs the rule (backed up by EFI memory map region info).
Indeed. So the fact that acpi_os_map_memory() is backed by acpi_os_ioremap() is something we should fix. So they should both consult the EFI memory map, but have different fallback defaults if the region is not annotated correctly.
Quoted 8 lines
Quoted 3 lines
So how does the sysfs code find the contents of this file? If some code is interpreting the BERT, could it be updated to use memory semantics explicitly when dumping the error status block?
See the commit above. Do you mean replacing the mapping function in
acpi_data_show()with something explicit egioremap_wc()through a back-end specific implementation ?
It seems the sysfs code already does the right thing, but the plumbing is simply wrong. The API clearly conveys the 'memory' semantics, but we drop those on the floor before reaching the memremap/ioremap backend.
On Wed, Jun 30, 2021 at 08:18:22PM +0200, Ard Biesheuvel wrote:
[...]
Quoted 9 lines
Quoted 4 lines
In current code, even if the BERT were mapped with
acpi_os_map_iomem()this would change nothing since it'sacpi_os_ioremap()that runs the rule (backed up by EFI memory map region info).Indeed. So the fact that
acpi_os_map_memory()is backed byacpi_os_ioremap()is something we should fix. So they should both consult the EFI memory map, but have different fallback defaults if the region is not annotated correctly.
Put together patch below even though I am not really satisfied, a tad intrusive and duplicate code in generic/arch backends, compile tested only; overall this IO vs memory mapping distinction is a bit too fuzzy for my taste - there is legacy unfortunately to consider though.
-- >8 --
Subject: [PATCH] ACPI: Add memory semantics to acpi_os_map_memory()
Some platforms require memory semantics requested by the mapping function to be translated into architectural specific memory attributes so that the mapping is effectively implementing what is expected from it in terms of allowed access patterns (eg unaligned access).
Rework acpi_os_map_memory() and acpi_os_ioremap() back-end to split them into two separate code paths that allow the architectural back-end to detect the default memory attributes required by the mapping in question.
--- arch/arm64/include/asm/acpi.h | 3 +++ arch/arm64/kernel/acpi.c | 16 ++++++++++++++-- drivers/acpi/osl.c | 23 ++++++++++++++++------- include/acpi/acpi_io.h | 8 ++++++++ 4 files changed, 41 insertions(+), 9 deletions(-)
arch/arm64/include/asm/acpi.h +3 -0
@@ -50,6 +50,9 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr);void __iomem *acpi_os_ioremap (acpi_physical_address phys,acpi_size size);#define acpi_os_ioremap acpi_os_ioremap +void __iomem *acpi_os_memmap (acpi_physical_address phys,acpi_size size); +#define acpi_os_memmap acpi_os_memmap +typedef u64 phys_cpuid_t ;#define PHYS_CPUID_INVALID INVALID_HWID
arch/arm64/kernel/acpi.c +14 -2
@@ -261,7 +261,8 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr)return __pgprot (PROT_DEVICE_nGnRnE); } -void __iomem *acpi_os_ioremap (acpi_physical_address phys,acpi_size size) +static void __iomem *__acpi_os_ioremap (acpi_physical_address phys, +acpi_size size,bool memory) {efi_memory_desc_t *md, *region =NULL ;pgprot_t prot;
@@ -289,7 +290,8 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)* regions that require a virtual mapping to make them accessible to * the EFI runtime services. */ - prot =__pgprot (PROT_DEVICE_nGnRnE); + prot = memory ?__pgprot (PROT_NORMAL_NC ) : +__pgprot (PROT_DEVICE_nGnRnE);if (region) {switch (region->type) {case EFI_LOADER_CODE :
@@ -349,6 +351,16 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)return __ioremap (phys, size, prot); } +void __iomem *acpi_os_ioremap (acpi_physical_address phys,acpi_size size) +{ +return __acpi_os_ioremap (phys, size, false); +} + +void __iomem *acpi_os_memmap (acpi_physical_address phys,acpi_size size) +{ +return __acpi_os_ioremap (phys, size, true); +} +/* * Claim Synchronous External Aborts as a firmware first notification. *
drivers/acpi/osl.c +16 -7
@@ -284,7 +284,8 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)#define should_use_kmap (pfn) page_is_ram(pfn)#endif -static void __iomem *acpi_map (acpi_physical_address pg_off,unsigned long pg_sz) +static void __iomem *acpi_map (acpi_physical_address pg_off,unsigned long pg_sz, +bool memory) {unsigned long pfn;
@@ -294,7 +295,8 @@ static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz)return NULL ;return (void __iomem __force *)kmap (pfn_to_page (pfn)); }else -return acpi_os_ioremap (pg_off, pg_sz); +return memory ?acpi_os_memmap (pg_off, pg_sz) : +acpi_os_ioremap (pg_off, pg_sz); }static void acpi_unmap (acpi_physical_address pg_off,void __iomem *vaddr)
@@ -309,9 +311,10 @@ static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr) }/** -* acpi_os_map_iomem - Get a virtual address for a given physical address range. +* __acpi_os_map_iomem - Get a virtual address for a given physical address range. * @phys: Start of the physical address range to map. * @size: Size of the physical address range to map. +* @memory: true if remapping memory, false if IO * * Look up the given physical address range in the list of existing ACPI memory * mappings. If found, get a reference to it and return a pointer to it (its
@@ -321,8 +324,8 @@ static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr)* During early init (when acpi_permanent_mmap has not been set yet) this * routine simply calls __acpi_map_table() to get the job done. */ -void __iomem __ref -*acpi_os_map_iomem (acpi_physical_address phys,acpi_size size) +static void __iomem __ref +*__acpi_os_map_iomem (acpi_physical_address phys,acpi_size size,bool memory) {struct acpi_ioremap *map;void __iomem *virt;
@@ -353,7 +356,7 @@ void __iomem __ref pg_off =round_down (phys,PAGE_SIZE ); pg_sz =round_up (phys + size,PAGE_SIZE ) - pg_off; - virt =acpi_map (phys, size); + virt =acpi_map (phys, size, memory);if (!virt) {mutex_unlock (&acpi_ioremap_lock);kfree (map);
@@ -372,11 +375,17 @@ void __iomem __refmutex_unlock (&acpi_ioremap_lock);return map->virt + (phys - map->phys); } + +void __iomem __ref +*acpi_os_map_iomem (acpi_physical_address phys,acpi_size size) +{ +return __acpi_os_map_iomem (phys, size, false); +}EXPORT_SYMBOL_GPL (acpi_os_map_iomem);void *__ref acpi_os_map_memory (acpi_physical_address phys,acpi_size size) { -return (void *)acpi_os_map_iomem (phys, size); +return (void *)__acpi_os_map_iomem (phys, size, true); }EXPORT_SYMBOL_GPL (acpi_os_map_memory);
include/acpi/acpi_io.h +8 -0
@@ -14,6 +14,14 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, }#endif +#ifndef acpi_os_memmap +static inline void __iomem *acpi_os_memmap (acpi_physical_address phys, +acpi_size size) +{ +return ioremap_cache (phys, size); +} +#endif +extern bool acpi_permanent_mmap;void __iomem __ref
Signature · 1 line
2.29.1
Quoted 15 lines · Lorenzo Pieralisi
On Wed, Jun 30, 2021 at 08:18:22PM +0200, Ard Biesheuvel wrote:
[...]
Quoted 9 lines
Quoted 4 lines
In current code, even if the BERT were mapped with
acpi_os_map_iomem()this would change nothing since it'sacpi_os_ioremap()that runs the rule (backed up by EFI memory map region info).Indeed. So the fact that
acpi_os_map_memory()is backed byacpi_os_ioremap()is something we should fix. So they should both consult the EFI memory map, but have different fallback defaults if the region is not annotated correctly.
Quoted 5 lines
Put together patch below even though I am not really satisfied, a tad intrusive and duplicate code in generic/arch backends, compile tested only; overall this IO vs memory mapping distinction is a bit too fuzzy for my taste - there is legacy unfortunately to consider though.
I'd say that this does not look unreasonable at all. Is there any way we could get this tested on actual hw?
Quoted 173 lines
-- >8 --
Subject: [PATCH] ACPI: Add memory semantics toacpi_os_map_memory()Some platforms require memory semantics requested by the mapping function to be translated into architectural specific memory attributes so that the mapping is effectively implementing what is expected from it in terms of allowed access patterns (eg unaligned access).
Rework
acpi_os_map_memory()andacpi_os_ioremap()back-end to split them into two separate code paths that allow the architectural back-end to detect the default memory attributes required by the mapping in question.Signed-off-by Lorenzo Pieralisi <[email protected]>--- arch/arm64/include/asm/acpi.h | 3 +++ arch/arm64/kernel/acpi.c | 16 ++++++++++++++-- drivers/acpi/osl.c | 23 ++++++++++++++++------- include/acpi/acpi_io.h | 8 ++++++++ 4 files changed, 41 insertions(+), 9 deletions(-)arch/arm64/include/asm/acpi.h +3
-0@@ -50,6 +50,9 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr);void __iomem *acpi_os_ioremap (acpi_physical_address phys,acpi_size size);#define acpi_os_ioremap acpi_os_ioremap +void __iomem *acpi_os_memmap (acpi_physical_address phys,acpi_size size); +#define acpi_os_memmap acpi_os_memmap +typedef u64 phys_cpuid_t ;#define PHYS_CPUID_INVALID INVALID_HWIDarch/arm64/kernel/acpi.c +14
-2@@ -261,7 +261,8 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr)return __pgprot (PROT_DEVICE_nGnRnE); } -void __iomem *acpi_os_ioremap (acpi_physical_address phys,acpi_size size) +static void __iomem *__acpi_os_ioremap (acpi_physical_address phys, +acpi_size size,bool memory) {efi_memory_desc_t *md, *region =NULL ;pgprot_t prot;@@ -289,7 +290,8 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)* regions that require a virtual mapping to make them accessible to * the EFI runtime services. */ - prot =__pgprot (PROT_DEVICE_nGnRnE); + prot = memory ?__pgprot (PROT_NORMAL_NC ) : +__pgprot (PROT_DEVICE_nGnRnE);if (region) {switch (region->type) {case EFI_LOADER_CODE :@@ -349,6 +351,16 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)return __ioremap (phys, size, prot); } +void __iomem *acpi_os_ioremap (acpi_physical_address phys,acpi_size size) +{ +return __acpi_os_ioremap (phys, size, false); +} + +void __iomem *acpi_os_memmap (acpi_physical_address phys,acpi_size size) +{ +return __acpi_os_ioremap (phys, size, true); +} +/* * Claim Synchronous External Aborts as a firmware first notification. * drivers/acpi/osl.c +16
-7@@ -284,7 +284,8 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)#define should_use_kmap (pfn) page_is_ram(pfn)#endif -static void __iomem *acpi_map (acpi_physical_address pg_off,unsigned long pg_sz) +static void __iomem *acpi_map (acpi_physical_address pg_off,unsigned long pg_sz, +bool memory) {unsigned long pfn;@@ -294,7 +295,8 @@ static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz)return NULL ;return (void __iomem __force *)kmap (pfn_to_page (pfn)); }else -return acpi_os_ioremap (pg_off, pg_sz); +return memory ?acpi_os_memmap (pg_off, pg_sz) : +acpi_os_ioremap (pg_off, pg_sz); }static void acpi_unmap (acpi_physical_address pg_off,void __iomem *vaddr)@@ -309,9 +311,10 @@ static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr) }/** -* acpi_os_map_iomem - Get a virtual address for a given physical address range. +* __acpi_os_map_iomem - Get a virtual address for a given physical address range. * @phys: Start of the physical address range to map. * @size: Size of the physical address range to map. +* @memory: true if remapping memory, false if IO * * Look up the given physical address range in the list of existing ACPI memory * mappings. If found, get a reference to it and return a pointer to it (its @@ -321,8 +324,8 @@ static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr)* During early init (when acpi_permanent_mmap has not been set yet) this * routine simply calls __acpi_map_table() to get the job done. */ -void __iomem __ref -*acpi_os_map_iomem (acpi_physical_address phys,acpi_size size) +static void __iomem __ref +*__acpi_os_map_iomem (acpi_physical_address phys,acpi_size size,bool memory) {struct acpi_ioremap *map;void __iomem *virt;@@ -353,7 +356,7 @@ void __iomem __ref pg_off =round_down (phys,PAGE_SIZE ); pg_sz =round_up (phys + size,PAGE_SIZE ) - pg_off; - virt =acpi_map (phys, size); + virt =acpi_map (phys, size, memory);if (!virt) {mutex_unlock (&acpi_ioremap_lock);kfree (map);@@ -372,11 +375,17 @@ void __iomem __refmutex_unlock (&acpi_ioremap_lock);return map->virt + (phys - map->phys); } + +void __iomem __ref +*acpi_os_map_iomem (acpi_physical_address phys,acpi_size size) +{ +return __acpi_os_map_iomem (phys, size, false); +}EXPORT_SYMBOL_GPL (acpi_os_map_iomem);void *__ref acpi_os_map_memory (acpi_physical_address phys,acpi_size size) { -return (void *)acpi_os_map_iomem (phys, size); +return (void *)__acpi_os_map_iomem (phys, size, true); }EXPORT_SYMBOL_GPL (acpi_os_map_memory);include/acpi/acpi_io.h +8
-1@@ -14,6 +14,14 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, }#endif +#ifndef acpi_os_memmap +static inline void __iomem *acpi_os_memmap (acpi_physical_address phys, +acpi_size size) +{ +return ioremap_cache (phys, size); +} +#endif +extern bool acpi_permanent_mmap;void __iomem __ref --2.29.1
Quoted 17 lines · Ard Biesheuvel
Quoted 15 lines · Lorenzo Pieralisi
On Wed, Jun 30, 2021 at 08:18:22PM +0200, Ard Biesheuvel wrote:
[...]
Quoted 9 lines
Quoted 4 lines
In current code, even if the BERT were mapped with
acpi_os_map_iomem()this would change nothing since it'sacpi_os_ioremap()that runs the rule (backed up by EFI memory map region info).Indeed. So the fact that
acpi_os_map_memory()is backed byacpi_os_ioremap()is something we should fix. So they should both consult the EFI memory map, but have different fallback defaults if the region is not annotated correctly.
Quoted 8 lines
Quoted 5 lines
Put together patch below even though I am not really satisfied, a tad intrusive and duplicate code in generic/arch backends, compile tested only; overall this IO vs memory mapping distinction is a bit too fuzzy for my taste - there is legacy unfortunately to consider though.
I'd say that this does not look unreasonable at all. Is there any way we could get this tested on actual hw?
Sure, I was meant to follow-up and was caught up in something else, sorry.
I will clean up the log, push it out in a branch on Monday, CKI should pick it up. I will also think about other possible testing options.
Thanks for having a look !
Lorenzo
Quoted 173 lines
Quoted 173 lines
-- >8 --
Subject: [PATCH] ACPI: Add memory semantics toacpi_os_map_memory()Some platforms require memory semantics requested by the mapping function to be translated into architectural specific memory attributes so that the mapping is effectively implementing what is expected from it in terms of allowed access patterns (eg unaligned access).
Rework
acpi_os_map_memory()andacpi_os_ioremap()back-end to split them into two separate code paths that allow the architectural back-end to detect the default memory attributes required by the mapping in question.Signed-off-by Lorenzo Pieralisi <[email protected]>--- arch/arm64/include/asm/acpi.h | 3 +++ arch/arm64/kernel/acpi.c | 16 ++++++++++++++-- drivers/acpi/osl.c | 23 ++++++++++++++++------- include/acpi/acpi_io.h | 8 ++++++++ 4 files changed, 41 insertions(+), 9 deletions(-)arch/arm64/include/asm/acpi.h +3
-0@@ -50,6 +50,9 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr);void __iomem *acpi_os_ioremap (acpi_physical_address phys,acpi_size size);#define acpi_os_ioremap acpi_os_ioremap +void __iomem *acpi_os_memmap (acpi_physical_address phys,acpi_size size); +#define acpi_os_memmap acpi_os_memmap +typedef u64 phys_cpuid_t ;#define PHYS_CPUID_INVALID INVALID_HWIDarch/arm64/kernel/acpi.c +14
-2@@ -261,7 +261,8 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr)return __pgprot (PROT_DEVICE_nGnRnE); } -void __iomem *acpi_os_ioremap (acpi_physical_address phys,acpi_size size) +static void __iomem *__acpi_os_ioremap (acpi_physical_address phys, +acpi_size size,bool memory) {efi_memory_desc_t *md, *region =NULL ;pgprot_t prot;@@ -289,7 +290,8 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)* regions that require a virtual mapping to make them accessible to * the EFI runtime services. */ - prot =__pgprot (PROT_DEVICE_nGnRnE); + prot = memory ?__pgprot (PROT_NORMAL_NC ) : +__pgprot (PROT_DEVICE_nGnRnE);if (region) {switch (region->type) {case EFI_LOADER_CODE :@@ -349,6 +351,16 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)return __ioremap (phys, size, prot); } +void __iomem *acpi_os_ioremap (acpi_physical_address phys,acpi_size size) +{ +return __acpi_os_ioremap (phys, size, false); +} + +void __iomem *acpi_os_memmap (acpi_physical_address phys,acpi_size size) +{ +return __acpi_os_ioremap (phys, size, true); +} +/* * Claim Synchronous External Aborts as a firmware first notification. * drivers/acpi/osl.c +16
-7@@ -284,7 +284,8 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)#define should_use_kmap (pfn) page_is_ram(pfn)#endif -static void __iomem *acpi_map (acpi_physical_address pg_off,unsigned long pg_sz) +static void __iomem *acpi_map (acpi_physical_address pg_off,unsigned long pg_sz, +bool memory) {unsigned long pfn;@@ -294,7 +295,8 @@ static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz)return NULL ;return (void __iomem __force *)kmap (pfn_to_page (pfn)); }else -return acpi_os_ioremap (pg_off, pg_sz); +return memory ?acpi_os_memmap (pg_off, pg_sz) : +acpi_os_ioremap (pg_off, pg_sz); }static void acpi_unmap (acpi_physical_address pg_off,void __iomem *vaddr)@@ -309,9 +311,10 @@ static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr) }/** -* acpi_os_map_iomem - Get a virtual address for a given physical address range. +* __acpi_os_map_iomem - Get a virtual address for a given physical address range. * @phys: Start of the physical address range to map. * @size: Size of the physical address range to map. +* @memory: true if remapping memory, false if IO * * Look up the given physical address range in the list of existing ACPI memory * mappings. If found, get a reference to it and return a pointer to it (its @@ -321,8 +324,8 @@ static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr)* During early init (when acpi_permanent_mmap has not been set yet) this * routine simply calls __acpi_map_table() to get the job done. */ -void __iomem __ref -*acpi_os_map_iomem (acpi_physical_address phys,acpi_size size) +static void __iomem __ref +*__acpi_os_map_iomem (acpi_physical_address phys,acpi_size size,bool memory) {struct acpi_ioremap *map;void __iomem *virt;@@ -353,7 +356,7 @@ void __iomem __ref pg_off =round_down (phys,PAGE_SIZE ); pg_sz =round_up (phys + size,PAGE_SIZE ) - pg_off; - virt =acpi_map (phys, size); + virt =acpi_map (phys, size, memory);if (!virt) {mutex_unlock (&acpi_ioremap_lock);kfree (map);@@ -372,11 +375,17 @@ void __iomem __refmutex_unlock (&acpi_ioremap_lock);return map->virt + (phys - map->phys); } + +void __iomem __ref +*acpi_os_map_iomem (acpi_physical_address phys,acpi_size size) +{ +return __acpi_os_map_iomem (phys, size, false); +}EXPORT_SYMBOL_GPL (acpi_os_map_iomem);void *__ref acpi_os_map_memory (acpi_physical_address phys,acpi_size size) { -return (void *)acpi_os_map_iomem (phys, size); +return (void *)__acpi_os_map_iomem (phys, size, true); }EXPORT_SYMBOL_GPL (acpi_os_map_memory);include/acpi/acpi_io.h +8
-1@@ -14,6 +14,14 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, }#endif +#ifndef acpi_os_memmap +static inline void __iomem *acpi_os_memmap (acpi_physical_address phys, +acpi_size size) +{ +return ioremap_cache (phys, size); +} +#endif +extern bool acpi_permanent_mmap;void __iomem __ref --2.29.1
Quoted 28 lines · Lorenzo Pieralisi
Quoted 17 lines · Ard Biesheuvel
Quoted 15 lines · Lorenzo Pieralisi
On Wed, Jun 30, 2021 at 08:18:22PM +0200, Ard Biesheuvel wrote:
[...]
Quoted 9 lines
Quoted 4 lines
In current code, even if the BERT were mapped with
acpi_os_map_iomem()this would change nothing since it'sacpi_os_ioremap()that runs the rule (backed up by EFI memory map region info).Indeed. So the fact that
acpi_os_map_memory()is backed byacpi_os_ioremap()is something we should fix. So they should both consult the EFI memory map, but have different fallback defaults if the region is not annotated correctly.Quoted 8 lines
Quoted 5 lines
Put together patch below even though I am not really satisfied, a tad intrusive and duplicate code in generic/arch backends, compile tested only; overall this IO vs memory mapping distinction is a bit too fuzzy for my taste - there is legacy unfortunately to consider though.
I'd say that this does not look unreasonable at all. Is there any way we could get this tested on actual hw?
Quoted 7 lines
Sure, I was meant to follow-up and was caught up in something else, sorry.
I will clean up the log, push it out in a branch on Monday, CKI should pick it up. I will also think about other possible testing options.
Hi,
thanks for the patience with the testing, the stress-ng test couldn't deal with a new glibc version and had to be fixed and this week has just been crazy.
I managed to do 2 runs of the updated tree with the stress-ng test and it didn't hit the problem. Given how unreliably it reproduces it doesn't mean all that much. I still have one more run pending and can submit more if needed.
However, we ran into a panic with this tree on a completely different machine:
https://gitlab.com/-/snippets/2152899/raw/main/snippetfile1.txt
The machine also hit a hardware error during LTP:
https://gitlab.com/-/snippets/2152899/raw/main/snippetfile2.txt
I'm not sure if the cause of these is the HW/firmware of they are related to any changes in the tree but I'm sending them over as they contain acpi in the call traces.
Veronika
Quoted 177 lines
Thanks for having a look !
LorenzoQuoted 173 lines
Quoted 173 lines
-- >8 --
Subject: [PATCH] ACPI: Add memory semantics toacpi_os_map_memory()Some platforms require memory semantics requested by the mapping function to be translated into architectural specific memory attributes so that the mapping is effectively implementing what is expected from it in terms of allowed access patterns (eg unaligned access).
Rework
acpi_os_map_memory()andacpi_os_ioremap()back-end to split them into two separate code paths that allow the architectural back-end to detect the default memory attributes required by the mapping in question.Signed-off-by Lorenzo Pieralisi <[email protected]>--- arch/arm64/include/asm/acpi.h | 3 +++ arch/arm64/kernel/acpi.c | 16 ++++++++++++++-- drivers/acpi/osl.c | 23 ++++++++++++++++------- include/acpi/acpi_io.h | 8 ++++++++ 4 files changed, 41 insertions(+), 9 deletions(-)arch/arm64/include/asm/acpi.h +3
-0@@ -50,6 +50,9 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr);void __iomem *acpi_os_ioremap (acpi_physical_address phys,acpi_size size);#define acpi_os_ioremap acpi_os_ioremap +void __iomem *acpi_os_memmap (acpi_physical_address phys,acpi_size size); +#define acpi_os_memmap acpi_os_memmap +typedef u64 phys_cpuid_t ;#define PHYS_CPUID_INVALID INVALID_HWIDarch/arm64/kernel/acpi.c +14
-2@@ -261,7 +261,8 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr)return __pgprot (PROT_DEVICE_nGnRnE); } -void __iomem *acpi_os_ioremap (acpi_physical_address phys,acpi_size size) +static void __iomem *__acpi_os_ioremap (acpi_physical_address phys, +acpi_size size,bool memory) {efi_memory_desc_t *md, *region =NULL ;pgprot_t prot;@@ -289,7 +290,8 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)* regions that require a virtual mapping to make them accessible to * the EFI runtime services. */ - prot =__pgprot (PROT_DEVICE_nGnRnE); + prot = memory ?__pgprot (PROT_NORMAL_NC ) : +__pgprot (PROT_DEVICE_nGnRnE);if (region) {switch (region->type) {case EFI_LOADER_CODE :@@ -349,6 +351,16 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)return __ioremap (phys, size, prot); } +void __iomem *acpi_os_ioremap (acpi_physical_address phys,acpi_size size) +{ +return __acpi_os_ioremap (phys, size, false); +} + +void __iomem *acpi_os_memmap (acpi_physical_address phys,acpi_size size) +{ +return __acpi_os_ioremap (phys, size, true); +} +/* * Claim Synchronous External Aborts as a firmware first notification. * drivers/acpi/osl.c +16
-7@@ -284,7 +284,8 @@ acpi_map_lookup_virt(void __iomem *virt, acpi_size size)#define should_use_kmap (pfn) page_is_ram(pfn)#endif -static void __iomem *acpi_map (acpi_physical_address pg_off,unsigned long pg_sz) +static void __iomem *acpi_map (acpi_physical_address pg_off,unsigned long pg_sz, +bool memory) {unsigned long pfn;@@ -294,7 +295,8 @@ static void __iomem *acpi_map(acpi_physical_address pg_off, unsigned long pg_sz)return NULL ;return (void __iomem __force *)kmap (pfn_to_page (pfn)); }else -return acpi_os_ioremap (pg_off, pg_sz); +return memory ?acpi_os_memmap (pg_off, pg_sz) : +acpi_os_ioremap (pg_off, pg_sz); }static void acpi_unmap (acpi_physical_address pg_off,void __iomem *vaddr)@@ -309,9 +311,10 @@ static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr) }/** -* acpi_os_map_iomem - Get a virtual address for a given physical address range. +* __acpi_os_map_iomem - Get a virtual address for a given physical address range. * @phys: Start of the physical address range to map. * @size: Size of the physical address range to map. +* @memory: true if remapping memory, false if IO * * Look up the given physical address range in the list of existing ACPI memory * mappings. If found, get a reference to it and return a pointer to it (its @@ -321,8 +324,8 @@ static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr)* During early init (when acpi_permanent_mmap has not been set yet) this * routine simply calls __acpi_map_table() to get the job done. */ -void __iomem __ref -*acpi_os_map_iomem (acpi_physical_address phys,acpi_size size) +static void __iomem __ref +*__acpi_os_map_iomem (acpi_physical_address phys,acpi_size size,bool memory) {struct acpi_ioremap *map;void __iomem *virt;@@ -353,7 +356,7 @@ void __iomem __ref pg_off =round_down (phys,PAGE_SIZE ); pg_sz =round_up (phys + size,PAGE_SIZE ) - pg_off; - virt =acpi_map (phys, size); + virt =acpi_map (phys, size, memory);if (!virt) {mutex_unlock (&acpi_ioremap_lock);kfree (map);@@ -372,11 +375,17 @@ void __iomem __refmutex_unlock (&acpi_ioremap_lock);return map->virt + (phys - map->phys); } + +void __iomem __ref +*acpi_os_map_iomem (acpi_physical_address phys,acpi_size size) +{ +return __acpi_os_map_iomem (phys, size, false); +}EXPORT_SYMBOL_GPL (acpi_os_map_iomem);void *__ref acpi_os_map_memory (acpi_physical_address phys,acpi_size size) { -return (void *)acpi_os_map_iomem (phys, size); +return (void *)__acpi_os_map_iomem (phys, size, true); }EXPORT_SYMBOL_GPL (acpi_os_map_memory);include/acpi/acpi_io.h +8
-1@@ -14,6 +14,14 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys, }#endif +#ifndef acpi_os_memmap +static inline void __iomem *acpi_os_memmap (acpi_physical_address phys, +acpi_size size) +{ +return ioremap_cache (phys, size); +} +#endif +extern bool acpi_permanent_mmap;void __iomem __ref --2.29.1
Quoted 49 lines · Veronika Kabatova
Quoted 28 lines · Lorenzo Pieralisi
Quoted 17 lines · Ard Biesheuvel
Quoted 15 lines · Lorenzo Pieralisi
On Wed, Jun 30, 2021 at 08:18:22PM +0200, Ard Biesheuvel wrote:
[...]
Quoted 9 lines
Quoted 4 lines
In current code, even if the BERT were mapped with
acpi_os_map_iomem()this would change nothing since it'sacpi_os_ioremap()that runs the rule (backed up by EFI memory map region info).Indeed. So the fact that
acpi_os_map_memory()is backed byacpi_os_ioremap()is something we should fix. So they should both consult the EFI memory map, but have different fallback defaults if the region is not annotated correctly.Quoted 8 lines
Quoted 5 lines
Put together patch below even though I am not really satisfied, a tad intrusive and duplicate code in generic/arch backends, compile tested only; overall this IO vs memory mapping distinction is a bit too fuzzy for my taste - there is legacy unfortunately to consider though.
I'd say that this does not look unreasonable at all. Is there any way we could get this tested on actual hw?
Quoted 7 lines
Sure, I was meant to follow-up and was caught up in something else, sorry.
I will clean up the log, push it out in a branch on Monday, CKI should pick it up. I will also think about other possible testing options.
Hi,
thanks for the patience with the testing, the stress-ng test couldn't deal with a new glibc version and had to be fixed and this week has just been crazy.
I managed to do 2 runs of the updated tree with the stress-ng test and it didn't hit the problem. Given how unreliably it reproduces it doesn't mean all that much. I still have one more run pending and can submit more if needed.
Quoted 4 lines
However, we ran into a panic with this tree on a completely different machine:
https://gitlab.com/-/snippets/2152899/raw/main/snippetfile1.txt
All the warnings from arch_setup_dma_ops() there are (unfortunately) pretty much legitimate for that platform, and should be gone again since rc2 with commit c1132702c71f.
Quoted 3 lines
The machine also hit a hardware error during LTP:
https://gitlab.com/-/snippets/2152899/raw/main/snippetfile2.txt
Hmm, if "access mode: secure" in that fault report implies that the firmnware itself has done something dodgy to raise an SError, I'm not sure there's much we can do about that...
Robin.
Quoted 60 lines · Robin Murphy
Quoted 49 lines · Veronika Kabatova
Quoted 28 lines · Lorenzo Pieralisi
Quoted 17 lines · Ard Biesheuvel
Quoted 15 lines · Lorenzo Pieralisi
On Wed, Jun 30, 2021 at 08:18:22PM +0200, Ard Biesheuvel wrote:
[...]
Quoted 9 lines
Quoted 4 lines
In current code, even if the BERT were mapped with
acpi_os_map_iomem()this would change nothing since it'sacpi_os_ioremap()that runs the rule (backed up by EFI memory map region info).Indeed. So the fact that
acpi_os_map_memory()is backed byacpi_os_ioremap()is something we should fix. So they should both consult the EFI memory map, but have different fallback defaults if the region is not annotated correctly.Quoted 8 lines
Quoted 5 lines
Put together patch below even though I am not really satisfied, a tad intrusive and duplicate code in generic/arch backends, compile tested only; overall this IO vs memory mapping distinction is a bit too fuzzy for my taste - there is legacy unfortunately to consider though.
I'd say that this does not look unreasonable at all. Is there any way we could get this tested on actual hw?
Quoted 7 lines
Sure, I was meant to follow-up and was caught up in something else, sorry.
I will clean up the log, push it out in a branch on Monday, CKI should pick it up. I will also think about other possible testing options.
Hi,
thanks for the patience with the testing, the stress-ng test couldn't deal with a new glibc version and had to be fixed and this week has just been crazy.
I managed to do 2 runs of the updated tree with the stress-ng test and it didn't hit the problem. Given how unreliably it reproduces it doesn't mean all that much. I still have one more run pending and can submit more if needed.
Quoted 4 lines
However, we ran into a panic with this tree on a completely different machine:
https://gitlab.com/-/snippets/2152899/raw/main/snippetfile1.txt
All the warnings from
arch_setup_dma_ops()there are (unfortunately) pretty much legitimate for that platform, and should be gone again since rc2 with commitc1132702c71f.
Quoted 8 lines
Quoted 3 lines
The machine also hit a hardware error during LTP:
https://gitlab.com/-/snippets/2152899/raw/main/snippetfile2.txt
Hmm, if "access mode: secure" in that fault report implies that the firmnware itself has done something dodgy to raise an SError, I'm not sure there's much we can do about that...
Thank you for checking!
In the meanwhile, the last test job completed and passed as well. Let me know if you'd like more test runs or if there's anything else I can help with.
Veronika
Quoted 2 lines
Robin.
Re: ??? FAIL: Test report for kernel 5.13.0-rc7 (arm-next, 8ab9b1a9)
In reply to Robin MurphyHi Robin,
(Old thread, so reference to it: https://lists.infradead.org/pipermail/linux-arm-kernel/2021-June/668228.html)
(Also, please keep me on Cc since I'm not subscribed to linux-arm)
Quoted 8 lines · Robin Murphy
Ah, from that I can only assume that this must be stress-ng's --sysfs test reading things at random, so not only would it have to be on a machine whose firmware presents the right thing in the right way but the random test conditions would also have to line up to poke it the "right" (wrong) way too.
As a temporary workaround for the CI flakes, might it be possible to configure stress-ng to stay away from just these ACPI "data" files?
I started looking at this issue and managed to reproduce the issue instantly with
dd if=/sys/firmware/acpi/tables/data/BERT of=/dev/null bs=7
I've attempted a few ways of fixing it based on the comments on this thread but wasn't successful so far (my knowledge is pretty limited in this area too, so not a big surprise). How can I be of assistance to debug/test patches for this issue?
Signature · 7 lines
Aristeu _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: ??? FAIL: Test report for kernel 5.13.0-rc7 (arm-next, 8ab9b1a9)
In reply to Robin MurphyHi Robin,
(Old thread, so reference to it: https://lists.infradead.org/pipermail/linux-arm-kernel/2021-June/668228.html)
(Also, please keep me on Cc since I'm not subscribed to linux-arm)
(And again because I failed to fix the email address after using the
archives mailbox, apologies for that)
Quoted 8 lines · Robin Murphy
Ah, from that I can only assume that this must be stress-ng's --sysfs test reading things at random, so not only would it have to be on a machine whose firmware presents the right thing in the right way but the random test conditions would also have to line up to poke it the "right" (wrong) way too.
As a temporary workaround for the CI flakes, might it be possible to configure stress-ng to stay away from just these ACPI "data" files?
I started looking at this issue and managed to reproduce the issue instantly with
dd if=/sys/firmware/acpi/tables/data/BERT of=/dev/null bs=7
I've attempted a few ways of fixing it based on the comments on this thread but wasn't successful so far (my knowledge is pretty limited in this area too, so not a big surprise). How can I be of assistance to debug/test patches for this issue?
Signature · 7 lines
Aristeu _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: ??? FAIL: Test report for kernel 5.13.0-rc7 (arm-next, 8ab9b1a9)
Hi Aristeu,
Quoted 20 lines · Aristeu Rozanski
Hi Robin,
(Old thread, so reference to it: https://lists.infradead.org/pipermail/linux-arm-kernel/2021-June/668228.html)
(Also, please keep me on Cc since I'm not subscribed to linux-arm)
(And again because I failed to fix the email address after using the
archives mailbox, apologies for that)Quoted 8 lines · Robin Murphy
Ah, from that I can only assume that this must be stress-ng's --sysfs test reading things at random, so not only would it have to be on a machine whose firmware presents the right thing in the right way but the random test conditions would also have to line up to poke it the "right" (wrong) way too.
As a temporary workaround for the CI flakes, might it be possible to configure stress-ng to stay away from just these ACPI "data" files?
I started looking at this issue and managed to reproduce the issue instantly with
Quoted 6 lines
dd if=/sys/firmware/acpi/tables/data/BERT of=/dev/null bs=7
I've attempted a few ways of fixing it based on the comments on this thread but wasn't successful so far (my knowledge is pretty limited in this area too, so not a big surprise). How can I be of assistance to debug/test patches for this issue?
Gosh, there's a fair bit of additional history between then and now, scattered across several other threads... From memory, we ended up merging some form of Lorenzo's patch, but that turned out to break some other machine with a *differently* dodgy memory map, and got reverted again. I have a feeling that things wound up at that point leaning towards a consensus that the pseudo-generic machinery that was actually only used for dumping BERT records could probably be ripped out and replaced with a simple dedicated iomem-safe thing for dumping BERT records, but I'm not sure if any further progress happened on that front.
Cheers,
Robin.
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: ??? FAIL: Test report for kernel 5.13.0-rc7 (arm-next, 8ab9b1a9)
In reply to Aristeu RozanskiQuoted 20 lines · Aristeu Rozanski
Hi Robin,
(Old thread, so reference to it: https://lists.infradead.org/pipermail/linux-arm-kernel/2021-June/668228.html)
(Also, please keep me on Cc since I'm not subscribed to linux-arm)
(And again because I failed to fix the email address after using the
archives mailbox, apologies for that)Quoted 8 lines · Robin Murphy
Ah, from that I can only assume that this must be stress-ng's --sysfs test reading things at random, so not only would it have to be on a machine whose firmware presents the right thing in the right way but the random test conditions would also have to line up to poke it the "right" (wrong) way too.
As a temporary workaround for the CI flakes, might it be possible to configure stress-ng to stay away from just these ACPI "data" files?
I started looking at this issue and managed to reproduce the issue instantly with
Quoted 6 lines
dd if=/sys/firmware/acpi/tables/data/BERT of=/dev/null bs=7
I've attempted a few ways of fixing it based on the comments on this thread but wasn't successful so far (my knowledge is pretty limited in this area too, so not a big surprise). How can I be of assistance to debug/test patches for this issue?
I put together the patch below that I need to send to see whether that's acceptable, if you can help me test it in the meantime, that'd great.
-- >8 --
Subject: [PATCH] ACPI: osl: Fix BERT error region memory mapping
Currently the sysfs interface maps the BERT error region as "memory" (through acpi_os_map_memory()) in order to copy the error records into memory buffers through memory operations (eg memory_read_from_buffer()).
The OS system cannot detect whether the BERT error region is part of system RAM or it is "device memory" (eg BMC memory) and therefore it cannot detect which memory attributes the bus to memory support (and corresponding kernel mapping, unless firmware provides the required information).
The acpi_os_map_memory() arch backend implementation determines the mapping attributes. On arm64, if the BERT error region is not present in the EFI memory map, the error region is mapped as device-nGnRnE; this triggers alignment faults since memcpy unaligned accesses are not allowed in device-nGnRnE regions.
The ACPI sysfs code cannot therefore map by default the BERT error region with memory semantics but should use a safer default.
Change the sysfs code to map the BERT error region as MMIO (through acpi_os_map_iomem()) and use the memcpy_fromio() interface to read the error region into the kernel buffer.
--- drivers/acpi/sysfs.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)
drivers/acpi/sysfs.c +18 -7
@@ -415,19 +415,30 @@ static ssize_t acpi_data_show(struct file *filp, struct kobject *kobj, loff_t offset, size_t count) {struct acpi_data_attr *data_attr; -void *base; -ssize_t rc; +void __iomem *base; +ssize_t size; data_attr = container_of(bin_attr, struct acpi_data_attr, attr); + size = data_attr->attr.size; + +if (offset <0 ) +return -EINVAL ; + +if (offset >= size) +return 0 ; - base =acpi_os_map_memory (data_attr->addr, data_attr->attr.size); +if (count > size - offset) + count = size - offset; + + base =acpi_os_map_iomem (data_attr->addr, size);if (!base)return -ENOMEM ; - rc =memory_read_from_buffer (buf, count, &offset, base, - data_attr->attr.size); -acpi_os_unmap_memory (base, data_attr->attr.size); -return rc; +memcpy_fromio (buf, base + offset, count); + +acpi_os_unmap_iomem (base, size); + +return count; }static int acpi_bert_data_init (void *th,struct acpi_data_attr *data_attr)
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: ??? FAIL: Test report for kernel 5.13.0-rc7 (arm-next, 8ab9b1a9)
Hi Lorenzo,
Quoted 73 lines · Lorenzo Pieralisi
I put together the patch below that I need to send to see whether that's acceptable, if you can help me test it in the meantime, that'd great.
-- >8 --
Subject: [PATCH] ACPI: osl: Fix BERT error region memory mappingCurrently the sysfs interface maps the BERT error region as "memory" (through
acpi_os_map_memory()) in order to copy the error records into memory buffers through memory operations (egmemory_read_from_buffer()).The OS system cannot detect whether the BERT error region is part of system RAM or it is "device memory" (eg BMC memory) and therefore it cannot detect which memory attributes the bus to memory support (and corresponding kernel mapping, unless firmware provides the required information).
The
acpi_os_map_memory()arch backend implementation determines the mapping attributes. On arm64, if the BERT error region is not present in the EFI memory map, the error region is mapped as device-nGnRnE; this triggers alignment faults since memcpy unaligned accesses are not allowed in device-nGnRnE regions.The ACPI sysfs code cannot therefore map by default the BERT error region with memory semantics but should use a safer default.
Change the sysfs code to map the BERT error region as MMIO (through
acpi_os_map_iomem()) and use thememcpy_fromio()interface to read the error region into the kernel buffer.Link https://lore.kernel.org/linux-acpi/CAJZ5v0g+OVbhuUUDrLUCfX_mVqY_e8ubgLTU98=jfjTeb4t+Pw@mail.gmail.com open hereSigned-off-by Lorenzo Pieralisi <[email protected]>Cc Ard Biesheuvel <[email protected]>Cc Will Deacon <[email protected]>Cc Hanjun Guo <[email protected]>Cc Sudeep Holla <[email protected]>Cc Catalin Marinas <[email protected]>Cc "Rafael J. Wysocki" <[email protected]>--- drivers/acpi/sysfs.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)drivers/acpi/sysfs.c +13
-4@@ -415,19 +415,30 @@ static ssize_t acpi_data_show(struct file *filp, struct kobject *kobj, loff_t offset, size_t count) {struct acpi_data_attr *data_attr; -void *base; -ssize_t rc; +void __iomem *base; +ssize_t size; data_attr = container_of(bin_attr, struct acpi_data_attr, attr); + size = data_attr->attr.size; + +if (offset <0 ) +return -EINVAL ; + +if (offset >= size) +return 0 ; - base =acpi_os_map_memory (data_attr->addr, data_attr->attr.size); +if (count > size - offset) + count = size - offset; + + base =acpi_os_map_iomem (data_attr->addr, size);if (!base)return -ENOMEM ; - rc = memory_read_from_buffer(buf, count, &offset, base,
drivers/acpi/sysfs.c static ssize_t acpi_data_show(struct file *filp, struct kobject *kobj, · line 442
Quoted 10 lines
drivers/acpi/sysfs.c +5
-3- data_attr->attr.size); -acpi_os_unmap_memory (base, data_attr->attr.size); -return rc; +memcpy_fromio (buf, base + offset, count); + +acpi_os_unmap_iomem (base, size); + +return count; }
Tested on the same machine I can trigger reliably and this fixes the issue.
Thanks!
Signature · 7 lines
Aristeu _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel