From: David Laight <David.Laight@ACULAB.COM>
To: "'Liang, Kan'" <kan.liang@linux.intel.com>,
"peterz@infradead.org" <peterz@infradead.org>,
"mingo@redhat.com" <mingo@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "ak@linux.intel.com" <ak@linux.intel.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: RE: [PATCH] perf/x86/intel/uncore: Fix oops when counting IMC uncore events on some TGL
Date: Wed, 27 May 2020 15:17:22 +0000 [thread overview]
Message-ID: <a891f75d599c4978ba941de73c6a667b@AcuMS.aculab.com> (raw)
In-Reply-To: <9f0ed889-590e-6f7a-85bd-c4be43e993f3@linux.intel.com>
From: Liang, Kan
> Sent: 27 May 2020 16:01
> On 5/27/2020 10:51 AM, David Laight wrote:
> > From: Liang, Kan
> >> Sent: 27 May 2020 15:47
> >> On 5/27/2020 8:59 AM, David Laight wrote:
> >>> From: kan.liang@linux.intel.com
> >>>> Sent: 27 May 2020 13:31
> >>>>
> >>>> From: Kan Liang <kan.liang@linux.intel.com>
> >>>>
> >>>> When counting IMC uncore events on some TGL machines, an oops will be
> >>>> triggered.
> >>>> [ 393.101262] BUG: unable to handle page fault for address:
> >>>> ffffb45200e15858
> >>>> [ 393.101269] #PF: supervisor read access in kernel mode
> >>>> [ 393.101271] #PF: error_code(0x0000) - not-present page
> >>>>
> >>>> Current perf uncore driver still use the IMC MAP SIZE inherited from
> >>>> SNB, which is 0x6000.
> >>>> However, the offset of IMC uncore counters for some TGL machines is
> >>>> larger than 0x6000, e.g. 0xd8a0.
> >>>>
> >>>> Enlarge the IMC MAP SIZE for TGL to 0xe000.
> >>>
> >>> Replacing one 'random' constant with a different one
> >>> doesn't seem like a proper fix.
> >>>
> >>> Surely the actual bounds of the 'memory' area are properly
> >>> defined somewhere.
> >>> Or at least should come from a table.
> >>>
> >>> You also need to verify that the offsets are within the mapped area.
> >>> An unexpected offset shouldn't try to access an invalid address.
> >>
> >> Thanks for the review.
> >>
> >> I agree that we should add a check before mapping the area to prevent
> >> the issue happens again.
> >>
> >> I think the check should be a generic check for all platforms which try
> >> to map an area, not just for TGL. I will submit a separate patch for the
> >> check.
> >
> > You need a check that the actual access is withing the mapped area.
> > So instead of getting an OOPS you get a error.
> >
> > This is after you've mapped it.
>
> Sure. Will add a WARN_ONCE() before the actual access.
No that will still panic some systems.
pr_warn() is all you need.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2020-05-27 15:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-27 12:30 [PATCH] perf/x86/intel/uncore: Fix oops when counting IMC uncore events on some TGL kan.liang
2020-05-27 12:59 ` David Laight
2020-05-27 14:46 ` Liang, Kan
2020-05-27 14:51 ` David Laight
2020-05-27 15:01 ` Liang, Kan
2020-05-27 15:17 ` David Laight [this message]
2020-05-27 16:02 ` Liang, Kan
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=a891f75d599c4978ba941de73c6a667b@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=ak@linux.intel.com \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox