[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/8] x86/paging: fold HAP and shadow memory alloc related fields


  • To: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 21 Dec 2022 15:28:35 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5bzW95XeRgMGOpd47+WI11+pl6WdJmyLKjqUrmzgKpo=; b=L20rlfGizwQ/mAh2msm3cxAxThzAEno7s6YSHMkL1JfWjmtDFhz/4Iefos9z6zvEEgxHC0oMX+r5vEeTZ0UgR7qsLpXHdTf0DYRtpqC2x/xtjiO34CZFL3BXkNNOa3/ZhDiAkYt9km3fmydmhTNgMkuKjOal4w2BwVuMbYc2lxR6i0ZjWjzc0BsBOinPvKJrdce43EmH7oZEZF1z2P66UCsAVu5vAuxDYVnmLICgOb1qOhqPpWEUUwp/k3e+9v2+wC6A3CbkaAORnrNYpEKZIxf9XuB8eoBQnFZOEmm2GNu9oKfuArYLOeN0CV4hJtN82K74ctSIh79keddaNhUBMA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R6lUJvR3BJ9bA5dcLHKShGnb7whZGnw9/Q+zxFyoxkhCZgKKVM3OAJvRyPjlWl1Xcx9VoaihcRlMjmPODQsHzzQ/SXXrXLQ0pX10UXCPy8aydul+J7MMiGHJRRcEfodwserRHD93WOeeCc6EwYfYBPOc/ja8C/WYFAKe9FaUqdzHlpw/IoCLIhIO4Rxx2CuDLYOUS74DTN4GMDbPI+XMxYli/DrxSBgXWqeB+ZiZmXDhz62Ttf9SKZ7Q2umBbcQ6kNIMvyufTq7MlLt7qyMW4idcJWZ4U2/wNskUS5465Jg+wpaI+8EEJ3i12L0tg6RcKQX3dFU44dBs3eSV3FJ6Nw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxx>, "Tim (Xen.org)" <tim@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 21 Dec 2022 14:29:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 21.12.2022 14:49, Andrew Cooper wrote:
> On 21/12/2022 1:24 pm, Jan Beulich wrote:
>> Especially with struct shadow_domain and struct hap_domain not living in
>> a union inside struct paging_domain, let's avoid the duplication: The
>> fields are named and used in identical ways, and only one of HAP or
>> shadow can be in use for a domain. This then also renders involved
>> expressions slightly more legible.
>>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, with two minor
> suggestions.

Thanks.

>> --- a/xen/arch/x86/include/asm/domain.h
>> +++ b/xen/arch/x86/include/asm/domain.h
>> @@ -179,10 +173,6 @@ struct shadow_vcpu {
>>  /*            hardware assisted paging          */
>>  /************************************************/
>>  struct hap_domain {
>> -    struct page_list_head freelist;
>> -    unsigned int      total_pages;  /* number of pages allocated */
>> -    unsigned int      free_pages;   /* number of pages on freelists */
>> -    unsigned int      p2m_pages;    /* number of pages allocated to p2m */
>>  };
> 
> Do we want to drop hap_domain?  I can't forsee needing to put anything
> back into it.

I would prefer to keep it, even if it's unclear what may want putting
there. It's not obvious to me at all that nothing ever will.

>> --- a/xen/arch/x86/mm/paging.c
>> +++ b/xen/arch/x86/mm/paging.c
>> @@ -979,17 +980,17 @@ int __init paging_set_allocation(struct
>>  
>>  int arch_get_paging_mempool_size(struct domain *d, uint64_t *size)
>>  {
>> -    int rc;
>> +    unsigned long pages;
>>  
>>      if ( is_pv_domain(d) )                 /* TODO: Relax in due course */
>>          return -EOPNOTSUPP;
>>  
>> -    if ( hap_enabled(d) )
>> -        rc = hap_get_allocation_bytes(d, size);
>> -    else
>> -        rc = shadow_get_allocation_bytes(d, size);
>> +    pages = d->arch.paging.total_pages;
>> +    pages += d->arch.paging.p2m_pages;
> 
> Any chance I can talk you into having a second space before the =, so we
> get:
> 
> pages  = d->arch.paging.total_pages;
> pages += d->arch.paging.p2m_pages;
> 
> nicely aligned vertically?

Sure, I can do that. I recall I was actually pondering whether to ...

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.