From: Petr Holasek <pholasek@redhat.com>
To: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org, Anton Arapov <anton@redhat.com>
Subject: Re: NUMA x86: add constraints check for nid parameters
Date: Wed, 7 Dec 2011 20:40:22 +0100 [thread overview]
Message-ID: <20111207194021.GA26060@dhcp-27-244.brq.redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1112061233330.28251@chino.kir.corp.google.com>
On Tue, 06 Dec 2011, David Rientjes wrote:
>
> On Fri, 2 Dec 2011, Petr Holasek wrote:
>
> > > > > > This patch adds constraints checks into __node_distance() and
> > > > > > numa_set_distance() functions. If from or to parameters are
> > > > > > lower than zero, it results into oops now.
> > > > >
> > > > > Passing negative numbers into __node_distance() sounds like a bug in
> > > > > the caller, and this patch will remove our means of detecting that bug.
> > > >
> > > > That's true, but upper boundary is checked now, so why not to check lower?
> > >
> > > Because it adds more code to the kernel and can hide bugs?
> > >
>
> The upper bound is checked to ensure that we don't dereference past end of
> the array that stores the distance table, so it will catch errors for
> things like memory hotplug when additional nodes are onlined and the data
> structure isn't updated accordingly.
Thanks for clarification, I missed this case.
>
> > > If what we're doing here is to be defensive against buggy BIOS tables
> > > (a good idea) then we should validate the BIOS table values as close as
> > > possible to the point where they were read frmo the BIOS. And we should
> > > (probably) emit a warning if a bad table entry is detected, rather than
> > > silently fixing it up.
> >
> > numa_set_distance() does exactly what you described above, only emits a
> > warning. I agree with your objections with __node_distance() checks, it
> > really can hide bugs in caller. So silent fix-up is the main problem and
> > we shouldn't check anything so the caller will be advised when using
> > wrong nid by oops with a benefit of less code for us. Do I understand your
> > opinion on this type of code?
>
> I'd have no objection to adding a check to numa_set_distance() to ensure
> the node ids are non-negative in the same way we check that the distances
> themselves are non-negative; that can catch errors when pxms are used
> uninitialized when parsing the SRAT. However, I think adding the check to
> __node_distance() is unnecessary.
Ok, I'll try v2 without __node_distance()
next prev parent reply other threads:[~2011-12-07 19:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-01 11:45 [PATCH RESEND] " Petr Holasek
2011-12-01 21:34 ` Andrew Morton
2011-12-01 23:14 ` Petr Holasek
2011-12-01 23:28 ` Andrew Morton
2011-12-02 10:55 ` Petr Holasek
2011-12-06 20:45 ` David Rientjes
2011-12-07 19:40 ` Petr Holasek [this message]
2011-12-07 19:43 ` [PATCH v2] " Petr Holasek
2011-12-07 21:46 ` David Rientjes
2011-12-08 12:16 ` [PATCH v3] " Petr Holasek
2011-12-08 21:09 ` David Rientjes
2011-12-09 7:10 ` Ingo Molnar
2011-12-09 10:44 ` David Rientjes
2011-12-09 20:08 ` [tip:x86/mm] x86/numa: Add " tip-bot for Petr Holasek
2011-12-08 18:58 ` [PATCH v2] NUMA x86: add " Andi Kleen
2011-12-08 21:12 ` David Rientjes
2011-12-09 7:11 ` Ingo Molnar
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=20111207194021.GA26060@dhcp-27-244.brq.redhat.com \
--to=pholasek@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=anton@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rientjes@google.com \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®