From: "H. Peter Anvin" <hpa@zytor.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: suresh.b.siddha@intel.com,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>,
linux-mtd@lists.infradead.org,
Sasha Levin <levinsasha928@gmail.com>,
Dave Jones <davej@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
dwmw2@infradead.org
Subject: Re: mtd: kernel BUG at arch/x86/mm/pat.c:279!
Date: Sun, 09 Sep 2012 10:01:33 -0700 [thread overview]
Message-ID: <504CCB6D.7070005@zytor.com> (raw)
In-Reply-To: <CA+55aFwej93o7aLe_xwV5CGuT0BDyAz54cyWm6Xe3wj-hCT3PA@mail.gmail.com>
On 09/09/2012 08:31 AM, Linus Torvalds wrote:
> On Sun, Sep 9, 2012 at 7:56 AM, Suresh Siddha <suresh.b.siddha@intel.com> wrote:
>>
>> yes but that is not a valid range I think because of the supported
>> physical address bit limits of the processor and also the max
>> architecture limit of 52 address bits.
>
> But how could the caller possibly know that? None of those internal
> PAT limits are exposed anywhere.
>
> So doing the BUG_ON() is wrong. I'd suggest changing it to an EINVAL.
>
> In fact, BUG_ON() is *always* wrong, unless it's a "my internal data
> structures are so messed up that I cannot continue".
>
I suspect the right answer is doing something like:
u64 max_phys = 1ULL << boot_cpu_data.x86_phys_bits;
if (start >= max_phys || end > max_phys || start >= end)
return -EINVAL;
... although max_phys perhaps should be precalculated and stored in
struct cpuinfo_x86 instead of being generated de novo.
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
WARNING: multiple messages have this Message-ID (diff)
From: "H. Peter Anvin" <hpa@zytor.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: suresh.b.siddha@intel.com, Sasha Levin <levinsasha928@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
dwmw2@infradead.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
linux-mtd@lists.infradead.org, linux-mm <linux-mm@kvack.org>,
Dave Jones <davej@redhat.com>
Subject: Re: mtd: kernel BUG at arch/x86/mm/pat.c:279!
Date: Sun, 09 Sep 2012 10:01:33 -0700 [thread overview]
Message-ID: <504CCB6D.7070005@zytor.com> (raw)
In-Reply-To: <CA+55aFwej93o7aLe_xwV5CGuT0BDyAz54cyWm6Xe3wj-hCT3PA@mail.gmail.com>
On 09/09/2012 08:31 AM, Linus Torvalds wrote:
> On Sun, Sep 9, 2012 at 7:56 AM, Suresh Siddha <suresh.b.siddha@intel.com> wrote:
>>
>> yes but that is not a valid range I think because of the supported
>> physical address bit limits of the processor and also the max
>> architecture limit of 52 address bits.
>
> But how could the caller possibly know that? None of those internal
> PAT limits are exposed anywhere.
>
> So doing the BUG_ON() is wrong. I'd suggest changing it to an EINVAL.
>
> In fact, BUG_ON() is *always* wrong, unless it's a "my internal data
> structures are so messed up that I cannot continue".
>
I suspect the right answer is doing something like:
u64 max_phys = 1ULL << boot_cpu_data.x86_phys_bits;
if (start >= max_phys || end > max_phys || start >= end)
return -EINVAL;
... although max_phys perhaps should be precalculated and stored in
struct cpuinfo_x86 instead of being generated de novo.
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: "H. Peter Anvin" <hpa@zytor.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: suresh.b.siddha@intel.com, Sasha Levin <levinsasha928@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
dwmw2@infradead.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
linux-mtd@lists.infradead.org, linux-mm <linux-mm@kvack.org>,
Dave Jones <davej@redhat.com>
Subject: Re: mtd: kernel BUG at arch/x86/mm/pat.c:279!
Date: Sun, 09 Sep 2012 10:01:33 -0700 [thread overview]
Message-ID: <504CCB6D.7070005@zytor.com> (raw)
In-Reply-To: <CA+55aFwej93o7aLe_xwV5CGuT0BDyAz54cyWm6Xe3wj-hCT3PA@mail.gmail.com>
On 09/09/2012 08:31 AM, Linus Torvalds wrote:
> On Sun, Sep 9, 2012 at 7:56 AM, Suresh Siddha <suresh.b.siddha@intel.com> wrote:
>>
>> yes but that is not a valid range I think because of the supported
>> physical address bit limits of the processor and also the max
>> architecture limit of 52 address bits.
>
> But how could the caller possibly know that? None of those internal
> PAT limits are exposed anywhere.
>
> So doing the BUG_ON() is wrong. I'd suggest changing it to an EINVAL.
>
> In fact, BUG_ON() is *always* wrong, unless it's a "my internal data
> structures are so messed up that I cannot continue".
>
I suspect the right answer is doing something like:
u64 max_phys = 1ULL << boot_cpu_data.x86_phys_bits;
if (start >= max_phys || end > max_phys || start >= end)
return -EINVAL;
... although max_phys perhaps should be precalculated and stored in
struct cpuinfo_x86 instead of being generated de novo.
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
next prev parent reply other threads:[~2012-09-09 17:01 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-29 8:48 mtd: kernel BUG at arch/x86/mm/pat.c:279! Sasha Levin
2012-06-29 8:48 ` Sasha Levin
2012-07-30 11:00 ` Sasha Levin
2012-07-30 11:00 ` Sasha Levin
2012-07-30 11:00 ` Sasha Levin
2012-09-07 16:55 ` Sasha Levin
2012-09-07 16:55 ` Sasha Levin
2012-09-07 16:55 ` Sasha Levin
2012-09-07 18:14 ` Linus Torvalds
2012-09-07 18:14 ` Linus Torvalds
2012-09-07 18:14 ` Linus Torvalds
2012-09-07 22:42 ` Suresh Siddha
2012-09-07 22:42 ` Suresh Siddha
2012-09-07 22:42 ` Suresh Siddha
2012-09-07 23:09 ` Linus Torvalds
2012-09-07 23:09 ` Linus Torvalds
2012-09-07 23:09 ` Linus Torvalds
2012-09-07 23:54 ` Suresh Siddha
2012-09-07 23:54 ` Suresh Siddha
2012-09-07 23:54 ` Suresh Siddha
2012-09-08 19:57 ` Linus Torvalds
2012-09-08 19:57 ` Linus Torvalds
2012-09-09 14:56 ` Suresh Siddha
2012-09-09 14:56 ` Suresh Siddha
2012-09-09 14:56 ` Suresh Siddha
2012-09-09 15:31 ` Linus Torvalds
2012-09-09 15:31 ` Linus Torvalds
2012-09-09 15:31 ` Linus Torvalds
2012-09-09 17:01 ` H. Peter Anvin [this message]
2012-09-09 17:01 ` H. Peter Anvin
2012-09-09 17:01 ` H. Peter Anvin
2012-09-12 10:50 ` Sasha Levin
2012-09-12 10:50 ` Sasha Levin
2012-09-12 10:50 ` Sasha Levin
2012-09-12 10:56 ` Sasha Levin
2012-09-12 10:56 ` Sasha Levin
2012-09-12 10:56 ` Sasha Levin
2012-09-28 9:00 ` Sasha Levin
2012-09-28 9:00 ` Sasha Levin
2012-09-28 9:00 ` Sasha Levin
2012-09-28 16:44 ` Linus Torvalds
2012-09-28 16:44 ` Linus Torvalds
2012-09-28 16:44 ` Linus Torvalds
2012-09-28 18:05 ` Artem Bityutskiy
2012-09-28 18:05 ` Artem Bityutskiy
2012-09-28 19:13 ` Linus Torvalds
2012-09-28 19:13 ` Linus Torvalds
2012-09-28 19:13 ` Linus Torvalds
2012-09-28 19:44 ` Sasha Levin
2012-09-28 19:44 ` Sasha Levin
2012-09-28 19:44 ` Sasha Levin
2012-09-28 19:04 ` David Woodhouse
2012-09-28 19:04 ` David Woodhouse
2012-09-28 19:15 ` richard -rw- weinberger
2012-09-28 19:15 ` richard -rw- weinberger
2012-09-28 19:15 ` richard -rw- weinberger
2012-09-28 19:18 ` richard -rw- weinberger
2012-09-28 19:18 ` richard -rw- weinberger
2012-09-28 19:18 ` richard -rw- weinberger
2012-09-29 16:11 ` David Woodhouse
2012-09-29 16:11 ` David Woodhouse
2012-09-29 16:34 ` David Woodhouse
2012-09-29 16:34 ` David Woodhouse
2012-09-09 16:56 ` H. Peter Anvin
2012-09-09 16:56 ` H. Peter Anvin
2012-09-09 16:56 ` H. Peter Anvin
2012-09-09 19:04 ` David Woodhouse
2012-09-09 19:04 ` David Woodhouse
2012-09-09 20:33 ` H. Peter Anvin
2012-09-09 20:33 ` H. Peter Anvin
2012-09-09 20:33 ` H. Peter Anvin
2012-09-10 5:17 ` Sasha Levin
2012-09-10 5:17 ` Sasha Levin
2012-09-10 5:17 ` Sasha Levin
2012-09-08 8:10 ` Sasha Levin
2012-09-08 8:10 ` Sasha Levin
2012-09-08 8:10 ` Sasha Levin
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=504CCB6D.7070005@zytor.com \
--to=hpa@zytor.com \
--cc=akpm@linux-foundation.org \
--cc=davej@redhat.com \
--cc=dwmw2@infradead.org \
--cc=levinsasha928@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-mtd@lists.infradead.org \
--cc=suresh.b.siddha@intel.com \
--cc=torvalds@linux-foundation.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.