On 25.11.2024 23:17, Julien Grall wrote:
>> --- a/xen/arch/arm/include/asm/page.h
>> +++ b/xen/arch/arm/include/asm/page.h
>> @@ -144,6 +144,12 @@ extern size_t dcache_line_bytes;
>>   
>>   #define copy_page(dp, sp) memcpy(dp, sp, PAGE_SIZE)
>>   
>> +#define clear_page_hot  clear_page
>> +#define clear_page_cold clear_page
>> +
>> +#define scrub_page_hot(page) memset(page, SCRUB_BYTE_PATTERN, PAGE_SIZE)
>> +#define scrub_page_cold      scrub_page_hot
> 
> This block seems to be common between all the arch but x86. Should we 
> add an header in asm generic?

I'd say that largely depends on the intentions of Arm, RISC-V, and PPC.
Personally I've always found it odd that memset() / memcpy() are used for
page clearing / copying. Surely there are better ways, and pretty certainly
about every arch also has distinct means to efficiently do "hot" and "cold"
clearing. Therefore keeping these #define-s in per-arch headers imo serves
as a reminder that something wants doing about them.

Jan

Reply via email to