summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2026-07-11pwm: th1520: remove unnecessary `deref`Gary Guo
`Deref` is automatic and should normally not be used directly. Also, `IoMem` is going to be implementing `Io` directly, so it will no longer to be implementing `Deref`. Reported-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://rust-for-linux.zulipchat.com/#narrow/channel/291565-Help/topic/.E2.9C.94.20Projection.20in.20dma.20bus.20address.20space/near/606672061 Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Gary Guo <gary@garyguo.net> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Link: https://patch.msgid.link/20260706-io_projection-v6-10-72cd5d055d54@garyguo.net Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-07-11rust: io: use view types instead of addresses for `Io`Gary Guo
Currently, `io_read` and `io_write` methods require the exact type of `Io` plus an address. This means that they need to be monomorphized for each different `Io` instance. This also means that multiple I/O implementors for the same I/O kind needs to duplicate implementation (e.g. `Mmio` and `MmioOwned`). Create a new `IoBackend` trait and define these operations on it instead. The operations are just going to receive a view type and operate on them. This has the additional advantage that the invariants can be moved from the trait (and guaranteed via `unsafe`) to type invariants on the canonical view types of the backends, so `io_read` and `io_write` can be safe. Note that a view type is needed; addresses are insufficient in this design, as they do not carry sufficient information. For example, `ConfigSpace` needs `&pci::Device` in addition to the address. `io_addr_assert` and `io_addr` are renamed to `io_view*` to reflect that they operate on views now, and make them standalone functions so they cannot be used by users to cast types outside io.rs. Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Gary Guo <gary@garyguo.net> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Link: https://patch.msgid.link/20260706-io_projection-v6-9-72cd5d055d54@garyguo.net Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-07-11rust: pci: io: make `ConfigSpace` a viewGary Guo
In order to support I/O projection, we are splitting I/O types into two categories: owned objects and views. Owned objects have a specific type that is related to setting up and tearing down, while views can have their type changed with I/O projection. Things like `IoMem` or `Bar` are owned objects, which requires setting up mapping and cleaning up on drop. On the other side, `ConfigSpace` is really just a view, as the resource is associated with the `pci::Device`. Remove the `ConfigSpaceKind` bound on `ConfigSpace` and make it a generic view. This means that `ConfigSpace` object now represents a subregion and therefore encodes offset (as address of pointers) and size (as metadata of pointers) itself. The full region case is still supported with offset 0 and size of `cfg_size`. Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Gary Guo <gary@garyguo.net> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Link: https://patch.msgid.link/20260706-io_projection-v6-8-72cd5d055d54@garyguo.net Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-07-11rust: io: implement `Mmio` as view typeGary Guo
Implement `Mmio` as view type and convert `RelaxedMmio` to view type as well. I/O implementations of `MmioOwned` are changed to delegate to the `Mmio` view type. All existing users of `MmioOwned` in the documentation which do not actually reflect the owning semantics is converted. Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Gary Guo <gary@garyguo.net> Tested-by: Daniel Almeida <daniel.almeida@collabora.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Link: https://patch.msgid.link/20260706-io_projection-v6-7-72cd5d055d54@garyguo.net Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-07-11rust: io: rename `Mmio` to `MmioOwned`Gary Guo
Most users would more commonly reach out to a view of `Mmio` rather than an owned instance of `Mmio`. Only implementor of `Io` like `Bar` or `IoMem` would need the owned version. Thus, rename `Mmio` to `MmioOwned` so that the name `Mmio` can be used for the view type instead. Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Gary Guo <gary@garyguo.net> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Suggested-by: Danilo Krummrich <dakr@kernel.org> Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/Generic.20I.2FO.20backends/near/571198078 Link: https://patch.msgid.link/20260706-io_projection-v6-6-72cd5d055d54@garyguo.net Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-07-11rust: io: generalize `MmioRaw` to pointer to arbitrary typeGary Guo
Conceptually, `MmioRaw` is just `__iomem *`, so it should work for any types. Update the existing use case where it represents a region of compile-time known minimum size and run-time known actual size to use the dynamic-sized type `Region<SIZE>` instead. Rename `maxsize` method to reflect that it is the actual size (not a bound) of the region. Implement `Clone` and `Copy` manually, which cannot be derived due to the generic parameter. The use of raw pointers also cause the `Send` and `Sync` auto trait implementation to be lost, so add them back by manual implementation. Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Gary Guo <gary@garyguo.net> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Suggested-by: Danilo Krummrich <dakr@kernel.org> Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/Generic.20I.2FO.20backends/near/571198078 Link: https://patch.msgid.link/20260706-io_projection-v6-5-72cd5d055d54@garyguo.net Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-07-11rust: io: implement `Io` on reference types insteadGary Guo
Currently, `Io` is implemented on owned I/O objects (e.g. `Bar`). This is going to change with I/O projections, as then `Io` needs to work both for owned objects and views of them. Views are themselves reference-like (however they obviously cannot be references, because they belong to a different address space). To facilitate the change, change `Io` to be implemented on reference types for the owned I/O objects, and make methods take `self` instead of `&self`. When I/O views are implemented, we can then naturally implement `Io` for these objects. Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Gary Guo <gary@garyguo.net> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Link: https://patch.msgid.link/20260706-io_projection-v6-4-72cd5d055d54@garyguo.net Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-07-11rust: io: restrict untyped IO access and `register!` to `Region`Gary Guo
Currently the `Io` trait exposes a bunch of untyped IO accesses, but if the `Io` region itself is typed, then it might be weird to have let io: Mmio<u32> = /* ... */; io.read8(1); while not unsound, it is surely strange. Thus, restrict the untyped methods and also the register macro to `Region` type only. Implement it by adding a generic type to `IoLoc` indicating allowed base types. This also paves the way to add typed register blocks in the future; for example, we could use this mechanism to block driver A's `register!()` generated macro from being used on driver B's MMIO. The same mechanism could be used for relative IO registers. These are future opportunities, and for now restrict everything to require `IoLoc<Region<SIZE>, _>`. Suggested-by: Alexandre Courbot <acourbot@nvidia.com> Link: https://lore.kernel.org/rust-for-linux/DHLB3RO3OSF5.2R7F27U99BKLN@nvidia.com/ Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Gary Guo <gary@garyguo.net> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Link: https://patch.msgid.link/20260706-io_projection-v6-3-72cd5d055d54@garyguo.net Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-07-11rust: io: add missing safety requirement in `IoCapable` methodsGary Guo
The current safety comment on `io_read`/`io_write` does not cover the topic about alignment. Add it so it can be relied on by implementor of `IoCapable`. Expand the check performed by `Io` by taking `self.addr()` into consideration when checking if `offset` is aligned. For the compile-time `io_addr_assert` check, check using the known minimum alignment of `Io::Target` and the accessed type. While at it, fix the alignment check to use `align_of` instead of `size_of`. The values match for all primitives (including u64, given that we do not provide u64 accessor on 32-bit platforms), but are not necessarily true for custom types. Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Gary Guo <gary@garyguo.net> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Link: https://patch.msgid.link/20260706-io_projection-v6-2-72cd5d055d54@garyguo.net Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-07-11rust: io: add dynamically-sized `Region` typeGary Guo
Currently many I/O related structs carry a `SIZE` parameter to denote the minimum size of the I/O region, while they also carry a field indicating the actual size. Proliferation of the pattern creates a lot of duplicated code, and makes it hard to create typed views of I/O. Introduce a `Region` type that carries the `SIZE` parameter. It is a wrapper of `[u8]`, which makes it dynamically sized with a metadata of `usize`. This way, pointers to `Region` naturally carry size information. This type is required to be 4-byte aligned. Expose the minimum size information via `MIN_SIZE` constant of the `KnownSize` trait. Similarly, expose the minimum alignment information via `KnownSize::MIN_ALIGN`. With these changes, it is possible to add an associated type to `Io` trait to represent the type of I/O region. For untyped regions, this is the newly added `Region` type. Remove `IoKnownSize` as it is no longer necessary. Use the same mechanism to indicate minimum size of PCI config spaces. Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Gary Guo <gary@garyguo.net> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Link: https://patch.msgid.link/20260706-io_projection-v6-1-72cd5d055d54@garyguo.net [ Add brief explanation on MIN_ALIGN. - Danilo ] Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-07-11dt-bindings: clock: Replace bouncing emailsKrzysztof Kozlowski
Replace permanently bouncing email addresses (550 5.1.1 Recipient address rejected) of Adam Skladowski, Chanho Park, Anusha Rao and Sireesh Kodali. There are no new messages from them via other email addresses, so drop them permanently. Add Alim Akhtar to Samsung ExynosAutov9 SoC clocks, because he looks at other Samsung clock hardware and drivers. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260623073050.36262-2-krzysztof.kozlowski@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-11clk: qcom: camcc-glymur: Add camera clock controller driverJagadeesh Kona
Add support for the camera clock controller for camera clients to be able to request for camcc clocks on Glymur platform. Reviewed-by: Taniya Das <taniya.das@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org> Signed-off-by: Jagadeesh Kona <jagadeesh.kona@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260624-glymur_camcc-v5-2-a321df74b1a1@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-11Merge branch '20260624-glymur_camcc-v5-1-a321df74b1a1@oss.qualcomm.com' into ↵Bjorn Andersson
clk-for-7.3 Merge Glymur camera clock controller binding through topic branch, to allow sharing constants with DeviceTree branches.
2026-07-11dt-bindings: clock: qcom: Add Glymur camera clock controllerJagadeesh Kona
Add device tree bindings for the camera clock controller on Qualcomm Glymur SoC. Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org> Signed-off-by: Jagadeesh Kona <jagadeesh.kona@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260624-glymur_camcc-v5-1-a321df74b1a1@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-11soc: qcom: Avoid SCM and SPM for cpuidle driversKrzysztof Kozlowski
QCOM_SCM and QCOM_SPM are user-selectable drivers, thus ARM_QCOM_SPM_CPUIDLE should rather avoid selecting them but instead depend to avoid any possible unmet dependencies. ARM_QCOM_SPM_CPUIDLE does use symbols from SCM and SPM, and since it cannot be built-in, the dependency must be as built-in. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260711-qcom-soc-kconfig-v2-4-4a907e064281@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-11soc: qcom: Make important drivers defaultKrzysztof Kozlowski
The drivers for Qualcomm SoC components are covering a basic or fundamental SoC blocks. Usually they are required for booting or to achieve basic expected functionality when running Linux. These drivers do not represent any sort of buses visible to the board designers/configurators, thus they should be always enabled, regardless how SoC is used in the final board. Kernel configuration should not ask users choice of drivers when that choice is obvious and known to the developers that answer should be 'yes' or 'module'. Switch most of the Qualcomm SoC drivers to a default 'yes' or 'module' for ARCH_QCOM, to match existing defconfig usage. This has no impact on arm64 defconfig, arm qcom_defconfig and arm multi_v7_defconfig. multi: +#define CONFIG_QCOM_PDR_HELPERS_MODULE 1 +#define CONFIG_QCOM_PBS_MODULE 1 +#define CONFIG_QCOM_AOSS_QMP 1 +#define CONFIG_QCOM_APR_MODULE 1 +#define CONFIG_QCOM_LLCC_MODULE 1 qcom: +#define CONFIG_QCOM_PDR_HELPERS_MODULE 1 +#define CONFIG_QCOM_PBS_MODULE 1 +#define CONFIG_QCOM_AOSS_QMP 1 +#define CONFIG_QCOM_APR_MODULE 1 +#define CONFIG_QCOM_SPM 1 +#define CONFIG_QCOM_LLCC_MODULE 1 The change will however enable by default all drivers for arm or arm64 COMPILE_TEST builds, whenever ARCH_QCOM is selected, which feels logical: if one selects ARCH_QCOM then probably by default wants to build test it entirely. Kernels with COMPILE_TEST are not supposed to be used for booting. Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260711-qcom-soc-kconfig-v2-3-4a907e064281@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-11soc: qcom: Restrict drivers per ARM/ARM64Krzysztof Kozlowski
There is no point to allow selecting core SoC drivers for Qualcomm ARMv7 SoCs when building ARM64 kernel, and vice versa. This makes kernel configuration more difficult as many do not remember the Qualcomm SoCs model names/numbers and their properties like architecture. No features should be lost because: 1. There won't be a single image for ARMv7 and ARMv8/9 SoCs. 2. Newer ARMv8/9 SoCs won't be running in arm32 emulation mode. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260711-qcom-soc-kconfig-v2-2-4a907e064281@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-11soc: qcom: Hide all drivers behind selectable menuKrzysztof Kozlowski
Switch from a simple menu to menuconfig, so all Qualcomm SoC drivers will be under one selectable option, allowing to disable them all which should make kernel configuration easier when preparing a non-Qualcomm kernel. This has few benefits (functional impact of this commit): 1. Allow compile testing of QCOM_OCMEM, which previously required ARCH_QCOM. 2. Hide behind ARCH_QCOM or COMPILE_TEST drivers specific to Qualcomm which should not be available to other kernel builds: QCOM_PMIC_PDCHARGER_ULOG, QCOM_PMIC_GLINK, QCOM_SPM and QCOM_PBS. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260711-qcom-soc-kconfig-v2-1-4a907e064281@oss.qualcomm.com Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2026-07-11drm/xe/pf: Handle migration descriptor using KLV helpersMichal Wajdeczko
As we plan to add more KLVs to the migration descriptor packet, to simplify such extensions and avoid coding errors, start using our KLV helpers for packet preparing and parsing. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com> Link: https://patch.msgid.link/20260707220816.677-14-michal.wajdeczko@intel.com
2026-07-11drm/xe/tests: Add migration packet testMichal Wajdeczko
One of our migration data packet (descriptor) is based on the KLV encoding. Add a simple descriptor initialization test, as we plan to use new KLV helper functions there. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com> Link: https://patch.msgid.link/20260708180921.2715-1-michal.wajdeczko@intel.com
2026-07-11drm/xe/tests: Add GuC KLV printer testMichal Wajdeczko
For completeness, add a simple test to exercise the KLV printer to make sure it doesn't crash at least. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com> Link: https://patch.msgid.link/20260711073608.7829-1-michal.wajdeczko@intel.com
2026-07-11drm/xe/tests: Add object encoding helper testMichal Wajdeczko
We will soon be encoding complex objects as KLVs using our helper function. Add few simple tests to make sure this helper function works as expected. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com> Link: https://patch.msgid.link/20260710195945.7316-1-michal.wajdeczko@intel.com
2026-07-11drm/xe/tests: Add string encoding helper testMichal Wajdeczko
Before we start using string to KLV encoding helper, add a simple test to make sure it works as expected. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com> #v1 Link: https://patch.msgid.link/20260708180755.2684-1-michal.wajdeczko@intel.com
2026-07-11drm/xe/tests: Add GuC KLV helpers basic testsMichal Wajdeczko
We will be making more extensive use of GuC KLV helpers. Add simple tests to ensure the helpers are working as expected. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com> Link: https://patch.msgid.link/20260707220816.677-9-michal.wajdeczko@intel.com
2026-07-11drm/xe/guc: Formalize Reserved KLVsMichal Wajdeczko
We have already started using few KLV keys from the 0xF000 range that, as we have agreed with the GuC team, will not be used in any GuC ABI actions. Add definitions for that reserved range and move our migration KLVs to new ABI header. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com> Link: https://patch.msgid.link/20260710172534.7201-1-michal.wajdeczko@intel.com
2026-07-11drm/xe/guc: Add KLV parsing helperMichal Wajdeczko
We have already introduced a helper to encode larger objects. Now add helper to parse the KLVs buffer. We will use it shortly. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com> Link: https://patch.msgid.link/20260707220816.677-7-michal.wajdeczko@intel.com
2026-07-11drm/xe/guc: Add object KLV encoding helperMichal Wajdeczko
We plan to encode larger objects as single KLV or set of KLVs. Add helper for that. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com> Link: https://patch.msgid.link/20260707220816.677-6-michal.wajdeczko@intel.com
2026-07-11drm/xe/guc: Add string KLV encoding helperMichal Wajdeczko
We also plan to encode a text data as KLV. Add helper for that too. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: Michał Winiarski <michal.winiarski@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com> Link: https://patch.msgid.link/20260707220816.677-5-michal.wajdeczko@intel.com
2026-07-11drm/xe/guc: Add basic KLV encoding helpersMichal Wajdeczko
We plan to encode more data as KLVs. Add helpers for that. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com> Link: https://patch.msgid.link/20260707220816.677-4-michal.wajdeczko@intel.com
2026-07-11drm/xe/guc: Prepare to print group KLVsMichal Wajdeczko
Some future KLVs will be encoded as a group of nested KLVs. Prepare our KLV printer function to handle such KLVs. List of known group keys will be updated later, for now just prepare it for testing. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com> Link: https://patch.msgid.link/20260707220816.677-3-michal.wajdeczko@intel.com
2026-07-11drm/xe/guc: Allow to print single KLVMichal Wajdeczko
We can decode and print all KLVs from the buffer, but it might be helpful also to allow printing just single already decoded KLV. Extract existing code into new function and make it public. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com> Link: https://patch.msgid.link/20260707220816.677-2-michal.wajdeczko@intel.com
2026-07-11dm thin metadata: fix superblock refcount leak on snapshot shadow failureGenjian Zhang
__reserve_metadata_snap() increments THIN_SUPERBLOCK_LOCATION in the metadata space map before shadowing it. When dm_tm_shadow_block() fails, a reference is leaked in the metadata space map. Fix by adding the missing dm_sm_dec_block(). Signed-off-by: Genjian Zhang <zhanggenjian@kylinos.cn> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Fixes: cc8394d86f04 ("dm thin: provide userspace access to pool metadata") Cc: stable@vger.kernel.org
2026-07-11objtool/rust: add one more `noreturn` Rust function for Rust 1.99.0Miguel Ojeda
Starting with Rust 1.99.0 (expected 2026-10-01), under `CONFIG_RUST_DEBUG_ASSERTIONS=y`, `objtool` may report: rust/kernel.o: warning: objtool: _R..._6kernel12module_param9set_paramaEB4_() falls through to next function _R..._6kernel12module_param9set_paramhEB4_() (and many others) due to calls to the `noreturn` symbol [1]: core::panicking::panic_null_reference_constructed Thus add the mangled one to the list so that `objtool` knows it is actually `noreturn`. See commit 56d680dd23c3 ("objtool/rust: list `noreturn` Rust functions") for more details. Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs). Cc: Josh Poimboeuf <jpoimboe@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Petr Pavlu <petr.pavlu@suse.com> Link: https://github.com/rust-lang/rust/pull/158796 [1] Reported-by: Alice Ryhl <aliceryhl@google.com> Closes: https://lore.kernel.org/rust-for-linux/alEBInX9gD1M5NAr@google.com/ Reviewed-by: Alice Ryhl <aliceryhl@google.com> Tested-by: Alice Ryhl <aliceryhl@google.com> Link: https://patch.msgid.link/20260710173252.191781-1-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-07-11rust: zerocopy: update to v0.8.54Miguel Ojeda
Update our vendored copy of `zerocopy` (and `zerocopy-derive`) to v0.8.54. It is a very small delta from v0.8.52, and most importantly it resolves the unexpected lack of inlining [1] which triggered a modpost error under `CONFIG_CC_OPTIMIZE_FOR_SIZE=y` reported by Alexandre using Gary's suggestion [2]: ERROR: modpost: "_RNvMNtCs5wX7wwEUCR9_8zerocopy6layoutNtB2_8SizeInfo24try_to_nonzero_elem_size" [drivers/gpu/nova-core.ko] undefined! ERROR: modpost: "_RNvNtCs5wX7wwEUCR9_8zerocopy4util18padding_needed_for" [drivers/gpu/nova-core.ko] undefined! It also resolves `most_traits` being unexpectedly documented [3] that I reported and adds a missing SPDX license identifier [4] that I requested to match the kernel version. The following script may be used to check for the remaining differences: for path in $(cd rust/zerocopy-derive/ && find . -type f ! -name README.md); do curl --silent --show-error --location \ https://github.com/google/zerocopy/raw/v0.8.54/zerocopy/zerocopy-derive/src/$path | git diff --no-index - rust/zerocopy-derive/$path && echo $path: OK done for path in $(cd rust/zerocopy/ && find . -type f ! -name README.md); do curl --silent --show-error --location \ https://github.com/google/zerocopy/raw/v0.8.54/zerocopy/$path | git diff --no-index - rust/zerocopy/$path && echo $path: OK done Cc: Joshua Liebow-Feeser <joshlf@google.com> Cc: Jack Wrenn <jswrenn@google.com> Reported-by: Alexandre Courbot <acourbot@nvidia.com> Closes: https://lore.kernel.org/rust-for-linux/20260708-zerocopy-export-v1-1-2bfc355853c6@nvidia.com/ [1] Suggested-by: Gary Guo <gary@garyguo.net> Link: https://lore.kernel.org/rust-for-linux/DJT6235B3DOV.222XR5O6VHG4M@garyguo.net/ [2] Link: https://github.com/google/zerocopy/issues/3466 [3] Link: https://github.com/google/zerocopy/issues/3457 [4] Reviewed-by: Alice Ryhl <aliceryhl@google.com> Tested-by: Alexandre Courbot <acourbot@nvidia.com> Reviewed-by: Gary Guo <gary@garyguo.net> Link: https://patch.msgid.link/20260709211311.142544-1-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-07-11rust: zerocopy: update to v0.8.52Miguel Ojeda
Update our vendored copy of `zerocopy` (and `zerocopy-derive`) to v0.8.52. Most SPDX identifiers have been added upstream at our request [1] (without parentheses -- supporting them is an issue on the kernel side, but it does already reduce our differences). The CSS one for `rustdoc` was added too [2], but will be picked up in a later version. For `zerocopy`, enable `--cfg no_fp_fmt_parse`, which was added at our request to avoid our local workaround [3]. This means one less difference, thus indicate so in our `README.md`. For `zerocopy-derive`, enable `--cfg zerocopy_unstable_linux`. This allows us to use `#[derive(zerocopy_derive::most_traits)]`, a new feature upstream added for us [4]. We noticed a minor doc render bug [5], which will be fixed for a future version too. The following script may be used to check for the remaining differences: for path in $(cd rust/zerocopy-derive/ && find . -type f ! -name README.md); do curl --silent --show-error --location \ https://github.com/google/zerocopy/raw/v0.8.52/zerocopy/zerocopy-derive/src/$path | git diff --no-index - rust/zerocopy-derive/$path && echo $path: OK done for path in $(cd rust/zerocopy/ && find . -type f ! -name README.md); do curl --silent --show-error --location \ https://github.com/google/zerocopy/raw/v0.8.52/zerocopy/$path | git diff --no-index - rust/zerocopy/$path && echo $path: OK done Cc: Joshua Liebow-Feeser <joshlf@google.com> Cc: Jack Wrenn <jswrenn@google.com> Link: https://github.com/google/zerocopy/issues/3428 [1] Link: https://github.com/google/zerocopy/issues/3457 [2] Link: https://github.com/google/zerocopy/issues/3426 [3] Link: https://github.com/google/zerocopy/pull/3416 [4] Link: https://github.com/google/zerocopy/issues/3466 [5] Acked-by: Nicolas Schier <n.schier@fritz.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Link: https://patch.msgid.link/20260625231919.692444-1-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-07-11net: openvswitch: reject oversized nested action attrsAsim Viladi Oglu Manizada
Open vSwitch stores generated flow actions as nlattrs, whose nla_len field is u16. Commit a1e64addf3ff ("net: openvswitch: remove misbehaving actions length check") allowed the total sw_flow_actions stream to grow beyond 64 KiB, which is valid, but also removed the last guard preventing a generated nested action attribute from exceeding U16_MAX. An oversized generated container can thus be closed with a truncated nla_len. A later dump or teardown then walks a structurally different stream than the one that was validated. In particular, an oversized nested CLONE/CT action may cause subsequent bytes in the generated stream to be interpreted as independent actions. Keep the larger total-action-stream behavior, but make nested action close reject generated containers that do not fit in nla_len, and return the error through all callers. For recursive SAMPLE, CLONE, DEC_TTL, and CHECK_PKT_LEN builders, trim resource-owning action-list tails in reverse construction order before discarding failed wrappers, so resources copied into the rejected tails are released before the wrappers are removed. Most failed outer wrappers are discarded by truncating actions_len after child resources have been released. CHECK_PKT_LEN also trims its parent after branch resources are gone. SET/TUNNEL close failures unwind their known tun_dst ownership directly, and SET_TO_MASKED has no external ownership and truncates on close failure. Fixes: a1e64addf3ff ("net: openvswitch: remove misbehaving actions length check") Cc: stable@vger.kernel.org Assisted-by: avom-custom-harness:gpt-5.5-qwen3.6-mod-mix Signed-off-by: Asim Viladi Oglu Manizada <manizada@pm.me> Reviewed-by: Eelco Chaudron <echaudro@redhat.com> Reviewed-by: Aaron Conole <aconole@redhat.com> Reviewed-by: Ilya Maximets <i.maximets@ovn.org> Link: https://patch.msgid.link/20260706094336.38639-1-manizada@pm.me Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-11net: ethernet: qualcomm: remove unneeded 'fast_io' parameter in regmap_configWolfram Sang
When using MMIO with regmap, fast_io is implied. No need to set it again. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Luo Jie <jie.luo@oss.qualcomm.com> Link: https://patch.msgid.link/20260705164208.2184-2-wsa+renesas@sang-engineering.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-11Merge branch 'net-support-per-netns-device-unregistration'Paolo Abeni
Kuniyuki Iwashima says: ==================== net: Support per-netns device unregistration The biggest blocker to per-netns RTNL is netdev unregistration. It starts within a single netns, but it can eventually involve multiple namespaces. There are three types of such cross-netns devices: 1. Paired devices (e.g., netkit, veth, vxcan) -> Unregistering one device also deletes its peer, which may reside in another netns. 2. Tunnel devices (e.g., bareudp, geneve, etc) -> Destroying a netns removes devices in another netns if their backend sockets reside in the dying netns 3. Stacked devices (e.g., ipvlan, macvlan, etc) -> Removing the lower device also removes multiple upper devices, each of which may reside in different namespaces. While the first two device types require at most two rtnl_net_lock()s, the stacked type has no upper limit. This makes it impossible to freeze all necessary namespaces in advance. This series introduces per-netns work, initially suggested at NetConf 2024, to delegate the unregistration of such cross-netns devices. https://netdev.bots.linux.dev/netconf/2024/kuniyu.pdf#page=62 The first half of the series wraps NETDEV_UNREGISTER (in core) with per-netns RTNL, adds a helper for per-netns device unregistration, and forces per-netns device unregistration in the core code when CONFIG_DEBUG_NET_SMALL_RTNL=y. The latter half picks out one from each type (veth, bareudp, ipvlan) and converts them to support per-netns device unregistration, although the operations are **still serialised under RTNL** for now. Please note that this series focuses only on the device unregistration paths. For example, there are ASSERT_RTNL() left in other paths, and Sashiko may point it out, but they are out of scope. This is just the first step, and we need more incremental changes to completely remove RTNL anyway. Now, we can see that unregistering a lower device (veth0 below) removes upper devices (ipvl2, ipvl3) in different namespaces using per-netns work with a different PID. The lower device (veth0) is freed only after all upper ipvlan devices have called netdev_put() in ipvlan_uninit(). # ip netns add ns1 # ip netns add ns2 # ip netns add ns3 # ip -n ns1 link add veth0 type veth peer veth1 # ip -n ns2 link add ipvl2 link veth0 link-netns ns1 type ipvlan mode l2 # ip -n ns3 link add ipvl3 link veth0 link-netns ns1 type ipvlan mode l2 # ip -n ns1 link del veth0 # bpftrace -e '#include <linux/netdevice.h> kprobe:ipvlan_uninit, kprobe:veth_dellink, kprobe:free_netdev { $dev = (struct net_device *)arg0; printf("PID: %d | DEV: %s%s\n", pid, $dev->name, kstack()); }' PID: 2010 | DEV: veth0 veth_dellink+5 rtnl_dellink+1213 rtnetlink_rcv_msg+1791 ... PID: 440 | DEV: ipvl2 ipvlan_uninit+5 unregister_netdevice_many_notify+7129 unregister_netdevice_many_net+1050 rtnl_net_work_func+136 ... PID: 440 | DEV: ipvl2 free_netdev+5 netdev_run_todo+4798 process_scheduled_works+2538 ... PID: 440 | DEV: ipvl3 ipvlan_uninit+5 unregister_netdevice_many_notify+7129 unregister_netdevice_many_net+1050 rtnl_net_work_func+136 process_scheduled_works+2538 ... PID: 2010 | DEV: veth0 free_netdev+5 netdev_run_todo+4798 rtnl_dellink+1507 rtnetlink_rcv_msg+1791 ... PID: 440 | DEV: ipvl3 free_netdev+5 netdev_run_todo+4798 process_scheduled_works+2538 ... v1: https://lore.kernel.org/netdev/20260701214334.266991-1-kuniyu@google.com/ ==================== Link: https://patch.msgid.link/20260703001009.1572444-1-kuniyu@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-11ipvlan: Support per-netns netdev unregistration.Kuniyuki Iwashima
When a lower device is unregistered, its upper ipvlan devices must also be unregistered. However, these upper devices may reside in different netns than the lower device. Let's use unregister_netdevice_queue_net() to support per-netns device unregistration for ipvlan. The new dying flag in struct ipvl_dev is used to avoid a race that ipvlan_link_delete() is called while its lower device is being removed in ipvlan_device_event(). If dying is true in ipvlan_link_delete(), the ipvlan device is already destructed but not yet unregistered. In this case, unregistration will be done in __rtnl_net_unlock() of the ->dellink() caller. Tested: 1. Create veth in ns1 and two ipvlan devices in ns2 and ns3. # ip netns add ns1 # ip netns add ns2 # ip netns add ns3 # ip -n ns1 link add veth0 type veth peer veth1 # ip -n ns2 link add ipvl2 link veth0 link-netns ns1 type ipvlan mode l2 # ip -n ns3 link add ipvl3 link veth0 link-netns ns1 type ipvlan mode l2 2. Run bpftrace to check that veth is unregistered first but wait ipvlan to be unregistered # bpftrace -e '#include <linux/netdevice.h> kprobe:ipvlan_uninit, kprobe:veth_dellink, kprobe:free_netdev { $dev = (struct net_device *)arg0; printf("PID: %d | DEV: %s%s\n", pid, $dev->name, kstack()); }' 3. Remove the lower veth0 in ns1. # ip -n ns1 link del veth0 We can see that veth0 is freed after unregistering ipvl2 and ipvl3 in per-netns work because ipvl_port holds refcount of veth0. PID: 2010 | DEV: veth0 veth_dellink+5 rtnl_dellink+1213 rtnetlink_rcv_msg+1791 ... PID: 440 | DEV: ipvl2 ipvlan_uninit+5 unregister_netdevice_many_notify+7129 unregister_netdevice_many_net+1050 rtnl_net_work_func+136 process_scheduled_works+2538 ... PID: 440 | DEV: ipvl2 free_netdev+5 netdev_run_todo+4798 process_scheduled_works+2538 ... PID: 440 | DEV: ipvl3 ipvlan_uninit+5 unregister_netdevice_many_notify+7129 unregister_netdevice_many_net+1050 rtnl_net_work_func+136 process_scheduled_works+2538 ... PID: 2010 | DEV: veth0 free_netdev+5 netdev_run_todo+4798 rtnl_dellink+1507 rtnetlink_rcv_msg+1791 ... PID: 440 | DEV: ipvl3 free_netdev+5 netdev_run_todo+4798 process_scheduled_works+2538 ... Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260703001009.1572444-15-kuniyu@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-11ipvlan: Protect ipvl_port.ipvlans with mutex.Kuniyuki Iwashima
struct ipvl_port is shared between a lower device and its upper ipvlan devices. All upper devices are linked to ipvl_port.ipvlans. Once RTNL is removed, the list can be modified concurrently from different netns due to device removal. Let's protect it with a per-port mutex. NETDEV_PRECHANGEUPPER and NETDEV_CHANGEUPPER are explicitly skipped to avoid deadlock for netdev_upper_dev_unlink() called from NETDEV_UNREGISTER. Note that __ipvtap_dellink_ptr is added for CONFIG_IPVLAN=y but CONFIG_TAP=m and CONFIG_IPVTAP=m. Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260703001009.1572444-14-kuniyu@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-11ipvlan: Synchronise ipvlan_init() and ipvlan_uninit() for the same lower dev.Kuniyuki Iwashima
ipvlan_uninit() for the last ipvlan device resets the lower device's rx_handler_data to NULL. Once RTNL is removed, ipvlan_init() would race with ipvlan_uninit(), which could leak a newly allocated ipvl_port. ipvlan_init() ipvlan_uninit() | |- if (refcount_dec_and_test(old_port)) ... |- ipvlan_port_destroy(old_port) | ' |- refcount_inc_not_zero(old_port) <-- fails |- ipvlan_port_create(phy_dev) . |- new_port = kzalloc() | |- phy_dev->rx_handler_data = new_port |- phy_dev->rx_handler_data = NULL ... `- kfree(old_port); Let's synchronise the two by holding the lower device's netdev_lock(). Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260703001009.1572444-13-kuniyu@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-11ipvlan: Convert ipvl_port.count to refcount_t.Kuniyuki Iwashima
struct ipvl_port is shared between a lower device and its upper ipvlan devices. While each upper device can always access ipvl_port safely via ipvlan_dev.port, the lower device relies on RTNL to access it via net_device.rx_handler_data. Once RTNL is removed, the lower device cannot read ipvl_port safely in ipvlan_device_event() because the port could be freed concurrently and net_device.rx_handler_data is set to NULL if the last ipvlan device in another namespace is unregistered. Let's convert ipvl_port.count to refcount_t and use RCU along with refcount_inc_not_zero() in ipvlan_device_event(). netdev_put() in ipvlan_port_destroy() is also moved down after cancel_work_sync(), which is the last user of port->dev. Note that ipvlan->port is now set in ipvlan_init() so that it can be used in ipvlan_uninit(), instead of ipvlan_port_get_rtnl() (rtnl_dereference()). Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260703001009.1572444-12-kuniyu@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-11bareudp: Support per-netns netdev unregistration.Kuniyuki Iwashima
bareudp_exit_rtnl_net() iterates bareudp devices whose sockets are in the dying netns and queues them for destruction. So the devices may reside in different netns. Let's use unregister_netdevice_queue_net() to support per-netns device unregistration. list_del() is changed to list_del_init() to avoid queueing the same device twice. Even after bareudp_exit_rtnl_net() queues a cross-netns bareudp device, bareudp_dellink() could be called concurrently for it (once RTNL is removed). In such a case, __rtnl_net_unlock() will perform the unregistration. Note that bareudp uses register_pernet_subsys() instead of _device(), so default_device_exit_batch() guarantees that the async per-netns works are flushed before ->exit(). Tested: 1. Create bareudp device across two netns. # ip netns add ns1 # ip netns add ns2 # ip -n ns1 link add bareudp0 link-netns ns2 type bareudp \ dstport 9292 ethertype ipv4 2. Run bpftrace to check that bareudp_uninit() is called between ->exit_rtnl() and ->exit(). # bpftrace -e '#include <linux/netdevice.h> kprobe:bareudp_uninit { $dev = (struct net_device *)arg0; printf("PID: %d | DEV: %s%s\n", pid, $dev->name, kstack()); } kprobe:bareudp_exit_rtnl_net, kprobe:bareudp_exit_net { printf("PID: %d%s\n", pid, kstack()); }' 3. Remove the netns where the bareudp socket resides # ip netns del ns2 Now, we can see bareudp0 is unregistered by per-netns work instead of cleanup_net() and it finishes before ->exit() to avoid WARN_ON_ONCE(!list_empty(&bn->bareudp_list)) there. PID: 576 bareudp_exit_rtnl_net+5 ops_undo_list+702 cleanup_net+1122 process_scheduled_works+2538 ... PID: 470 | DEV: bareudp0 bareudp_uninit+5 unregister_netdevice_many_notify+7129 unregister_netdevice_many_net+1050 rtnl_net_work_func+136 process_scheduled_works+2538 ... PID: 576 bareudp_exit_net+5 ops_undo_list+1064 cleanup_net+1122 process_scheduled_works+2538 Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260703001009.1572444-11-kuniyu@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-11bareudp: Protect bareudp_list with mutex.Kuniyuki Iwashima
struct bareudp_dev.net is the netns where the backend bareudp socket resides. struct bareudp_dev is linked to the bareudp_net.bareudp_list of the socket's netns. During netns dismantle or module unload, bareudp_exit_rtnl_net() iterates the list and queues devices for destruction regardless of the devices' netns. Thus, once RTNL is removed, the list can be modified concurrently from different netns due to device removal. Let's protect it with per-netns mutex. bareudp_newlink() is still protected by rtnl_net_lock()s, so acquiring bn->lock twice in bareudp_find_dev() and bareudp_configure() is not a problem. Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260703001009.1572444-10-kuniyu@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-11veth: Support per-netns device unregistration.Kuniyuki Iwashima
Currently, veth_dellink() unregisters both local and peer devices synchronously under RTNL. Once RTNL is removed, it can be called concurrently from different netns. Let's use xchg() and unregister_netdevice_queue_net() to support per-netns device unregistration. This way, each device is queued for destruction only once by the winner of the race. Note that the extra netdev_hold() ensures that @peer obtained by the first xchg() is not freed during the subsequent access to netdev_priv(peer). The 2nd xchg() overwrites @dev to balance the refcount. Tested: 1. Create two veth pairs (veth1-2, veth3-4) between two netns (ns1 & ns2). # ip netns add ns1 # ip netns add ns2 # ip -n ns1 link add veth1 type veth peer veth2 netns ns2 # ip -n ns1 link add veth3 type veth peer veth4 netns ns2 2. Run bpftrace to check if the same process does NOT unregister the paired veth devices # bpftrace -e '#include <linux/netdevice.h> kprobe:free_netdev { $dev = (struct net_device *)arg0; printf("PID: %d | DEV: %s%s\n", pid, $dev->name, kstack()); }' 3. Remove veth2 in ns2 and check bpftrace output # ip -n ns2 link del veth2 PID: 2194 | DEV: veth2 free_netdev+5 netdev_run_todo+4798 rtnl_dellink+1507 rtnetlink_rcv_msg+1791 ... PID: 448 | DEV: veth1 free_netdev+5 netdev_run_todo+4798 process_scheduled_works+2538 ... 4. Remove ns2 (thus veth4) and check bpftrace output # ip netns del ns2 PID: 571 | DEV: veth4 free_netdev+5 netdev_run_todo+4798 default_device_exit_batch+2271 ops_undo_list+993 cleanup_net+1122 process_scheduled_works+2538 ... PID: 441 | DEV: veth3 free_netdev+5 netdev_run_todo+4798 process_scheduled_works+2538 ... Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260703001009.1572444-9-kuniyu@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-11net: Call unregister_netdevice_many() per netns.Kuniyuki Iwashima
For per-netns device unregistration, the list passed to unregister_netdevice_many() must contain devices from a single netns only (once all callers are converted). Let's move collected devices in the following functions to net->dev_unreg_head and let __rtnl_net_unlock() pass them to unregister_netdevice_many(). * default_device_exit_batch() * ops_exit_rtnl_list() * __rtnl_kill_links() This allows incremental conversion of each driver to support per-netns device unregistration without affecting the normal kernel where CONFIG_DEBUG_NET_SMALL_RTNL is disabled. Note that this change unbatches synchronize_rcu() etc in unregister_netdevice_many(), but we can later split it into multiple stages to batch them again. Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260703001009.1572444-8-kuniyu@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-11net: Add per-netns netdev unregistration infra.Kuniyuki Iwashima
When we need to unregister a netdev in a different netns, we will delegate its unregistration to per-netns work. There are three types of such cross-netns devices: 1. Paired devices (e.g., netkit, veth, vxcan) -> Unregistering one device also deletes its peer, which may reside in another netns. 2. Tunnel devices (e.g., bareudp, geneve, etc) -> Destroying a netns removes devices in another netns if their backend sockets reside in the dying netns 3. Stacked devices (e.g., ipvlan, macvlan, etc) -> Removing the lower device also removes multiple upper devices, each of which may reside in different namespaces. In these cases, we will use unregister_netdevice_queue_net() to queue such potential cross-netns devices for destruction. Each driver must not call both unregister_netdevice_queue_net() and unregister_netdevice_queue() for the same device. See the subsequent veth/bareudp/ipvlan patches for how they avoid double queueing. unregister_netdevice_queue_net() takes net and dev. If dev resides in the net, it simply calls unregister_netdevice_queue(). If dev_net(dev) is different from the net, it enqueues the device to dev_net(dev)->dev_unreg_head and schedules the per-netns work. When __rtnl_net_unlock() is called from the per-netns work (or another thread already holding the lock), unregister_netdevice_many_net() collects the queued devices and calls unregister_netdevice_many() to perform the actual unregistration. During netns dismantle, rtnl_net_flush_workqueue() is called at the end of default_device_exit_batch() to ensure that cross-netns devices in the other alive netns are unregistered. Once RTNL is removed, a device could be moved to another netns while being queued to net->dev_unreg_head. __dev_change_net_namespace() handles this race by acquiring net->dev_unreg_lock of both the old and new netns after dev_set_net() and moving the device between their dev_unreg_head lists. Since dev_set_net() and unregister_netdevice_queue_net() are synchronised by netdev_lock(), the device is either queued to the old netns's dev_unreg_head and then moved, or queued directly to the new netns. Note that unregister_netdevice_move_net() does not need to call rtnl_net_queue_work() because __dev_change_net_namespace() is (supposed to be) called with rtnl_net_lock(). (Not all callers hold it yet, but the race does not happen until all callers are converted and RTNL is removed.) Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260703001009.1572444-7-kuniyu@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-11net: Hold __rtnl_net_lock() in netdev_wait_allrefs_any().Kuniyuki Iwashima
Currently, netdev_run_todo() processes pending devices from multiple namespaces in a batch. To expand the per-netns RTNL coverage for NETDEV_UNREGISTER, let's acquire __rtnl_net_lock() in netdev_wait_allrefs_any(). Note that netdev_run_todo() itself will need to be namespacified before RTNL is removed. Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260703001009.1572444-6-kuniyu@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-11net: Wrap default_device_exit_net() with __rtnl_net_lock().Kuniyuki Iwashima
default_device_exit_net() could call dev_change_net_namespace() to move devices from a dying netns to init_net. Let's hold the two netns __rtnl_net_lock() around it. Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260703001009.1572444-5-kuniyu@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-11rtnetlink: Add per-netns rtnl_work.Kuniyuki Iwashima
The biggest blocker to per-netns RTNL is netdev unregistration. It starts within a single netns (e.g., during a device lookup or netns dismantle), but it can eventually involve multiple namespaces, such as when upper ipvlan devices reside in different netns. This prevents us from acquiring multiple rtnl_net_lock()s beforehand. When we encounter such a cross-netns device, we must delegate the unregistration to the work of the netns where the device actually resides. Let's add per-netns rtnl_work to support the deferred netdev unregistration. Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Link: https://patch.msgid.link/20260703001009.1572444-4-kuniyu@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>