* Re: [PATCH] [v2] iommu, debugobjects: avoid gcc-16.1 section mismatch warnings
2026-05-13 14:53 [PATCH] [v2] iommu, debugobjects: avoid gcc-16.1 section mismatch warnings Arnd Bergmann
@ 2026-05-13 15:48 ` Miguel Ojeda
2026-05-13 19:35 ` Arnd Bergmann
2026-05-15 18:06 ` Jason Gunthorpe
` (3 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Miguel Ojeda @ 2026-05-13 15:48 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Will Deacon, Joerg Roedel, Miguel Ojeda, Andrew Morton,
Thomas Gleixner, Nathan Chancellor, Arnd Bergmann, linux-kbuild,
stable, Robin Murphy, Kees Cook, linux-arm-kernel, iommu,
linux-kernel
On Wed, May 13, 2026 at 4:54 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> With some more experimenting, I found that marking these functions as
> __attribute__((noipa)) is both logical and reliable.
>
> In order to keep the syntax readable, add a custom macro for this in
> include/linux/compiler_attributes.h next to other related macros and
> use it to annotate both files.
Acked-by: Miguel Ojeda <ojeda@kernel.org>
I double-checked that GCC 8.1 implemented the attribute in commit
036ea39917b0 ("attribs.c (decl_attributes): Imply noinline, noclone
and no_icf attributes for noipa attribute."), which also happens to be
our minimum in Linux; and that Clang indeed does not seem to support
it (not even a mention of it in their repository).
If you don't mind, please add underscores (i.e. `((__noipa__))`) and
place it after `__noinline__` to keep it sorted (the file is meant to
be sorted by actual attribute name, though some entries were added
that break that, but I will clean that and a couple other things up at
some point).
Thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] [v2] iommu, debugobjects: avoid gcc-16.1 section mismatch warnings
2026-05-13 15:48 ` Miguel Ojeda
@ 2026-05-13 19:35 ` Arnd Bergmann
0 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2026-05-13 19:35 UTC (permalink / raw)
To: Miguel Ojeda, Arnd Bergmann
Cc: Will Deacon, Joerg Roedel, Miguel Ojeda, Andrew Morton,
Thomas Gleixner, Nathan Chancellor, linux-kbuild, stable,
Robin Murphy, Kees Cook, linux-arm-kernel, iommu, linux-kernel
On Wed, May 13, 2026, at 17:48, Miguel Ojeda wrote:
> On Wed, May 13, 2026 at 4:54 PM Arnd Bergmann <arnd@kernel.org> wrote:
>>
>> With some more experimenting, I found that marking these functions as
>> __attribute__((noipa)) is both logical and reliable.
>>
>> In order to keep the syntax readable, add a custom macro for this in
>> include/linux/compiler_attributes.h next to other related macros and
>> use it to annotate both files.
>
> Acked-by: Miguel Ojeda <ojeda@kernel.org>
Thanks!
> If you don't mind, please add underscores (i.e. `((__noipa__))`) and
> place it after `__noinline__` to keep it sorted (the file is meant to
> be sorted by actual attribute name, though some entries were added
> that break that, but I will clean that and a couple other things up at
> some point).
Ok, changed now, will wait for other comments before resending.
Arnd
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] [v2] iommu, debugobjects: avoid gcc-16.1 section mismatch warnings
2026-05-13 14:53 [PATCH] [v2] iommu, debugobjects: avoid gcc-16.1 section mismatch warnings Arnd Bergmann
2026-05-13 15:48 ` Miguel Ojeda
@ 2026-05-15 18:06 ` Jason Gunthorpe
2026-05-15 20:56 ` Thomas Gleixner
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Jason Gunthorpe @ 2026-05-15 18:06 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Will Deacon, Joerg Roedel, Miguel Ojeda, Andrew Morton,
Thomas Gleixner, Nathan Chancellor, Arnd Bergmann, linux-kbuild,
stable, Robin Murphy, Kees Cook, linux-arm-kernel, iommu,
linux-kernel
On Wed, May 13, 2026 at 04:53:54PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> gcc-16 has gained some more advanced inter-procedual optimization
> techniques that enable it to inline the dummy_tlb_add_page() and
> dummy_tlb_flush() function pointers into a specialized version of
> __arm_v7s_unmap:
>
> WARNING: modpost: vmlinux: section mismatch in reference: __arm_v7s_unmap+0x2cc (section: .text) -> dummy_tlb_add_page (section: .init.text)
> ERROR: modpost: Section mismatches detected.
>
> From what I can tell, the transformation is correct, as this is only
> called when __arm_v7s_unmap() is called from arm_v7s_do_selftests(),
> which is also __init. Since __arm_v7s_unmap() however is not __init,
> gcc cannot inline the inner function calls directly.
The selftests should be moved into a kunit like was done for pgtable-arm:
commit 699b059962add22b2a324645b6ae2a607fc1a93e
Author: Mostafa Saleh <smostafa@google.com>
Date: Mon Nov 3 12:33:50 2025 +0000
iommu/io-pgtable-arm: Move selftests to a separate file
Clean up the io-pgtable-arm library by moving the selftests out.
Next the tests will be registered with kunit.
Then you won't have these section problems because the code will be in
another module :)
Jason
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] [v2] iommu, debugobjects: avoid gcc-16.1 section mismatch warnings
2026-05-13 14:53 [PATCH] [v2] iommu, debugobjects: avoid gcc-16.1 section mismatch warnings Arnd Bergmann
2026-05-13 15:48 ` Miguel Ojeda
2026-05-15 18:06 ` Jason Gunthorpe
@ 2026-05-15 20:56 ` Thomas Gleixner
2026-05-19 12:06 ` Will Deacon
2026-05-28 7:08 ` Joerg Roedel
4 siblings, 0 replies; 7+ messages in thread
From: Thomas Gleixner @ 2026-05-15 20:56 UTC (permalink / raw)
To: Arnd Bergmann, Will Deacon, Joerg Roedel, Miguel Ojeda,
Andrew Morton, Nathan Chancellor
Cc: Arnd Bergmann, linux-kbuild, stable, Robin Murphy, Kees Cook,
linux-arm-kernel, iommu, linux-kernel
On Wed, May 13 2026 at 16:53, Arnd Bergmann wrote:
> Link: https://lore.kernel.org/all/abRB6g-48ZX6Yl2r@willie-the-truck/
> Cc: Will Deacon <will@kernel.org>
> Cc: Thomas Gleixner <tglx@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Miguel Ojeda <ojeda@kernel.org>
> Cc: linux-kbuild@vger.kernel.org
> Cc: stable@vger.kernel.org
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> v2: I merged both patches into one, to simplify the dependency
> on the new compiler_attributes.h macro.
Which you could have split into 'provide macro', fix A, fix B ..., but
that's just pedantry :)
But seriously, this is way more palatable than the other hacks!
Acked-by: Thomas Gleixner <tglx@kernel.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] [v2] iommu, debugobjects: avoid gcc-16.1 section mismatch warnings
2026-05-13 14:53 [PATCH] [v2] iommu, debugobjects: avoid gcc-16.1 section mismatch warnings Arnd Bergmann
` (2 preceding siblings ...)
2026-05-15 20:56 ` Thomas Gleixner
@ 2026-05-19 12:06 ` Will Deacon
2026-05-28 7:08 ` Joerg Roedel
4 siblings, 0 replies; 7+ messages in thread
From: Will Deacon @ 2026-05-19 12:06 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Joerg Roedel, Miguel Ojeda, Andrew Morton, Thomas Gleixner,
Nathan Chancellor, Arnd Bergmann, linux-kbuild, stable,
Robin Murphy, Kees Cook, linux-arm-kernel, iommu, linux-kernel
On Wed, May 13, 2026 at 04:53:54PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> gcc-16 has gained some more advanced inter-procedual optimization
> techniques that enable it to inline the dummy_tlb_add_page() and
> dummy_tlb_flush() function pointers into a specialized version of
> __arm_v7s_unmap:
>
> WARNING: modpost: vmlinux: section mismatch in reference: __arm_v7s_unmap+0x2cc (section: .text) -> dummy_tlb_add_page (section: .init.text)
> ERROR: modpost: Section mismatches detected.
>
> From what I can tell, the transformation is correct, as this is only
> called when __arm_v7s_unmap() is called from arm_v7s_do_selftests(),
> which is also __init. Since __arm_v7s_unmap() however is not __init,
> gcc cannot inline the inner function calls directly.
>
> In debug_objects_selftest(), the same thing happens. Both the
> caller and the leaf function are __init, but the IPA pulls
> it into a non-init one:
>
> WARNING: modpost: vmlinux: section mismatch in reference: lookup_object_or_alloc+0x7c (section: .text.lookup_object_or_alloc) -> is_static_object (section: .init.text)
>
> Marking the affected functions as not "__init" would reliably avoid this
> issue but is not a good solution because it removes an otherwise correct
> annotation. I tried marking the functions as 'noinline', but that ended
> up not covering all the affected configurations.
>
> With some more experimenting, I found that marking these functions as
> __attribute__((noipa)) is both logical and reliable.
>
> In order to keep the syntax readable, add a custom macro for this in
> include/linux/compiler_attributes.h next to other related macros and
> use it to annotate both files.
>
> Link: https://lore.kernel.org/all/abRB6g-48ZX6Yl2r@willie-the-truck/
> Cc: Will Deacon <will@kernel.org>
> Cc: Thomas Gleixner <tglx@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Miguel Ojeda <ojeda@kernel.org>
> Cc: linux-kbuild@vger.kernel.org
> Cc: stable@vger.kernel.org
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> v2: I merged both patches into one, to simplify the dependency
> on the new compiler_attributes.h macro.
> ---
> drivers/iommu/io-pgtable-arm-v7s.c | 18 ++++++++++++------
> include/linux/compiler_attributes.h | 11 +++++++++++
> lib/debugobjects.c | 2 +-
> 3 files changed, 24 insertions(+), 7 deletions(-)
For the io-pgtable change:
Acked-by: Will Deacon <will@kernel.org>
Thanks, Arnd.
Will
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] [v2] iommu, debugobjects: avoid gcc-16.1 section mismatch warnings
2026-05-13 14:53 [PATCH] [v2] iommu, debugobjects: avoid gcc-16.1 section mismatch warnings Arnd Bergmann
` (3 preceding siblings ...)
2026-05-19 12:06 ` Will Deacon
@ 2026-05-28 7:08 ` Joerg Roedel
4 siblings, 0 replies; 7+ messages in thread
From: Joerg Roedel @ 2026-05-28 7:08 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Will Deacon, Miguel Ojeda, Andrew Morton, Thomas Gleixner,
Nathan Chancellor, Arnd Bergmann, linux-kbuild, stable,
Robin Murphy, Kees Cook, linux-arm-kernel, iommu, linux-kernel
Applied for -rc, thanks Arnd.
^ permalink raw reply [flat|nested] 7+ messages in thread