On 10/7/2025 6:41 PM, Jason Gunthorpe wrote:
> On Tue, Oct 07, 2025 at 05:38:48PM +0530, Vasant Hegde wrote:
>>> +           PT_WARN_ON(compute_best_pgsize(&pts, oa) != leaf_pgsize_lg2);
>>
>>
>> If I select CONFIG_DEBUG_GENERIC_PT=y and boot AMD system with V1 (Host page
>> table), in some cases we hit this warning. Code path looks ok. may be silence
>> these warning?
>>
>> [   31.985383] pt_iommu_amdv1_map_pages : oa 0x208b95d000 va 0xfef80000 
>> last_va 0xfef9ffff pgsz_lg 0xc pgsize 0x1000 pgcount 0x20
>                                                        ^^^^
>> [   31.985384] __map_range_leaf oa 0x208b95e000 va 0xfef80000 last_va 
>> 0xfef9ffff pgsize 0xd leaf_pgsize 0xc possible_sz 0x1ff000
>                                              ^^^^
> 
> oa advanced but va didn't. It's a a little bug in the warning,
> since it doesn't recompute the va each iteration.  I'm surprised the> random
test didn't find it..

I have not tried unit tests. So far I am running on real HW.

> 
>               if (IS_ENABLED(CONFIG_DEBUG_GENERIC_PT)) {
>                       pt_index_to_va(&pts);
>                       PT_WARN_ON(compute_best_pgsize(&pts, oa) !=
>                                  leaf_pgsize_lg2);
>               }

Verified. This works.

Thanks
-Vasant


Reply via email to