From: Tejun Heo <tj@kernel.org>
To: Laurent Vivier <lvivier@redhat.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
Jens Axboe <axboe@kernel.dk>,
Lai Jiangshan <jiangshanlai@gmail.com>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/2] powerpc/workqueue: update list of possible CPUs
Date: Thu, 24 Aug 2017 06:51:23 -0700 [thread overview]
Message-ID: <20170824135122.GM491396@devbig577.frc2.facebook.com> (raw)
In-Reply-To: <6ab4f6f1-b42f-a5fe-4974-0996baa86502@redhat.com>
Hello, Laurent.
On Thu, Aug 24, 2017 at 02:10:31PM +0200, Laurent Vivier wrote:
> > Yeah, it just needs to match up new cpus to the cpu ids assigned to
> > the right node.
>
> We are not able to assign the cpu ids to the right node before the CPU
> is present, because firmware doesn't provide CPU mapping <-> node id
> before that.
What I meant was to assign the matching CPU ID when the CPU becomes
present - ie. have CPU IDs available for different nodes and allocate
them to the new CPU according to its node mapping when it actually
comes up. Please note that I'm not saying this is the way to go, just
that it is a solvable problem from the arch code.
> > The node mapping for that cpu id changes *dynamically* while the
> > system is running and that can race with node-affinity sensitive
> > operations such as memory allocations.
>
> Memory is mapped to the node through its own firmware entry, so I don't
> think cpu id change can affect memory affinity, and before we know the
> node id of the CPU, the CPU is not present and thus it can't use memory.
The latter part isn't true. For example, percpu memory gets alloacted
for all possible CPUs according to their node affinity, so the memory
node association change which happens when the CPU comes up for the
first time can race against such allocations. I don't know whether
that's actually problematic but we don't have *any* synchronization
around it. If you think it's safe to have such races, please explain
why that is.
> > Please take a step back and think through the problem again. You
> > can't bandaid it this way.
>
> Could you give some ideas, proposals?
> As the firmware doesn't provide the information before the CPU is really
> plugged, I really don't know how to manage this problem.
There are two possible approaches, I think.
1. Make physical cpu -> logical cpu mapping indirect so that the
kernel's cpu ID assignment is always on the right numa node. This
may mean that the kernel might have to keep more possible CPUs
around than necessary but it does have the benefit that all memory
allocations are affine to the right node.
2. Make cpu <-> node mapping properly dynamic. Identify what sort of
synchronization we'd need around the mapping changing dynamically.
Note that we might not need much but it'll most likely need some.
Build synchronization and notification infrastructure around it.
Thanks.
--
tejun
prev parent reply other threads:[~2017-08-24 13:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-21 13:49 [PATCH 1/2] powerpc/workqueue: update list of possible CPUs Laurent Vivier
2017-08-21 13:49 ` [PATCH 2/2] blk-mq: don't use WORK_CPU_UNBOUND Laurent Vivier
2017-08-21 14:48 ` Tejun Heo
2017-08-21 14:48 ` [PATCH 1/2] powerpc/workqueue: update list of possible CPUs Tejun Heo
2017-08-22 1:41 ` Michael Ellerman
2017-08-22 16:54 ` Tejun Heo
2017-08-23 11:00 ` Michael Ellerman
2017-08-23 11:17 ` Laurent Vivier
2017-08-23 13:26 ` Tejun Heo
2017-08-24 12:10 ` Laurent Vivier
2017-08-24 13:51 ` Tejun Heo [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=20170824135122.GM491396@devbig577.frc2.facebook.com \
--to=tj@kernel.org \
--cc=axboe@kernel.dk \
--cc=jiangshanlai@gmail.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lvivier@redhat.com \
--cc=mpe@ellerman.id.au \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox