Re: [PATCH] iommupt/amdv1: avoid GCOV builds triggering FIELD_PREP build failure
From: Sherry Yang
Date: Wed Mar 25 2026 - 19:40:04 EST
> On Mar 10, 2026, at 10:57 AM, Jason Gunthorpe <jgg@xxxxxxxxxx> wrote:
>
> On Tue, Mar 10, 2026 at 05:17:31PM +0000, Sherry Yang wrote:
>
>> Unfortunately, I ran into the FIELD_PREP build failure with
>> 98d5110f90ae (“iommupt: Make it clearer to the compiler that
>> pts.level == 0 for single page”) already merged, which means it
>> doesn’t work for me. I noticed you mentioned clang 18 hit the same
>> issue and fixed by the patch. We’re using GCC 14.2.1, looks like GCC
>> still constant-folds the contiguous branch despite the change to
>> pts.level.
>
> This is all a performance path, I'm reluctant to add more code for
> everyone just to hide things from GCC bugs.
>
> Maybe you can rework this to be only when gcov is on, or maybe you can
> fix it by futher enhancing what the other commit does. Perhaps an
> always inline annotation is all that is missing?
Thanks for the pointer — marking amdv1pt_install_leaf_entry() as
__always_inline fixes the gcc/gcov build failure for me while keeping
the original FIELD_PREP() path intact.
If you’re happy with this approach, I'll send the patch out.
Thanks,
Sherry