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

Re: [PATCH v5 2/6] xen/x86: move generically usable NUMA code from x86 to common


  • To: Wei Chen <wei.chen@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 27 Sep 2022 11:39:53 +0200
  • 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=F9kFhuTcFtVZ1SWWyJmIBrW3Qdox9i1MyNKA5SDvbRw=; b=Yk3Ty4wIUx04YQXLGAKhTaHpROsH9+xomBDj4nfo/HWcv5Rhnz3bykJIkNY8Eqbiqh4rNM09RiL6wzH3b//CpU7StpZ7typxi1eneMtBCz98V+0W2RElEPSjE1x27+TS1naAHhXBo54KYN7+H6GsS6cxdHQSC5v8rdF2QEEyOYxBvL0TgGf0CI/XO2hplcnKL9HhYkT1VLFkC6nkkM5VDNJW6S9NicyIOFacAm82RjuJbjfB/H8mtv3Lti2MPu2pvlp0O7HiWXsyJeX0B3X7s5/kBcuUk1fWzcgpVREqJbYShU7vPxLAKaYXICU0HT6bi410LjYimCmdO+HX9PERaw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=if0Bnx5+f/efCn+a1maG3bCPzDFPFCpXlNRAP7e27Hzy+Isbz1yvbIL95iHOdrDLUmXHDGdCs2LWrl4QOoPnUGXVmw1pKAM3XdMcwSkQ3OgHiYGlLFQBgjpQGr5kF6TpnpaFHTdDcNtz46vk+9tST5VuxgIRak6sLQU4dJw2Q+H+foNXYdu7Zut8RgOJviPp3Z6qA19jpYffqVaB8fNCCxa14OBlfpz14yn4qkIVFdFPJZrQHot0vk+tGl2S6FNBozr+MWw4qohokjT0KetERxIxbnYPO0Uya00FWm2vk6myjOkjEnDiFoSPDenkAQTuoUFhibfoQCEJfCLvSpkq2Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: nd@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 27 Sep 2022 09:40:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27.09.2022 10:19, Jan Beulich wrote:
> On 20.09.2022 11:12, Wei Chen wrote:
>> +static unsigned int __init extract_lsb_from_nodes(const struct node *nodes,
>> +                                                  nodeid_t numnodes)
>> +{
>> +    unsigned int i, nodes_used = 0;
>> +    unsigned long spdx, epdx;
>> +    unsigned long bitfield = 0, memtop = 0;
>> +
>> +    for ( i = 0; i < numnodes; i++ )
>> +    {
>> +        spdx = paddr_to_pdx(nodes[i].start);
>> +        epdx = paddr_to_pdx(nodes[i].end - 1) + 1;
>> +
>> +        if ( spdx >= epdx )
>> +            continue;
>> +
>> +        bitfield |= spdx;
> 
> Perhaps to be taken care of in a separate patch: We accumulate only
> the bits from the start addresses here, contrary to what the comment
> ahead of the function says (and I think it is the comment which is
> putting things correctly).

It's the comment which is wrong - it wasn't updated in Linux commit
54413927f022 ("x86-64: x86_64-make-the-numa-hash-function-nodemap-allocation
fix fix"). Our code was cloned from Linux'es. In fact when memory is not
contiguous, too small a shift value might be determined. This in particular
also may matter for the lowest range covered by any node: On x86 this will
always start at zero (and hence won't influence the final calculation), but
iirc on Arm memory may (and typically will) start at non-zero addresses. In
such a case the first node's start address should be ignored, as it's fine
to (kind of) associate all lower addresses (where no memory is) with this
same node. But that's now indeed something which will want taking care of
while making the code usable for other architectures.

Jan



 


Rackspace

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