All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: Ingo Molnar <mingo@kernel.org>
Cc: "Andy Lutomirski" <luto@kernel.org>, "X86 ML" <x86@kernel.org>,
	"Sasha Levin" <sasha.levin@oracle.com>,
	"Brian Gerst" <brgerst@gmail.com>,
	"Frédéric Weisbecker" <fweisbec@gmail.com>,
	"Denys Vlasenko" <dvlasenk@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Oleg Nesterov" <oleg@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"Thomas Gleixner" <tglx@linutronix.de>
Subject: Re: [PATCH] x86/traps: Weaken context tracking entry assertions
Date: Fri, 21 Aug 2015 07:39:38 -0700	[thread overview]
Message-ID: <CALCETrUDFihHXE0EjpbF4Zu_hsm+WwH+Rie3zf9PGJVSQGRAXQ@mail.gmail.com> (raw)
In-Reply-To: <20150821062328.GA32366@gmail.com>

On Thu, Aug 20, 2015 at 11:23 PM, Ingo Molnar <mingo@kernel.org> wrote:
>
> * Andy Lutomirski <luto@kernel.org> wrote:
>
>> We were asserting that we were all the way in CONTEXT_KERNEL when exception
>> handlers were called.  While having this be true is, I think, a nice goal (or
>> maybe a variant in which we assert that we're in CONTEXT_KERNEL or some new IRQ
>> context), we're not quite there.
>>
>> In particular, if an IRQ interrupts the SYSCALL prologue and the IRQ handler in
>> turn causes an exception, the exception entry will be called in RCU IRQ mode but
>> with CONTEXT_USER.
>
> Hm, so what harm would there be in making IRQ handlers enter CONTEXT_KERNEL?
> Would nohz-full break?
>

We already do it for IRQs that hit user mode.  We don't do it for IRQs
that hit kernel mode because we don't need it yet (with this patch
applied) and because IMO we have no business taking IRQs from kernel
mode while in CONTEXT_USER.

I want to fix the latter in 4.4.  It's easy for native entries (it's
exactly the entry_64.S part of the other patch I sent), but it's
currently a big mess for compat entries because of the uaccess for
arg6, and I got that totally wrong in my patch.  Rather than further
complicating the asm, I think I want to try moving all of the compat
entries into C for 4.4.  I ran out of time to do it for 4.3.

Also, Rik said awhile ago that *huge* context tracking speedups would
become possible if we promised to stop calling the context tracking
hooks with IRQs on.  That's almost done in -tip -- I think the only
remaining ones are the syscall entries.  (syscall return is done in
-tip.)

I could teach IRQ entries to switch all the way to CONTEXT_KERNEL even
if they interrupt syscall entry, but that would also make the asm
messier for minimal short-term-only gain.

> I'd rather have a bit more tracking overhead here than lose such useful sanity
> checks.

I agree, but even the weaker sanity checks retain a decent amount of the value.

--Andy

  parent reply	other threads:[~2015-08-21 14:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-21  5:03 [PATCH] x86/traps: Weaken context tracking entry assertions Andy Lutomirski
2015-08-21  6:23 ` Ingo Molnar
2015-08-21 13:38   ` Frederic Weisbecker
2015-08-21 14:39   ` Andy Lutomirski [this message]
2015-08-21 13:24 ` Frederic Weisbecker
2015-08-22 13:57 ` [tip:core/core] " tip-bot for Andy Lutomirski

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=CALCETrUDFihHXE0EjpbF4Zu_hsm+WwH+Rie3zf9PGJVSQGRAXQ@mail.gmail.com \
    --to=luto@amacapital.net \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=sasha.levin@oracle.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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 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.