Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1209959

Re: [tip:x86/asm] x86/asm/entry/64: Migrate error and IRQ exit work to C and remove old assembly code

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Frederic Weisbecker <fweisbec@gmail.com>
Newsgroups linux.kernel
Subject Re: [tip:x86/asm] x86/asm/entry/64: Migrate error and IRQ exit work to C and remove old assembly code
Date Wed, 19 Aug 2015 19:20:01 +0200
Message-ID <pZfbP-3Xo-1@gated-at.bofh.it> (permalink)
References <pIf8f-4d6-33@gated-at.bofh.it> <pJyLx-4Ca-61@gated-at.bofh.it> <pWqn7-1X7-7@gated-at.bofh.it> <pWqGt-2kd-9@gated-at.bofh.it> <pWr9w-37t-7@gated-at.bofh.it> <pWrjb-3iz-7@gated-at.bofh.it> <pWEq9-5Pp-59@gated-at.bofh.it> <pWFPd-7Zw-45@gated-at.bofh.it> <pYXHY-3Pc-13@gated-at.bofh.it> <pYXRE-41k-19@gated-at.bofh.it>
X-Original-To Andy Lutomirski <luto@amacapital.net>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=NknJo7EfcwMkfqEhZLxOeHDQ9zgXLMGZKTapPJZGjog=; b=yvRrOMVVlcUIKkQp5mj+2NyOmp2S0QVxijQlTeLKOXcsda/mk62uJJGoP7ycxNiKFP s8ONtUc8mGOiNady+9ZuYUuo2qGR2tbiWuEWd8lUG/GOHs2rDSmsuseynIyfEfa+4oxD 4rCNbAdVImiUEJAwKWVjThrGmFGAp94qKFDF9FpDMnsZLV2CZ3VOB9fBkZhfcFxB+PCx t3Nj2hLzd3nc1fc8yHW0+vdBglk8rEZDF6l7eq0JYT5AqwIs7RQSi1HtWYlAj7ARIuB5 WxhHhRo8fbpX6EpGLb8Yt1x8N9zPfO+UXOzSFWxoPHjlUmDnOBKu3BZ9VvZLXPMtA6LJ ceQQ==
X-Received by 10.180.107.138 with SMTP id hc10mr5093293wib.2.1440004694220; Wed, 19 Aug 2015 10:18:14 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.23 (2014-03-12)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 71
Organization linux.* mail to news gateway
X-Original-Cc Denys Vlasenko <dvlasenk@redhat.com>, Rik van Riel <riel@redhat.com>, Borislav Petkov <bp@alien8.de>, Peter Zijlstra <peterz@infradead.org>, Brian Gerst <brgerst@gmail.com>, Denys Vlasenko <vda.linux@googlemail.com>, Kees Cook <keescook@chromium.org>, Thomas Gleixner <tglx@linutronix.de>, Oleg Nesterov <oleg@redhat.com>, Andrew Lutomirski <luto@kernel.org>, Linus Torvalds <torvalds@linux-foundation.org>, Ingo Molnar <mingo@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "linux-tip-commits@vger.kernel.org" <linux-tip-commits@vger.kernel.org>
X-Original-Date Wed, 19 Aug 2015 19:18:12 +0200
X-Original-Message-ID <20150819171811.GB21717@lerouge>
X-Original-References <60e90901eee611e59e958bfdbbe39969b4f88fe5.1435952415.git.luto@kernel.org> <tip-02bc7768fe447ae305e924b931fa629073a4a1b9@git.kernel.org> <20150811223827.GB15639@lerouge> <CALCETrVo+FoiWoRJXAtcONm9itV1FsogCDx8U1SussBpr_K9NA@mail.gmail.com> <20150811232234.GD15639@lerouge> <CALCETrVN00n0MJ-F1idkE7i4NA6H_kN69ztsTqH6sOpJHJ0NMQ@mail.gmail.com> <20150812133217.GB21542@lerouge> <CALCETrVMtAuckNBctBbXUPpTNRV1PoPufJUQuSuZ8V5vQgFW6A@mail.gmail.com> <20150818223409.GB12858@lerouge> <CALCETrVD1EyH075Lwja4rCLg9OXSB7ZgQtP_5ZwFypf3b9q9sQ@mail.gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1209959

Show key headers only | View raw


