* [PATCH] tracing: fprobe: Remove __packed from generic __fprobe_header
@ 2026-04-28 8:30 Markus Schneider-Pargmann (The Capable Hub)
2026-06-10 7:17 ` Markus Schneider-Pargmann
2026-06-10 8:17 ` Masami Hiramatsu
0 siblings, 2 replies; 5+ messages in thread
From: Markus Schneider-Pargmann (The Capable Hub) @ 2026-04-28 8:30 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers,
Heiko Carstens
Cc: linux-kernel, linux-trace-kernel,
Markus Schneider-Pargmann (The Capable Hub)
fp pointer and unsigned long have the same size on all relevant
architectures that build Linux. Furthermore this struct is only used in
architectures that do not set ARCH_DEFINE_ENCODE_FPROBE_HEADER which is
set only for 64bit architectures (apart from LoongArch).
Both fields are aligned on these architectures so the struct with
__packed and without it are the same.
Remove the __packed as it is unnecessary.
Fixes: 4346ba160409 ("fprobe: Rewrite fprobe on function-graph tracer")
Signed-off-by: Markus Schneider-Pargmann (The Capable Hub) <msp@baylibre.com>
---
kernel/trace/fprobe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c
index cc49ebd2a773..21751dcdb7b9 100644
--- a/kernel/trace/fprobe.c
+++ b/kernel/trace/fprobe.c
@@ -181,7 +181,7 @@ static inline void read_fprobe_header(unsigned long *stack,
struct __fprobe_header {
struct fprobe *fp;
unsigned long size_words;
-} __packed;
+};
#define FPROBE_HEADER_SIZE_IN_LONG SIZE_IN_LONG(sizeof(struct __fprobe_header))
---
base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
change-id: 20260427-topic-fprobe-packed-v7-1-f44f9bbdedf6
Best regards,
--
Markus Schneider-Pargmann (The Capable Hub) <msp@baylibre.com>
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] tracing: fprobe: Remove __packed from generic __fprobe_header
2026-04-28 8:30 [PATCH] tracing: fprobe: Remove __packed from generic __fprobe_header Markus Schneider-Pargmann (The Capable Hub)
@ 2026-06-10 7:17 ` Markus Schneider-Pargmann
2026-06-10 8:17 ` Masami Hiramatsu
1 sibling, 0 replies; 5+ messages in thread
From: Markus Schneider-Pargmann @ 2026-06-10 7:17 UTC (permalink / raw)
To: Markus Schneider-Pargmann (The Capable Hub), Steven Rostedt,
Masami Hiramatsu, Mathieu Desnoyers, Heiko Carstens
Cc: linux-kernel, linux-trace-kernel
[-- Attachment #1: Type: text/plain, Size: 1506 bytes --]
Hi,
On Tue Apr 28, 2026 at 10:30 AM CEST, Markus Schneider-Pargmann (The Capable Hub) wrote:
> fp pointer and unsigned long have the same size on all relevant
> architectures that build Linux. Furthermore this struct is only used in
> architectures that do not set ARCH_DEFINE_ENCODE_FPROBE_HEADER which is
> set only for 64bit architectures (apart from LoongArch).
>
> Both fields are aligned on these architectures so the struct with
> __packed and without it are the same.
>
> Remove the __packed as it is unnecessary.
Friendly ping on this.
Best
Markus
>
> Fixes: 4346ba160409 ("fprobe: Rewrite fprobe on function-graph tracer")
> Signed-off-by: Markus Schneider-Pargmann (The Capable Hub) <msp@baylibre.com>
> ---
> kernel/trace/fprobe.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c
> index cc49ebd2a773..21751dcdb7b9 100644
> --- a/kernel/trace/fprobe.c
> +++ b/kernel/trace/fprobe.c
> @@ -181,7 +181,7 @@ static inline void read_fprobe_header(unsigned long *stack,
> struct __fprobe_header {
> struct fprobe *fp;
> unsigned long size_words;
> -} __packed;
> +};
>
> #define FPROBE_HEADER_SIZE_IN_LONG SIZE_IN_LONG(sizeof(struct __fprobe_header))
>
>
> ---
> base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
> change-id: 20260427-topic-fprobe-packed-v7-1-f44f9bbdedf6
>
> Best regards,
> --
> Markus Schneider-Pargmann (The Capable Hub) <msp@baylibre.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 289 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] tracing: fprobe: Remove __packed from generic __fprobe_header
2026-04-28 8:30 [PATCH] tracing: fprobe: Remove __packed from generic __fprobe_header Markus Schneider-Pargmann (The Capable Hub)
2026-06-10 7:17 ` Markus Schneider-Pargmann
@ 2026-06-10 8:17 ` Masami Hiramatsu
2026-06-10 9:20 ` Markus Schneider-Pargmann
2026-06-10 11:06 ` David Laight
1 sibling, 2 replies; 5+ messages in thread
From: Masami Hiramatsu @ 2026-06-10 8:17 UTC (permalink / raw)
To: Markus Schneider-Pargmann (The Capable Hub)
Cc: Steven Rostedt, Mathieu Desnoyers, Heiko Carstens, linux-kernel,
linux-trace-kernel
Hi Markus,
Thanks for ping me.
On Tue, 28 Apr 2026 10:30:29 +0200
"Markus Schneider-Pargmann (The Capable Hub)" <msp@baylibre.com> wrote:
> fp pointer and unsigned long have the same size on all relevant
> architectures that build Linux. Furthermore this struct is only used in
> architectures that do not set ARCH_DEFINE_ENCODE_FPROBE_HEADER which is
> set only for 64bit architectures (apart from LoongArch).
>
> Both fields are aligned on these architectures so the struct with
> __packed and without it are the same.
>
> Remove the __packed as it is unnecessary.
>
> Fixes: 4346ba160409 ("fprobe: Rewrite fprobe on function-graph tracer")
NOTE: This is not a Fix, but just cleanup or minor update. Or, you have
any problem with this __packed attribute?
Unless there is no problem (or any concern), I would like to keep this
as it is.
Thank you,
> Signed-off-by: Markus Schneider-Pargmann (The Capable Hub) <msp@baylibre.com>
> ---
> kernel/trace/fprobe.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c
> index cc49ebd2a773..21751dcdb7b9 100644
> --- a/kernel/trace/fprobe.c
> +++ b/kernel/trace/fprobe.c
> @@ -181,7 +181,7 @@ static inline void read_fprobe_header(unsigned long *stack,
> struct __fprobe_header {
> struct fprobe *fp;
> unsigned long size_words;
> -} __packed;
> +};
>
> #define FPROBE_HEADER_SIZE_IN_LONG SIZE_IN_LONG(sizeof(struct __fprobe_header))
>
>
> ---
> base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
> change-id: 20260427-topic-fprobe-packed-v7-1-f44f9bbdedf6
>
> Best regards,
> --
> Markus Schneider-Pargmann (The Capable Hub) <msp@baylibre.com>
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] tracing: fprobe: Remove __packed from generic __fprobe_header
2026-06-10 8:17 ` Masami Hiramatsu
@ 2026-06-10 9:20 ` Markus Schneider-Pargmann
2026-06-10 11:06 ` David Laight
1 sibling, 0 replies; 5+ messages in thread
From: Markus Schneider-Pargmann @ 2026-06-10 9:20 UTC (permalink / raw)
To: Masami Hiramatsu, Markus Schneider-Pargmann (The Capable Hub)
Cc: Steven Rostedt, Mathieu Desnoyers, Heiko Carstens, linux-kernel,
linux-trace-kernel
[-- Attachment #1: Type: text/plain, Size: 1560 bytes --]
Hi Masami,
On Wed Jun 10, 2026 at 10:17 AM CEST, Masami Hiramatsu wrote:
> Hi Markus,
>
> Thanks for ping me.
>
> On Tue, 28 Apr 2026 10:30:29 +0200
> "Markus Schneider-Pargmann (The Capable Hub)" <msp@baylibre.com> wrote:
>
>> fp pointer and unsigned long have the same size on all relevant
>> architectures that build Linux. Furthermore this struct is only used in
>> architectures that do not set ARCH_DEFINE_ENCODE_FPROBE_HEADER which is
>> set only for 64bit architectures (apart from LoongArch).
>>
>> Both fields are aligned on these architectures so the struct with
>> __packed and without it are the same.
>>
>> Remove the __packed as it is unnecessary.
>>
>> Fixes: 4346ba160409 ("fprobe: Rewrite fprobe on function-graph tracer")
>
> NOTE: This is not a Fix, but just cleanup or minor update. Or, you have
> any problem with this __packed attribute?
Thanks, yes it is not fixing a bug, I can remove this.
>
> Unless there is no problem (or any concern), I would like to keep this
> as it is.
There is currently no problem with __packed in the upstream kernel. I
just thought this would be a good cleanup to remove the unnecessary
attribute. I am working on CHERI architectures where pointers have
capabilities. __packed breaks these capability tags and therefore
doesn't work on CHERI. When looking into why this struct has a __packed
attribute I didn't see a reason, so I thought this would be a good patch
for upstream as well even though CHERI is not yet relevant for upstream
linux.
Best
Markus
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 289 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] tracing: fprobe: Remove __packed from generic __fprobe_header
2026-06-10 8:17 ` Masami Hiramatsu
2026-06-10 9:20 ` Markus Schneider-Pargmann
@ 2026-06-10 11:06 ` David Laight
1 sibling, 0 replies; 5+ messages in thread
From: David Laight @ 2026-06-10 11:06 UTC (permalink / raw)
To: Masami Hiramatsu (Google)
Cc: Markus Schneider-Pargmann (The Capable Hub), Steven Rostedt,
Mathieu Desnoyers, Heiko Carstens, linux-kernel,
linux-trace-kernel
On Wed, 10 Jun 2026 17:17:40 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
> Hi Markus,
>
> Thanks for ping me.
>
> On Tue, 28 Apr 2026 10:30:29 +0200
> "Markus Schneider-Pargmann (The Capable Hub)" <msp@baylibre.com> wrote:
>
> > fp pointer and unsigned long have the same size on all relevant
> > architectures that build Linux. Furthermore this struct is only used in
> > architectures that do not set ARCH_DEFINE_ENCODE_FPROBE_HEADER which is
> > set only for 64bit architectures (apart from LoongArch).
> >
> > Both fields are aligned on these architectures so the struct with
> > __packed and without it are the same.
> >
> > Remove the __packed as it is unnecessary.
> >
> > Fixes: 4346ba160409 ("fprobe: Rewrite fprobe on function-graph tracer")
>
> NOTE: This is not a Fix, but just cleanup or minor update. Or, you have
> any problem with this __packed attribute?
>
> Unless there is no problem (or any concern), I would like to keep this
> as it is.
There is likely to be a difference on architectures that fault misaligned
accesses.
On those gcc will use multiple byte-sized accesses (and a log of shifts etc)
for code that accesses those members because it will assume that the
structure itself can be misaligned.
So you only want __packed on structures that might be misaligned and those
that contain misaligned members.
If the structure is only guaranteed to be 32bit aligned then use __packed
__aligned(4) so that two 32bit accesses get used instead of 8 8bit ones.
-- David
>
> Thank you,
>
> > Signed-off-by: Markus Schneider-Pargmann (The Capable Hub) <msp@baylibre.com>
> > ---
> > kernel/trace/fprobe.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c
> > index cc49ebd2a773..21751dcdb7b9 100644
> > --- a/kernel/trace/fprobe.c
> > +++ b/kernel/trace/fprobe.c
> > @@ -181,7 +181,7 @@ static inline void read_fprobe_header(unsigned long *stack,
> > struct __fprobe_header {
> > struct fprobe *fp;
> > unsigned long size_words;
> > -} __packed;
> > +};
> >
> > #define FPROBE_HEADER_SIZE_IN_LONG SIZE_IN_LONG(sizeof(struct __fprobe_header))
> >
> >
> > ---
> > base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
> > change-id: 20260427-topic-fprobe-packed-v7-1-f44f9bbdedf6
> >
> > Best regards,
> > --
> > Markus Schneider-Pargmann (The Capable Hub) <msp@baylibre.com>
> >
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-06-10 11:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-28 8:30 [PATCH] tracing: fprobe: Remove __packed from generic __fprobe_header Markus Schneider-Pargmann (The Capable Hub)
2026-06-10 7:17 ` Markus Schneider-Pargmann
2026-06-10 8:17 ` Masami Hiramatsu
2026-06-10 9:20 ` Markus Schneider-Pargmann
2026-06-10 11:06 ` David Laight
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox