* [PATCH] iommupt/amdv1: mark amdv1pt_install_leaf_entry as __always_inline
@ 2026-03-26 16:17 Sherry Yang
2026-03-27 8:43 ` Jörg Rödel
2026-03-30 17:27 ` Vasant Hegde
0 siblings, 2 replies; 3+ messages in thread
From: Sherry Yang @ 2026-03-26 16:17 UTC (permalink / raw)
To: jgg, joerg.roedel, kevin.tian, vasant.hegde, joro, will,
robin.murphy, iommu
Cc: sherry.yang, linux-kernel
After enabling CONFIG_GCOV_KERNEL and CONFIG_GCOV_PROFILE_ALL, following
build failure is observed under GCC 14.2.1:
In function 'amdv1pt_install_leaf_entry',
inlined from '__do_map_single_page' at drivers/iommu/generic_pt/fmt/../iommu_pt.h:650:3,
inlined from '__map_single_page0' at drivers/iommu/generic_pt/fmt/../iommu_pt.h:661:1,
inlined from 'pt_descend' at drivers/iommu/generic_pt/fmt/../pt_iter.h:391:9,
inlined from '__do_map_single_page' at drivers/iommu/generic_pt/fmt/../iommu_pt.h:657:10,
inlined from '__map_single_page1.constprop' at drivers/iommu/generic_pt/fmt/../iommu_pt.h:661:1:
././include/linux/compiler_types.h:706:45: error: call to '__compiletime_assert_71' declared with attribute error: FIELD_PREP: value too large for the field
706 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
|
......
drivers/iommu/generic_pt/fmt/amdv1.h:220:26: note: in expansion of macro 'FIELD_PREP'
220 | FIELD_PREP(AMDV1PT_FMT_OA,
| ^~~~~~~~~~
In the path '__do_map_single_page()', level 0 always invokes
'pt_install_leaf_entry(&pts, map->oa, PAGE_SHIFT, …)'. At runtime that
lands in the 'if (oasz_lg2 == isz_lg2)' arm of 'amdv1pt_install_leaf_entry()';
the contiguous-only 'else' block is unreachable for 4 KiB pages.
With CONFIG_GCOV_KERNEL + CONFIG_GCOV_PROFILE_ALL, the extra
instrumentation changes GCC's inlining so that the "dead" 'else' branch
still gets instantiated. The compiler constant-folds the contiguous OA
expression, runs the 'FIELD_PREP()' compile-time check, and produces:
FIELD_PREP: value too large for the field
gcov-enabled builds therefore fail even though the code path never executes.
Fix this by marking amdv1pt_install_leaf_entry as __always_inline.
Fixes: dcd6a011a8d5 ("iommupt: Add map_pages op")
Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sherry Yang <sherry.yang@oracle.com>
---
drivers/iommu/generic_pt/fmt/amdv1.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/generic_pt/fmt/amdv1.h b/drivers/iommu/generic_pt/fmt/amdv1.h
index 3b2c41d9654d..8d11b08291d7 100644
--- a/drivers/iommu/generic_pt/fmt/amdv1.h
+++ b/drivers/iommu/generic_pt/fmt/amdv1.h
@@ -191,7 +191,7 @@ static inline enum pt_entry_type amdv1pt_load_entry_raw(struct pt_state *pts)
}
#define pt_load_entry_raw amdv1pt_load_entry_raw
-static inline void
+static __always_inline void
amdv1pt_install_leaf_entry(struct pt_state *pts, pt_oaddr_t oa,
unsigned int oasz_lg2,
const struct pt_write_attrs *attrs)
--
2.50.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iommupt/amdv1: mark amdv1pt_install_leaf_entry as __always_inline
2026-03-26 16:17 [PATCH] iommupt/amdv1: mark amdv1pt_install_leaf_entry as __always_inline Sherry Yang
@ 2026-03-27 8:43 ` Jörg Rödel
2026-03-30 17:27 ` Vasant Hegde
1 sibling, 0 replies; 3+ messages in thread
From: Jörg Rödel @ 2026-03-27 8:43 UTC (permalink / raw)
To: Sherry Yang
Cc: jgg, joerg.roedel, kevin.tian, vasant.hegde, will, robin.murphy,
iommu, linux-kernel
On Thu, Mar 26, 2026 at 09:17:19AM -0700, Sherry Yang wrote:
> Fixes: dcd6a011a8d5 ("iommupt: Add map_pages op")
> Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
> Signed-off-by: Sherry Yang <sherry.yang@oracle.com>
> ---
> drivers/iommu/generic_pt/fmt/amdv1.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iommupt/amdv1: mark amdv1pt_install_leaf_entry as __always_inline
2026-03-26 16:17 [PATCH] iommupt/amdv1: mark amdv1pt_install_leaf_entry as __always_inline Sherry Yang
2026-03-27 8:43 ` Jörg Rödel
@ 2026-03-30 17:27 ` Vasant Hegde
1 sibling, 0 replies; 3+ messages in thread
From: Vasant Hegde @ 2026-03-30 17:27 UTC (permalink / raw)
To: Sherry Yang, jgg, joerg.roedel, kevin.tian, joro, will,
robin.murphy, iommu
Cc: linux-kernel
On 3/26/2026 9:47 PM, Sherry Yang wrote:
> After enabling CONFIG_GCOV_KERNEL and CONFIG_GCOV_PROFILE_ALL, following
> build failure is observed under GCC 14.2.1:
>
> In function 'amdv1pt_install_leaf_entry',
> inlined from '__do_map_single_page' at drivers/iommu/generic_pt/fmt/../iommu_pt.h:650:3,
> inlined from '__map_single_page0' at drivers/iommu/generic_pt/fmt/../iommu_pt.h:661:1,
> inlined from 'pt_descend' at drivers/iommu/generic_pt/fmt/../pt_iter.h:391:9,
> inlined from '__do_map_single_page' at drivers/iommu/generic_pt/fmt/../iommu_pt.h:657:10,
> inlined from '__map_single_page1.constprop' at drivers/iommu/generic_pt/fmt/../iommu_pt.h:661:1:
> ././include/linux/compiler_types.h:706:45: error: call to '__compiletime_assert_71' declared with attribute error: FIELD_PREP: value too large for the field
> 706 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> |
>
> ......
>
> drivers/iommu/generic_pt/fmt/amdv1.h:220:26: note: in expansion of macro 'FIELD_PREP'
> 220 | FIELD_PREP(AMDV1PT_FMT_OA,
> | ^~~~~~~~~~
>
> In the path '__do_map_single_page()', level 0 always invokes
> 'pt_install_leaf_entry(&pts, map->oa, PAGE_SHIFT, …)'. At runtime that
> lands in the 'if (oasz_lg2 == isz_lg2)' arm of 'amdv1pt_install_leaf_entry()';
> the contiguous-only 'else' block is unreachable for 4 KiB pages.
>
> With CONFIG_GCOV_KERNEL + CONFIG_GCOV_PROFILE_ALL, the extra
> instrumentation changes GCC's inlining so that the "dead" 'else' branch
> still gets instantiated. The compiler constant-folds the contiguous OA
> expression, runs the 'FIELD_PREP()' compile-time check, and produces:
>
> FIELD_PREP: value too large for the field
>
> gcov-enabled builds therefore fail even though the code path never executes.
>
> Fix this by marking amdv1pt_install_leaf_entry as __always_inline.
>
> Fixes: dcd6a011a8d5 ("iommupt: Add map_pages op")
> Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
> Signed-off-by: Sherry Yang <sherry.yang@oracle.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
-Vasant
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-30 17:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-26 16:17 [PATCH] iommupt/amdv1: mark amdv1pt_install_leaf_entry as __always_inline Sherry Yang
2026-03-27 8:43 ` Jörg Rödel
2026-03-30 17:27 ` Vasant Hegde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®