your mail
Christian König
christian.koenig at amd.com
Mon Aug 25 18:35:21 UTC 2025
On 21.08.25 12:05, Lorenzo Stoakes wrote:
> On Thu, Aug 21, 2025 at 11:30:43AM +0200, David Hildenbrand wrote:
>>> I will add this xen/apply_to_page_range() thing to my TODOs, which atm
>>> would invovle changing these drivers to use vmf_insert_pfn_prot() instead.
>>>
>>
>> Busy today (want to reply to Christian) but
>>
>> a) Re: performance, we would want something like
>> vmf_insert_pfns_prot(), similar to vm_insert_pages(), to bulk-insert
>> multiple PFNs.
Yes, exactly that. Ideally something like an iterator/callback like interface.
I've seen at least four or five different representations of the PFNs in drivers.
>> b) Re: PAT, we'll have to figure out why PAT information is wrong here
>> (was there no previous PAT reservation from the driver?), but IF we
>> really have to override, we'd want a way to tell
>> vmf_insert_pfn_prot() to force the selected caching mode.
>>
Well the difference between vmf_insert_pfn() and vmf_insert_pfn_prot() is that the driver actually want to specify the caching modes.
That this is overridden by the PAT even for pages which are not part of the linear mapping is really surprising.
As far as I can see there is no technical necessity for that. Even for pages in the linear mapping only a handful of x86 CPUs actually need that. See Intels i915 GPU driver for reference.
Intel has used that approach for ages and for AMD CPUs the only reference I could find where the kernel needs it are Athlons produced between 1996 and 2004.
Maybe we should disable the PAT on CPUs which actually don't need it?
> Ack, ok good that we have a feasible way forward.
>
> FYI, spoke to Peter off-list and he mentioned he had a more general series
> to get rid of this kind of [ab]use of apply_to_page_range() (see [0]), I
> gather he hasn't the time to resurrect but perhaps one of us can at some
> point?
>
> Perhaps we need a shorter term fix to _this_ issue (which involves not
> using this interface), and then follow it up with an adaptation of the
> below?
Sounds like a plan to me.
Regards,
Christian.
>
> Cheers, Lorenzo
>
> [0]:https://lore.kernel.org/all/20210412080012.357146277@infradead.org/
>
>
>
>> --
>> Cheers
>>
>> David / dhildenb
More information about the Intel-gfx
mailing list