bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Large modules with 6.15 [was: [PATCH v4 6/6] percpu/x86: Enable strict percpu checks via named AS qualifiers]
       [not found]   ` <02c00acd-9518-4371-be2c-eb63e5d11d9c@kernel.org>
@ 2025-06-05 14:32     ` Jiri Slaby
  2025-06-05 16:17       ` Alexei Starovoitov
  0 siblings, 1 reply; 2+ messages in thread
From: Jiri Slaby @ 2025-06-05 14:32 UTC (permalink / raw)
  To: Uros Bizjak, x86, linux-mm, linux-kernel, linux-bcachefs,
	linux-arch, netdev
  Cc: Nadav Amit, Dennis Zhou, Tejun Heo, Christoph Lameter,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Linus Torvalds, Andy Lutomirski, Brian Gerst,
	Peter Zijlstra, Shung-Hsi Yu, Alexei Starovoitov, Daniel Borkmann,
	John Fastabend, bpf, Martin KaFai Lau

Cc BPF people, just so you know.

On 05. 06. 25, 16:27, Jiri Slaby wrote:
> On 27. 01. 25, 17:05, Uros Bizjak wrote:
>> This patch declares percpu variables in __seg_gs/__seg_fs named AS
>> and keeps them named AS qualified until they are dereferenced with
>> percpu accessor. This approach enables various compiler check
>> for cross-namespace variable assignments.
>>
>> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
>> Acked-by: Nadav Amit <nadav.amit@gmail.com>
>> Cc: Dennis Zhou <dennis@kernel.org>
>> Cc: Tejun Heo <tj@kernel.org>
>> Cc: Christoph Lameter <cl@linux.com>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Ingo Molnar <mingo@kernel.org>
>> Cc: Borislav Petkov <bp@alien8.de>
>> Cc: Dave Hansen <dave.hansen@linux.intel.com>
>> Cc: "H. Peter Anvin" <hpa@zytor.com>
>> Cc: Linus Torvalds <torvalds@linux-foundation.org>
>> Cc: Andy Lutomirski <luto@kernel.org>
>> Cc: Brian Gerst <brgerst@gmail.com>
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> ---
>>   arch/x86/include/asm/percpu.h | 15 ++++++++++++---
>>   1 file changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/ 
>> percpu.h
>> index 27f668660abe..474d648bca9a 100644
>> --- a/arch/x86/include/asm/percpu.h
>> +++ b/arch/x86/include/asm/percpu.h
>> @@ -95,9 +95,18 @@
>>   #endif /* CONFIG_SMP */
>> -#define __my_cpu_type(var)    typeof(var) __percpu_seg_override
>> -#define __my_cpu_ptr(ptr)    (__my_cpu_type(*(ptr))*)(__force 
>> uintptr_t)(ptr)
>> -#define __my_cpu_var(var)    (*__my_cpu_ptr(&(var)))
>> +#if defined(CONFIG_USE_X86_SEG_SUPPORT) && defined(USE_TYPEOF_UNQUAL)
>> +# define __my_cpu_type(var)    typeof(var)
>> +# define __my_cpu_ptr(ptr)    (ptr)
>> +# define __my_cpu_var(var)    (var)
>> +
>> +# define __percpu_qual        __percpu_seg_override
>> +#else
>> +# define __my_cpu_type(var)    typeof(var) __percpu_seg_override
>> +# define __my_cpu_ptr(ptr)    (__my_cpu_type(*(ptr))*)(__force 
>> uintptr_t)(ptr)
>> +# define __my_cpu_var(var)    (*__my_cpu_ptr(&(var)))
>> +#endif
>> +
> 
> Another issue with this is this causes all modules in 6.15 are 2-4 times 
> (compressed size) bigger:
> $ ll /usr/lib/modules/*-[0-9]-default/kernel/drivers/atm/atmtcp.ko.zst
>  > -rw-r--r--. 1 root root 10325 May 13 11:49 /usr/lib/modules/6.14.6-2- 
> default/kernel/drivers/atm/atmtcp.ko.zst
>  > -rw-r--r--. 1 root root 39677 Jun  2 09:13 /usr/lib/modules/6.15.0-1- 
> default/kernel/drivers/atm/atmtcp.ko.zst
> 
> It's due to larger .BTF section:
> .BTF              PROGBITS         0000000000000000  [-00003080-]
> [-       00000000000011a8-]  {+00003100+}
> {+       0000000000012cf8+}  0000000000000000           0     0     1
> 
> There are a lot of new BTF types defined in each module like:
> +attribute_group STRUCT
> +backing_dev_info STRUCT
> +bdi_writeback STRUCT
> +bin_attribute STRUCT
> +bio_end_io_t TYPEDEF
> +bio_list STRUCT
> +bio_set STRUCT
> +bio STRUCT
> +bio_vec STRUCT
> 
> Reverting this gives me back to normal sizes.
> 
> Any ideas?
> 
> FTR downstream report:
> https://bugzilla.suse.com/show_bug.cgi?id=1244135
> 
> thanks,

-- 
js
suse labs


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Large modules with 6.15 [was: [PATCH v4 6/6] percpu/x86: Enable strict percpu checks via named AS qualifiers]
  2025-06-05 14:32     ` Large modules with 6.15 [was: [PATCH v4 6/6] percpu/x86: Enable strict percpu checks via named AS qualifiers] Jiri Slaby
