All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Chen <Wei.Chen@arm.com>
To: Jan Beulich <jbeulich@suse.com>, Julien Grall <julien@xen.org>
Cc: "Penny Zheng" <Penny.Zheng@arm.com>,
	"Bertrand Marquis" <Bertrand.Marquis@arm.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>
Subject: RE: DMA restriction and NUMA node number
Date: Tue, 13 Jul 2021 10:50:18 +0000	[thread overview]
Message-ID: <DB9PR08MB6857356F5E942970978838099E149@DB9PR08MB6857.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <080cf741-7a11-4df5-5f24-cc7680f92151@suse.com>

Hi Jan,

> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: 2021年7月13日 18:21
> To: Julien Grall <julien@xen.org>; Wei Chen <Wei.Chen@arm.com>
> Cc: Penny Zheng <Penny.Zheng@arm.com>; Bertrand Marquis
> <Bertrand.Marquis@arm.com>; xen-devel@lists.xen.org; Roger Pau Monné
> <roger.pau@citrix.com>; Stefano Stabellini <sstabellini@kernel.org>;
> Andrew Cooper <andrew.cooper3@citrix.com>
> 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@citrix.com>
> >> 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.

      reply	other threads:[~2021-07-13 10:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13  3:19 DMA restriction and NUMA node number Wei Chen
2021-07-13  9:26 ` Julien Grall
2021-07-13 10:21   ` Jan Beulich
2021-07-13 10:50     ` Wei Chen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB9PR08MB6857356F5E942970978838099E149@DB9PR08MB6857.eurprd08.prod.outlook.com \
    --to=wei.chen@arm.com \
    --cc=Bertrand.Marquis@arm.com \
    --cc=Penny.Zheng@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.