Some network selftests defined variable-sized types variable at the middle
of struct causing -Wgnu-variable-sized-type-not-at-end warning.
warning:
timestamping.c:285:18: warning: field 'cm' with variable sized type
'struct cmsghdr' not at the end of a struct or class is a GNU
extension [-Wgnu-variable-sized-type-not-at-end]
285 | struct cmsghdr cm;
| ^
ipsec.c:835:5: warning: field 'u' with variable sized type 'union
(unnamed union at ipsec.c:831:3)' not at the end of a struct or class
is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
835 | } u;
| ^
This patch move these field at the end of struct to fix these warnings.
Signed-off-by: Ankit Khushwaha <ankitkhushwaha.linux(a)gmail.com>
---
Changelog:
v2: https://lore.kernel.org/linux-kselftest/20251027050856.30270-1-ankitkhushwa…
- fixed typos in the commit msg.
---
tools/testing/selftests/net/ipsec.c | 2 +-
tools/testing/selftests/net/timestamping.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/net/ipsec.c b/tools/testing/selftests/net/ipsec.c
index 0ccf484b1d9d..36083c8f884f 100644
--- a/tools/testing/selftests/net/ipsec.c
+++ b/tools/testing/selftests/net/ipsec.c
@@ -828,12 +828,12 @@ static int xfrm_state_pack_algo(struct nlmsghdr *nh, size_t req_sz,
struct xfrm_desc *desc)
{
struct {
+ char buf[XFRM_ALGO_KEY_BUF_SIZE];
union {
struct xfrm_algo alg;
struct xfrm_algo_aead aead;
struct xfrm_algo_auth auth;
} u;
- char buf[XFRM_ALGO_KEY_BUF_SIZE];
} alg = {};
size_t alen, elen, clen, aelen;
unsigned short type;
diff --git a/tools/testing/selftests/net/timestamping.c b/tools/testing/selftests/net/timestamping.c
index 044bc0e9ed81..ad2be2143698 100644
--- a/tools/testing/selftests/net/timestamping.c
+++ b/tools/testing/selftests/net/timestamping.c
@@ -282,8 +282,8 @@ static void recvpacket(int sock, int recvmsg_flags,
struct iovec entry;
struct sockaddr_in from_addr;
struct {
- struct cmsghdr cm;
char control[512];
+ struct cmsghdr cm;
} control;
int res;
--
2.51.0
The following powerpc ppc6xx_defconfig build regressions noticed on the
Linux next-20251027 tag with gcc-14 and gcc-8.
* powerpc, build
- gcc-14-ppc6xx_defconfig
- gcc-8-ppc6xx_defconfig
First seen on next-20251027
Good: next-20251024
Bad: next-20251027
Regression Analysis:
- New regression? yes
- Reproducibility? yes
Build regression: next-20251027: backlight.c:59:39: error: implicit
declaration of function 'of_find_node_by_name'; did you mean
'bus_find_device_by_name'?
Build regression: next-20251027: include/linux/math.h:167:43: error:
first argument to '__builtin_choose_expr' not a constant
Build regression: next-20251027: via-pmu-backlight.c:22:20: error:
'FB_BACKLIGHT_LEVELS' undeclared here (not in a function)
Build regression: next-20251027: minmax.h:71:17: error: first argument
to '__builtin_choose_expr' not a constant
Build regression: next-20251027: compiler.h:168:17: error:
'__UNIQUE_ID_x__286' undeclared (first use in this function); did you
mean '__UNIQUE_ID_y__287'?
Reported-by: Linux Kernel Functional Testing <lkft(a)linaro.org>
## Build error
arch/powerpc/platforms/powermac/backlight.c: In function
'pmac_has_backlight_type':
arch/powerpc/platforms/powermac/backlight.c:59:39: error: implicit
declaration of function 'of_find_node_by_name'; did you mean
'bus_find_device_by_name'? [-Wimplicit-function-declaration]
59 | struct device_node* bk_node =
of_find_node_by_name(NULL, "backlight");
| ^~~~~~~~~~~~~~~~~~~~
| bus_find_device_by_name
arch/powerpc/platforms/powermac/backlight.c:59:39: error:
initialization of 'struct device_node *' from 'int' makes pointer from
integer without a cast [-Wint-conversion]
arch/powerpc/platforms/powermac/backlight.c:60:17: error: implicit
declaration of function 'of_property_match_string'
[-Wimplicit-function-declaration]
60 | int i = of_property_match_string(bk_node,
"backlight-control", type);
| ^~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/platforms/powermac/backlight.c:62:9: error: implicit
declaration of function 'of_node_put'
[-Wimplicit-function-declaration]
62 | of_node_put(bk_node);
| ^~~~~~~~~~~
drivers/macintosh/via-pmu-backlight.c:22:20: error:
'FB_BACKLIGHT_LEVELS' undeclared here (not in a function)
22 | static u8 bl_curve[FB_BACKLIGHT_LEVELS];
| ^~~~~~~~~~~~~~~~~~~
In file included from <command-line>:
drivers/macintosh/via-pmu-backlight.c: In function 'pmu_backlight_curve_lookup':
include/linux/compiler.h:168:17: error: '__UNIQUE_ID_x__286'
undeclared (first use in this function); did you mean
'__UNIQUE_ID_y__287'?
168 | __PASTE(__UNIQUE_ID_, \
| ^~~~~~~~~~~~
drivers/macintosh/via-pmu-backlight.c:45:23: note: in expansion of macro 'max'
45 | max = max((int)bl_curve[i], max);
| ^~~
include/linux/minmax.h:71:17: error: first argument to
'__builtin_choose_expr' not a constant
71 | (typeof(__builtin_choose_expr(sizeof(ux) > 4, 1LL,
1L)))(ux) >= 0)
| ^~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:577:23: note: in definition of macro
'__compiletime_assert'
577 | if (!(condition))
\
| ^~~~~~~~~
drivers/macintosh/via-pmu-backlight.c:45:23: note: in expansion of macro 'max'
45 | max = max((int)bl_curve[i], max);
| ^~~
include/linux/minmax.h:71:17: error: first argument to
'__builtin_choose_expr' not a constant
71 | (typeof(__builtin_choose_expr(sizeof(ux) > 4, 1LL,
1L)))(ux) >= 0)
| ^~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:577:23: note: in definition of macro
'__compiletime_assert'
577 | if (!(condition))
\
| ^~~~~~~~~
include/linux/minmax.h:112:25: note: in expansion of macro '__careful_cmp'
112 | #define max(x, y) __careful_cmp(max, x, y)
| ^~~~~~~~~~~~~
drivers/macintosh/via-pmu-backlight.c:45:23: note: in expansion of macro 'max'
45 | max = max((int)bl_curve[i], max);
| ^~~
In file included from include/linux/kernel.h:27,
from arch/powerpc/include/asm/page.h:11,
from arch/powerpc/include/asm/thread_info.h:13,
from include/linux/thread_info.h:60,
from arch/powerpc/include/asm/ptrace.h:342,
from drivers/macintosh/via-pmu-backlight.c:11:
include/linux/math.h:162:17: error: first argument to
'__builtin_choose_expr' not a constant
162 | __builtin_choose_expr(
\
| ^~~~~~~~~~~~~~~~~~~~~
drivers/macintosh/via-pmu-backlight.c: In function
'pmu_backlight_get_level_brightness':
drivers/macintosh/via-pmu-backlight.c:63:38: error: 'FB_BACKLIGHT_MAX'
undeclared (first use in this function); did you mean 'BACKLIGHT_RAW'?
63 | pmulevel = bl_curve[level] * FB_BACKLIGHT_MAX / MAX_PMU_LEVEL;
| ^~~~~~~~~~~~~~~~
| BACKLIGHT_RAW
drivers/macintosh/via-pmu-backlight.c:58:51: warning: parameter
'level' set but not used [-Wunused-but-set-parameter]
58 | static int pmu_backlight_get_level_brightness(int level)
| ~~~~^~~~~
drivers/macintosh/via-pmu-backlight.c: In function 'pmu_backlight_init':
drivers/macintosh/via-pmu-backlight.c:144:17: error: implicit
declaration of function 'of_machine_is_compatible'
[-Wimplicit-function-declaration]
144 | of_machine_is_compatible("AAPL,3400/2400") ||
| ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/macintosh/via-pmu-backlight.c: At top level:
drivers/macintosh/via-pmu-backlight.c:22:11: warning: 'bl_curve'
defined but not used [-Wunused-variable]
22 | static u8 bl_curve[FB_BACKLIGHT_LEVELS];
| ^~~~~~~~
make[5]: *** [scripts/Makefile.build:287:
drivers/macintosh/via-pmu-backlight.o] Error 1
make[5]: Target 'drivers/macintosh/' not remade because of errors.
## Source
* Kernel version: 6.18.0-rc2-next-20251027
* Git tree: https://kernel.googlesource.com/pub/scm/linux/kernel/git/next/linux-next.git
* Git describe: next-20251027
* Git commit: 8fec172c82c2b5f6f8e47ab837c1dc91ee3d1b87
* Architectures: powerpc
* Toolchains: gcc-14
* Kconfigs: defconfig
## Build
* Test log: https://storage.tuxsuite.com/public/linaro/lkft/builds/34dKrlb77LGOQQSoC8FH…
* Test details:
https://regressions.linaro.org/lkft/linux-next-master/next-20251027/build/g…
* Build plan: https://tuxapi.tuxsuite.com/v1/groups/linaro/projects/lkft/builds/34dKrlb77…
* Build link: https://storage.tuxsuite.com/public/linaro/lkft/builds/34dKrlb77LGOQQSoC8FH…
* Kernel config:
https://storage.tuxsuite.com/public/linaro/lkft/builds/34dKrlb77LGOQQSoC8FH…
--
Linaro LKFT
Hello,
IIUC this is the first independent patch series for guest_memfd's in-place
conversion series! Happy to finally bring this out on its own.
Previous versions of this feature, part of other series, are available at
[1][2][3].
Many prior discussions have led up to these main features of this series, and
these are the main points I'd like feedback on.
1. Having private/shared status stored in a maple tree (Thanks Michael for your
support of using maple trees over xarrays for performance! [4]).
2. Having a new guest_memfd ioctl (not a vm ioctl) that performs conversions.
3. Using ioctls/structs/input attribute similar to the existing vm ioctl
KVM_SET_MEMORY_ATTRIBUTES to perform conversions.
4. Storing requested attributes directly in the maple tree.
5. Using a KVM module-wide param to toggle between setting memory attributes via
vm and guest_memfd ioctls (making them mututally exclusive - a single loaded
KVM module can only do one of the two.)
6. Skipping LRU in guest_memfd folios - make guest_memfd folios not participate
in LRU to avoid LRU refcounts from interfering with conversions.
This series is based on kvm/next, followed by
+ v12 of NUMA mempolicy support patches [5]
+ 3 cleanup patches from Sean [6][7][8]
Everything is stitched together here for your convenience
https://github.com/googleprodkernel/linux-cc/commits/guest_memfd-inplace-co…
Thank you all for helping with this series!
If I missed out your comment from a previous series, it's not intentional!
Please do raise it again.
TODOs:
+ There might be an issue with memory failure handling because when guest_memfd
folios stop participating in LRU. From a preliminary analysis,
HWPoisonHandlable() is only true if PageLRU() is true. This needs further
investigation.
[1] https://lore.kernel.org/all/bd163de3118b626d1005aa88e71ef2fb72f0be0f.172600…
[2] https://lore.kernel.org/all/20250117163001.2326672-6-tabba@google.com/
[3] https://lore.kernel.org/all/b784326e9ccae6a08388f1bf39db70a2204bdc51.174726…
[4] https://lore.kernel.org/all/20250529054227.hh2f4jmyqf6igd3i@amd.com/
[5] https://lore.kernel.org/all/20251007221420.344669-1-seanjc@google.com/T/
[6] https://lore.kernel.org/all/20250924174255.2141847-1-seanjc@google.com/
[7] https://lore.kernel.org/all/20251007224515.374516-1-seanjc@google.com/
[8] https://lore.kernel.org/all/20251007223625.369939-1-seanjc@google.com/
Ackerley Tng (19):
KVM: guest_memfd: Update kvm_gmem_populate() to use gmem attributes
KVM: Introduce KVM_SET_MEMORY_ATTRIBUTES2
KVM: guest_memfd: Don't set FGP_ACCESSED when getting folios
KVM: guest_memfd: Skip LRU for guest_memfd folios
KVM: guest_memfd: Add support for KVM_SET_MEMORY_ATTRIBUTES
KVM: selftests: Update framework to use KVM_SET_MEMORY_ATTRIBUTES2
KVM: selftests: guest_memfd: Test basic single-page conversion flow
KVM: selftests: guest_memfd: Test conversion flow when INIT_SHARED
KVM: selftests: guest_memfd: Test indexing in guest_memfd
KVM: selftests: guest_memfd: Test conversion before allocation
KVM: selftests: guest_memfd: Convert with allocated folios in
different layouts
KVM: selftests: guest_memfd: Test precision of conversion
KVM: selftests: guest_memfd: Test that truncation does not change
shared/private status
KVM: selftests: guest_memfd: Test conversion with elevated page
refcount
KVM: selftests: Reset shared memory after hole-punching
KVM: selftests: Provide function to look up guest_memfd details from
gpa
KVM: selftests: Make TEST_EXPECT_SIGBUS thread-safe
KVM: selftests: Update private_mem_conversions_test to mmap()
guest_memfd
KVM: selftests: Add script to exercise private_mem_conversions_test
Sean Christopherson (18):
KVM: guest_memfd: Introduce per-gmem attributes, use to guard user
mappings
KVM: Rename KVM_GENERIC_MEMORY_ATTRIBUTES to KVM_VM_MEMORY_ATTRIBUTES
KVM: Enumerate support for PRIVATE memory iff kvm_arch_has_private_mem
is defined
KVM: Stub in ability to disable per-VM memory attribute tracking
KVM: guest_memfd: Wire up kvm_get_memory_attributes() to per-gmem
attributes
KVM: guest_memfd: Enable INIT_SHARED on guest_memfd for x86 Coco VMs
KVM: Move KVM_VM_MEMORY_ATTRIBUTES config definition to x86
KVM: Let userspace disable per-VM mem attributes, enable per-gmem
attributes
KVM: selftests: Create gmem fd before "regular" fd when adding memslot
KVM: selftests: Rename guest_memfd{,_offset} to gmem_{fd,offset}
KVM: selftests: Add support for mmap() on guest_memfd in core library
KVM: selftests: Add helpers for calling ioctls on guest_memfd
KVM: selftests: guest_memfd: Test that shared/private status is
consistent across processes
KVM: selftests: Add selftests global for guest memory attributes
capability
KVM: selftests: Provide common function to set memory attributes
KVM: selftests: Check fd/flags provided to mmap() when setting up
memslot
KVM: selftests: Update pre-fault test to work with per-guest_memfd
attributes
KVM: selftests: Update private memory exits test work with per-gmem
attributes
Documentation/virt/kvm/api.rst | 72 ++-
arch/x86/include/asm/kvm_host.h | 2 +-
arch/x86/kvm/Kconfig | 15 +-
arch/x86/kvm/mmu/mmu.c | 4 +-
arch/x86/kvm/x86.c | 13 +-
include/linux/kvm_host.h | 44 +-
include/trace/events/kvm.h | 4 +-
include/uapi/linux/kvm.h | 17 +
mm/filemap.c | 1 +
mm/memcontrol.c | 2 +
tools/testing/selftests/kvm/.gitignore | 1 +
tools/testing/selftests/kvm/Makefile.kvm | 1 +
.../kvm/guest_memfd_conversions_test.c | 498 ++++++++++++++++++
.../testing/selftests/kvm/include/kvm_util.h | 127 ++++-
.../testing/selftests/kvm/include/test_util.h | 29 +-
tools/testing/selftests/kvm/lib/kvm_util.c | 128 +++--
tools/testing/selftests/kvm/lib/test_util.c | 7 -
.../selftests/kvm/pre_fault_memory_test.c | 2 +-
.../kvm/x86/private_mem_conversions_test.c | 55 +-
.../kvm/x86/private_mem_conversions_test.py | 159 ++++++
.../kvm/x86/private_mem_kvm_exits_test.c | 36 +-
virt/kvm/Kconfig | 4 +-
virt/kvm/guest_memfd.c | 414 +++++++++++++--
virt/kvm/kvm_main.c | 104 +++-
24 files changed, 1554 insertions(+), 185 deletions(-)
create mode 100644 tools/testing/selftests/kvm/guest_memfd_conversions_test.c
create mode 100755 tools/testing/selftests/kvm/x86/private_mem_conversions_test.py
--
2.51.0.858.gf9c4a03a3a-goog
Fix compilation error in UPROBE_setup caused by pointer type mismatch
in ternary expression. The probed_uretprobe and probed_uprobe function
pointers have different type attributes (__attribute__((nocf_check))),
which causes the conditional operator to fail with:
seccomp_bpf.c:5175:74: error: pointer type mismatch in conditional
expression [-Wincompatible-pointer-types]
Cast both function pointers to 'const void *' to match the expected
parameter type of get_uprobe_offset(), resolving the type mismatch
while preserving the function selection logic.
Signed-off-by: Nirbhay Sharma <nirbhay.lkd(a)gmail.com>
---
tools/testing/selftests/seccomp/seccomp_bpf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 874f17763536..e13ffe18ef95 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -5172,7 +5172,8 @@ FIXTURE_SETUP(UPROBE)
ASSERT_GE(bit, 0);
}
- offset = get_uprobe_offset(variant->uretprobe ? probed_uretprobe : probed_uprobe);
+ offset = get_uprobe_offset(variant->uretprobe ?
+ (const void *)probed_uretprobe : (const void *)probed_uprobe);
ASSERT_GE(offset, 0);
if (variant->uretprobe)
--
2.48.1
Changelog:
v8:
Added review-bys and addressed comments from Mike Rapoport and
Pratyush Yadav.
Added "memblock: Unpreserve memory in case of error" to handle
rollback if preserve fails half way through.
This series refactors the KHO framework to better support in-kernel
users like the upcoming LUO. The current design, which relies on a
notifier chain and debugfs for control, is too restrictive for direct
programmatic use.
The core of this rework is the removal of the notifier chain in favor of
a direct registration API. This decouples clients from the shutdown-time
finalization sequence, allowing them to manage their preserved state
more flexibly and at any time.
In support of this new model, this series also:
- Exports kho_finalize() and kho_abort() for programmatic control.
- Makes the debugfs interface optional.
- Introduces APIs to unpreserve memory and fixes a bug in the abort
path where client state was being incorrectly discarded. Note that
this is an interim step, as a more comprehensive fix is planned as
part of the stateless KHO work [1].
- Moves all KHO code into a new kernel/liveupdate/ directory to
consolidate live update components.
[1] https://lore.kernel.org/all/20251020100306.2709352-1-jasonmiu@google.com
Mike Rapoport (Microsoft) (1):
kho: drop notifiers
Pasha Tatashin (7):
kho: allow to drive kho from within kernel
kho: make debugfs interface optional
kho: add interfaces to unpreserve folios and page ranges
kho: don't unpreserve memory during abort
liveupdate: kho: move to kernel/liveupdate
liveupdate: kho: move kho debugfs directory to liveupdate
memblock: Unpreserve memory in case of error
Documentation/core-api/kho/concepts.rst | 2 +-
MAINTAINERS | 3 +-
include/linux/kexec_handover.h | 53 +-
init/Kconfig | 2 +
kernel/Kconfig.kexec | 24 -
kernel/Makefile | 3 +-
kernel/kexec_handover_internal.h | 16 -
kernel/liveupdate/Kconfig | 39 ++
kernel/liveupdate/Makefile | 5 +
kernel/{ => liveupdate}/kexec_handover.c | 508 +++++++-----------
.../{ => liveupdate}/kexec_handover_debug.c | 0
kernel/liveupdate/kexec_handover_debugfs.c | 219 ++++++++
kernel/liveupdate/kexec_handover_internal.h | 56 ++
lib/test_kho.c | 33 +-
mm/memblock.c | 82 ++-
tools/testing/selftests/kho/init.c | 2 +-
tools/testing/selftests/kho/vmtest.sh | 1 +
17 files changed, 590 insertions(+), 458 deletions(-)
delete mode 100644 kernel/kexec_handover_internal.h
create mode 100644 kernel/liveupdate/Kconfig
create mode 100644 kernel/liveupdate/Makefile
rename kernel/{ => liveupdate}/kexec_handover.c (80%)
rename kernel/{ => liveupdate}/kexec_handover_debug.c (100%)
create mode 100644 kernel/liveupdate/kexec_handover_debugfs.c
create mode 100644 kernel/liveupdate/kexec_handover_internal.h
base-commit: 72fb0170ef1f45addf726319c52a0562b6913707
--
2.51.1.821.gb6fe4d2222-goog
This patch series suggests fixes for several corner cases in the RISC-V
vector ptrace implementation:
- init vector context with proper vlenb, to avoid reading zero vlenb
by an early attached debugger
- follow gdbserver expectations and return ENODATA instead of EINVAL
if vector extension is supported but not yet activated for the
traced process
- validate input vector csr registers in ptrace, to maintain an accurate
view of the tracee's vector context across multiple halt/resume
debug cycles
For detailed description see the appropriate commit messages. A new test
suite v_ptrace is added into the tools/testing/selftests/riscv/vector
to verify some of the vector ptrace functionality and corner cases.
Previous versions:
- v2: https://lore.kernel.org/linux-riscv/20250821173957.563472-1-geomatsi@gmail.…
- v1: https://lore.kernel.org/linux-riscv/20251007115840.2320557-1-geomatsi@gmail…
Changes in v3:
Address the review comments by Andy Chiu and rework the approach:
- drop forced vector context save entirely
- perform strict validation of vector csr regs in ptrace
Changes in v2:
- add thread_info flag to allow to force vector context save
- force vector context save after vector ptrace to ensure valid vector
context in the next ptrace operations
- force vector context save on the first context switch after vector
context init to get proper vlenb
---
Ilya Mamay (1):
riscv: ptrace: return ENODATA for inactive vector extension
Sergey Matyukevich (8):
selftests: riscv: test ptrace vector interface
selftests: riscv: verify initial vector state with ptrace
riscv: vector: init vector context with proper vlenb
riscv: csr: define vector registers elements
riscv: ptrace: validate input vector csr registers
selftests: riscv: verify ptrace rejects invalid vector csr inputs
selftests: riscv: verify ptrace accepts valid vector csr values
selftests: riscv: verify syscalls discard vector context
arch/riscv/include/asm/csr.h | 11 +
arch/riscv/kernel/ptrace.c | 72 +-
arch/riscv/kernel/vector.c | 12 +-
.../testing/selftests/riscv/vector/.gitignore | 1 +
tools/testing/selftests/riscv/vector/Makefile | 5 +-
.../testing/selftests/riscv/vector/v_ptrace.c | 737 ++++++++++++++++++
6 files changed, 830 insertions(+), 8 deletions(-)
create mode 100644 tools/testing/selftests/riscv/vector/v_ptrace.c
base-commit: 72761a7e31225971d0b29d9195e0ffa986b77867
--
2.51.0
From: Nai-Chen Cheng <bleach1827(a)gmail.com>
[ Upstream commit d3f7457da7b9527a06dbcbfaf666aa51ac2eeb53 ]
The selftests 'make clean' does not clean the net/lib because it only
processes $(TARGETS) and ignores $(INSTALL_DEP_TARGETS). This leaves
compiled objects in net/lib after cleaning, requiring manual cleanup.
Include $(INSTALL_DEP_TARGETS) in clean target to ensure net/lib
dependency is properly cleaned.
Signed-off-by: Nai-Chen Cheng <bleach1827(a)gmail.com>
Reviewed-by: Simon Horman <horms(a)kernel.org>
Tested-by: Simon Horman <horms(a)kernel.org> # build-tested
Acked-by: Shuah Khan <skhan(a)linuxfoundation.org>
Link: https://patch.msgid.link/20250910-selftests-makefile-clean-v1-1-29e7f496cd8…
Signed-off-by: Jakub Kicinski <kuba(a)kernel.org>
Signed-off-by: Sasha Levin <sashal(a)kernel.org>
---
LLM Generated explanations, may be completely bogus:
YES – updating `tools/testing/selftests/Makefile:319` to iterate over
`$(TARGETS) $(INSTALL_DEP_TARGETS)` brings the `clean` recipe in line
with the existing `all` and `install` loops
(`tools/testing/selftests/Makefile:211` and `:276`), so the implicit
net/lib helper that gets built for networking selftests is now removed
during `make clean`. This fixes a real annoyance where stale objects
remain under `net/lib/` after cleaning, forcing manual removal and
risking rebuild flakiness if headers or tooling change. The change is
tiny, selftests-only, and mirrors logic already exercised in other
targets, so regression risk is negligible. Just make sure the stable
branch you target already carries the dependency hook that introduced
`INSTALL_DEP_TARGETS` (commit b86761ff6374813cdf64ffd6b95ddd1813c435d8
or equivalent); older branches without that infrastructure don’t need
this patch. Natural follow-up: once backported, run `make -C
tools/testing/selftests clean` after building the net tests to confirm
the stale net/lib objects are cleared.
tools/testing/selftests/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 030da61dbff3a..a2d8e1093b005 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -314,7 +314,7 @@ gen_tar: install
@echo "Created ${TAR_PATH}"
clean:
- @for TARGET in $(TARGETS); do \
+ @for TARGET in $(TARGETS) $(INSTALL_DEP_TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
done;
--
2.51.0
The current implementation of the arp monitor builds a list of vlan-tags by
following the chain of net_devices above the bond. See bond_verify_device_path().
Unfortunately, with some configurations, this is not possible. One example is
when an ovs switch is configured above the bond.
This change extends the "arp_ip_target" parameter format to allow for a list of
vlan tags to be included for each arp target. This new list of tags is optional
and may be omitted to preserve the current format and process of discovering
vlans.
The new format for arp_ip_target is:
arp_ip_target ipv4-address[vlan-tag\...],...
For example:
arp_ip_target 10.0.0.1[10/20]
arp_ip_target 10.0.0.1[] (used to disable vlan discovery)
Changes since V13
Thanks for the help Paolo:
- Changed first argument of bond_option_arp_ip_target_add() to a const.
- Changed first argument of bond_arp_target_to_string to a const.
- Added compiler time check of size argument to: bond_arp_target_to_string(),
BUILD_BUG_ON(size != BOND_OPTION_STRING_MAX_SIZE);
- In bond_arp_send_all() I changed the condition for both the allocation and
the free calls to be the same to improve the clarity of the code.
- Removed extra tab in bond_fill_info().
- Updated update bond_get_size() to reflect the increased payload for the
arp_ip_target option.
- Corrected indentation and alignment in bond-arp-ip-target.sh.
Changes since V12
Fixed uninitialized variable in bond_option_arp_ip_targets_set() (patch 4)
causing a CI failure.
Changes since V11
No Change.
Changes since V10
Thanks Paolo:
- 1/7 Changed the layout of struct bond_arp_target to reduce size of the struct.
- 3/7 Fixed format 'size-num' -> 'size - num'
- 7/7 Updated selftest (bond-arp-ip-target.sh). Removed sleep 10 in check_failure_count().
Added call to tc to verify arp probes are reaching the target interface. Then I verify that
the Link Failure counts are not increasing over "time". Arp probes are sent every 100ms,
two missed probes will trigger a Link failure. A one second wait between checking counts
should be be more than sufficient. This speeds up the execution of the test.
Thanks Nikolay:
- 4/7 In bond_option_arp_ip_targets_clear() I changed the definition of empty_target to empty_target = {}.
- bond_validate_tags() now verifies input is a multiple of sizeof(struct bond_vlan_tag).
Updated VID validity check to use: !tags->vlan_id || tags->vlan_id >= VLAN_VID_MASK) as suggested.
- In bond_option_arp_ip_targets_set() removed the redundant length check of target.target_ip.
- Added kfree(target.tags) when bond_option_arp_ip_target_add() results in an error.
- Removed the caching of struct bond_vlan_tag returned by bond_verify_device_path(), Nikolay
pointed out that caching tags prevented the detection of VLAN configuration changes.
Added a kfree(tags) for tags allocated in bond_verify_device_path().
Jay, Nikolay and I had a discussion regarding locking when adding, deleting or changing vlan tags.
Jay pointed out that user supplied tags that are stashed in the bond configuration and can only be
changed via user space this can be done safely in an RCU manner as netlink always operates with RTNL
held. If user space provided tags and then replumbs things, it'll be on user space to update the tags
in a safe manor.
I was concerned about changing options on a configured bond, I found that attempting to change
a bonds configuration (using "ip set") will abort the attempt to make a change if the bond's state is
"UP" or has slaves configured. Therefor the configuration and operational side of a bond is separated.
I agree with Jay that the existing locking scheme is sufficient.
Change since V9
Fix kdoc build error.
Changes since V8:
Moved the #define BOND_MAX_VLAN_TAGS from patch 6 to patch 3.
Thanks Simon for catching the bisection break.
Changes since V7:
These changes should eliminate the CI failures I have been seeing.
1) patch 2, changed type of bond_opt_value.extra_len to size_t.
2) Patch 4, added bond_validate_tags() to validate the array of bond_vlan_tag provided by
the user.
Changes since V6:
1) I made a number of changes to fix the failure seen in the
kernel CI. I am still unable to reproduce the this failure, hopefully I
have fixed it. These change are in patch #4 to functions:
bond_option_arp_ip_targets_clear() and
bond_option_arp_ip_targets_set()
Changes since V5: Only the last 2 patches have changed since V5.
1) Fixed sparse warning in bond_fill_info().
2) Also in bond_fill_info() I resolved data.addr uninitialized when if condition is not met.
Thank you Simon for catching this. Note: The change is different that what I shared earlier.
3) Fixed shellcheck warnings in test script: Blocked source warning, Ignored specific unassigned
references and exported ALL_TESTS to resolve a reference warning.
Changes since V4:
1)Dropped changes to proc and sysfs APIs to bonding. These APIs
do not need to be updated to support new functionality. Netlink
and iproute2 have been updated to do the right thing, but the
other APIs are more or less frozen in the past.
2)Jakub reported a warning triggered in bond_info_seq_show() during
testing. I was unable to reproduce this warning or identify
it with code inspection. However, all my changes to bond_info_seq_show()
have been dropped as unnecessary (see above).
Hopefully this will resolve the issue.
3)Selftest script has been updated based on the results of shellcheck.
Two unresolved references that are not possible to resolve are all
that remain.
4)A patch was added updating bond_info_fill()
to support "ip -d show <bond-device>" command.
The inclusion of a list of vlan tags is optional. The new logic
preserves both forward and backward compatibility with the kernel
and iproute2 versions.
Changes since V3:
1) Moved the parsing of the extended arp_ip_target out of the kernel and into
userspace (ip command). A separate patch to iproute2 to follow shortly.
2) Split up the patch set to make review easier.
Please see iproute changes in a separate posting.
Thank you for your time and reviews.
Signed-off-by: David Wilder <wilder(a)us.ibm.com>
David Wilder (7):
bonding: Adding struct bond_arp_target
bonding: Adding extra_len field to struct bond_opt_value.
bonding: arp_ip_target helpers.
bonding: Processing extended arp_ip_target from user space.
bonding: Update to bond_arp_send_all() to use supplied vlan tags
bonding: Update for extended arp_ip_target format.
bonding: Selftest and documentation for the arp_ip_target parameter.
Documentation/networking/bonding.rst | 11 +
drivers/net/bonding/bond_main.c | 48 +++--
drivers/net/bonding/bond_netlink.c | 39 +++-
drivers/net/bonding/bond_options.c | 146 ++++++++++---
drivers/net/bonding/bond_procfs.c | 4 +-
drivers/net/bonding/bond_sysfs.c | 4 +-
include/net/bond_options.h | 29 ++-
include/net/bonding.h | 67 +++++-
.../selftests/drivers/net/bonding/Makefile | 1 +
.../drivers/net/bonding/bond-arp-ip-target.sh | 204 ++++++++++++++++++
10 files changed, 474 insertions(+), 79 deletions(-)
create mode 100755 tools/testing/selftests/drivers/net/bonding/bond-arp-ip-target.sh
--
2.50.1