From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64/numa: Add more vetting in numa_set_distance()
Date: Mon, 29 Oct 2018 11:25:04 +0000 [thread overview]
Message-ID: <20181029112504.GF14127@arm.com> (raw)
In-Reply-To: <1540562267-101152-1-git-send-email-john.garry@huawei.com>
Hi John,
On Fri, Oct 26, 2018 at 09:57:47PM +0800, John Garry wrote:
> Currently it is acceptable to set the distance between 2 separate nodes to
> LOCAL_DISTANCE.
>
> Reject this as it is invalid.
>
> This change avoids a crash reported in [1].
>
> [1] https://www.spinics.net/lists/arm-kernel/msg683304.html
>
> Signed-off-by: John Garry <john.garry@huawei.com>
>
> diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
> index 146c04c..6092e3d 100644
> --- a/arch/arm64/mm/numa.c
> +++ b/arch/arm64/mm/numa.c
> @@ -335,7 +335,8 @@ void __init numa_set_distance(int from, int to, int distance)
> }
>
> if ((u8)distance != distance ||
> - (from == to && distance != LOCAL_DISTANCE)) {
> + (from == to && distance != LOCAL_DISTANCE) ||
> + (from != to && distance == LOCAL_DISTANCE)) {
The current code here is more-or-less lifted from the x86 implementation
of numa_set_distance(). I think we should either factor out the sanity check
into a core helper or make the core code robust to these funny configurations.
Will
WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: John Garry <john.garry@huawei.com>
Cc: catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linuxarm@huawei.com
Subject: Re: [PATCH] arm64/numa: Add more vetting in numa_set_distance()
Date: Mon, 29 Oct 2018 11:25:04 +0000 [thread overview]
Message-ID: <20181029112504.GF14127@arm.com> (raw)
In-Reply-To: <1540562267-101152-1-git-send-email-john.garry@huawei.com>
Hi John,
On Fri, Oct 26, 2018 at 09:57:47PM +0800, John Garry wrote:
> Currently it is acceptable to set the distance between 2 separate nodes to
> LOCAL_DISTANCE.
>
> Reject this as it is invalid.
>
> This change avoids a crash reported in [1].
>
> [1] https://www.spinics.net/lists/arm-kernel/msg683304.html
>
> Signed-off-by: John Garry <john.garry@huawei.com>
>
> diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
> index 146c04c..6092e3d 100644
> --- a/arch/arm64/mm/numa.c
> +++ b/arch/arm64/mm/numa.c
> @@ -335,7 +335,8 @@ void __init numa_set_distance(int from, int to, int distance)
> }
>
> if ((u8)distance != distance ||
> - (from == to && distance != LOCAL_DISTANCE)) {
> + (from == to && distance != LOCAL_DISTANCE) ||
> + (from != to && distance == LOCAL_DISTANCE)) {
The current code here is more-or-less lifted from the x86 implementation
of numa_set_distance(). I think we should either factor out the sanity check
into a core helper or make the core code robust to these funny configurations.
Will
next prev parent reply other threads:[~2018-10-29 11:25 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-26 13:57 [PATCH] arm64/numa: Add more vetting in numa_set_distance() John Garry
2018-10-26 13:57 ` John Garry
2018-10-29 11:25 ` Will Deacon [this message]
2018-10-29 11:25 ` Will Deacon
2018-10-29 12:14 ` John Garry
2018-10-29 12:14 ` John Garry
2018-10-29 12:16 ` Will Deacon
2018-10-29 12:16 ` Will Deacon
2018-10-29 12:32 ` John Garry
2018-10-29 12:32 ` John Garry
2018-10-29 12:45 ` Anshuman Khandual
2018-10-29 12:45 ` Anshuman Khandual
2018-10-29 14:44 ` John Garry
2018-10-29 14:44 ` John Garry
2018-10-30 2:46 ` Anshuman Khandual
2018-10-30 2:46 ` Anshuman Khandual
2018-11-01 11:27 ` Will Deacon
2018-11-01 11:27 ` Will Deacon
2018-11-01 11:39 ` John Garry
2018-11-01 11:39 ` John Garry
2018-11-08 14:20 ` Anshuman Khandual
2018-11-08 14:20 ` Anshuman Khandual
2018-10-29 14:48 ` Will Deacon
2018-10-29 14:48 ` Will Deacon
2018-10-30 3:00 ` Anshuman Khandual
2018-10-30 3:00 ` Anshuman Khandual
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=20181029112504.GF14127@arm.com \
--to=will.deacon@arm.com \
--cc=linux-arm-kernel@lists.infradead.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.