On Tue, Aug 18, 2015 at 03:40:20PM -0700, Andy Lutomirski wrote:
> On Tue, Aug 18, 2015 at 3:34 PM, Frederic Weisbecker <fweisbec@gmail.com> wrote:
> >> If we switched back to exception_enter, we'd have to remember the
> >> previous state, and, with a single exception right now, I think that's
> >> unnecessary.
> >>
> >> I think there are only three states we can be in at exception entry:
> >> user (and user_mode(regs)), kernel (and kernel_mode(regs)), or
> >> NMI-like.
> >
> > But we can have user && (!user_mode(regs)) if exception happens on exception
> > entry code.
> 
> I sure hope not, unless it nests inside an NMI-like thing.  It's
> conceivable that this might happen due to perf NMIs causing a failed
> MSR read or similar.  We might need to relax the assertions to check
> that we're either in kernel or NMI context.  If so, that's
> straightforward.  Meanwhile no one has reported this happening.

But we can still have #DB on entry code right? We blocked breakpoints on entry
code (I still don't get why and it looks to me like an overkill) but we still
have watchpoints.

> 
> >
> >> In the user case, the new code is correct.  In the kernel
> >> case, the new code is also correct.  In the NMI case (if we're nested
> >> in an NMI or similar entry)) then it is and was the responsibility of
> >> the NMI-like entry to call rcu_nmi_enter(), and things that nest
> >> inside that shouldn't touch context tracking (with the possible
> >> exception of calling rcu_nmi_enter() again).
> >>
> >> In current -tip, there's a slight hole in this due to syscalls, and I'll fix it.
> >
> > There must be a check for context tracking enabled anyway. So why can't
> > we just just do in exception entry code:
> >
> >        if (exception_slow_path()) {
> >            exception_enter()
> >            exception_handler()
> >            exception_exit()
> >        } else {
> >            normal stuff
> >        }
> >
> > Especially if we can manage to implement static keys in ASM, this will sum up to
> > a single one.
> 
> There isn't really an exception slow path.  There's already a branch
> for user vs kernel (in the CPL sense), and with my patches, there's no
> additional branch for previous context tracking state.

But an exception slow path based on static key would the most lightweight
thing for context tracking off-case (which is 99.9999% of usecases) and we
would keep it robust (ie: no need to enumerate all the fragile non-possibility
for an exception in entry code to get it safe).

> > So now we can't set a breakpoint on syscall entry anymore?
> >
> > I'm still nervous with all that.
> 
> We haven't done anything that would make breakpoints on syscall entry
> less safe than they were, but we now disallow the breakpoints.  In the
> future, we might take advantage of that change.

I still don't get the reason of that.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [tip:x86/asm] x86/asm/entry/64: Migrate error and IRQ exit work  to C and remove old assembly code Frederic Weisbecker <fweisbec@gmail.com> - 2015-08-12 00:40 +0200
  Re: [tip:x86/asm] x86/asm/entry/64: Migrate error and IRQ exit work  to C and remove old assembly code Andy Lutomirski <luto@amacapital.net> - 2015-08-12 01:00 +0200
    Re: [tip:x86/asm] x86/asm/entry/64: Migrate error and IRQ exit work  to C and remove old assembly code Frederic Weisbecker <fweisbec@gmail.com> - 2015-08-12 01:30 +0200
      Re: [tip:x86/asm] x86/asm/entry/64: Migrate error and IRQ exit work  to C and remove old assembly code Andy Lutomirski <luto@amacapital.net> - 2015-08-12 01:40 +0200
        Re: [tip:x86/asm] x86/asm/entry/64: Migrate error and IRQ exit work  to C and remove old assembly code Frederic Weisbecker <fweisbec@gmail.com> - 2015-08-12 15:40 +0200
          Re: [tip:x86/asm] x86/asm/entry/64: Migrate error and IRQ exit work  to C and remove old assembly code Andy Lutomirski <luto@amacapital.net> - 2015-08-12 17:10 +0200
            Re: [tip:x86/asm] x86/asm/entry/64: Migrate error and IRQ exit work  to C and remove old assembly code Frederic Weisbecker <fweisbec@gmail.com> - 2015-08-19 00:40 +0200
              Re: [tip:x86/asm] x86/asm/entry/64: Migrate error and IRQ exit work  to C and remove old assembly code Andy Lutomirski <luto@amacapital.net> - 2015-08-19 00:50 +0200
                Re: [tip:x86/asm] x86/asm/entry/64: Migrate error and IRQ exit work  to C and remove old assembly code Frederic Weisbecker <fweisbec@gmail.com> - 2015-08-19 19:20 +0200
                Re: [tip:x86/asm] x86/asm/entry/64: Migrate error and IRQ exit work  to C and remove old assembly code Andy Lutomirski <luto@amacapital.net> - 2015-08-19 20:10 +0200

csiph-web