On 05/03/2025 9:23 am, Jan Beulich wrote:
> On 04.03.2025 00:29, Andrew Cooper wrote:
>> struct domain is always a page aligned allocation.  Update it's type to
>> reflect this, so we can safely reuse the lower bits in the pointer for
>> auxiliary information.
>>
>> No functional change.
>>
>> Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
>> ---
>> CC: Anthony PERARD <anthony.per...@vates.tech>
>> CC: Michal Orzel <michal.or...@amd.com>
>> CC: Jan Beulich <jbeul...@suse.com>
>> CC: Julien Grall <jul...@xen.org>
>> CC: Roger Pau Monné <roger....@citrix.com>
>> CC: Stefano Stabellini <sstabell...@kernel.org>
>> CC: Dario Faggioli <dfaggi...@suse.com>
>> CC: Juergen Gross <jgr...@suse.com>
>> CC: George Dunlap <g...@xenproject.org>
>>
>> v2:
>>  * New
>>
>> Interestingly this does cause two changes in the resulting binary, both 
>> caused
>> by GCC electing to use a more complicated addressing mode to save one ADD
>> instruction.
> That's on x86, I suppose?

Yes.

>
>> --- a/xen/include/xen/sched.h
>> +++ b/xen/include/xen/sched.h
>> @@ -645,7 +645,7 @@ struct domain
>>      unsigned int num_llc_colors;
>>      const unsigned int *llc_colors;
>>  #endif
>> -};
>> +} __aligned(PAGE_SIZE);
>>  
>>  static inline struct page_list_head *page_to_list(
>>      struct domain *d, const struct page_info *pg)
> I understand struct domain is where you need the annotation right away, but is
> there a reason not to do the same for struct vcpu right away?

struct vcpu is more complicated.  It's multi-page on ARM, and I have a
strong suspicion that alignment is going to have to change away from
PAGE_SIZE for architectures wanting to use larger page sizes.

e.g. with 64k pagetables, I expect these will still want 4k alignment,
and therefore they'll all want changing. i.e. I'm probably creating less
work for someone in the future by not annotating struct vcpu. ~Andrew

Reply via email to