* Linux 5.15-rc2 @ 2021-09-20 0:40 Linus Torvalds 2021-09-20 13:44 ` Guenter Roeck 0 siblings, 1 reply; 7+ messages in thread From: Linus Torvalds @ 2021-09-20 0:40 UTC (permalink / raw) To: Linux Kernel Mailing List So I've spent a fair amount of this week trying to sort out all the odd warnings, and I want to particularly thank Guenter Roeck for his work on tracking where the build failures due to -Werror come from. Is it done? No. But on the whole I'm feeling fairly good about this all, even if it has meant that I've been looking at some really odd and grotty code. Who knew I'd still worry about some odd EISA driver on alpha, after all these years? A slight change of pace ;) The most annoying thing is probably the "fix one odd corner case, three others rear their ugly heads". But I remain convinced that it's all for a good cause, and that we really do want to have a clean build even for the crazy odd cases. We'll get there. Anyway, I hope this release will turn more normal soon - but the rc2 week tends to be fairly quiet for me, so the fact that I then ended up looking at reports of odd warnings-turned-errors this week wasn't too bad. There's obviously other fixes in here too, only a small subset of the shortlog below is due to the warning fixes, even if that's what I've personally been most involved with. Go test, and keep the reports coming, Linus --- Adam Borowski (1): net: wan: wanxl: define CROSS_COMPILE_M68K Adrian Bunk (1): bnx2x: Fix enabling network interfaces without VFs Adrian Hunter (1): perf script: Fix ip display when type != attr->type Aleksander Jan Bajkowski (1): net: dsa: lantiq_gswip: Add 200ms assert delay Alex Deucher (1): drm/amdgpu/display: add a proper license to dc_link_dp.c Alex Elder (1): net: ipa: initialize all filter table slots Alexander Egorenkov (1): s390/sclp: fix Secure-IPL facility detection Alim Akhtar (1): dt-bindings: ufs: Add bindings for Samsung ufs host Andrea Claudi (1): selftest: net: fix typo in altname test Andreas Larsson (1): sparc32: page align size in arch_dma_alloc Andrii Nakryiko (1): perf bpf: Ignore deprecation warning when using libbpf's btf__get_from_id() Andy Shevchenko (1): x86/platform: Increase maximum GPIO number for X86_64 Anson Jacob (1): drm/amd/display: dc_assert_fp_enabled assert only if FPU is not enabled Ansuel Smith (1): net: dsa: qca8k: fix kernel panic with legacy mdio mapping Anton Eidelman (1): nvme-multipath: fix ANA state updates when a namespace is not present Ariel Marcovitch (2): checkkconfigsymbols.py: Forbid passing 'HEAD' to --commit checkkconfigsymbols.py: Remove skipping of help lines in parse_kconfig_file Arnd Bergmann (2): ne2000: fix unused function warning drm/rockchip: cdn-dp-core: Make cdn_dp_core_resume __maybe_unused Aya Levin (3): net/mlx5e: Fix mutual exclusion between CQE compression and HW TS net/mlx5e: Fix condition when retrieving PTP-rqn udp_tunnel: Fix udp_tunnel_nic work-queue type Baptiste Lepers (1): events: Reuse value read using READ_ONCE instead of re-reading it Baruch Siach (1): net/packet: clarify source of pr_*() messages Bixuan Cui (1): bpf: Add oversize check before call kvcalloc() Bjorn Helgaas (1): PCI/VPD: Defer VPD sizing until first access Boqun Feng (1): locking/rwbase: Take care of ordering guarantee for fastpath reader Chris Wilson (1): rtc: cmos: Disable irq around direct invocation of cmos_interrupt() Christian König (1): drm/amdgpu: fix use after free during BO move Christoph Hellwig (3): dma-mapping: fix the kerneldoc for dma_map_sg_attrs block: check if a profile is actually registered in blk_integrity_unregister nvme: remove the call to nvme_update_disk_info in nvme_ns_remove Colin Ian King (1): qlcnic: Remove redundant initialization of variable ret Cédric Le Goater (1): powerpc/xics: Set the IRQ chip data for the ICS native backend Dan Carpenter (1): nvmet: fix a width vs precision bug in nvmet_subsys_attr_serial_show() Dan Li (1): arm64: Mark __stack_chk_guard as __ro_after_init Daniel Borkmann (4): bpf: Relicense disassembler as GPL-2.0-only OR BSD-2-Clause bpf, cgroups: Fix cgroup v2 fallback on v1/v2 mixed mode bpf, selftests: Add cgroup v1 net_cls classid helpers bpf, selftests: Add test case for mixed cgroup v1/v2 Daniel Vetter (1): drm/i915: Release ctx->syncobj on final put, not on ctx close Daniel Wagner (1): nvme: avoid race in shutdown namespace removal Daniele Ceraolo Spurio (1): drm/i915/guc: drop guc_communication_enabled Dave Ertman (1): ice: Correctly deal with PFs that do not support RDMA David Brazdil (1): of: restricted dma: Fix condition for rmem init David Heidelberg (1): dt-bindings: arm: Fix Toradex compatible typo David Hildenbrand (1): s390/pci_mmio: fully validate the VMA before calling follow_pte() David Thompson (1): mlxbf_gige: clear valid_polarity upon open Doug Smythies (1): cpufreq: intel_pstate: Override parameters if HWP forced by BIOS Edwin Peer (1): bnxt_en: make bnxt_free_skbs() safe to call after bnxt_free_mem() Eli Cohen (1): net/{mlx5|nfp|bnxt}: Remove unnecessary RTNL lock assert Eric Dumazet (3): net/af_unix: fix a data-race in unix_dgram_poll net-caif: avoid user-triggerable WARN_ON(1) Revert "Revert "ipv4: fix memory leaks in ip_cmsg_send() callers"" Ernst Sjöstrand (1): drm/amd/amdgpu: Increase HWIP_MAX_INSTANCE to 10 Eugene Syromiatnikov (1): io-wq: provide IO_WQ_* constants for IORING_REGISTER_IOWQ_MAX_WORKERS arg items Evan Quan (2): PCI: Add AMD GPU multi-function power dependencies drm/amd/pm: fix runpm hang when amdgpu loaded prior to sound driver Felix Kuehling (1): drm/amdkfd: make needs_pcie_atomics FW-version dependent Florian Fainelli (1): r6040: Restore MDIO clock frequency after MAC reset Ganesh Goudar (1): powerpc/mce: Fix access error in mce handler Geert Uytterhoeven (2): m68k: mvme: Remove overdue #warnings in RTC handling sh: Add missing FORCE prerequisites in Makefile Guenter Roeck (9): net: ni65: Avoid typecast of pointer to u32 m68k: Double cast io functions to unsigned long compiler.h: Introduce absolute_pointer macro net: i825xx: Use absolute_pointer for memcpy from fixed memory location alpha: Move setup.h out of uapi alpha: Use absolute_pointer to define COMMAND_LINE alpha: Declare virt_to_phys and virt_to_bus parameter as pointer to volatile cpufreq: vexpress: Drop unused variable net: 6pack: Fix tx timeout and slot time Hamza Mahfooz (1): dma-debug: prevent an error message from causing runtime problems Hao Xu (2): io-wq: code clean of io_wqe_create_worker() io-wq: fix potential race of acct->nr_workers Harry Wentland (1): drm/amd/display: Get backlight from PWM if DMCU is not initialized Heiko Carstens (3): s390: update defconfigs s390/ap: fix kernel doc comments s390: remove WARN_DYNAMIC_STACK Helge Deller (2): parisc: Use absolute_pointer() to define PAGE0 parisc: Declare pci_iounmap() parisc version only when CONFIG_PCI enabled Hersen Wu (1): drm/amd/display: dsc mst 2 4K displays go dark with 2 lane HBR3 Hoang Le (1): tipc: increase timeout in tipc_sk_enqueue() Huang Rui (1): drm/ttm: fix type mismatch error on sparc64 Ian Rogers (1): libperf evsel: Make use of FD robust. James Morse (1): cpufreq: schedutil: Destroy mutex before kobject_put() frees the memory James Zhu (3): drm/amdkfd: separate kfd_iommu_resume from kfd_resume drm/amdgpu: add amdgpu_amdkfd_resume_iommu drm/amdgpu: move iommu_resume before ip init/resume Jan Beulich (9): xen/pvcalls: backend can be a module swiotlb-xen: avoid double free swiotlb-xen: fix late init retry swiotlb-xen: maintain slab count properly swiotlb-xen: suppress certain init retries swiotlb-xen: limit init retries swiotlb-xen: drop leftover __ref swiotlb-xen: arrange to have buffer info logged swiotlb-xen: drop DEFAULT_NSLABS Jean-Philippe Brucker (2): selftests/bpf: Fix build of task_pt_regs test for arm64 PCI/ACPI: Don't reset a fwnode set by OF Jeff Moyer (1): x86/pat: Pass valid address to sanitize_phys() Jens Axboe (6): io_uring: ensure symmetry in handling iter types in loop_rw_iter() io_uring: pin SQPOLL data before unlocking ring lock iov_iter: add helper to save iov_iter state io_uring: allow retry for O_NONBLOCK if async is supported io_uring: use iov_iter state save/restore helpers Revert "iov_iter: track truncated size" Jeremy Kerr (1): mctp: perform route destruction under RCU read lock Jesper Nilsson (1): net: stmmac: allow CSR clock of 300MHz Jiaran Zhang (2): net: hns3: fix the exception when query imp info net: hns3: fix the timing issue of VF clearing interrupt sources Joakim Zhang (2): net: stmmac: fix system hang caused by eee_ctrl_timer during suspend/resume net: stmmac: platform: fix build warning when with !CONFIG_PM_SLEEP Jon Derrick (1): MAINTAINERS: Add Nirmal Patel as VMD maintainer Juergen Gross (4): xen/balloon: use a kernel thread instead a workqueue PM: base: power: don't try to use non-existing RTC for storing data xen: reset legacy rtc flag for PV domU xen: fix usage of pmd_populate in mremap for pv guests Kai-Heng Feng (1): drm/i915/dp: Use max params for panels < eDP 1.4 Keith Busch (1): nvme-tcp: fix io_work priority inversion Kenneth Feng (1): drm/amd/pm: fix the issue of uploading powerplay table Kortan (1): gen_compile_commands: fix missing 'sys' package Lang Yu (5): drm/amdgpu: fix sysfs_emit/sysfs_emit_at warnings(v2) drm/amdgpu: update SMU PPSMC for cyan skilfish drm/amdgpu: update SMU driver interface for cyan skilfish(v3) drm/amdgpu: add some pptable funcs for cyan skilfish(v3) drm/amdgpu: add manual sclk/vddc setting support for cyan skilfish(v3) Lee Shawn C (1): drm/i915/dp: return proper DPRX link training result Len Baker (1): net: mana: Prefer struct_size over open coded arithmetic Li Jinlin (1): blk-cgroup: fix UAF by grabbing blkcg lock before destroying blkg pd Lihong Kou (1): block: flush the integrity workqueue in blk_integrity_unregister Lin, Zhenpeng (1): dccp: don't duplicate ccid when cloning dccp sock Linus Torvalds (17): compiler_attributes.h: drop __has_attribute() support for gcc4 Drop some straggling mentions of gcc-4.9 as being stale memblock: introduce saner 'memblock_free_ptr()' interface sparc: avoid stringop-overread errors qnx4: avoid stringop-overread errors 3com 3c515: make it compile on 64-bit architectures spi: Fix tegra20 build with CONFIG_PM=n alpha: make 'Jensen' IO functions build again tgafb: clarify dependencies alpha: mark 'Jensen' platform as no longer broken alpha: move __udiv_qrnnd library function to arch/alpha/lib/ Revert drm/vc4 hdmi runtime PM changes Revert "drm/vc4: hdmi: Remove drm_encoder->crtc usage" alpha: enable GENERIC_PCI_IOMAP unconditionally dmascc: use proper 'virt_to_bus()' rather than casting to 'int' pci_iounmap'2: Electric Boogaloo: try to make sense of it all Linux 5.15-rc2 Lucas Stach (8): drm/etnaviv: return context from etnaviv_iommu_context_get drm/etnaviv: put submit prev MMU context when it exists drm/etnaviv: stop abusing mmu_context as FE running marker drm/etnaviv: keep MMU context across runtime suspend/resume drm/etnaviv: exec and MMU state is lost when resetting the GPU drm/etnaviv: fix MMU context leak on GPU reset drm/etnaviv: reference MMU context when setting up hardware state drm/etnaviv: add missing MMU context put when reaping MMU mapping Lv Ruyi (1): arm64/kernel: remove duplicate include in process.c Maor Gottlieb (1): net/mlx5: Fix potential sleeping in atomic context Mark Bloch (1): net/mlx5: Lag, don't update lag if lag isn't supported Mark Brown (1): arm64/sve: Use correct size when reinitialising SVE state Masami Hiramatsu (1): tools/bootconfig: Define memblock_free_ptr() to fix build error Mauro Carvalho Chehab (2): dt-bindings: net: dsa: sja1105: update nxp,sja1105.yaml reference dt-bindings: arm: mediatek: mmsys: update mediatek,mmsys.yaml reference Meenakshikumar Somasundaram (1): drm/amd/display: Link training retry fix for abort case Michael Chan (2): bnxt_en: Fix error recovery regression bnxt_en: Clean up completion ring page arrays completely Michael Ellerman (1): powerpc/boot: Fix build failure since GCC 4.9 removal Michael Petlan (1): perf machine: Initialize srcline string member in add_location struct Michel Dänzer (1): drm/amdgpu: Drop inline from amdgpu_ras_eeprom_max_record_count Mike Rapoport (1): x86/mm: Fix kern_addr_valid() to cope with existing but not present entries Ming Lei (1): blk-mq: avoid to iterate over stale request Nathan Chancellor (6): tools: compiler-gcc.h: Guard error attribute use with __has_attribute drm/i915/selftests: Do not use import_obj uninitialized drm/i915/selftests: Always initialize err in igt_dmabuf_import_same_driver_lmem() drm/i915: Enable -Wsometimes-uninitialized x86/build: Do not add -falign flags unconditionally for clang kbuild: Add -Werror=ignored-optimization-argument to CLANG_FLAGS Nathan Rossi (1): net: phylink: Update SFP selected interface on advertising changes Nicholas Kazlauskas (2): drm/amd/display: Add NULL checks for vblank workqueue drm/amd/display: Fix white screen page fault for gpuvm Nicholas Piggin (4): powerpc/64s: system call scv tabort fix for corrupt irq soft-mask state selftests/powerpc: Add scv versions of the basic TM syscall tests powerpc/64s: system call rfscv workaround for TM bugs KVM: PPC: Book3S HV: Tolerate treclaim. in fake-suspend mode changing registers Nick Desaulniers (10): Documentation: raise minimum supported version of GCC to 5.1 compiler.h: drop fallback overflow checkers mm/ksm: remove old GCC 4.9+ check Kconfig.debug: drop GCC 5+ version check for DWARF5 riscv: remove Kconfig check for GCC version for ARCH_RV64I powerpc: remove GCC version check for UPD_CONSTR arm64: remove GCC version check for ARCH_SUPPORTS_INT128 Makefile: drop GCC < 5 -fno-var-tracking-assignments workaround compiler-gcc.h: drop checks for older GCC versions vmlinux.lds.h: remove old check for GCC 4.9 Nirmoy Das (2): drm/amdgpu: use IS_ERR for debugfs APIs drm/radeon: pass drm dev radeon_agp_head_init directly Paolo Abeni (2): vhost_net: fix OoB on sendmsg() failure. igc: fix tunnel offloading Parav Pandit (1): net/mlx5: Fix rdma aux device on devlink reload Paul Menzel (1): drm/amdgpu: Demote TMZ unsupported log message from warning to info Pavel Begunkov (2): io_uring: auto-removal for direct open/accept io_uring: move iopoll reissue into regular IO path Peter Zijlstra (2): locking/rwbase: Properly match set_and_save_state() to restore_state() locking/rwbase: Extract __rwbase_write_trylock() Qingqing Zhuo (1): drm/amd/display: Fix unstable HPCP compliance on Chrome Barcelo Ramji Jiyani (1): kbuild: Fix comment typo in scripts/Makefile.modpost Randy Dunlap (1): ptp: dp83640: don't define PAGE0 Ravi Bangoria (1): perf annotate: Fix fused instr logic for assembly functions Ruozhu Li (1): nvme-rdma: destroy cm id before destroy qp to avoid use after free Saeed Mahameed (1): net/mlx5: FWTrace, cancel work on alloc pd error flow Samuel Holland (1): dt-bindings: net: sun8i-emac: Add compatible for D1 Saravana Kannan (1): Revert "of: property: fw_devlink: Add support for "phy-handle" property" Shai Malin (1): qed: Handle management FW error Simon Ser (2): amd/display: downgrade validation failure log level amd/display: enable panel orientation quirks Sukadev Bhattiprolu (2): ibmvnic: check failover_pending in login response ibmvnic: check failover_pending in login response Thomas Hellström (1): drm/i915/gem: Fix the mman selftest Tong Zhang (1): net: macb: fix use after free on rmmod Tony Luck (1): x86/mce: Avoid infinite loop for copy from user recovery Vasily Averin (1): ipc: remove memcg accounting for sops objects in do_semtimedop() Vinay Belgaumkar (1): drm/i915: Get PM ref before accessing HW register Vitaly Kuznetsov (1): Drivers: hv: vmbus: Fix kernel crash upon unbinding a device from uio_hv_generic driver Vlad Buslov (1): net/mlx5: Bridge, fix uninitialized variable usage Vladimir Oltean (3): net: dsa: destroy the phylink instance on any error in dsa_slave_phy_setup Revert "net: phy: Uniform PHY driver access" net: dsa: flush switchdev workqueue before tearing down CPU/DSA ports Wei Liu (2): asm-generic/hyperv: provide cpumask_to_vpset_noself x86/hyperv: remove on-stack cpumask from hv_send_ipi_mask_allbutself Will Deacon (1): x86/uaccess: Fix 32-bit __get_user_asm_u64() when CC_HAS_ASM_GOTO_OUTPUT=y Xiang wangx (1): selftests: nci: replace unsigned int with int Xiaoguang Wang (1): io_uring: fix missing sigmask restore in io_cqring_wait() Xiyu Yang (1): net/l2tp: Fix reference count leak in l2tp_udp_recv_core Yajun Deng (1): Revert "ipv4: fix memory leaks in ip_cmsg_send() callers" Yanfei Xu (1): blkcg: fix memory leak in blk_iolatency_init Yonghong Song (1): bpf, mm: Fix lockdep warning triggered by stack_map_get_build_id_offset() Yufeng Mo (3): net: hns3: pad the short tunnel frame before sending to hardware net: hns3: change affinity_mask to numa node range net: hns3: disable mac in flr process Yunsheng Lin (1): net: hns3: add option to turn off page pool feature zhang kai (1): ipv6: delay fib6_sernum increase in fib6_add zhenggy (1): tcp: fix tp->undo_retrans accounting in tcp_sacktag_one() Íñigo Huguet (2): sfc: fallback for lack of xdp tx queues sfc: last resort fallback for lack of xdp tx queues ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Linux 5.15-rc2 2021-09-20 0:40 Linux 5.15-rc2 Linus Torvalds @ 2021-09-20 13:44 ` Guenter Roeck 2021-09-20 16:18 ` Linus Torvalds 0 siblings, 1 reply; 7+ messages in thread From: Guenter Roeck @ 2021-09-20 13:44 UTC (permalink / raw) To: Linus Torvalds; +Cc: Linux Kernel Mailing List On Sun, Sep 19, 2021 at 05:40:42PM -0700, Linus Torvalds wrote: [ ... ] > > Go test, and keep the reports coming, > Build results: total: 153 pass: 148 fail: 5 Failed builds: mips:allmodconfig parisc:allmodconfig sparc64:allnoconfig sparc64:tinyconfig xtensa:allmodconfig Qemu test results: total: 480 pass: 479 fail: 1 Failed tests: sparc64:sun4u:nodebug:smp:virtio-pci:net,i82559er:hd Details for build failures below. Several improvements since last week, but it looks like the alpha related pci_iounmap patches still need some tweaking (see error log at the very end). Guenter --- In file included from arch/mips/include/asm/sibyte/sb1250.h:28, from drivers/watchdog/sb_wdog.c:58: arch/mips/include/asm/sibyte/bcm1480_scd.h:261: error: "M_SPC_CFG_CLEAR" redefined In file included from arch/mips/include/asm/sibyte/sb1250.h:28, from drivers/watchdog/sb_wdog.c:58: arch/mips/include/asm/sibyte/bcm1480_scd.h:262: error: "M_SPC_CFG_ENABLE" redefined Affected builds: mips:allmodconfig Patch: https://lore.kernel.org/r/20210913073220.1159520-1-liu.yun@linux.dev Status: Waiting for pull request from Wim --- drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c: In function 'nvkm_control_mthd_pstate_info': drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c:60:35: error: overflow in conversion from 'int' to '__s8' {aka 'signed char'} changes value from '-251' to '5' [-Werror=overflow] 60 | args->v0.pwrsrc = -ENOSYS; Affected builds: parisc:allmodconfig Background: args->v0.pwrsrc is s8, -ENOSYS is -251 on parisc Patch: https://lore.kernel.org/lkml/20210908190817.1213486-1-linux@roeck-us.net/ Status: No response as of 9/20 --- drivers/scsi/ncr53c8xx.c:8000:26: error: 'retrieve_from_waiting_list' defined but not used Affected builds: parisc:allmodconfig Patch: https://lore.kernel.org/r/YTfS/LH5vCN6afDW@ls3530 Status: Applied to 5.15/scsi-fixes --- drivers/video/fbdev/omap2/omapfb/dss/dsi.c: In function 'dsi_dump_dsidev_irqs': drivers/video/fbdev/omap2/omapfb/dss/dsi.c:1623:1: error: the frame size of 1104 bytes is larger than 1024 bytes and many similar errors. Seen in xtensa:allmodconfig. Background: xtensa:allmodconfig enables KASAN which in turn increases stack size requirements significantly. Patch: https://lore.kernel.org/lkml/20210912025235.3514761-1-linux@roeck-us.net/ Status: Queued in https://www.ozlabs.org/~akpm/mmotm/ --- arch/sparc/lib/iomap.c:22:6: error: redefinition of 'pci_iounmap' 22 | void pci_iounmap(struct pci_dev *dev, void __iomem * addr) | ^~~~~~~~~~~ In file included from arch/sparc/include/asm/io_64.h:11, from arch/sparc/include/asm/io.h:5, from include/linux/io.h:13, from include/linux/pci.h:39, from arch/sparc/lib/iomap.c:5: include/asm-generic/pci_iomap.h:54:20: note: previous definition of 'pci_iounmap' was here 54 | static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) Affected builds: sparc64:allnoconfig, sparc64:tinyconfig ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Linux 5.15-rc2 2021-09-20 13:44 ` Guenter Roeck @ 2021-09-20 16:18 ` Linus Torvalds 2021-09-20 17:04 ` Linus Torvalds 0 siblings, 1 reply; 7+ messages in thread From: Linus Torvalds @ 2021-09-20 16:18 UTC (permalink / raw) To: Guenter Roeck Cc: Linux Kernel Mailing List, linux-sparc, David S. Miller, linux-arch On Mon, Sep 20, 2021 at 6:44 AM Guenter Roeck <linux@roeck-us.net> wrote: > > Details for build failures below. Several improvements since last week, > but it looks like the alpha related pci_iounmap patches still need some > tweaking (see error log at the very end). Bah. I thought I had tested sparc64, but I was wrong. Silly me, I had only tested the 32-bit case. That sparc64 thing is being particularly stupid: sparc64 uses GENERIC_PCI_IOMAP, but declares its own empty pci_iounmap() because it didn't use GENERIC_IOMAP that does this all right. And because it didn't use the generic iomap code, it's all actually entirely buggy, in that it seems to think that pci_iounmap() is about unmapping ports (like ioport_unmap) and thus a no-op. But no, pci_iounmap() is supposed to unmap anything that pci_iomap() mapped, which includes the actual MMIO range too. Basically, the whole idea of "pci_iomap()" is that you give it a PCI device and the index to the BAR in that device, and it maps that BAR - whether it is MMIO or PIO. And then you can use that __iomem pointer for ioread*() and friends (or you can use readl()/writel() if you know it was MMIO). You can give it a maximum length if you want, but by default it just maps the whole PCI BAR, so the default usage would just be void __iomem *map = pci_iomap(pdev, bar, 0); And then you do whatever IO using that 'map' base pointer, and once you're done you do "pci_iounmap()" on it all. And then the trick most cases use is that they know that the PIO case is just always a fixed map, so for PIO that "map/unmap" part os a no-op. But generally ONLY for the PIO case. And the sparc64 code seems to think it's only used for PIO, and makes pci_iounmap() a no-op in general. Which is all kinds of completely broken. This is the same bug that the broken inline function in <asm-generic/io.h> had, and that I added a big comment about in commit 316e8d79a095 ("pci_iounmap'2: Electric Boogaloo: try to make sense of it all"): + * This code is odd, and the ARCH_HAS/ARCH_WANTS #define logic comes + * from legacy <asm-generic/io.h> header file behavior. In particular, + * it would seem to make sense to do the iounmap(p) for the non-IO-space + * case here regardless, but that's not what the old header file code + * did. Probably incorrectly, but this is meant to be bug-for-bug + * compatible. but I intentionally didn't fix the bug in that commit, because I wanted to just try to keep the odd old logic as closely as possible. It looks like a big part of the "people do their own pci_iounmap()" thing is that they do it badly and with bugs. This was all meant to uncover and fix warnings, but it seems to be uncovering bigger issues. Of course, most of the time the "pci_iounmap()" only happens at driver unload time, so it's basically only a kernel virtual memory mapping leak, which may be why people didn't realize how buggy their own implementations were. What the normal GENERIC_IOMAP code does is: - it "fake maps" the PIO space at an invalid fixed virtual address Since we know that a PIO address on PCI is just a 16-bit number, this fake virtual window is small and easy to do: /* * We encode the physical PIO addresses (0-0xffff) into the * pointer by offsetting them with a constant (0x10000) and * assuming that all the low addresses are always PIO. That means * we can do some sanity checks on the low bits, and don't * need to just take things for granted. */ #define PIO_OFFSET 0x10000UL #define PIO_MASK 0x0ffffUL #define PIO_RESERVED 0x40000UL so the logic is basically that we can trivially test whether a "void __iomem *" pointer is a PIO pointer or not: if the pointer value is in that range of PIO_OFFSET..PIO_OFFSET+PIO_MASK range, it's PIO, otherwise it's mmio. - the MMIO space acts using all the normal ioremap() logic, and we can tell the end result apart from PIO with the above trivial thing. - the GENERIC_IOMAP code internally just has a IO_COND(adds, is_pio, is_mmio) helper macro, which sets "port" for the is_pio case, and "addr" for the is_mmio case, so you can do trivial things like this: unsigned int ioread8(const void __iomem *addr) { IO_COND(addr, return inb(port), return readb(addr)); return 0xff; } which does the "inb(port)" for the PIO case, and the "readb(addr)" for the MMIO case. - and lookie here what the GENERIC_IOMAP code for pci_iounmap() is: void pci_iounmap(struct pci_dev *dev, void __iomem * addr) { IO_COND(addr, /* nothing */, iounmap(addr)); } IOW, for the "is_pio" case it does nothing, and for the "is_mmio" case it does "iounmap()". So the GENERIC_IOMAP code is actually really simple and should just work for pretty much everybody. All it requires is that fake kernel virtual address range at PIO_OFFSET (you can override the default values if you want - maybe your architecture really wants to put MMIO in those virtual addresses, but I don't think there's a lot of reason to generally want to do it) But despite that, people think they should implement their own code, and then they clearly get it HORRIBLY WRONG. Anyway, this email ended up being a long explanation of what the code _should_ do, in the hope that some enterprising kernel developer decides "Oh, this sounds like an easy thing to fix". But you do need to be able to test the end result at least a tiny bit. Because I suspect that the real fix for sparc64 is to just get rid of its broken non-GENERIC_IOMAP code, and just do "select GENERIC_IOMAP" And I don't think sparc64 is the only architecture that should go "Oh, I should just use GENERIC_IOMAP instead of implementing it badly by hand". Anyone? Linus ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Linux 5.15-rc2 2021-09-20 16:18 ` Linus Torvalds @ 2021-09-20 17:04 ` Linus Torvalds 2021-09-20 18:03 ` Linus Torvalds 2021-09-20 19:14 ` John Paul Adrian Glaubitz 0 siblings, 2 replies; 7+ messages in thread From: Linus Torvalds @ 2021-09-20 17:04 UTC (permalink / raw) To: Guenter Roeck Cc: Linux Kernel Mailing List, linux-sparc, David S. Miller, linux-arch On Mon, Sep 20, 2021 at 9:18 AM Linus Torvalds <torvalds@linux-foundation.org> wrote: > > Anyway, this email ended up being a long explanation of what the code > _should_ do, in the hope that some enterprising kernel developer > decides "Oh, this sounds like an easy thing to fix". But you do need > to be able to test the end result at least a tiny bit. In the meantime, the build fix is trivial: make that broken sparc pci_iounmap() definition depend on CONFIG_PCI being set. But let me build a few more sparc configs (and this time do it properly for both 32-bit and 64-bit) before I actually commit it and push it out. Linus ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Linux 5.15-rc2 2021-09-20 17:04 ` Linus Torvalds @ 2021-09-20 18:03 ` Linus Torvalds 2021-09-20 19:14 ` John Paul Adrian Glaubitz 1 sibling, 0 replies; 7+ messages in thread From: Linus Torvalds @ 2021-09-20 18:03 UTC (permalink / raw) To: Guenter Roeck Cc: Linux Kernel Mailing List, linux-sparc, David S. Miller, linux-arch On Mon, Sep 20, 2021 at 10:04 AM Linus Torvalds <torvalds@linux-foundation.org> wrote: > > But let me build a few more sparc configs (and this time do it > properly for both 32-bit and 64-bit) before I actually commit it and > push it out. Actually, I think I _had_ tested sparc64 properly before, it's just that I had only done the bigger configurations that had CONFIG_PCI enabled and that didn't show the failure due to that. But I have now done the allnoconfig and tinyconfig builds that showed the problem, and verified that the trivial "depend on CONFIG_PCI" fixes things for me. Looks like the only remaining problem in your build configuration list that isn't queued up somewhere is that odd nouveau use of pwrsrc and the errno range thing. I'll apply it directly. I'm sure that other configs will have a lot of other cases, but it is good to see at least your set shrinking. Linus ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Linux 5.15-rc2 2021-09-20 17:04 ` Linus Torvalds 2021-09-20 18:03 ` Linus Torvalds @ 2021-09-20 19:14 ` John Paul Adrian Glaubitz 2021-09-20 20:11 ` Linus Torvalds 1 sibling, 1 reply; 7+ messages in thread From: John Paul Adrian Glaubitz @ 2021-09-20 19:14 UTC (permalink / raw) To: Linus Torvalds, Guenter Roeck Cc: Linux Kernel Mailing List, linux-sparc, David S. Miller, linux-arch Hi Linus! On 9/20/21 19:04, Linus Torvalds wrote: > On Mon, Sep 20, 2021 at 9:18 AM Linus Torvalds > <torvalds@linux-foundation.org> wrote: >> >> Anyway, this email ended up being a long explanation of what the code >> _should_ do, in the hope that some enterprising kernel developer >> decides "Oh, this sounds like an easy thing to fix". But you do need >> to be able to test the end result at least a tiny bit. > > In the meantime, the build fix is trivial: make that broken sparc > pci_iounmap() definition depend on CONFIG_PCI being set. > > But let me build a few more sparc configs (and this time do it > properly for both 32-bit and 64-bit) before I actually commit it and > push it out. If you want to get feedback whether the kernel actually boots, let me know. I could test boot on a SPARC T5 LDOM (SPARC VM logical domain). Adrian -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer - glaubitz@debian.org `. `' Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Linux 5.15-rc2 2021-09-20 19:14 ` John Paul Adrian Glaubitz @ 2021-09-20 20:11 ` Linus Torvalds 0 siblings, 0 replies; 7+ messages in thread From: Linus Torvalds @ 2021-09-20 20:11 UTC (permalink / raw) To: John Paul Adrian Glaubitz Cc: Guenter Roeck, Linux Kernel Mailing List, linux-sparc, David S. Miller, linux-arch On Mon, Sep 20, 2021 at 12:14 PM John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> wrote: > > If you want to get feedback whether the kernel actually boots, let me know. So having looked around more sparc64 actually looks to be ok as-is, because it doesn't do any ioremap at all, and the PIO accesses are done at physical address zero. Sparc uses a special IO memory address space and can basically map all of PCI that way, and it looks like the hardware does all the required special things for the PIO range at address 0-0xffff. So it turns out that the "missing iounmap()" is actually ok on sparc, because it's a no-op anyway - because the ioremap() was just a pointer cast with no actual remapping necessary. And the generic IOMAP thing does assume that PIO is special, in ways that sparc doesn't need. On x86, PIO is not remapped, but also uses different instructions, so it's not just pointer games that could be done at iomap/unmap case. (And on many other architectures you need to do different synchronization, even if you could perhaps otherwise make the PIO-vs-MMIO be only about the pointer mapping - so "writeb()" and "outb()" aren't just different in the addressing). End result: the only downside of sparc not using the generic iomap is likely that sparc will happily use a NULL __iomap pointer (error) and basically use it as a PIO access. But since other architectures like x86-64 would warn for that case (see 'bad_io_access()' in lib/iomap.c), even that isn't actually a big deal - any such bugs would have been found elsewhere. And having looked at this, I'm starting to suspect that sparc oddity is _why_ the fallback version in <asm-generic/io.h> was so broken. It did the right thing on sparc, but leaks iomap remappings almost anywhere else. But maybe sparc ended up being the only user of it? Linus ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-09-21 2:53 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-09-20 0:40 Linux 5.15-rc2 Linus Torvalds 2021-09-20 13:44 ` Guenter Roeck 2021-09-20 16:18 ` Linus Torvalds 2021-09-20 17:04 ` Linus Torvalds 2021-09-20 18:03 ` Linus Torvalds 2021-09-20 19:14 ` John Paul Adrian Glaubitz 2021-09-20 20:11 ` Linus Torvalds
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).