@ 2025-06-05 16:17       ` Alexei Starovoitov
  0 siblings, 0 replies; 2+ messages in thread
From: Alexei Starovoitov @ 2025-06-05 16:17 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Uros Bizjak, X86 ML, linux-mm, LKML, linux-bcachefs, linux-arch,
	Network Development, Nadav Amit, Dennis Zhou, Tejun Heo,
	Christoph Lameter, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Linus Torvalds, Andy Lutomirski,
	Brian Gerst, Peter Zijlstra, Shung-Hsi Yu, Alexei Starovoitov,
	Daniel Borkmann, John Fastabend, bpf, Martin KaFai Lau

On Thu, Jun 5, 2025 at 7:32 AM Jiri Slaby <jirislaby@kernel.org> wrote:
>
> Cc BPF people, just so you know.
>
> On 05. 06. 25, 16:27, Jiri Slaby wrote:
> > On 27. 01. 25, 17:05, Uros Bizjak wrote:
> >> This patch declares percpu variables in __seg_gs/__seg_fs named AS
> >> and keeps them named AS qualified until they are dereferenced with
> >> percpu accessor. This approach enables various compiler check
> >> for cross-namespace variable assignments.
> >>
> >> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> >> Acked-by: Nadav Amit <nadav.amit@gmail.com>
> >> Cc: Dennis Zhou <dennis@kernel.org>
> >> Cc: Tejun Heo <tj@kernel.org>
> >> Cc: Christoph Lameter <cl@linux.com>
> >> Cc: Thomas Gleixner <tglx@linutronix.de>
> >> Cc: Ingo Molnar <mingo@kernel.org>
> >> Cc: Borislav Petkov <bp@alien8.de>
> >> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> >> Cc: "H. Peter Anvin" <hpa@zytor.com>
> >> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> >> Cc: Andy Lutomirski <luto@kernel.org>
> >> Cc: Brian Gerst <brgerst@gmail.com>
> >> Cc: Peter Zijlstra <peterz@infradead.org>
> >> ---
> >>   arch/x86/include/asm/percpu.h | 15 ++++++++++++---
> >>   1 file changed, 12 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/
> >> percpu.h
> >> index 27f668660abe..474d648bca9a 100644
> >> --- a/arch/x86/include/asm/percpu.h
> >> +++ b/arch/x86/include/asm/percpu.h
> >> @@ -95,9 +95,18 @@
> >>   #endif /* CONFIG_SMP */
> >> -#define __my_cpu_type(var)    typeof(var) __percpu_seg_override
> >> -#define __my_cpu_ptr(ptr)    (__my_cpu_type(*(ptr))*)(__force
> >> uintptr_t)(ptr)
> >> -#define __my_cpu_var(var)    (*__my_cpu_ptr(&(var)))
> >> +#if defined(CONFIG_USE_X86_SEG_SUPPORT) && defined(USE_TYPEOF_UNQUAL)
> >> +# define __my_cpu_type(var)    typeof(var)
> >> +# define __my_cpu_ptr(ptr)    (ptr)
> >> +# define __my_cpu_var(var)    (var)
> >> +
> >> +# define __percpu_qual        __percpu_seg_override
> >> +#else
> >> +# define __my_cpu_type(var)    typeof(var) __percpu_seg_override
> >> +# define __my_cpu_ptr(ptr)    (__my_cpu_type(*(ptr))*)(__force
> >> uintptr_t)(ptr)
> >> +# define __my_cpu_var(var)    (*__my_cpu_ptr(&(var)))
> >> +#endif
> >> +
> >
> > Another issue with this is this causes all modules in 6.15 are 2-4 times
> > (compressed size) bigger:
> > $ ll /usr/lib/modules/*-[0-9]-default/kernel/drivers/atm/atmtcp.ko.zst
> >  > -rw-r--r--. 1 root root 10325 May 13 11:49 /usr/lib/modules/6.14.6-2-
> > default/kernel/drivers/atm/atmtcp.ko.zst
> >  > -rw-r--r--. 1 root root 39677 Jun  2 09:13 /usr/lib/modules/6.15.0-1-
> > default/kernel/drivers/atm/atmtcp.ko.zst
> >
> > It's due to larger .BTF section:
> > .BTF              PROGBITS         0000000000000000  [-00003080-]
> > [-       00000000000011a8-]  {+00003100+}
> > {+       0000000000012cf8+}  0000000000000000           0     0     1
> >
> > There are a lot of new BTF types defined in each module like:
> > +attribute_group STRUCT
> > +backing_dev_info STRUCT
> > +bdi_writeback STRUCT
> > +bin_attribute STRUCT
> > +bio_end_io_t TYPEDEF
> > +bio_list STRUCT
> > +bio_set STRUCT
> > +bio STRUCT
> > +bio_vec STRUCT
> >
> > Reverting this gives me back to normal sizes.
> >
> > Any ideas?

Try newer pahole ?
It was fixed by:
https://lore.kernel.org/bpf/20250429161042.2069678-1-alan.maguire@oracle.com/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-06-05 16:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250127160709.80604-1-ubizjak@gmail.com>
     [not found] ` <20250127160709.80604-7-ubizjak@gmail.com>
     [not found]   ` <02c00acd-9518-4371-be2c-eb63e5d11d9c@kernel.org>
2025-06-05 14:32     ` Large modules with 6.15 [was: [PATCH v4 6/6] percpu/x86: Enable strict percpu checks via named AS qualifiers] Jiri Slaby
2025-06-05 16:17       ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).