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

RE: DMA restriction and NUMA node number


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>
  • From: Wei Chen <Wei.Chen@xxxxxxx>
  • Date: Tue, 13 Jul 2021 10:50:18 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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-SenderADCheck; bh=6QepIXfzkBJrmwksHDfXsLidyKq4aMvUuffWXtzxvRY=; b=OwxjV8n5cHwWpByHdQP7PBfMf7I6FwXzX0ZLSrSkAG/RTbsD8oFmFbLjUAMn7SVK/9IebIiNrPD0ut74N1UAOGe692IHEZTgLUO3DJwPNpmXlXHNhjGqluVBByVymHwjHm9l1WRhYPNEiG1HLLUS2s4SowJGD/VFXY6Zhjb2pj4SaYxKVhrXiO7bAApWw9m+dxARoxG+a3zvlVny+Ymg29NE8jneM2KW5P5o746DEPb0L2qul8h0eLni2Tz3gJkb2qvLK9aSGq4mTZFQJYe2kUhkXVKjwjiiCEkAYHaVKlss4/HoJx/Cez1x8yylDY1r/SpgBsvdvJIHPiWRIE1iWw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HHi4cuLdDhE9h3/Zjv7ggOWEGOB1aFBqb7Z2OI3hyKU0klmJIxEFjBrOt9BZ7z7iQ9UMbn50Lg6IJ8yUOluEIJsbbHLZYuLaE6rig8l8STRhaprFxaPOXjeoq/wUbmacY8O0Accqz4nt/14GoRKfbn7IR4/VWLi0MUUpT7coCYDU77GQoUo5/gCu6MpCAh7kGdZTJE8p3GEJJKv4sePFRRlWrbSMq4s5bgiIHf8AUDJf/x/ZMdYgNdkvcDnQfEQPlLTlZj4WrXVK/I5bAKPeNR/jqca059uVwyiwlxOPCVxPwqdLsZcRw5lmaWi3Z2RyBfVEa7KMPBCxvK4AzfH4wg==
  • Authentication-results-original: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=arm.com;
  • Cc: Penny Zheng <Penny.Zheng@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, "xen-devel@xxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Tue, 13 Jul 2021 10:50:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: Add3jZlm0dMwxzV2RvOni5fmVkcvwgAO4HYAAAHsL4AAAIBVIA==
  • Thread-topic: DMA restriction and NUMA node number

Hi Jan,

> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: 2021年7月13日 18:21
> To: Julien Grall <julien@xxxxxxx>; Wei Chen <Wei.Chen@xxxxxxx>
> Cc: Penny Zheng <Penny.Zheng@xxxxxxx>; Bertrand Marquis
> <Bertrand.Marquis@xxxxxxx>; xen-devel@xxxxxxxxxxxxx; Roger Pau Monné
> <roger.pau@xxxxxxxxxx>; Stefano Stabellini <sstabellini@xxxxxxxxxx>;
> Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Subject: Re: DMA restriction and NUMA node number
>
> On 13.07.2021 11:26, Julien Grall wrote:
> > On 13/07/2021 04:19, Wei Chen wrote:
> >> I am doing some NUMA testing on Xen. And I find the DMA restriction is
> >> based on NUMA node number [1].
> >>      if ( !dma_bitsize && (num_online_nodes() > 1) )
> >>          dma_bitsize = arch_get_dma_bitsize();
> >>
> >> On Arm64, we will set dma_bitsize [2] to 0, that means we don't need to
> >> reserve DMA memory. But when num_online_nodes > 1, the dma_bitsize
> >> will override to 32. This may be caused by the Arm64 version
> >> arch_get_dma_bitsize, it may be a simple implementation and not NUMA
> >> aware.
> >>
> >> But I still quite curious about why DMA restriction depends on NUMA
> >> node number.
>
> So really do you mean "node count", not "node number"?
>

I mean NUMA online nodes. If "node count" here means "count how many NUMA
nodes are online", my answer is yes for "node count".

> >> In Arm64, dma_bitsize does not change when the NUMA node
> >> changes. So we didn't expect arch_get_dma_bitsize to be called here.
> >>
> >> I copied Keir's commit message from 2008. It seems this code was
> considered
> >> only for x86, when he was working on it. But I'm not an x86 expert, so
> I
> >> hope Xen x86 folks can give some help. Understanding this will help us
> to
> >
> > It is best to CCed the relevant person so they know you have requested
> > there input. I have added the x86 maintainers in the thread.
> >
> >> do some adaptations to Arm in subsequent modifications : )
> >>
> >> commit accacb43cb7f16e9d1d8c0e58ea72c9d0c32cec2
> >> Author: Keir Fraser <keir.fraser@xxxxxxxxxx>
> >> Date:   Mon Jul 28 16:40:30 2008 +0100
> >>
> >>      Simplify 'dma heap' logic.
> >>
> >>      1. Only useful for NUMA systems, so turn it off on non-NUMA
> systems by
> >>         default.
> >>      2. On NUMA systems, by default relate the DMA heap size to NUMA
> node 0
> >>         memory size (so that not all of node 0's memory ends up being
> 'DMA
> >>         heap').
> >>      3. Remove the 'dma emergency pool'. It's less useful now that
> running
> >>         out of low memory isn;t as fatal as it used to be (e.g., when
> we
> >>         needed to be able to allocate low-memory PAE page directories).
>
> So on x86 memory starts from 0, and we want to be cautious with giving
> out memory that may be needed for special purposes (first and foremost
> DMA). With the buddy allocator working from high addresses to lower ones,
> low addresses will be used last (unless specifically requested) without
> any further precautions when not taking NUMA into account. This in
> particular covers the case of just a single NUMA node.
>
> When taking NUMA into account we need to be more careful: If a single
> node contains the majority (or all) of the more precious memory, we
> want to prefer non-local allocations over exhausting the more precious
> memory ranges. Hence we need to set aside some largely arbitrary amount
> allocation of which would happen only after also exhausting all other
> nodes' memory.
>
> I hope I have suitably reconstructed the thinking back then. And yes,
> there are x86 implications in here.
>

Thanks for your explanation, we have a deeper understanding of the
thoughts of this DMA restriction. Although the memory layout of Arm
and x86 is not the same, we can try to keep this idea still in common,
and try resolve this difference in Arm's ARCH.

Thanks,
Wei Chen

> Jan

IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

 


Rackspace

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