[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrXC5mVPTKjW7gZG_GGbADbeUPO7X-9ARTOaCVo1icYJkw@mail.gmail.com>
Date: Fri, 29 Apr 2016 17:09:56 -0700
From: Andy Lutomirski <luto@...capital.net>
To: Jiri Kosina <jikos@...nel.org>
Cc: Ingo Molnar <mingo@...hat.com>,
Josh Poimboeuf <jpoimboe@...hat.com>, X86 ML <x86@...nel.org>,
Heiko Carstens <heiko.carstens@...ibm.com>,
"linux-s390@...r.kernel.org" <linux-s390@...r.kernel.org>,
live-patching@...r.kernel.org,
Michael Ellerman <mpe@...erman.id.au>,
Chris J Arges <chris.j.arges@...onical.com>,
linuxppc-dev@...ts.ozlabs.org, Jessica Yu <jeyu@...hat.com>,
Petr Mladek <pmladek@...e.com>, Jiri Slaby <jslaby@...e.cz>,
Vojtech Pavlik <vojtech@...e.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Miroslav Benes <mbenes@...e.cz>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking
On Apr 29, 2016 3:11 PM, "Jiri Kosina" <jikos@...nel.org> wrote:
>
> On Fri, 29 Apr 2016, Andy Lutomirski wrote:
>
> > > NMI, MCE and interrupts aren't a problem because they have dedicated
> > > stacks, which are easy to detect. If the tasks' stack is on an
> > > exception stack or an irq stack, we consider it unreliable.
> >
> > Only on x86_64.
>
> Well, MCEs are more or less x86-specific as well. But otherwise good
> point, thanks Andy.
>
> So, how does stack layout generally look like in case when NMI is actually
> running on proper kernel stack? I thought it's guaranteed to contain
> pt_regs anyway in all cases. Is that not guaranteed to be the case?
>
On x86, at least, there will still be pt_regs for the NMI. For the
interrupted state, though, there might not be pt_regs, as the NMI
might have happened while still populating pt_regs. In fact, the NMI
stack could overlap task_pt_regs.
For x86_32, there's no guarantee that pt_regs contains sp due to
hardware silliness. You need to parse it more carefully, as,
!user_mode(regs), then the old sp is just above pt_regs.
--Andy
Powered by blists - more mailing lists