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

Re: [PATCH] libs/xg: allow caller to provide extra memflags for populate physmap


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 18 Dec 2025 21:34:40 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=JbMx2D5RQ+AK0UWiTpeI1pqmKfhiWejFXP1z+JCN778=; b=WsF9KFwLJyFHj5szLLCXEJk7yCVggV+zTMUysS9wn8tb6xUWKFNER/X7BCXM0eY0px2C3cgEo+DoqKDZhk8zlStDGcWCD/dZr2d61GZBvkHFARCpRo8OtKHESynIZT4UAQIgymX9owDY+P8pruaF6uXykYN6CxfPtlEf2Wh26+8iwnhonbQkDU8iWGA6bHoh2SRQy/cxFOfzjkm49Z4o+5RXwz04Udhn1g3dtjZ2VhpLrynrY3P1WYfCDTGYpe1rkqqwTVGQnEIUBwgFVwkGPJlHC4pMBPSQ8G/EEMaRU4UesgP2cYiBZmTQW8VCnz+AReujPPqy1Bw9e42DRqWpHw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FZ1IrAEqkrz+DpgDK4xOL1ZcexsQLywfmyd66+nuO9kGXMMvzEOkN6Cq0Sa7v/onBGXUpFcrtkI4kQHbOZWr62QycYzm4jQjbCwTByi8IljZj/LkzqIcGjFZhqutNtrQFEVdbpnZx/B4dga5vs7WiSN2YfTlcNHZxC292vKJe6xyqh4o/S7PZQBso447crFWBaNOeG4BnLOJReuk7kFW3GN8D867CjmUrXeTr79Ful4W7WJHGbKptI+cabCZFCGV5kUHnmwq6K6LfLfDdUEXJX0rRnw3FcobReOSDa4OOE1+cK7a82itYHxnKSAX2npHeL2lDH5nqvgV74kv0gARhQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 18 Dec 2025 21:35:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 18/12/2025 3:27 pm, Jan Beulich wrote:
> On 18.12.2025 16:17, Roger Pau Monne wrote:
>> --- a/tools/libs/guest/xg_dom_x86.c
>> +++ b/tools/libs/guest/xg_dom_x86.c
>> @@ -1260,14 +1260,15 @@ static int meminit_pv(struct xc_dom_image *dom)
>>      /* allocate guest memory */
>>      for ( i = 0; i < nr_vmemranges; i++ )
>>      {
>> -        unsigned int memflags;
>> +        unsigned int memflags = dom->memflags;
>>          uint64_t pages, super_pages;
>>          unsigned int pnode = vnode_to_pnode[vmemranges[i].nid];
>>          xen_pfn_t extents[SUPERPAGE_BATCH_SIZE];
>>          xen_pfn_t pfn_base_idx;
>>  
>> -        memflags = 0;
>> -        if ( pnode != XC_NUMA_NO_NODE )
>> +        if ( pnode != XC_NUMA_NO_NODE &&
>> +             /* Only set the node if the caller hasn't done so. */
>> +             XENMEMF_get_node(memflags) == 0xFFU )
>>              memflags |= XENMEMF_exact_node(pnode);
> I'd like to suggest to avoid open-coding the 0xff here and elsewhere.
> XENMEMF_get_node(0) will be less fragile overall, imo.

XENMEMF_get_node(0) is even more meaningless than 0xFF, which is at
least obviously a sentinel value.

~Andrew



 


Rackspace

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