* RE: [PATCH net-next 0/9] net: dsa: netc: add bridge mode support
From: Wei Fang @ 2026-05-29 1:53 UTC (permalink / raw)
To: Wei Fang (OSS), Claudiu Manoil, Vladimir Oltean, Clark Wang,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, chleroy@kernel.org,
andrew@lunn.ch, olteanv@gmail.com
Cc: imx@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org
In-Reply-To: <20260527100217.794987-1-wei.fang@oss.nxp.com>
> This series adds bridge mode support to the NETC DSA switch driver,
> covering both VLAN-aware and VLAN-unaware operation.
>
> The NETC switch manages forwarding through a set of hardware tables
> accessed via NTMP: the FDB table (FDBT), VLAN filter table (VFT), egress
> treatment table (ETT), and egress count table (ECT). The series extends
> the NTMP layer with the operations required for bridging, then builds the
> DSA bridge callbacks on top.
>
> Since all switch ports share the VFT, so only one VLAN-aware bridge is
> supported.
>
> FDB aging is managed in software. A periodic delayed work sweeps the
> table using the hardware activity element mechanism, with a default aging
> time of 300 seconds matching the IEEE 802.1Q standard. Per-port entries
> are also flushed immediately on bridge leave and link-down events.
>
> Wei Fang (9):
> net: enetc: add interfaces to manage FDB entries
> net: enetc: add "Update" and "Delete" operations to VLAN filter table
> net: enetc: add interfaces to manage egress treatment table
> net: enetc: add "Update" operation to the egress count table
> net: dsa: netc: initialize the group bitmap of ETT and ECT
> net: enetc: add helpers to set/clear table bitmap
> net: dsa: netc: add VLAN filter table and egress treatment management
> net: dsa: netc: add bridge mode support
> net: dsa: netc: implement dynamic FDB entry aging
>
> drivers/net/dsa/netc/netc_main.c | 882
> +++++++++++++++++-
> drivers/net/dsa/netc/netc_switch.h | 34 +
> drivers/net/dsa/netc/netc_switch_hw.h | 6 +
> drivers/net/ethernet/freescale/enetc/ntmp.c | 431 +++++++++
> .../ethernet/freescale/enetc/ntmp_private.h | 14 +
> include/linux/fsl/ntmp.h | 60 ++
> 6 files changed, 1413 insertions(+), 14 deletions(-)
>
> --
> 2.34.1
Sashi reported some issues for this series:
[1] https://sashiko.dev/#/patchset/20260527100217.794987-1-wei.fang%40oss.nxp.com
[2] https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260527100217.794987-1-wei.fang%40oss.nxp.com
Some of them are indeed potential issues, I will fix them in next version.
Any other comments are welcome, thanks.
--
pw-bot: cr
^ permalink raw reply
* Re: [PATCH v6 3/6] selftest/bpf: Fixing powerpc JIT disassembly failure
From: bot+bpf-ci @ 2026-05-28 22:40 UTC (permalink / raw)
To: adubey, bpf
Cc: hbathini, linuxppc-dev, maddy, ast, andrii, daniel, shuah,
linux-kselftest, stable, adubey, ast, andrii, daniel, martin.lau,
eddyz87, yonghong.song, clm, ihor.solodrai
In-Reply-To: <20260529015855.364704-4-adubey@linux.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 3327 bytes --]
> diff --git a/tools/testing/selftests/bpf/jit_disasm_helpers.c b/tools/testing/selftests/bpf/jit_disasm_helpers.c
> index 364c557c5115..21e3e3e68c14 100644
> --- a/tools/testing/selftests/bpf/jit_disasm_helpers.c
> +++ b/tools/testing/selftests/bpf/jit_disasm_helpers.c
[ ... ]
> @@ -216,9 +218,28 @@ int get_jited_program_text(int fd, char *text, size_t text_sz)
> if (!ASSERT_OK(err, "bpf_prog_get_info_by_fd #2"))
> goto out;
>
> + /*
> + * last 8 bytes contains dummy_trampoline address in JIT
> + * output on 64-bit and last 4 bytes on 32-bit powerpc,
> + * which can't disassemble to a valid instruction.
> + */
> + triple = LLVMGetDefaultTargetTriple();
> + if (triple) {
> + if (strstr(triple, "powerpc")) {
> + if (IS_ENABLED(CONFIG_PPC64))
> + trunc_len = 8;
> + else
> + trunc_len = 4;
> + }
> + LLVMDisposeMessage(triple);
> + }
Can IS_ENABLED(CONFIG_PPC64) ever be true in this file?
This is a userspace selftest (tools/testing/selftests/bpf/jit_disasm_helpers.c).
IS_ENABLED here resolves to tools/include/linux/kconfig.h:
#define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option))
which ultimately tests __is_defined(CONFIG_PPC64), i.e. whether CONFIG_PPC64
is a defined preprocessor macro.
The kernel proper makes CONFIG_* macros visible by force-including
include/generated/autoconf.h via the build flags. The selftests/bpf build
does not do that: tools/testing/selftests/bpf/Makefile only adds an include
search path and -DHAVE_GENHDR, with no -include autoconf.h, and the include
chain for this file never pulls in generated/autoconf.h.
So CONFIG_PPC64 is undefined and IS_ENABLED(CONFIG_PPC64) is 0 on every
build, including ppc64/ppc64le. trunc_len then always becomes 4.
On 64-bit powerpc the JITed stub appends an 8-byte dummy trampoline address,
but only 4 bytes get truncated. The remaining 4 bytes are still handed to the
disassembler, which can decode them into a seemingly valid instruction, which
is the failure this change is meant to fix. Would a runtime check on the
triple, for example strstr(triple, "powerpc64"), be needed to distinguish
64-bit from 32-bit here, since the 8-vs-4 selection is otherwise compile-time?
> +
> for (pc = 0, i = 0; i < jited_funcs; ++i) {
> fprintf(text_out, "func #%d:\n", i);
> - disasm_one_func(text_out, image + pc, func_lens[i]);
> + /* Disabled JIT have zero func_lens, hence underflow */
> + __u32 disasm_len = func_lens[i] > trunc_len ?
> + func_lens[i] - trunc_len : 0;
> + disasm_one_func(text_out, image + pc, disasm_len);
> fprintf(text_out, "\n");
> pc += func_lens[i];
> }
The commit message describes fixing a powerpc JIT disassembly failure caused
by the dummy trampoline address emitted at the tail of the long_branch stub.
That trailing field was introduced by commit d243b62b7bd3 ("powerpc64/bpf:
Add support for bpf trampolines"). The two sibling commits in this series
both carry that Fixes: tag, but this selftest-side commit does not.
Should this include:
Fixes: d243b62b7bd3 ("powerpc64/bpf: Add support for bpf trampolines")
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/26605473656
^ permalink raw reply
* [PATCH v6 6/6] selftest/bpf: Add tailcall verifier selftest for powerpc64
From: adubey @ 2026-05-29 1:58 UTC (permalink / raw)
To: bpf
Cc: hbathini, linuxppc-dev, maddy, ast, andrii, daniel, shuah,
linux-kselftest, stable, Abhishek Dubey
In-Reply-To: <20260529015855.364704-1-adubey@linux.ibm.com>
From: Abhishek Dubey <adubey@linux.ibm.com>
Verifier testcase result for tailcalls:
# ./test_progs -t verifier_tailcall
#618/1 verifier_tailcall/invalid map type for tail call:OK
#618/2 verifier_tailcall/invalid map type for tail call @unpriv:OK
#618 verifier_tailcall:OK
#619/1 verifier_tailcall_jit/main:OK
#619 verifier_tailcall_jit:OK
Summary: 2/3 PASSED, 0 SKIPPED, 0 FAILED
Signed-off-by: Abhishek Dubey <adubey@linux.ibm.com>
---
.../bpf/progs/verifier_tailcall_jit.c | 69 +++++++++++++++++++
1 file changed, 69 insertions(+)
diff --git a/tools/testing/selftests/bpf/progs/verifier_tailcall_jit.c b/tools/testing/selftests/bpf/progs/verifier_tailcall_jit.c
index 8d60c634a114..b754b76420c9 100644
--- a/tools/testing/selftests/bpf/progs/verifier_tailcall_jit.c
+++ b/tools/testing/selftests/bpf/progs/verifier_tailcall_jit.c
@@ -90,6 +90,75 @@ __jited(" popq %rax")
__jited(" jmp {{.*}}") /* jump to tail call tgt */
__jited("L0: leave")
__jited(" {{(retq|jmp 0x)}}") /* return or jump to rethunk */
+__arch_powerpc64
+/* program entry for main(), regular function prologue */
+__jited(" nop")
+__jited("...") /* ld 2, 16(13) absent with CONFIG_PPC_KERNEL_PCREL */
+__jited(" li 9, 0")
+__jited(" std 9, -8(1)")
+__jited(" mflr 0")
+__jited(" std 0, 16(1)")
+__jited(" stdu 1, {{.*}}(1)")
+/* load address and call sub() via count register */
+__jited(" lis 12, {{.*}}")
+__jited(" sldi 12, 12, 32")
+__jited(" oris 12, 12, {{.*}}")
+__jited(" ori 12, 12, {{.*}}")
+__jited(" mtctr 12")
+__jited(" bctrl")
+__jited(" mr 8, 3")
+__jited(" li 8, 0")
+__jited(" addi 1, 1, {{.*}}")
+__jited(" ld 0, 16(1)")
+__jited(" mtlr 0")
+__jited(" mr 3, 8")
+__jited(" blr")
+__jited("...")
+__jited("func #1")
+/* subprogram entry for sub() */
+__jited(" nop")
+__jited("...") /* ld 2, 16(13) absent with CONFIG_PPC_KERNEL_PCREL */
+/* tail call prologue for subprogram */
+__jited(" ld 10, 0(1)")
+__jited(" ld 9, -8(10)")
+__jited(" cmpldi 9, 33")
+__jited(" bt {{.*}}, {{.*}}")
+__jited(" addi 9, 10, -8")
+__jited(" std 9, -8(1)")
+__jited(" lis {{.*}}, {{.*}}")
+__jited(" sldi {{.*}}, {{.*}}, 32")
+__jited(" oris {{.*}}, {{.*}}, {{.*}}")
+__jited(" ori {{.*}}, {{.*}}, {{.*}}")
+__jited(" li {{.*}}, 0")
+__jited(" lwz 9, {{.*}}({{.*}})")
+__jited(" slwi {{.*}}, {{.*}}, 0")
+__jited(" cmplw {{.*}}, 9")
+__jited(" bf 0, {{.*}}")
+/* bpf_tail_call implementation */
+__jited(" ld 9, -8(1)")
+__jited(" cmpldi 9, 33")
+__jited(" bf {{.*}}, {{.*}}")
+__jited(" ld 9, 0(9)")
+__jited(" cmpldi 9, 33")
+__jited(" bt {{.*}}, {{.*}}")
+__jited(" addi 9, 9, 1")
+__jited(" mulli 10, {{.*}}, 8")
+__jited(" add 10, 10, {{.*}}")
+__jited(" ld 10, {{.*}}(10)")
+__jited(" cmpldi 10, 0")
+__jited(" bt {{.*}}, {{.*}}")
+__jited(" ld 10, {{.*}}(10)")
+__jited(" addi 10, 10, {{.*}}") /* offset depends on CONFIG_PPC_KERNEL_PCREL */
+__jited(" mtctr 10")
+__jited(" ld 10, -8(1)")
+__jited(" cmpldi 10, 33")
+__jited(" bt {{.*}}, {{.*}}")
+__jited(" addi 10, 1, -8")
+__jited(" std 9, 0(10)")
+__jited(" bctr")
+__jited(" mr 3, 8")
+__jited(" blr")
+
SEC("tc")
__naked int main(void)
{
--
2.52.0
^ permalink raw reply related
* [PATCH v6 5/6] powerpc64/bpf: fix compare instruction emitted for tailcall
From: adubey @ 2026-05-29 1:58 UTC (permalink / raw)
To: bpf
Cc: hbathini, linuxppc-dev, maddy, ast, andrii, daniel, shuah,
linux-kselftest, stable, Abhishek Dubey, sashiko-bot
In-Reply-To: <20260529015855.364704-1-adubey@linux.ibm.com>
From: Abhishek Dubey <adubey@linux.ibm.com>
The tail_call_info field can contain either a scalar counter
value or a 64-bit pointer to the counter, using a 32-bit
compare (cmplwi) only checks the lower 32 bits, which can lead
to incorrect comparisions when location of counter is near 4GB
boundary. Use instruction cmpldi for accurate comparision in
all cases.
Reported-by: sashiko-bot@kernel.org
Closes: https://lore.kernel.org/bpf/20260517191450.85AE6C2BCB8@smtp.kernel.org/
Fixes: 2ed2d8f6fb38 ("powerpc64/bpf: Support tailcalls with subprogs")
Signed-off-by: Abhishek Dubey <adubey@linux.ibm.com>
---
arch/powerpc/net/bpf_jit_comp.c | 2 +-
arch/powerpc/net/bpf_jit_comp64.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 9885a68f64f4..0844024845ae 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -762,7 +762,7 @@ static void bpf_trampoline_setup_tail_call_info(u32 *image, struct codegen_conte
* Setting the tail_call_info in trampoline's frame
* depending on if previous frame had value or reference.
*/
- EMIT(PPC_RAW_CMPLWI(_R3, MAX_TAIL_CALL_CNT));
+ EMIT(PPC_RAW_CMPLDI(_R3, MAX_TAIL_CALL_CNT));
PPC_BCC_CONST_SHORT(COND_GT, 8);
EMIT(PPC_RAW_ADDI(_R3, _R4, -BPF_PPC_TAILCALL));
diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
index 885dc8cf55a2..74fce3cf6c5e 100644
--- a/arch/powerpc/net/bpf_jit_comp64.c
+++ b/arch/powerpc/net/bpf_jit_comp64.c
@@ -276,7 +276,7 @@ void bpf_jit_build_prologue(u32 *image, struct codegen_context *ctx)
*/
EMIT(PPC_RAW_LD(bpf_to_ppc(TMP_REG_2), _R1, 0));
EMIT(PPC_RAW_LD(bpf_to_ppc(TMP_REG_1), bpf_to_ppc(TMP_REG_2), -(BPF_PPC_TAILCALL)));
- EMIT(PPC_RAW_CMPLWI(bpf_to_ppc(TMP_REG_1), MAX_TAIL_CALL_CNT));
+ EMIT(PPC_RAW_CMPLDI(bpf_to_ppc(TMP_REG_1), MAX_TAIL_CALL_CNT));
PPC_BCC_CONST_SHORT(COND_GT, 8);
EMIT(PPC_RAW_ADDI(bpf_to_ppc(TMP_REG_1), bpf_to_ppc(TMP_REG_2),
-(BPF_PPC_TAILCALL)));
@@ -651,7 +651,7 @@ static int bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 o
PPC_BCC_SHORT(COND_GE, out);
EMIT(PPC_RAW_LD(bpf_to_ppc(TMP_REG_1), _R1, bpf_jit_stack_tailcallinfo_offset(ctx)));
- EMIT(PPC_RAW_CMPLWI(bpf_to_ppc(TMP_REG_1), MAX_TAIL_CALL_CNT));
+ EMIT(PPC_RAW_CMPLDI(bpf_to_ppc(TMP_REG_1), MAX_TAIL_CALL_CNT));
PPC_BCC_CONST_SHORT(COND_LE, 8);
/* dereference TMP_REG_1 */
@@ -661,7 +661,7 @@ static int bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 o
* if (tail_call_info == MAX_TAIL_CALL_CNT)
* goto out;
*/
- EMIT(PPC_RAW_CMPLWI(bpf_to_ppc(TMP_REG_1), MAX_TAIL_CALL_CNT));
+ EMIT(PPC_RAW_CMPLDI(bpf_to_ppc(TMP_REG_1), MAX_TAIL_CALL_CNT));
PPC_BCC_SHORT(COND_EQ, out);
/*
@@ -696,7 +696,7 @@ static int bpf_jit_emit_tail_call(u32 *image, struct codegen_context *ctx, u32 o
* tail_call_info.
*/
EMIT(PPC_RAW_LD(bpf_to_ppc(TMP_REG_2), _R1, bpf_jit_stack_tailcallinfo_offset(ctx)));
- EMIT(PPC_RAW_CMPLWI(bpf_to_ppc(TMP_REG_2), MAX_TAIL_CALL_CNT));
+ EMIT(PPC_RAW_CMPLDI(bpf_to_ppc(TMP_REG_2), MAX_TAIL_CALL_CNT));
PPC_BCC_CONST_SHORT(COND_GT, 8);
/* First get address of tail_call_info */
--
2.52.0
^ permalink raw reply related
* [PATCH v6 4/6] selftest/bpf: Enable verifier selftest for powerpc64
From: adubey @ 2026-05-29 1:58 UTC (permalink / raw)
To: bpf
Cc: hbathini, linuxppc-dev, maddy, ast, andrii, daniel, shuah,
linux-kselftest, stable, Abhishek Dubey
In-Reply-To: <20260529015855.364704-1-adubey@linux.ibm.com>
From: Abhishek Dubey <adubey@linux.ibm.com>
This patch enables arch specifier "__powerpc64" in verifier
selftest for ppc64. Power 32-bit would require separate
handling. Changes tested for 64-bit only.
Signed-off-by: Abhishek Dubey <adubey@linux.ibm.com>
---
tools/testing/selftests/bpf/progs/bpf_misc.h | 1 +
tools/testing/selftests/bpf/test_loader.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/tools/testing/selftests/bpf/progs/bpf_misc.h b/tools/testing/selftests/bpf/progs/bpf_misc.h
index 9eeb5b0b63d6..cdc2a3de3054 100644
--- a/tools/testing/selftests/bpf/progs/bpf_misc.h
+++ b/tools/testing/selftests/bpf/progs/bpf_misc.h
@@ -158,6 +158,7 @@
#define __arch_arm64 __arch("ARM64")
#define __arch_riscv64 __arch("RISCV64")
#define __arch_s390x __arch("s390x")
+#define __arch_powerpc64 __arch("POWERPC64")
#define __caps_unpriv(caps) __test_tag("test_caps_unpriv=" EXPAND_QUOTE(caps))
#define __load_if_JITed() __test_tag("load_mode=jited")
#define __load_if_no_JITed() __test_tag("load_mode=no_jited")
diff --git a/tools/testing/selftests/bpf/test_loader.c b/tools/testing/selftests/bpf/test_loader.c
index abdb9e6e3713..d5589355ed9e 100644
--- a/tools/testing/selftests/bpf/test_loader.c
+++ b/tools/testing/selftests/bpf/test_loader.c
@@ -377,6 +377,7 @@ enum arch {
ARCH_ARM64 = 0x4,
ARCH_RISCV64 = 0x8,
ARCH_S390X = 0x10,
+ ARCH_POWERPC64 = 0x20,
};
static int get_current_arch(void)
@@ -389,6 +390,8 @@ static int get_current_arch(void)
return ARCH_RISCV64;
#elif defined(__s390x__)
return ARCH_S390X;
+#elif defined(__powerpc64__)
+ return ARCH_POWERPC64;
#endif
return ARCH_UNKNOWN;
}
@@ -580,6 +583,8 @@ static int parse_test_spec(struct test_loader *tester,
arch = ARCH_RISCV64;
} else if (strcmp(val, "s390x") == 0) {
arch = ARCH_S390X;
+ } else if (strcmp(val, "POWERPC64") == 0) {
+ arch = ARCH_POWERPC64;
} else {
PRINT_FAIL("bad arch spec: '%s'\n", val);
err = -EINVAL;
--
2.52.0
^ permalink raw reply related
* [PATCH v6 3/6] selftest/bpf: Fixing powerpc JIT disassembly failure
From: adubey @ 2026-05-29 1:58 UTC (permalink / raw)
To: bpf
Cc: hbathini, linuxppc-dev, maddy, ast, andrii, daniel, shuah,
linux-kselftest, stable, Abhishek Dubey
In-Reply-To: <20260529015855.364704-1-adubey@linux.ibm.com>
From: Abhishek Dubey <adubey@linux.ibm.com>
Ensure that the trampoline stubs JITed at the tail of the
epilogue do not expose the dummy trampoline address stored
in the last 8 bytes(64-bit) and last 4 bytes(32-bit)
to the disassembly flow. Prevent the disassembler from
ingesting this memory address, as it may occasionally decode
into a seemingly valid but incorrect instruction. Fix this
issue by truncating the last 8/4 bytes from JITed buffers
before supplying them for disassembly.
Signed-off-by: Abhishek Dubey <adubey@linux.ibm.com>
---
.../selftests/bpf/jit_disasm_helpers.c | 23 ++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/jit_disasm_helpers.c b/tools/testing/selftests/bpf/jit_disasm_helpers.c
index 364c557c5115..a6d10cf456a4 100644
--- a/tools/testing/selftests/bpf/jit_disasm_helpers.c
+++ b/tools/testing/selftests/bpf/jit_disasm_helpers.c
@@ -170,9 +170,11 @@ int get_jited_program_text(int fd, char *text, size_t text_sz)
struct bpf_prog_info info = {};
__u32 info_len = sizeof(info);
__u32 jited_funcs, len, pc;
+ __u32 trunc_len = 0;
__u32 *func_lens = NULL;
FILE *text_out = NULL;
uint8_t *image = NULL;
+ char *triple = NULL;
int i, err = 0;
if (!llvm_initialized) {
@@ -216,9 +218,28 @@ int get_jited_program_text(int fd, char *text, size_t text_sz)
if (!ASSERT_OK(err, "bpf_prog_get_info_by_fd #2"))
goto out;
+ /*
+ * last 8 bytes contains dummy_trampoline address in JIT
+ * output on 64-bit and last 4 bytes on 32-bit powerpc,
+ * which can't disassemble to a valid instruction.
+ */
+ triple = LLVMGetDefaultTargetTriple();
+ if (triple) {
+ if (strstr(triple, "powerpc")) {
+ if (IS_ENABLED(CONFIG_PPC64))
+ trunc_len = 8;
+ else
+ trunc_len = 4;
+ }
+ LLVMDisposeMessage(triple);
+ }
+
for (pc = 0, i = 0; i < jited_funcs; ++i) {
fprintf(text_out, "func #%d:\n", i);
- disasm_one_func(text_out, image + pc, func_lens[i]);
+ /* Disabled JIT have zero func_lens, hence underflow */
+ __u32 disasm_len = func_lens[i] > trunc_len ?
+ func_lens[i] - trunc_len : 0;
+ disasm_one_func(text_out, image + pc, disasm_len);
fprintf(text_out, "\n");
pc += func_lens[i];
}
--
2.52.0
^ permalink raw reply related
* [PATCH v6 2/6] powerpc/bpf: Move out dummy_tramp_addr after Long branch stub
From: adubey @ 2026-05-29 1:58 UTC (permalink / raw)
To: bpf
Cc: hbathini, linuxppc-dev, maddy, ast, andrii, daniel, shuah,
linux-kselftest, stable, Abhishek Dubey, bot+bpf-ci
In-Reply-To: <20260529015855.364704-1-adubey@linux.ibm.com>
From: Abhishek Dubey <adubey@linux.ibm.com>
Move the long branch address field to the bottom of the long
branch stub. This allows uninterrupted disassembly until the
last 8 bytes. The last bytes exclusion is logically necessary to
prevent disassembly failure, otherwise the actual program layout
is never altered. Hence no effect on overall program size.
Also, align dummy_tramp_addr field with 8-byte boundary.
Following is disassembler output for test program with moved down
dummy_tramp_addr field:
.....
.....
pc:68 left:44 a6 03 08 7c : mtlr 0
pc:72 left:40 bc ff ff 4b : b .-68
pc:76 left:36 a6 02 68 7d : mflr 11
pc:80 left:32 05 00 9f 42 : bcl 20, 31, .+4
pc:84 left:28 a6 02 88 7d : mflr 12
pc:88 left:24 14 00 8c e9 : ld 12, 20(12)
pc:92 left:20 a6 03 89 7d : mtctr 12
pc:96 left:16 a6 03 68 7d : mtlr 11
pc:100 left:12 20 04 80 4e : bctr
pc:104 left:8 c0 34 1d 00 :
Failure log:
Can't disasm instruction at offset 104: c0 34 1d 00 00 00 00 c0
Disassembly logic can truncate at 104, ignoring last 8 bytes.
Update the dummy_tramp_addr field offset calculation from the end
of the program to reflect its new location, for bpf_arch_text_poke()
to update the actual trampoline's address in this field.
All BPF trampoline selftests continue to pass with this patch applied.
Reported-by: bot+bpf-ci@kernel.org
Fixes: d243b62b7bd3 ("powerpc64/bpf: Add support for bpf trampolines")
Cc: stable@vger.kernel.org
Signed-off-by: Abhishek Dubey <adubey@linux.ibm.com>
---
arch/powerpc/net/bpf_jit_comp.c | 46 +++++++++++++++++----------------
1 file changed, 24 insertions(+), 22 deletions(-)
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 3492d82d147f..9885a68f64f4 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -52,9 +52,10 @@ asm (
void bpf_jit_build_fentry_stubs(u32 *image, u32 *fimage, struct codegen_context *ctx)
{
int ool_stub_idx, long_branch_stub_idx;
- int ool_instrs;
+ int stubs_instrs;
/*
+ * The dummy_tramp_addr field is placed at bottom of Long branch stub.
* In the final pass, align the mis-aligned dummy_tramp_addr field
* in the fimage. The alignment NOP must appear before OOL stub,
* to make ool_stub_idx & long_branch_stub_idx constant from end.
@@ -62,13 +63,10 @@ void bpf_jit_build_fentry_stubs(u32 *image, u32 *fimage, struct codegen_context
* dummy_tramp_addr must be 8-byte aligned for load-register
* compatibility. The fimage can be non 8-byte aligned, so final
* alignment depends on start of fimage and the stub's instruction
- * count offset. The OOL stub has 4 instructions (with
- * CONFIG_PPC_FTRACE_OUT_OF_LINE) or 3 instructions (without)
- * before dummy_tramp_addr.
- *
- * Emit a NOP here if (ctx->idx + ool_instrs) is odd, so that
- * dummy_tramp_addr lands at an even instruction offset (== 8-byte
- * aligned from an 8-byte aligned base).
+ * count. The stubs block has 11 instructions (with
+ * CONFIG_PPC_FTRACE_OUT_OF_LINE) or 10 instructions (without)
+ * before dummy_tramp_addr field. Emit a NOP if the address of
+ * dummy_tramp_addr is non aligned.
*
* In pass=0 when image==NULL, conservatively account for space
* required to accommodate alignment NOP. In case final pass skips
@@ -76,8 +74,8 @@ void bpf_jit_build_fentry_stubs(u32 *image, u32 *fimage, struct codegen_context
* jited_len signifies correct program size.
*/
- ool_instrs = IS_ENABLED(CONFIG_PPC_FTRACE_OUT_OF_LINE) ? 4*4 : 3*4;
- if (!image || !IS_ALIGNED((unsigned long)fimage + ctx->idx*4 + ool_instrs, 8))
+ stubs_instrs = IS_ENABLED(CONFIG_PPC_FTRACE_OUT_OF_LINE) ? 11*4 : 10*4;
+ if (!image || !IS_ALIGNED((unsigned long)fimage + ctx->idx*4 + stubs_instrs, 8))
EMIT(PPC_RAW_NOP());
/*
@@ -98,28 +96,29 @@ void bpf_jit_build_fentry_stubs(u32 *image, u32 *fimage, struct codegen_context
/*
* Long branch stub:
- * .long <dummy_tramp_addr> // 8-byte aligned
* mflr r11
* bcl 20,31,$+4
- * mflr r12
- * ld r12, -8-SZL(r12)
+ * mflr r12 // lr/r12 stores pc of current(this) inst.
+ * ld r12, 20(r12) // offset(dummy_tramp_addr) from prev inst. is 20
* mtctr r12
- * mtlr r11 // needed to retain ftrace ABI
+ * mtlr r11 // needed to retain ftrace ABI
* bctr
+ * .long <dummy_tramp_addr> // 8-byte aligned
*/
- if (image)
- *((unsigned long *)&image[ctx->idx]) = (unsigned long)dummy_tramp;
-
- ctx->idx += SZL / 4;
long_branch_stub_idx = ctx->idx;
EMIT(PPC_RAW_MFLR(_R11));
EMIT(PPC_RAW_BCL4());
EMIT(PPC_RAW_MFLR(_R12));
- EMIT(PPC_RAW_LL(_R12, _R12, -8-SZL));
+ EMIT(PPC_RAW_LL(_R12, _R12, 20));
EMIT(PPC_RAW_MTCTR(_R12));
EMIT(PPC_RAW_MTLR(_R11));
EMIT(PPC_RAW_BCTR());
+ if (image)
+ *((unsigned long *)&image[ctx->idx]) = (unsigned long)dummy_tramp;
+
+ ctx->idx += SZL / 4;
+
if (!bpf_jit_ool_stub) {
bpf_jit_ool_stub = (ctx->idx - ool_stub_idx) * 4;
bpf_jit_long_branch_stub = (ctx->idx - long_branch_stub_idx) * 4;
@@ -1289,6 +1288,7 @@ static void do_isync(void *info __maybe_unused)
* bpf_func:
* [nop|b] ool_stub
* 2. Out-of-line stub:
+ * nop // optional nop for alignment
* ool_stub:
* mflr r0
* [b|bl] <bpf_prog>/<long_branch_stub>
@@ -1296,14 +1296,14 @@ static void do_isync(void *info __maybe_unused)
* b bpf_func + 4
* 3. Long branch stub:
* long_branch_stub:
- * .long <branch_addr>/<dummy_tramp>
* mflr r11
* bcl 20,31,$+4
* mflr r12
- * ld r12, -16(r12)
+ * ld r12, 20(r12)
* mtctr r12
* mtlr r11 // needed to retain ftrace ABI
* bctr
+ * .long <branch_addr>/<dummy_tramp>
*
* dummy_tramp is used to reduce synchronization requirements.
*
@@ -1405,10 +1405,12 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t,
* 1. Update the address in the long branch stub:
* If new_addr is out of range, we will have to use the long branch stub, so patch new_addr
* here. Otherwise, revert to dummy_tramp, but only if we had patched old_addr here.
+ *
+ * dummy_tramp_addr moved to bottom of long branch stub.
*/
if ((new_addr && !is_offset_in_branch_range(new_addr - ip)) ||
(old_addr && !is_offset_in_branch_range(old_addr - ip)))
- ret = patch_ulong((void *)(bpf_func_end - bpf_jit_long_branch_stub - SZL),
+ ret = patch_ulong((void *)(bpf_func_end - SZL), /* SZL: dummy_tramp_addr offset */
(new_addr && !is_offset_in_branch_range(new_addr - ip)) ?
(unsigned long)new_addr : (unsigned long)dummy_tramp);
if (ret)
--
2.52.0
^ permalink raw reply related
* [PATCH v6 1/6] powerpc/bpf: fix alignment of long branch trampoline address
From: adubey @ 2026-05-29 1:58 UTC (permalink / raw)
To: bpf
Cc: hbathini, linuxppc-dev, maddy, ast, andrii, daniel, shuah,
linux-kselftest, stable, Abhishek Dubey
In-Reply-To: <20260529015855.364704-1-adubey@linux.ibm.com>
From: Abhishek Dubey <adubey@linux.ibm.com>
Ensure the dummy trampoline address field present between the OOL stub
and the long branch stub is 8-byte aligned, for memory compatibility
when content loaded to a register.
Reported-by: Hari Bathini <hbathini@linux.ibm.com>
Fixes: d243b62b7bd3 ("powerpc64/bpf: Add support for bpf trampolines")
Cc: stable@vger.kernel.org
Signed-off-by: Abhishek Dubey <adubey@linux.ibm.com>
---
arch/powerpc/net/bpf_jit.h | 4 ++--
arch/powerpc/net/bpf_jit_comp.c | 39 +++++++++++++++++++++++++++----
arch/powerpc/net/bpf_jit_comp32.c | 4 ++--
arch/powerpc/net/bpf_jit_comp64.c | 4 ++--
4 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
index f32de8704d4d..71e6e7d01057 100644
--- a/arch/powerpc/net/bpf_jit.h
+++ b/arch/powerpc/net/bpf_jit.h
@@ -214,8 +214,8 @@ int bpf_jit_emit_func_call_rel(u32 *image, u32 *fimage, struct codegen_context *
int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct codegen_context *ctx,
u32 *addrs, int pass, bool extra_pass);
void bpf_jit_build_prologue(u32 *image, struct codegen_context *ctx);
-void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx);
-void bpf_jit_build_fentry_stubs(u32 *image, struct codegen_context *ctx);
+void bpf_jit_build_epilogue(u32 *image, u32 *fimage, struct codegen_context *ctx);
+void bpf_jit_build_fentry_stubs(u32 *image, u32 *fimage, struct codegen_context *ctx);
void bpf_jit_realloc_regs(struct codegen_context *ctx);
int bpf_jit_emit_exit_insn(u32 *image, struct codegen_context *ctx, int tmp_reg, long exit_addr);
void prepare_for_fsession_fentry(u32 *image, struct codegen_context *ctx, int cookie_cnt,
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 53ab97ad6074..3492d82d147f 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -49,11 +49,39 @@ asm (
" .popsection ;"
);
-void bpf_jit_build_fentry_stubs(u32 *image, struct codegen_context *ctx)
+void bpf_jit_build_fentry_stubs(u32 *image, u32 *fimage, struct codegen_context *ctx)
{
int ool_stub_idx, long_branch_stub_idx;
+ int ool_instrs;
/*
+ * In the final pass, align the mis-aligned dummy_tramp_addr field
+ * in the fimage. The alignment NOP must appear before OOL stub,
+ * to make ool_stub_idx & long_branch_stub_idx constant from end.
+ *
+ * dummy_tramp_addr must be 8-byte aligned for load-register
+ * compatibility. The fimage can be non 8-byte aligned, so final
+ * alignment depends on start of fimage and the stub's instruction
+ * count offset. The OOL stub has 4 instructions (with
+ * CONFIG_PPC_FTRACE_OUT_OF_LINE) or 3 instructions (without)
+ * before dummy_tramp_addr.
+ *
+ * Emit a NOP here if (ctx->idx + ool_instrs) is odd, so that
+ * dummy_tramp_addr lands at an even instruction offset (== 8-byte
+ * aligned from an 8-byte aligned base).
+ *
+ * In pass=0 when image==NULL, conservatively account for space
+ * required to accommodate alignment NOP. In case final pass skips
+ * emitting alignment NOP, the image buffer have 4 spare bytes and
+ * jited_len signifies correct program size.
+ */
+
+ ool_instrs = IS_ENABLED(CONFIG_PPC_FTRACE_OUT_OF_LINE) ? 4*4 : 3*4;
+ if (!image || !IS_ALIGNED((unsigned long)fimage + ctx->idx*4 + ool_instrs, 8))
+ EMIT(PPC_RAW_NOP());
+
+ /*
+ * nop // optional, for alignment of dummy_tramp_addr
* Out-of-line stub:
* mflr r0
* [b|bl] tramp
@@ -70,7 +98,7 @@ void bpf_jit_build_fentry_stubs(u32 *image, struct codegen_context *ctx)
/*
* Long branch stub:
- * .long <dummy_tramp_addr>
+ * .long <dummy_tramp_addr> // 8-byte aligned
* mflr r11
* bcl 20,31,$+4
* mflr r12
@@ -81,6 +109,7 @@ void bpf_jit_build_fentry_stubs(u32 *image, struct codegen_context *ctx)
*/
if (image)
*((unsigned long *)&image[ctx->idx]) = (unsigned long)dummy_tramp;
+
ctx->idx += SZL / 4;
long_branch_stub_idx = ctx->idx;
EMIT(PPC_RAW_MFLR(_R11));
@@ -107,7 +136,7 @@ int bpf_jit_emit_exit_insn(u32 *image, struct codegen_context *ctx, int tmp_reg,
PPC_JMP(ctx->alt_exit_addr);
} else {
ctx->alt_exit_addr = ctx->idx * 4;
- bpf_jit_build_epilogue(image, ctx);
+ bpf_jit_build_epilogue(image, NULL, ctx);
}
return 0;
@@ -286,7 +315,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_verifier_env *env, struct bpf_pr
*/
bpf_jit_build_prologue(NULL, &cgctx);
addrs[fp->len] = cgctx.idx * 4;
- bpf_jit_build_epilogue(NULL, &cgctx);
+ bpf_jit_build_epilogue(NULL, NULL, &cgctx);
fixup_len = fp->aux->num_exentries * BPF_FIXUP_LEN * 4;
extable_len = fp->aux->num_exentries * sizeof(struct exception_table_entry);
@@ -318,7 +347,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_verifier_env *env, struct bpf_pr
bpf_jit_binary_pack_free(fhdr, hdr);
goto out_err;
}
- bpf_jit_build_epilogue(code_base, &cgctx);
+ bpf_jit_build_epilogue(code_base, fcode_base, &cgctx);
if (bpf_jit_enable > 1)
pr_info("Pass %d: shrink = %d, seen = 0x%x\n", pass,
diff --git a/arch/powerpc/net/bpf_jit_comp32.c b/arch/powerpc/net/bpf_jit_comp32.c
index bfdc50740da8..95bda0dee925 100644
--- a/arch/powerpc/net/bpf_jit_comp32.c
+++ b/arch/powerpc/net/bpf_jit_comp32.c
@@ -229,7 +229,7 @@ static void bpf_jit_emit_common_epilogue(u32 *image, struct codegen_context *ctx
}
-void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx)
+void bpf_jit_build_epilogue(u32 *image, u32 *fimage, struct codegen_context *ctx)
{
EMIT(PPC_RAW_MR(_R3, bpf_to_ppc(BPF_REG_0)));
@@ -237,7 +237,7 @@ void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx)
EMIT(PPC_RAW_BLR());
- bpf_jit_build_fentry_stubs(image, ctx);
+ bpf_jit_build_fentry_stubs(image, fimage, ctx);
}
/* Relative offset needs to be calculated based on final image location */
diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
index db364d9083e7..885dc8cf55a2 100644
--- a/arch/powerpc/net/bpf_jit_comp64.c
+++ b/arch/powerpc/net/bpf_jit_comp64.c
@@ -398,7 +398,7 @@ static void bpf_jit_emit_common_epilogue(u32 *image, struct codegen_context *ctx
}
}
-void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx)
+void bpf_jit_build_epilogue(u32 *image, u32 *fimage, struct codegen_context *ctx)
{
bpf_jit_emit_common_epilogue(image, ctx);
@@ -407,7 +407,7 @@ void bpf_jit_build_epilogue(u32 *image, struct codegen_context *ctx)
EMIT(PPC_RAW_BLR());
- bpf_jit_build_fentry_stubs(image, ctx);
+ bpf_jit_build_fentry_stubs(image, fimage, ctx);
}
/*
--
2.52.0
^ permalink raw reply related
* [PATCH v6 0/6] powerpc/bpf: Add support for verifier selftest
From: adubey @ 2026-05-29 1:58 UTC (permalink / raw)
To: bpf
Cc: hbathini, linuxppc-dev, maddy, ast, andrii, daniel, shuah,
linux-kselftest, stable, Abhishek Dubey
From: Abhishek Dubey <adubey@linux.ibm.com>
The verifier selftest validates JITed instructions by matching expected
disassembly output. The first two patches fix issues in powerpc instruction
disassembly that were causing test flow failures. The fix is common for
64-bit & 32-bit powerpc. Add support for the powerpc-specific "__powerpc64"
architecture tag in the third patch, enabling proper test filtering in
verifier test files. Introduce verifier testcases for tailcalls on powerpc64
in the final patch.
The first patch in series is fix patch, correcting memory alignment with
8-byte boundary for long branch address field. The subsequent patches
enables verifier selftests on powerpc. The last but one patch in
the series fixes incorrect comparator usage for comparing tailcall info
with tailcall threshold.
Issue Details:
--------------
The Long branch stub in the trampoline implementation[1] provides
flexibility to handles short as well as long branch distance to
actual trampoline. Whereas, the 8 bytes long dummy_tramp_addr field
sitting before long branch stub leads to failure when enabling
verifier based seltest for ppc64.
The verifier selftests require disassembing the final jited image
to get native instructions. Later the disassembled instruction
sequence is matched against sequence of instructions provided in
test-file under __jited() wrapper. The final jited image contains
Out-of-line stub and Long branch stub as part of epilogue jitting
for a bpf program. The 8 bytes space for dummy_tramp is sandwiched
between both above mentioned stubs. These 8 bytes contain memory
address of dummy trampoline during trampoline invocation which don't
correspond to any powerpc instructions. So, disassembly fails
resulting in failure of verifier selftests.
The following code snippet shows the problem with current arrangement
made for dummy_tramp_addr.
/* Out-of-line stub */
mflr r0
[b|bl] tramp
mtlr r0 //only with OOL
b bpf_func + 4
/* Long branch stub */
.long <dummy_tramp_addr> <---Invalid bytes sequence, disassembly fails
mflr r11
bcl 20,31,$+4
mflr r12
ld r12, -8-SZL(r12)
mtctr r12
mtlr r11 //retain ftrace ABI
bctr
Consider test program binary of size 112 bytes:
0: 00000060 10004de8 00002039 f8ff21f9 81ff21f8 7000e1fb 3000e13b
28: 3000e13b 2a006038 f8ff7ff8 00000039 7000e1eb 80002138 7843037d
56: 2000804e a602087c 00000060 a603087c bcffff4b c0341d00 000000c0
84: a602687d 05009f42 a602887d f0ff8ce9 a603897d a603687d 2004804e
Disassembly output of above binary for ppc64le:
pc:0 left:112 00 00 00 60 : nop
pc:4 left:108 10 00 4d e8 : ld 2, 16(13)
pc:8 left:104 00 00 20 39 : li 9, 0
pc:12 left:100 f8 ff 21 f9 : std 9, -8(1)
pc:16 left:96 81 ff 21 f8 : stdu 1, -128(1)
pc:20 left:92 70 00 e1 fb : std 31, 112(1)
pc:24 left:88 30 00 e1 3b : addi 31, 1, 48
pc:28 left:84 30 00 e1 3b : addi 31, 1, 48
pc:32 left:80 2a 00 60 38 : li 3, 42
pc:36 left:76 f8 ff 7f f8 : std 3, -8(31)
pc:40 left:72 00 00 00 39 : li 8, 0
pc:44 left:68 70 00 e1 eb : ld 31, 112(1)
pc:48 left:64 80 00 21 38 : addi 1, 1, 128
pc:52 left:60 78 43 03 7d : mr 3, 8
pc:56 left:56 20 00 80 4e : blr
pc:60 left:52 a6 02 08 7c : mflr 0
pc:64 left:48 00 00 00 60 : nop
pc:68 left:44 a6 03 08 7c : mtlr 0
pc:72 left:40 bc ff ff 4b : b .-68
pc:76 left:36 c0 34 1d 00 :
...
Failure log:
Can't disasm instruction at offset 76: c0 34 1d 00 00 00 00 c0 a6 02 68 7d 05 00 9f 42
--------------------------------------
Observation:
Can't disasm instruction at offset 76 as this address has
".long <dummy_tramp_addr>" (0xc0341d00000000c0)
But valid instructions follow at offset 84 onwards.
Move the long branch address space to the bottom of the long
branch stub. This allows uninterrupted disassembly until the
last 8 bytes. Exclude these last bytes from the overall
program length to prevent failure in assembly generation.
Following is disassembler output for same test program with moved down
dummy_tramp_addr field:
.....
.....
pc:68 left:44 a6 03 08 7c : mtlr 0
pc:72 left:40 bc ff ff 4b : b .-68
pc:76 left:36 a6 02 68 7d : mflr 11
pc:80 left:32 05 00 9f 42 : bcl 20, 31, .+4
pc:84 left:28 a6 02 88 7d : mflr 12
pc:88 left:24 14 00 8c e9 : ld 12, 20(12)
pc:92 left:20 a6 03 89 7d : mtctr 12
pc:96 left:16 a6 03 68 7d : mtlr 11
pc:100 left:12 20 04 80 4e : bctr
pc:104 left:8 c0 34 1d 00 :
Failure log:
Can't disasm instruction at offset 104: c0 34 1d 00 00 00 00 c0
---------------------------------------
Disassembly logic can truncate at 104, ignoring last 8 bytes.
Update the dummy_tramp_addr field offset calculation from the end
of the program to reflect its new location, for bpf_arch_text_poke()
to update the actual trampoline's address in this field.
[1] https://lore.kernel.org/all/20241030070850.1361304-18-hbathini@linux.ibm.com
v5->v6:
Changed alignment NOP emittion dependency on fimage layout
Adjust tail truncate length for 32-bit ppc
Addressed few minor bot comments
v4->v5:
Handled alignment NOP emit logic and corresponding stub offsets
Handled image buffer overflow problem in last pass
Above changes took care of other bot reviews
Included LLVMDisposeMessage() for graceful freeing
Adjusted parameters in bpf_jit_build_fentry_stubs for ppc32
Adjusted expected JIT inst. in tailcall test for
CONFIG_PPC_KERNEL_PCREL config
Added fix patch at last for inaccurate use of cmplwi inst.
v3->v4:
Changed logic for emitting alignment NOP
v2->v3:
Removed fixed NOP from bottom of long branch stub
Rebased on top of bpf-next
v1->v2:
Added fix-patch to correct memory alignment in-place
Moved the optional alignmnet NOP before OOL stub
[v1]: https://lore.kernel.org/bpf/20260225013627.22098-1-adubey@linux.ibm.com
[v2]: https://lore.kernel.org/bpf/20260403004011.44417-1-adubey@linux.ibm.com
[v3]: https://lore.kernel.org/bpf/20260411221413.44304-1-adubey@linux.ibm.com
[v4]: https://lore.kernel.org/bpf/20260517214043.12975-1-adubey@linux.ibm.com
[v5]: https://lore.kernel.org/bpf/20260519233812.18787-1-adubey@linux.ibm.com
Abhishek Dubey (6):
powerpc/bpf: fix alignment of long branch trampoline address
powerpc/bpf: Move out dummy_tramp_addr after Long branch stub
selftest/bpf: Fixing powerpc JIT disassembly failure
selftest/bpf: Enable verifier selftest for powerpc64
powerpc64/bpf: fix compare instruction emitted for tailcall
selftest/bpf: Add tailcall verifier selftest for powerpc64
arch/powerpc/net/bpf_jit.h | 4 +-
arch/powerpc/net/bpf_jit_comp.c | 63 ++++++++++++-----
arch/powerpc/net/bpf_jit_comp32.c | 4 +-
arch/powerpc/net/bpf_jit_comp64.c | 12 ++--
.../selftests/bpf/jit_disasm_helpers.c | 23 ++++++-
tools/testing/selftests/bpf/progs/bpf_misc.h | 1 +
.../bpf/progs/verifier_tailcall_jit.c | 69 +++++++++++++++++++
tools/testing/selftests/bpf/test_loader.c | 5 ++
8 files changed, 154 insertions(+), 27 deletions(-)
--
2.52.0
^ permalink raw reply
* [PATCH] macintosh: macio_asic: add missing kernel-doc params for macio_add_one_device
From: Rosen Penev @ 2026-05-28 20:27 UTC (permalink / raw)
To: linuxppc-dev; +Cc: open list
Add documentation for the @parent and @parent_res parameters that were
missing from the kernel-doc comment.
Assisted-by: Opencode:Big-pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/macintosh/macio_asic.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index ee3caa3d87d1..9e744c8e687d 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -349,8 +349,10 @@ static void macio_setup_resources(struct macio_dev *dev,
/**
* macio_add_one_device - Add one device from OF node to the device tree
* @chip: pointer to the macio_chip holding the device
+ * @parent: parent device
* @np: pointer to the device node in the OF tree
* @in_bay: set to 1 if device is part of a media-bay
+ * @parent_res: parent resource
*
* When media-bay is changed to hotswap drivers, this function will
* be exposed to the bay driver some way...
--
2.54.0
^ permalink raw reply related
* [PATCH] powerpc: rtas: use get_user to simplify manage_flash_write
From: Thorsten Blum @ 2026-05-28 20:12 UTC (permalink / raw)
To: Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP), Srikar Dronamraju, Shrikanth Hegde
Cc: Thorsten Blum, linuxppc-dev, linux-kernel
Drop the local 10-byte buffer. The old code copied at most 9 bytes from
the user buffer, but only the first byte was used to select the RTAS
operation.
Use get_user() to read the command byte instead and compare it directly
with '0' and '1'. Drop the explicit user buffer check, since get_user()
will fail on a NULL pointer and correctly return -EFAULT instead of
-EINVAL. Remove the now-obsolete string constants as well as any
strncmp() and strlen() calls.
Return the original count instead of a potentially capped value, since
the full user write has been consumed once the command is accepted.
Use unsigned int op to better match the manage_flash() interface.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
arch/powerpc/kernel/rtas_flash.c | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index 583dc16e9d3c..722dbfb6fbf8 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -394,30 +394,23 @@ static ssize_t manage_flash_write(struct file *file, const char __user *buf,
size_t count, loff_t *off)
{
struct rtas_manage_flash_t *const args_buf = &rtas_manage_flash_data;
- static const char reject_str[] = "0";
- static const char commit_str[] = "1";
- char stkbuf[10];
- int op;
+ unsigned int op;
+ char cmd;
guard(mutex)(&rtas_manage_flash_mutex);
if ((args_buf->status == MANAGE_AUTH) || (count == 0))
return count;
- op = -1;
- if (buf) {
- if (count > 9) count = 9;
- if (copy_from_user (stkbuf, buf, count))
- return -EFAULT;
- if (strncmp(stkbuf, reject_str, strlen(reject_str)) == 0)
- op = RTAS_REJECT_TMP_IMG;
- else if (strncmp(stkbuf, commit_str, strlen(commit_str)) == 0)
- op = RTAS_COMMIT_TMP_IMG;
- }
-
- if (op == -1) { /* buf is empty, or contains invalid string */
+ if (get_user(cmd, buf))
+ return -EFAULT;
+
+ if (cmd == '0')
+ op = RTAS_REJECT_TMP_IMG;
+ else if (cmd == '1')
+ op = RTAS_COMMIT_TMP_IMG;
+ else
return -EINVAL;
- }
manage_flash(args_buf, op);
return count;
^ permalink raw reply related
* Re: [PATCH 00/16] lib/cpumask: get rid of cpumap_print_to_pagebuf()
From: Andrew Morton @ 2026-05-28 20:02 UTC (permalink / raw)
To: Yury Norov
Cc: Rasmus Villemoes, Russell King, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, James Clark, Thomas Gleixner,
Borislav Petkov, Dave Hansen, H. Peter Anvin, Rafael J. Wysocki,
Len Brown, Greg Kroah-Hartman, Danilo Krummrich, Chanwoo Choi,
MyungJoo Ham, Kyungmin Park, Heiko Stuebner, Lorenzo Pieralisi,
Xu Yilun, Tom Rix, Moritz Fischer, Yicong Yang, Jonathan Cameron,
Dennis Dalessandro, Jason Gunthorpe, Leon Romanovsky,
Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny, Bjorn Helgaas,
Shuai Xue, Will Deacon, Jiucheng Xu, Neil Armstrong, Kevin Hilman,
Jerome Brunet, Martin Blumenstingl, Robin Murphy, Jing Zhang,
Xu Yang, Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh,
Khuong Dinh, Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov,
Kees Cook, Thomas Weißschuh, Aboorva Devarajan,
Ritesh Harjani (IBM), Ilkka Koskinen, Besar Wicaksono, Ma Ke,
Chengwen Feng, linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
linux-perf-users, linux-acpi, driver-core, linux-pm,
linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
linux-amlogic, linux-cxl, linux-arm-msm, Roman Gushchin
In-Reply-To: <ahiYUr0dO_dhOHTU@yury>
On Thu, 28 May 2026 15:32:34 -0400 Yury Norov <ynorov@nvidia.com> wrote:
> > > > Sashiko doesn't attempt bitmap-for-next, so it couldn't apply this series.
> > > > https://sashiko.dev/#/patchset/20260528183625.870813-1-ynorov@nvidia.com
> > >
> > > OK... What should I do about that?
> >
> > Rebase onto something which Sashiko *does* attempt. Mainline, a few
> > mm.git branches. Maybe linux-next.
>
> Is Sashiko a new mandatory requirement now? Documentation doesn't even
> mention the bot.
It's early days and things are still evolving.
No, I'm not aware of any team having made it mandatory but boy it's
helpful. Authors appreciate it because it finds bugs, and nobody wants
to add bugs to Linux.
^ permalink raw reply
* Re: [PATCH 00/16] lib/cpumask: get rid of cpumap_print_to_pagebuf()
From: Yury Norov @ 2026-05-28 19:52 UTC (permalink / raw)
To: Ian Rogers
Cc: Andrew Morton, Rasmus Villemoes, Russell King, Frank Li,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP), Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Adrian Hunter, James Clark,
Thomas Gleixner, Borislav Petkov, Dave Hansen, H. Peter Anvin,
Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
linux-perf-users, linux-acpi, driver-core, linux-pm,
linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
linux-amlogic, linux-cxl, linux-arm-msm, Roman Gushchin
In-Reply-To: <CAP-5=fXXg+PqH7EZ8X599CKYFWCwQgyH2H-4-+5M3_b9w_dTNw@mail.gmail.com>
On Thu, May 28, 2026 at 12:44:15PM -0700, Ian Rogers wrote:
> On Thu, May 28, 2026 at 12:32 PM Yury Norov <ynorov@nvidia.com> wrote:
> >
> > On Thu, May 28, 2026 at 12:29:03PM -0700, Andrew Morton wrote:
> > > On Thu, 28 May 2026 15:26:28 -0400 Yury Norov <ynorov@nvidia.com> wrote:
> > >
> > > > On Thu, May 28, 2026 at 12:18:06PM -0700, Andrew Morton wrote:
> > > > > On Thu, 28 May 2026 14:36:07 -0400 Yury Norov <ynorov@nvidia.com> wrote:
> > > > >
> > > > > > cpumap_print_to_pagebuf() is the equivalent for the "&*pb[l]" notation
> > > > > > in printk-like functions. In some cases, it makes people to create
> > > > > > temporary buffers for the printed cpumasks, where it can be avoided.
> > > > > >
> > > > > > Get rid of it in a favor of more standard printing API.
> > > > > >
> > > > > > Each patch, except for the last one, is independent and may be moved with
> > > > > > the corresponding subsystem. Or I can take it in bitmap-for-next, at
> > > > > > maintainers' discretion.
> > > > > >
> > > > > > On top of bitmap-for-next.
> > > > >
> > > > > Sashiko doesn't attempt bitmap-for-next, so it couldn't apply this series.
> > > > > https://sashiko.dev/#/patchset/20260528183625.870813-1-ynorov@nvidia.com
> > > >
> > > > OK... What should I do about that?
> > >
> > > Rebase onto something which Sashiko *does* attempt. Mainline, a few
> > > mm.git branches. Maybe linux-next.
> >
> > Is Sashiko a new mandatory requirement now? Documentation doesn't even
> > mention the bot.
> >
> > > Roman, is there a list of trees/branches which Sashiko tries to apply
> > > series to?
> >
> > Hi Roman,
> >
> > Can you add bitmap-for-next in the list?
>
> Fwiw, you can see the list of branches attempted and the SHA they are
> at in the Baseline drop down:
>
> Baseline Status Log
> tip/x86/core (0f61b1860cc3f52aef9036d7235ed1f017632193) Failed View Log
> powerpc/HEAD (6916d5703ddf9a38f1f6c2cc793381a24ee914c6) Failed View Log
> chanwoo/HEAD (7fd2df204f342fc17d1a0bfcd474b24232fb0f32) Failed View Log
> linux-arm/HEAD (dd6c438c3e64a5ff0b5d7e78f7f9be547803ef1b) Failed View Log
> linux-pm/HEAD (e7ae89a0c97ce2b68b0983cd01eda67cf373517d) Failed View Log
> linux-fpga/HEAD Failed View Log
> pci/HEAD (254f49634ee16a731174d2ae34bc50bd5f45e731) Failed View Log
> linux-pm/thermal (21c315342b81526874acfa311f11b3f72bed4e14) Failed View Log
> rdma/HEAD (67464f388d52ec172be62c99fc43697437ffa384) Failed View Log
> linux-next/HEAD (f7af91adc230aa99e23330ecf85bc9badd9780ad) Failed View Log
> HEAD (917719c412c48687d4a176965d1fa35320ec457c) Failed View Log
Thanks, Ian. Bitmap-for-next is tracked with linux-next.
^ permalink raw reply
* Re: [PATCH 00/16] lib/cpumask: get rid of cpumap_print_to_pagebuf()
From: Ian Rogers @ 2026-05-28 19:44 UTC (permalink / raw)
To: Yury Norov
Cc: Andrew Morton, Rasmus Villemoes, Russell King, Frank Li,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy (CS GROUP), Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Adrian Hunter, James Clark,
Thomas Gleixner, Borislav Petkov, Dave Hansen, H. Peter Anvin,
Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
linux-perf-users, linux-acpi, driver-core, linux-pm,
linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
linux-amlogic, linux-cxl, linux-arm-msm, Roman Gushchin
In-Reply-To: <ahiYUr0dO_dhOHTU@yury>
On Thu, May 28, 2026 at 12:32 PM Yury Norov <ynorov@nvidia.com> wrote:
>
> On Thu, May 28, 2026 at 12:29:03PM -0700, Andrew Morton wrote:
> > On Thu, 28 May 2026 15:26:28 -0400 Yury Norov <ynorov@nvidia.com> wrote:
> >
> > > On Thu, May 28, 2026 at 12:18:06PM -0700, Andrew Morton wrote:
> > > > On Thu, 28 May 2026 14:36:07 -0400 Yury Norov <ynorov@nvidia.com> wrote:
> > > >
> > > > > cpumap_print_to_pagebuf() is the equivalent for the "&*pb[l]" notation
> > > > > in printk-like functions. In some cases, it makes people to create
> > > > > temporary buffers for the printed cpumasks, where it can be avoided.
> > > > >
> > > > > Get rid of it in a favor of more standard printing API.
> > > > >
> > > > > Each patch, except for the last one, is independent and may be moved with
> > > > > the corresponding subsystem. Or I can take it in bitmap-for-next, at
> > > > > maintainers' discretion.
> > > > >
> > > > > On top of bitmap-for-next.
> > > >
> > > > Sashiko doesn't attempt bitmap-for-next, so it couldn't apply this series.
> > > > https://sashiko.dev/#/patchset/20260528183625.870813-1-ynorov@nvidia.com
> > >
> > > OK... What should I do about that?
> >
> > Rebase onto something which Sashiko *does* attempt. Mainline, a few
> > mm.git branches. Maybe linux-next.
>
> Is Sashiko a new mandatory requirement now? Documentation doesn't even
> mention the bot.
>
> > Roman, is there a list of trees/branches which Sashiko tries to apply
> > series to?
>
> Hi Roman,
>
> Can you add bitmap-for-next in the list?
Fwiw, you can see the list of branches attempted and the SHA they are
at in the Baseline drop down:
Baseline Status Log
tip/x86/core (0f61b1860cc3f52aef9036d7235ed1f017632193) Failed View Log
powerpc/HEAD (6916d5703ddf9a38f1f6c2cc793381a24ee914c6) Failed View Log
chanwoo/HEAD (7fd2df204f342fc17d1a0bfcd474b24232fb0f32) Failed View Log
linux-arm/HEAD (dd6c438c3e64a5ff0b5d7e78f7f9be547803ef1b) Failed View Log
linux-pm/HEAD (e7ae89a0c97ce2b68b0983cd01eda67cf373517d) Failed View Log
linux-fpga/HEAD Failed View Log
pci/HEAD (254f49634ee16a731174d2ae34bc50bd5f45e731) Failed View Log
linux-pm/thermal (21c315342b81526874acfa311f11b3f72bed4e14) Failed View Log
rdma/HEAD (67464f388d52ec172be62c99fc43697437ffa384) Failed View Log
linux-next/HEAD (f7af91adc230aa99e23330ecf85bc9badd9780ad) Failed View Log
HEAD (917719c412c48687d4a176965d1fa35320ec457c) Failed View Log
Thanks,
Ian
^ permalink raw reply
* Re: [PATCH 00/16] lib/cpumask: get rid of cpumap_print_to_pagebuf()
From: Yury Norov @ 2026-05-28 19:32 UTC (permalink / raw)
To: Andrew Morton
Cc: Rasmus Villemoes, Russell King, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, James Clark, Thomas Gleixner,
Borislav Petkov, Dave Hansen, H. Peter Anvin, Rafael J. Wysocki,
Len Brown, Greg Kroah-Hartman, Danilo Krummrich, Chanwoo Choi,
MyungJoo Ham, Kyungmin Park, Heiko Stuebner, Lorenzo Pieralisi,
Xu Yilun, Tom Rix, Moritz Fischer, Yicong Yang, Jonathan Cameron,
Dennis Dalessandro, Jason Gunthorpe, Leon Romanovsky,
Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny, Bjorn Helgaas,
Shuai Xue, Will Deacon, Jiucheng Xu, Neil Armstrong, Kevin Hilman,
Jerome Brunet, Martin Blumenstingl, Robin Murphy, Jing Zhang,
Xu Yang, Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh,
Khuong Dinh, Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov,
Kees Cook, Thomas Weißschuh, Aboorva Devarajan,
Ritesh Harjani (IBM), Ilkka Koskinen, Besar Wicaksono, Ma Ke,
Chengwen Feng, linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
linux-perf-users, linux-acpi, driver-core, linux-pm,
linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
linux-amlogic, linux-cxl, linux-arm-msm, Roman Gushchin
In-Reply-To: <20260528122903.cf74cf905418ab2d144607c3@linux-foundation.org>
On Thu, May 28, 2026 at 12:29:03PM -0700, Andrew Morton wrote:
> On Thu, 28 May 2026 15:26:28 -0400 Yury Norov <ynorov@nvidia.com> wrote:
>
> > On Thu, May 28, 2026 at 12:18:06PM -0700, Andrew Morton wrote:
> > > On Thu, 28 May 2026 14:36:07 -0400 Yury Norov <ynorov@nvidia.com> wrote:
> > >
> > > > cpumap_print_to_pagebuf() is the equivalent for the "&*pb[l]" notation
> > > > in printk-like functions. In some cases, it makes people to create
> > > > temporary buffers for the printed cpumasks, where it can be avoided.
> > > >
> > > > Get rid of it in a favor of more standard printing API.
> > > >
> > > > Each patch, except for the last one, is independent and may be moved with
> > > > the corresponding subsystem. Or I can take it in bitmap-for-next, at
> > > > maintainers' discretion.
> > > >
> > > > On top of bitmap-for-next.
> > >
> > > Sashiko doesn't attempt bitmap-for-next, so it couldn't apply this series.
> > > https://sashiko.dev/#/patchset/20260528183625.870813-1-ynorov@nvidia.com
> >
> > OK... What should I do about that?
>
> Rebase onto something which Sashiko *does* attempt. Mainline, a few
> mm.git branches. Maybe linux-next.
Is Sashiko a new mandatory requirement now? Documentation doesn't even
mention the bot.
> Roman, is there a list of trees/branches which Sashiko tries to apply
> series to?
Hi Roman,
Can you add bitmap-for-next in the list?
Thanks,
Yury
^ permalink raw reply
* Re: [PATCH 00/16] lib/cpumask: get rid of cpumap_print_to_pagebuf()
From: Andrew Morton @ 2026-05-28 19:29 UTC (permalink / raw)
To: Yury Norov
Cc: Rasmus Villemoes, Russell King, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, James Clark, Thomas Gleixner,
Borislav Petkov, Dave Hansen, H. Peter Anvin, Rafael J. Wysocki,
Len Brown, Greg Kroah-Hartman, Danilo Krummrich, Chanwoo Choi,
MyungJoo Ham, Kyungmin Park, Heiko Stuebner, Lorenzo Pieralisi,
Xu Yilun, Tom Rix, Moritz Fischer, Yicong Yang, Jonathan Cameron,
Dennis Dalessandro, Jason Gunthorpe, Leon Romanovsky,
Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny, Bjorn Helgaas,
Shuai Xue, Will Deacon, Jiucheng Xu, Neil Armstrong, Kevin Hilman,
Jerome Brunet, Martin Blumenstingl, Robin Murphy, Jing Zhang,
Xu Yang, Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh,
Khuong Dinh, Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov,
Kees Cook, Thomas Weißschuh, Aboorva Devarajan,
Ritesh Harjani (IBM), Ilkka Koskinen, Besar Wicaksono, Ma Ke,
Chengwen Feng, linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
linux-perf-users, linux-acpi, driver-core, linux-pm,
linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
linux-amlogic, linux-cxl, linux-arm-msm, Roman Gushchin
In-Reply-To: <ahiW5LKLiPMC6il_@yury>
On Thu, 28 May 2026 15:26:28 -0400 Yury Norov <ynorov@nvidia.com> wrote:
> On Thu, May 28, 2026 at 12:18:06PM -0700, Andrew Morton wrote:
> > On Thu, 28 May 2026 14:36:07 -0400 Yury Norov <ynorov@nvidia.com> wrote:
> >
> > > cpumap_print_to_pagebuf() is the equivalent for the "&*pb[l]" notation
> > > in printk-like functions. In some cases, it makes people to create
> > > temporary buffers for the printed cpumasks, where it can be avoided.
> > >
> > > Get rid of it in a favor of more standard printing API.
> > >
> > > Each patch, except for the last one, is independent and may be moved with
> > > the corresponding subsystem. Or I can take it in bitmap-for-next, at
> > > maintainers' discretion.
> > >
> > > On top of bitmap-for-next.
> >
> > Sashiko doesn't attempt bitmap-for-next, so it couldn't apply this series.
> > https://sashiko.dev/#/patchset/20260528183625.870813-1-ynorov@nvidia.com
>
> OK... What should I do about that?
Rebase onto something which Sashiko *does* attempt. Mainline, a few
mm.git branches. Maybe linux-next.
Roman, is there a list of trees/branches which Sashiko tries to apply
series to?
Thanks.
^ permalink raw reply
* Re: [PATCH 00/16] lib/cpumask: get rid of cpumap_print_to_pagebuf()
From: Yury Norov @ 2026-05-28 19:26 UTC (permalink / raw)
To: Andrew Morton
Cc: Rasmus Villemoes, Russell King, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, James Clark, Thomas Gleixner,
Borislav Petkov, Dave Hansen, H. Peter Anvin, Rafael J. Wysocki,
Len Brown, Greg Kroah-Hartman, Danilo Krummrich, Chanwoo Choi,
MyungJoo Ham, Kyungmin Park, Heiko Stuebner, Lorenzo Pieralisi,
Xu Yilun, Tom Rix, Moritz Fischer, Yicong Yang, Jonathan Cameron,
Dennis Dalessandro, Jason Gunthorpe, Leon Romanovsky,
Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny, Bjorn Helgaas,
Shuai Xue, Will Deacon, Jiucheng Xu, Neil Armstrong, Kevin Hilman,
Jerome Brunet, Martin Blumenstingl, Robin Murphy, Jing Zhang,
Xu Yang, Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh,
Khuong Dinh, Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov,
Kees Cook, Thomas Weißschuh, Aboorva Devarajan,
Ritesh Harjani (IBM), Ilkka Koskinen, Besar Wicaksono, Ma Ke,
Chengwen Feng, linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
linux-perf-users, linux-acpi, driver-core, linux-pm,
linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528121806.2b54606ba6e42f7f371d95c3@linux-foundation.org>
On Thu, May 28, 2026 at 12:18:06PM -0700, Andrew Morton wrote:
> On Thu, 28 May 2026 14:36:07 -0400 Yury Norov <ynorov@nvidia.com> wrote:
>
> > cpumap_print_to_pagebuf() is the equivalent for the "&*pb[l]" notation
> > in printk-like functions. In some cases, it makes people to create
> > temporary buffers for the printed cpumasks, where it can be avoided.
> >
> > Get rid of it in a favor of more standard printing API.
> >
> > Each patch, except for the last one, is independent and may be moved with
> > the corresponding subsystem. Or I can take it in bitmap-for-next, at
> > maintainers' discretion.
> >
> > On top of bitmap-for-next.
>
> Sashiko doesn't attempt bitmap-for-next, so it couldn't apply this series.
> https://sashiko.dev/#/patchset/20260528183625.870813-1-ynorov@nvidia.com
OK... What should I do about that?
^ permalink raw reply
* Re: [PATCH 00/16] lib/cpumask: get rid of cpumap_print_to_pagebuf()
From: Andrew Morton @ 2026-05-28 19:18 UTC (permalink / raw)
To: Yury Norov
Cc: Rasmus Villemoes, Russell King, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, James Clark, Thomas Gleixner,
Borislav Petkov, Dave Hansen, H. Peter Anvin, Rafael J. Wysocki,
Len Brown, Greg Kroah-Hartman, Danilo Krummrich, Chanwoo Choi,
MyungJoo Ham, Kyungmin Park, Heiko Stuebner, Lorenzo Pieralisi,
Xu Yilun, Tom Rix, Moritz Fischer, Yicong Yang, Jonathan Cameron,
Dennis Dalessandro, Jason Gunthorpe, Leon Romanovsky,
Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny, Bjorn Helgaas,
Shuai Xue, Will Deacon, Jiucheng Xu, Neil Armstrong, Kevin Hilman,
Jerome Brunet, Martin Blumenstingl, Robin Murphy, Jing Zhang,
Xu Yang, Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh,
Khuong Dinh, Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov,
Kees Cook, Thomas Weißschuh, Aboorva Devarajan,
Ritesh Harjani (IBM), Ilkka Koskinen, Besar Wicaksono, Ma Ke,
Chengwen Feng, linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
linux-perf-users, linux-acpi, driver-core, linux-pm,
linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528183625.870813-1-ynorov@nvidia.com>
On Thu, 28 May 2026 14:36:07 -0400 Yury Norov <ynorov@nvidia.com> wrote:
> cpumap_print_to_pagebuf() is the equivalent for the "&*pb[l]" notation
> in printk-like functions. In some cases, it makes people to create
> temporary buffers for the printed cpumasks, where it can be avoided.
>
> Get rid of it in a favor of more standard printing API.
>
> Each patch, except for the last one, is independent and may be moved with
> the corresponding subsystem. Or I can take it in bitmap-for-next, at
> maintainers' discretion.
>
> On top of bitmap-for-next.
Sashiko doesn't attempt bitmap-for-next, so it couldn't apply this series.
https://sashiko.dev/#/patchset/20260528183625.870813-1-ynorov@nvidia.com
^ permalink raw reply
* [PATCH 16/16] lib/bitmap-str: get rid of cpumap_print_to_pagebuf()
From: Yury Norov @ 2026-05-28 18:36 UTC (permalink / raw)
To: Andrew Morton, Rasmus Villemoes, Yury Norov
Cc: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy (CS GROUP), Peter Zijlstra,
Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
H. Peter Anvin, Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
linux-perf-users, linux-acpi, driver-core, linux-pm,
linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528183625.870813-1-ynorov@nvidia.com>
Now that all users of the function are switched to the alternatives,
drop the function.
Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
include/linux/cpumask.h | 19 -------------------
lib/bitmap-str.c | 9 ++++-----
2 files changed, 4 insertions(+), 24 deletions(-)
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index d3cda0544954..4c8bb6953107 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -13,7 +13,6 @@
#include <linux/cpumask_types.h>
#include <linux/gfp_types.h>
#include <linux/numa.h>
-#include <linux/sprintf.h>
#include <linux/threads.h>
#include <linux/types.h>
#include <vdso/page.h>
@@ -1315,24 +1314,6 @@ static __always_inline bool cpu_dying(unsigned int cpu)
}
#endif /* NR_CPUS > BITS_PER_LONG */
-/**
- * cpumap_print_to_pagebuf - copies the cpumask into the buffer either
- * as comma-separated list of cpus or hex values of cpumask
- * @list: indicates whether the cpumap must be list
- * @mask: the cpumask to copy
- * @buf: the buffer to copy into
- *
- * Return: the length of the (null-terminated) @buf string, zero if
- * nothing is copied.
- */
-static __always_inline ssize_t
-cpumap_print_to_pagebuf(bool list, char *buf, const struct cpumask *mask)
-{
- /* Opencode offset_in_page(buf) to not include linux/mm.h */
- return scnprintf(buf, PAGE_SIZE - ((unsigned long)buf & ~PAGE_MASK),
- list ? "%*pbl\n" : "%*pb\n", cpumask_pr_args(mask));
-}
-
/**
* cpumap_print_bitmask_to_buf - copies the cpumask into the buffer as
* hex values of cpumask
diff --git a/lib/bitmap-str.c b/lib/bitmap-str.c
index 26d36c938c6a..dd9aa0635fa5 100644
--- a/lib/bitmap-str.c
+++ b/lib/bitmap-str.c
@@ -75,8 +75,7 @@ static int bitmap_print_to_buf(bool list, char *buf, const unsigned long *maskp,
* @off: in the string from which we are copying, We copy to @buf
* @count: the maximum number of bytes to print
*
- * The sprintf("%*pb[l]") is used indirectly via its cpumap wrapper
- * cpumap_print_to_pagebuf() or directly by drivers to export hexadecimal
+ * The sprintf("%*pb[l]") format is used by drivers to export hexadecimal
* bitmask and decimal list to userspace by sysfs ABI.
* Drivers might be using a normal attribute for this kind of ABIs. A
* normal attribute typically has show entry as below::
@@ -115,9 +114,9 @@ static int bitmap_print_to_buf(bool list, char *buf, const unsigned long *maskp,
* parameters such as off, count from bin_attribute show entry to this API.
*
* The role of cpumap_print_bitmask_to_buf() and cpumap_print_list_to_buf()
- * is similar with cpumap_print_to_pagebuf(), the difference is that
- * scnprintf("%*pb[l]") mainly serves sysfs attribute with the assumption
- * the destination buffer is exactly one page and won't be more than one page.
+ * is similar to direct sysfs_emit("%*pb[l]") formatting, but the latter
+ * assumes the destination buffer is exactly one page and won't be more than
+ * one page.
* cpumap_print_bitmask_to_buf() and cpumap_print_list_to_buf(), on the other
* hand, mainly serves bin_attribute which doesn't work with exact one page,
* and it can break the size limit of converted decimal list and hexadecimal
--
2.51.0
^ permalink raw reply related
* [PATCH 15/16] thermal: intel: Use sysfs_emit() for powerclamp cpumask
From: Yury Norov @ 2026-05-28 18:36 UTC (permalink / raw)
To: Andrew Morton, Rasmus Villemoes, Yury Norov
Cc: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy (CS GROUP), Peter Zijlstra,
Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
H. Peter Anvin, Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
linux-perf-users, linux-acpi, driver-core, linux-pm,
linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528183625.870813-1-ynorov@nvidia.com>
cpumask_get() is used as a sysfs getter for the cpumask module
parameter. Use sysfs_emit() and cpumask_pr_args() to emit the mask.
This prepares for removing cpumap_print_to_pagebuf().
Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
drivers/thermal/intel/intel_powerclamp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
index ccf380da12f2..bd7fd98dc310 100644
--- a/drivers/thermal/intel/intel_powerclamp.c
+++ b/drivers/thermal/intel/intel_powerclamp.c
@@ -200,7 +200,7 @@ static int cpumask_get(char *buf, const struct kernel_param *kp)
if (!cpumask_available(idle_injection_cpu_mask))
return -ENODEV;
- return cpumap_print_to_pagebuf(false, buf, idle_injection_cpu_mask);
+ return sysfs_emit(buf, "%*pb\n", cpumask_pr_args(idle_injection_cpu_mask));
}
static const struct kernel_param_ops cpumask_ops = {
--
2.51.0
^ permalink raw reply related
* [PATCH 14/16] powercap: intel_rapl: Use sysfs_emit() for cpumask show
From: Yury Norov @ 2026-05-28 18:36 UTC (permalink / raw)
To: Andrew Morton, Rasmus Villemoes, Yury Norov
Cc: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy (CS GROUP), Peter Zijlstra,
Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
H. Peter Anvin, Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
linux-perf-users, linux-acpi, driver-core, linux-pm,
linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528183625.870813-1-ynorov@nvidia.com>
cpumask_show() is a sysfs show callback. Use sysfs_emit() and
cpumask_pr_args() to emit the mask.
This prepares for removing cpumap_print_to_pagebuf().
Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
drivers/powercap/intel_rapl_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c
index a8dd02dff0a0..b38d4a7799a8 100644
--- a/drivers/powercap/intel_rapl_common.c
+++ b/drivers/powercap/intel_rapl_common.c
@@ -1441,7 +1441,7 @@ static ssize_t cpumask_show(struct device *dev,
}
cpus_read_unlock();
- ret = cpumap_print_to_pagebuf(true, buf, cpu_mask);
+ ret = sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpu_mask));
free_cpumask_var(cpu_mask);
--
2.51.0
^ permalink raw reply related
* [PATCH 13/16] perf: Use sysfs_emit() for cpumask show callbacks
From: Yury Norov @ 2026-05-28 18:36 UTC (permalink / raw)
To: Andrew Morton, Rasmus Villemoes, Yury Norov
Cc: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy (CS GROUP), Peter Zijlstra,
Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
H. Peter Anvin, Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
linux-perf-users, linux-acpi, driver-core, linux-pm,
linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528183625.870813-1-ynorov@nvidia.com>
These callbacks are sysfs show paths.
Use sysfs_emit() and cpumask_pr_args() to emit the masks.
This prepares for removing cpumap_print_to_pagebuf().
Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
drivers/perf/alibaba_uncore_drw_pmu.c | 2 +-
drivers/perf/amlogic/meson_ddr_pmu_core.c | 2 +-
drivers/perf/arm-cci.c | 2 +-
drivers/perf/arm-ccn.c | 2 +-
drivers/perf/arm-cmn.c | 2 +-
drivers/perf/arm-ni.c | 2 +-
drivers/perf/arm_cspmu/arm_cspmu.c | 2 +-
drivers/perf/arm_dmc620_pmu.c | 4 ++--
drivers/perf/arm_dsu_pmu.c | 2 +-
drivers/perf/arm_pmu.c | 2 +-
drivers/perf/arm_smmuv3_pmu.c | 2 +-
drivers/perf/arm_spe_pmu.c | 2 +-
drivers/perf/cxl_pmu.c | 2 +-
drivers/perf/dwc_pcie_pmu.c | 2 +-
drivers/perf/fsl_imx8_ddr_perf.c | 2 +-
drivers/perf/fsl_imx9_ddr_perf.c | 2 +-
drivers/perf/fujitsu_uncore_pmu.c | 2 +-
drivers/perf/hisilicon/hisi_pcie_pmu.c | 2 +-
drivers/perf/hisilicon/hisi_uncore_pmu.c | 2 +-
drivers/perf/marvell_cn10k_ddr_pmu.c | 2 +-
drivers/perf/marvell_cn10k_tad_pmu.c | 2 +-
drivers/perf/marvell_pem_pmu.c | 2 +-
drivers/perf/nvidia_t410_c2c_pmu.c | 2 +-
drivers/perf/nvidia_t410_cmem_latency_pmu.c | 2 +-
drivers/perf/qcom_l2_pmu.c | 2 +-
drivers/perf/qcom_l3_pmu.c | 2 +-
drivers/perf/starfive_starlink_pmu.c | 2 +-
drivers/perf/thunderx2_pmu.c | 2 +-
drivers/perf/xgene_pmu.c | 2 +-
kernel/events/core.c | 2 +-
30 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/drivers/perf/alibaba_uncore_drw_pmu.c b/drivers/perf/alibaba_uncore_drw_pmu.c
index ac49d3b2dad6..74786a5dd6a2 100644
--- a/drivers/perf/alibaba_uncore_drw_pmu.c
+++ b/drivers/perf/alibaba_uncore_drw_pmu.c
@@ -221,7 +221,7 @@ static ssize_t ali_drw_pmu_cpumask_show(struct device *dev,
{
struct ali_drw_pmu *drw_pmu = to_ali_drw_pmu(dev_get_drvdata(dev));
- return cpumap_print_to_pagebuf(true, buf, cpumask_of(drw_pmu->cpu));
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(drw_pmu->cpu)));
}
static struct device_attribute ali_drw_pmu_cpumask_attr =
diff --git a/drivers/perf/amlogic/meson_ddr_pmu_core.c b/drivers/perf/amlogic/meson_ddr_pmu_core.c
index c1e755c356a3..f614aa3434a5 100644
--- a/drivers/perf/amlogic/meson_ddr_pmu_core.c
+++ b/drivers/perf/amlogic/meson_ddr_pmu_core.c
@@ -191,7 +191,7 @@ static ssize_t meson_ddr_perf_cpumask_show(struct device *dev,
{
struct ddr_pmu *pmu = dev_get_drvdata(dev);
- return cpumap_print_to_pagebuf(true, buf, cpumask_of(pmu->cpu));
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(pmu->cpu)));
}
static struct device_attribute meson_ddr_perf_cpumask_attr =
diff --git a/drivers/perf/arm-cci.c b/drivers/perf/arm-cci.c
index 1cc3214d6b6d..f0ef0a679e74 100644
--- a/drivers/perf/arm-cci.c
+++ b/drivers/perf/arm-cci.c
@@ -1351,7 +1351,7 @@ static ssize_t pmu_cpumask_attr_show(struct device *dev,
struct pmu *pmu = dev_get_drvdata(dev);
struct cci_pmu *cci_pmu = to_cci_pmu(pmu);
- return cpumap_print_to_pagebuf(true, buf, cpumask_of(cci_pmu->cpu));
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(cci_pmu->cpu)));
}
static struct device_attribute pmu_cpumask_attr =
diff --git a/drivers/perf/arm-ccn.c b/drivers/perf/arm-ccn.c
index 8af3563fdf60..d5dcb4280434 100644
--- a/drivers/perf/arm-ccn.c
+++ b/drivers/perf/arm-ccn.c
@@ -538,7 +538,7 @@ static ssize_t arm_ccn_pmu_cpumask_show(struct device *dev,
{
struct arm_ccn *ccn = pmu_to_arm_ccn(dev_get_drvdata(dev));
- return cpumap_print_to_pagebuf(true, buf, cpumask_of(ccn->dt.cpu));
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(ccn->dt.cpu)));
}
static struct device_attribute arm_ccn_pmu_cpumask_attr =
diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index f5305c8fdca4..2187ba763b72 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -1326,7 +1326,7 @@ static ssize_t arm_cmn_cpumask_show(struct device *dev,
{
struct arm_cmn *cmn = to_cmn(dev_get_drvdata(dev));
- return cpumap_print_to_pagebuf(true, buf, cpumask_of(cmn->cpu));
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(cmn->cpu)));
}
static struct device_attribute arm_cmn_cpumask_attr =
diff --git a/drivers/perf/arm-ni.c b/drivers/perf/arm-ni.c
index 66858c65215d..03a1c6bf9223 100644
--- a/drivers/perf/arm-ni.c
+++ b/drivers/perf/arm-ni.c
@@ -239,7 +239,7 @@ static ssize_t arm_ni_cpumask_show(struct device *dev,
{
struct arm_ni *ni = cd_to_ni(pmu_to_cd(dev_get_drvdata(dev)));
- return cpumap_print_to_pagebuf(true, buf, cpumask_of(ni->cpu));
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(ni->cpu)));
}
static struct device_attribute arm_ni_cpumask_attr =
diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c
index 80fb314d5135..e6292021f653 100644
--- a/drivers/perf/arm_cspmu/arm_cspmu.c
+++ b/drivers/perf/arm_cspmu/arm_cspmu.c
@@ -305,7 +305,7 @@ static ssize_t arm_cspmu_cpumask_show(struct device *dev,
default:
return 0;
}
- return cpumap_print_to_pagebuf(true, buf, cpumask);
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask));
}
static struct attribute *arm_cspmu_cpumask_attrs[] = {
diff --git a/drivers/perf/arm_dmc620_pmu.c b/drivers/perf/arm_dmc620_pmu.c
index 4f6b196160f8..467147a05eec 100644
--- a/drivers/perf/arm_dmc620_pmu.c
+++ b/drivers/perf/arm_dmc620_pmu.c
@@ -237,8 +237,8 @@ static ssize_t dmc620_pmu_cpumask_show(struct device *dev,
{
struct dmc620_pmu *dmc620_pmu = to_dmc620_pmu(dev_get_drvdata(dev));
- return cpumap_print_to_pagebuf(true, buf,
- cpumask_of(dmc620_pmu->irq->cpu));
+ return sysfs_emit(buf, "%*pbl\n",
+ cpumask_pr_args(cpumask_of(dmc620_pmu->irq->cpu)));
}
static struct device_attribute dmc620_pmu_cpumask_attr =
diff --git a/drivers/perf/arm_dsu_pmu.c b/drivers/perf/arm_dsu_pmu.c
index 32b0dd7c693b..bcbd19e075a5 100644
--- a/drivers/perf/arm_dsu_pmu.c
+++ b/drivers/perf/arm_dsu_pmu.c
@@ -157,7 +157,7 @@ static ssize_t dsu_pmu_cpumask_show(struct device *dev,
default:
return 0;
}
- return cpumap_print_to_pagebuf(true, buf, cpumask);
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask));
}
static struct attribute *dsu_pmu_format_attrs[] = {
diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index 939bcbd433aa..51ab6cc52ca0 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -570,7 +570,7 @@ static ssize_t cpus_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct arm_pmu *armpmu = to_arm_pmu(dev_get_drvdata(dev));
- return cpumap_print_to_pagebuf(true, buf, &armpmu->supported_cpus);
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&armpmu->supported_cpus));
}
static DEVICE_ATTR_RO(cpus);
diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
index 621f02a7f43b..8ce34e6bb82b 100644
--- a/drivers/perf/arm_smmuv3_pmu.c
+++ b/drivers/perf/arm_smmuv3_pmu.c
@@ -537,7 +537,7 @@ static ssize_t smmu_pmu_cpumask_show(struct device *dev,
{
struct smmu_pmu *smmu_pmu = to_smmu_pmu(dev_get_drvdata(dev));
- return cpumap_print_to_pagebuf(true, buf, cpumask_of(smmu_pmu->on_cpu));
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(smmu_pmu->on_cpu)));
}
static struct device_attribute smmu_pmu_cpumask_attr =
diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c
index dbd0da111639..9f786fd48cdd 100644
--- a/drivers/perf/arm_spe_pmu.c
+++ b/drivers/perf/arm_spe_pmu.c
@@ -343,7 +343,7 @@ static ssize_t cpumask_show(struct device *dev,
{
struct arm_spe_pmu *spe_pmu = dev_get_drvdata(dev);
- return cpumap_print_to_pagebuf(true, buf, &spe_pmu->supported_cpus);
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&spe_pmu->supported_cpus));
}
static DEVICE_ATTR_RO(cpumask);
diff --git a/drivers/perf/cxl_pmu.c b/drivers/perf/cxl_pmu.c
index 68a54d97d2a8..0735eb33f5f3 100644
--- a/drivers/perf/cxl_pmu.c
+++ b/drivers/perf/cxl_pmu.c
@@ -493,7 +493,7 @@ static ssize_t cpumask_show(struct device *dev, struct device_attribute *attr,
{
struct cxl_pmu_info *info = dev_get_drvdata(dev);
- return cpumap_print_to_pagebuf(true, buf, cpumask_of(info->on_cpu));
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(info->on_cpu)));
}
static DEVICE_ATTR_RO(cpumask);
diff --git a/drivers/perf/dwc_pcie_pmu.c b/drivers/perf/dwc_pcie_pmu.c
index 5385401fa9cf..291e776d6f6a 100644
--- a/drivers/perf/dwc_pcie_pmu.c
+++ b/drivers/perf/dwc_pcie_pmu.c
@@ -117,7 +117,7 @@ static ssize_t cpumask_show(struct device *dev,
{
struct dwc_pcie_pmu *pcie_pmu = to_dwc_pcie_pmu(dev_get_drvdata(dev));
- return cpumap_print_to_pagebuf(true, buf, cpumask_of(pcie_pmu->on_cpu));
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(pcie_pmu->on_cpu)));
}
static DEVICE_ATTR_RO(cpumask);
diff --git a/drivers/perf/fsl_imx8_ddr_perf.c b/drivers/perf/fsl_imx8_ddr_perf.c
index bcdf5575d71c..3760ebe02674 100644
--- a/drivers/perf/fsl_imx8_ddr_perf.c
+++ b/drivers/perf/fsl_imx8_ddr_perf.c
@@ -237,7 +237,7 @@ static ssize_t ddr_perf_cpumask_show(struct device *dev,
{
struct ddr_pmu *pmu = dev_get_drvdata(dev);
- return cpumap_print_to_pagebuf(true, buf, cpumask_of(pmu->cpu));
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(pmu->cpu)));
}
static struct device_attribute ddr_perf_cpumask_attr =
diff --git a/drivers/perf/fsl_imx9_ddr_perf.c b/drivers/perf/fsl_imx9_ddr_perf.c
index 7050b48c0467..6fee5eb5087a 100644
--- a/drivers/perf/fsl_imx9_ddr_perf.c
+++ b/drivers/perf/fsl_imx9_ddr_perf.c
@@ -159,7 +159,7 @@ static ssize_t ddr_perf_cpumask_show(struct device *dev,
{
struct ddr_pmu *pmu = dev_get_drvdata(dev);
- return cpumap_print_to_pagebuf(true, buf, cpumask_of(pmu->cpu));
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(pmu->cpu)));
}
static struct device_attribute ddr_perf_cpumask_attr =
diff --git a/drivers/perf/fujitsu_uncore_pmu.c b/drivers/perf/fujitsu_uncore_pmu.c
index c3c6f56474ad..a07877632d53 100644
--- a/drivers/perf/fujitsu_uncore_pmu.c
+++ b/drivers/perf/fujitsu_uncore_pmu.c
@@ -374,7 +374,7 @@ static ssize_t cpumask_show(struct device *dev,
{
struct uncore_pmu *uncorepmu = to_uncore_pmu(dev_get_drvdata(dev));
- return cpumap_print_to_pagebuf(true, buf, cpumask_of(uncorepmu->cpu));
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(uncorepmu->cpu)));
}
static DEVICE_ATTR_RO(cpumask);
diff --git a/drivers/perf/hisilicon/hisi_pcie_pmu.c b/drivers/perf/hisilicon/hisi_pcie_pmu.c
index c5394d007b61..0f55d871c67e 100644
--- a/drivers/perf/hisilicon/hisi_pcie_pmu.c
+++ b/drivers/perf/hisilicon/hisi_pcie_pmu.c
@@ -121,7 +121,7 @@ static ssize_t cpumask_show(struct device *dev, struct device_attribute *attr, c
{
struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(dev_get_drvdata(dev));
- return cpumap_print_to_pagebuf(true, buf, cpumask_of(pcie_pmu->on_cpu));
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(pcie_pmu->on_cpu)));
}
static DEVICE_ATTR_RO(cpumask);
diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.c b/drivers/perf/hisilicon/hisi_uncore_pmu.c
index de71dcf11653..0ff2fdf4b3e2 100644
--- a/drivers/perf/hisilicon/hisi_uncore_pmu.c
+++ b/drivers/perf/hisilicon/hisi_uncore_pmu.c
@@ -56,7 +56,7 @@ static ssize_t hisi_associated_cpus_sysfs_show(struct device *dev,
{
struct hisi_pmu *hisi_pmu = to_hisi_pmu(dev_get_drvdata(dev));
- return cpumap_print_to_pagebuf(true, buf, &hisi_pmu->associated_cpus);
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&hisi_pmu->associated_cpus));
}
static DEVICE_ATTR(associated_cpus, 0444, hisi_associated_cpus_sysfs_show, NULL);
diff --git a/drivers/perf/marvell_cn10k_ddr_pmu.c b/drivers/perf/marvell_cn10k_ddr_pmu.c
index 72ac17efd846..8681e8715cb3 100644
--- a/drivers/perf/marvell_cn10k_ddr_pmu.c
+++ b/drivers/perf/marvell_cn10k_ddr_pmu.c
@@ -364,7 +364,7 @@ static ssize_t cn10k_ddr_perf_cpumask_show(struct device *dev,
{
struct cn10k_ddr_pmu *pmu = dev_get_drvdata(dev);
- return cpumap_print_to_pagebuf(true, buf, cpumask_of(pmu->cpu));
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(pmu->cpu)));
}
static struct device_attribute cn10k_ddr_perf_cpumask_attr =
diff --git a/drivers/perf/marvell_cn10k_tad_pmu.c b/drivers/perf/marvell_cn10k_tad_pmu.c
index 51ccb0befa05..54909d0031b7 100644
--- a/drivers/perf/marvell_cn10k_tad_pmu.c
+++ b/drivers/perf/marvell_cn10k_tad_pmu.c
@@ -258,7 +258,7 @@ static ssize_t tad_pmu_cpumask_show(struct device *dev,
{
struct tad_pmu *tad_pmu = to_tad_pmu(dev_get_drvdata(dev));
- return cpumap_print_to_pagebuf(true, buf, cpumask_of(tad_pmu->cpu));
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(tad_pmu->cpu)));
}
static DEVICE_ATTR(cpumask, 0444, tad_pmu_cpumask_show, NULL);
diff --git a/drivers/perf/marvell_pem_pmu.c b/drivers/perf/marvell_pem_pmu.c
index 29fbcd1848e4..cf1d8cdb1318 100644
--- a/drivers/perf/marvell_pem_pmu.c
+++ b/drivers/perf/marvell_pem_pmu.c
@@ -164,7 +164,7 @@ static ssize_t pem_perf_cpumask_show(struct device *dev,
{
struct pem_pmu *pmu = dev_get_drvdata(dev);
- return cpumap_print_to_pagebuf(true, buf, cpumask_of(pmu->cpu));
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(pmu->cpu)));
}
static struct device_attribute pem_perf_cpumask_attr =
diff --git a/drivers/perf/nvidia_t410_c2c_pmu.c b/drivers/perf/nvidia_t410_c2c_pmu.c
index 411987153ff3..bff875f4f625 100644
--- a/drivers/perf/nvidia_t410_c2c_pmu.c
+++ b/drivers/perf/nvidia_t410_c2c_pmu.c
@@ -658,7 +658,7 @@ static ssize_t nv_c2c_pmu_cpumask_show(struct device *dev,
default:
return 0;
}
- return cpumap_print_to_pagebuf(true, buf, cpumask);
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask));
}
#define NV_C2C_PMU_CPUMASK_ATTR(_name, _config) \
diff --git a/drivers/perf/nvidia_t410_cmem_latency_pmu.c b/drivers/perf/nvidia_t410_cmem_latency_pmu.c
index acb8f5571522..6c8e41598ec1 100644
--- a/drivers/perf/nvidia_t410_cmem_latency_pmu.c
+++ b/drivers/perf/nvidia_t410_cmem_latency_pmu.c
@@ -501,7 +501,7 @@ static ssize_t cmem_lat_pmu_cpumask_show(struct device *dev,
default:
return 0;
}
- return cpumap_print_to_pagebuf(true, buf, cpumask);
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask));
}
#define NV_PMU_CPUMASK_ATTR(_name, _config) \
diff --git a/drivers/perf/qcom_l2_pmu.c b/drivers/perf/qcom_l2_pmu.c
index ea8c85729937..c0c522b10b72 100644
--- a/drivers/perf/qcom_l2_pmu.c
+++ b/drivers/perf/qcom_l2_pmu.c
@@ -638,7 +638,7 @@ static ssize_t l2_cache_pmu_cpumask_show(struct device *dev,
{
struct l2cache_pmu *l2cache_pmu = to_l2cache_pmu(dev_get_drvdata(dev));
- return cpumap_print_to_pagebuf(true, buf, &l2cache_pmu->cpumask);
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&l2cache_pmu->cpumask));
}
static struct device_attribute l2_cache_pmu_cpumask_attr =
diff --git a/drivers/perf/qcom_l3_pmu.c b/drivers/perf/qcom_l3_pmu.c
index 66e6cabd6fff..c8d259dd1f80 100644
--- a/drivers/perf/qcom_l3_pmu.c
+++ b/drivers/perf/qcom_l3_pmu.c
@@ -663,7 +663,7 @@ static ssize_t cpumask_show(struct device *dev,
{
struct l3cache_pmu *l3pmu = to_l3cache_pmu(dev_get_drvdata(dev));
- return cpumap_print_to_pagebuf(true, buf, &l3pmu->cpumask);
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&l3pmu->cpumask));
}
static DEVICE_ATTR_RO(cpumask);
diff --git a/drivers/perf/starfive_starlink_pmu.c b/drivers/perf/starfive_starlink_pmu.c
index 964897c2baa9..222a0a34e211 100644
--- a/drivers/perf/starfive_starlink_pmu.c
+++ b/drivers/perf/starfive_starlink_pmu.c
@@ -131,7 +131,7 @@ cpumask_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct starlink_pmu *starlink_pmu = to_starlink_pmu(dev_get_drvdata(dev));
- return cpumap_print_to_pagebuf(true, buf, &starlink_pmu->cpumask);
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&starlink_pmu->cpumask));
}
static DEVICE_ATTR_RO(cpumask);
diff --git a/drivers/perf/thunderx2_pmu.c b/drivers/perf/thunderx2_pmu.c
index 6ed4707bd6bb..a69c02d2d874 100644
--- a/drivers/perf/thunderx2_pmu.c
+++ b/drivers/perf/thunderx2_pmu.c
@@ -254,7 +254,7 @@ static ssize_t cpumask_show(struct device *dev, struct device_attribute *attr,
struct tx2_uncore_pmu *tx2_pmu;
tx2_pmu = pmu_to_tx2_pmu(dev_get_drvdata(dev));
- return cpumap_print_to_pagebuf(true, buf, cpumask_of(tx2_pmu->cpu));
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(tx2_pmu->cpu)));
}
static DEVICE_ATTR_RO(cpumask);
diff --git a/drivers/perf/xgene_pmu.c b/drivers/perf/xgene_pmu.c
index 33b5497bdc06..e9e4871db08d 100644
--- a/drivers/perf/xgene_pmu.c
+++ b/drivers/perf/xgene_pmu.c
@@ -595,7 +595,7 @@ static ssize_t cpumask_show(struct device *dev,
{
struct xgene_pmu_dev *pmu_dev = to_pmu_dev(dev_get_drvdata(dev));
- return cpumap_print_to_pagebuf(true, buf, &pmu_dev->parent->cpu);
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&pmu_dev->parent->cpu));
}
static DEVICE_ATTR_RO(cpumask);
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 7935d5663944..61689d348abd 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -12657,7 +12657,7 @@ static ssize_t cpumask_show(struct device *dev, struct device_attribute *attr,
struct cpumask *mask = perf_scope_cpumask(pmu->scope);
if (mask)
- return cpumap_print_to_pagebuf(true, buf, mask);
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(mask));
return 0;
}
--
2.51.0
^ permalink raw reply related
* [PATCH 12/16] PCI/sysfs: Use sysfs_emit() for cpumask show callbacks
From: Yury Norov @ 2026-05-28 18:36 UTC (permalink / raw)
To: Andrew Morton, Rasmus Villemoes, Yury Norov
Cc: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy (CS GROUP), Peter Zijlstra,
Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
H. Peter Anvin, Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
linux-perf-users, linux-acpi, driver-core, linux-pm,
linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528183625.870813-1-ynorov@nvidia.com>
These callbacks are sysfs show paths.
Use sysfs_emit() and cpumask_pr_args() to emit the masks.
This prepares for removing cpumap_print_to_pagebuf().
Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
drivers/pci/pci-sysfs.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index d37860841260..319c1d1459ac 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -114,7 +114,8 @@ static ssize_t pci_dev_show_local_cpu(struct device *dev, bool list,
#else
mask = cpumask_of_pcibus(to_pci_dev(dev)->bus);
#endif
- return cpumap_print_to_pagebuf(list, buf, mask);
+ return sysfs_emit(buf, list ? "%*pbl\n" : "%*pb\n",
+ cpumask_pr_args(mask));
}
static ssize_t local_cpus_show(struct device *dev,
@@ -139,7 +140,7 @@ static ssize_t cpuaffinity_show(struct device *dev,
{
const struct cpumask *cpumask = cpumask_of_pcibus(to_pci_bus(dev));
- return cpumap_print_to_pagebuf(false, buf, cpumask);
+ return sysfs_emit(buf, "%*pb\n", cpumask_pr_args(cpumask));
}
static DEVICE_ATTR_RO(cpuaffinity);
@@ -148,7 +149,7 @@ static ssize_t cpulistaffinity_show(struct device *dev,
{
const struct cpumask *cpumask = cpumask_of_pcibus(to_pci_bus(dev));
- return cpumap_print_to_pagebuf(true, buf, cpumask);
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask));
}
static DEVICE_ATTR_RO(cpulistaffinity);
--
2.51.0
^ permalink raw reply related
* [PATCH 11/16] nvdimm: Use sysfs_emit() for cpumask show callback
From: Yury Norov @ 2026-05-28 18:36 UTC (permalink / raw)
To: Andrew Morton, Rasmus Villemoes, Yury Norov
Cc: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy (CS GROUP), Peter Zijlstra,
Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
H. Peter Anvin, Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
linux-perf-users, linux-acpi, driver-core, linux-pm,
linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528183625.870813-1-ynorov@nvidia.com>
nvdimm_pmu_cpumask_show() is a sysfs show callback. Use sysfs_emit() and
cpumask_pr_args() to emit the mask.
This prepares for removing cpumap_print_to_pagebuf().
Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
drivers/nvdimm/nd_perf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvdimm/nd_perf.c b/drivers/nvdimm/nd_perf.c
index e0b51438dc9b..9e497cae65b3 100644
--- a/drivers/nvdimm/nd_perf.c
+++ b/drivers/nvdimm/nd_perf.c
@@ -123,7 +123,7 @@ static ssize_t nvdimm_pmu_cpumask_show(struct device *dev,
nd_pmu = container_of(pmu, struct nvdimm_pmu, pmu);
- return cpumap_print_to_pagebuf(true, buf, cpumask_of(nd_pmu->cpu));
+ return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(nd_pmu->cpu)));
}
static int nvdimm_pmu_cpu_offline(unsigned int cpu, struct hlist_node *node)
--
2.51.0
^ permalink raw reply related
* [PATCH 10/16] RDMA/hfi1: Use sysfs_emit() for cpumask show helper
From: Yury Norov @ 2026-05-28 18:36 UTC (permalink / raw)
To: Andrew Morton, Rasmus Villemoes, Yury Norov
Cc: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy (CS GROUP), Peter Zijlstra,
Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
H. Peter Anvin, Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
linux-perf-users, linux-acpi, driver-core, linux-pm,
linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528183625.870813-1-ynorov@nvidia.com>
sdma_get_cpu_to_sde_map() is used by a sysfs show callback.
Use sysfs_emit() and cpumask_pr_args() to emit the mask.
This prepares for removing cpumap_print_to_pagebuf().
Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
drivers/infiniband/hw/hfi1/sdma.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/hfi1/sdma.c b/drivers/infiniband/hw/hfi1/sdma.c
index cfd9dd0f7e81..f253c8ee182d 100644
--- a/drivers/infiniband/hw/hfi1/sdma.c
+++ b/drivers/infiniband/hw/hfi1/sdma.c
@@ -11,6 +11,7 @@
#include <linux/timer.h>
#include <linux/vmalloc.h>
#include <linux/highmem.h>
+#include <linux/sysfs.h>
#include "hfi.h"
#include "common.h"
@@ -1049,7 +1050,7 @@ ssize_t sdma_get_cpu_to_sde_map(struct sdma_engine *sde, char *buf)
if (cpumask_empty(&sde->cpu_mask))
snprintf(buf, PAGE_SIZE, "%s\n", "empty");
else
- cpumap_print_to_pagebuf(true, buf, &sde->cpu_mask);
+ sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&sde->cpu_mask));
mutex_unlock(&process_to_sde_mutex);
return strnlen(buf, PAGE_SIZE);
}
--
2.51.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox