From: Frederic Weisbecker <frederic@kernel.org>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>,
x86@kernel.org, Steven Rostedt <rostedt@goodmis.org>,
Brian Gerst <brgerst@gmail.com>, Juergen Gross <JGross@suse.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Arnd Bergmann <arnd@arndb.de>
Subject: Re: [patch 13/16] x86/entry: Move irqflags and context tracking to C for simple idtentries
Date: Wed, 26 Feb 2020 18:17:06 +0100 [thread overview]
Message-ID: <20200226171705.GC6075@lenoir> (raw)
In-Reply-To: <2A899107-5AB8-4907-8AF2-31154A2E0A98@amacapital.net>
On Wed, Feb 26, 2020 at 09:09:34AM -0800, Andy Lutomirski wrote:
>
>
> > On Feb 26, 2020, at 9:05 AM, Frederic Weisbecker <frederic@kernel.org> wrote:
> >
> > On Wed, Feb 26, 2020 at 09:05:38AM +0100, Peter Zijlstra wrote:
> >>> On Tue, Feb 25, 2020 at 11:33:34PM +0100, Thomas Gleixner wrote:
> >>>
> >>> --- a/arch/x86/include/asm/idtentry.h
> >>> +++ b/arch/x86/include/asm/idtentry.h
> >>> @@ -7,14 +7,31 @@
> >>>
> >>> #ifndef __ASSEMBLY__
> >>>
> >>> +#ifdef CONFIG_CONTEXT_TRACKING
> >>> +static __always_inline void enter_from_user_context(void)
> >>> +{
> >>> + CT_WARN_ON(ct_state() != CONTEXT_USER);
> >>> + user_exit_irqoff();
> >>> +}
> >>> +#else
> >>> +static __always_inline void enter_from_user_context(void) { }
> >>> +#endif
> >>> +
> >>> /**
> >>> * idtentry_enter - Handle state tracking on idtentry
> >>> * @regs: Pointer to pt_regs of interrupted context
> >>> *
> >>> - * Place holder for now.
> >>> + * Invokes:
> >>> + * - The hardirq tracer to keep the state consistent as low level ASM
> >>> + * entry disabled interrupts.
> >>> + *
> >>> + * - Context tracking if the exception hit user mode
> >>> */
> >>> static __always_inline void idtentry_enter(struct pt_regs *regs)
> >>> {
> >>> + trace_hardirqs_off();
> >>> + if (user_mode(regs))
> >>> + enter_from_user_context();
> >>> }
> >>
> >> So:
> >>
> >> asm_exc_int3
> >> exc_int3
> >> idtentry_enter()
> >> enter_from_user_context
> >> if (context_tracking_enabled())
> >>
> >> poke_int3_handler();
> >>
> >> Is, AFAICT, completely buggered.
> >>
> >> You can't have a static_branch before the poke_int3_handler that deals
> >> with text_poke.
> >
> > #BP is treated like an NMI in your patchset IIRC?
> > In that case and since that implies we can't schedule, we can remove
> > the call to context tracking there once we have nmi_enter()/nmi_exit()
> > called unconditionally.
>
> int3 from user mode can send signals. This has better be able to schedule by the time it hits prepare_exit_to_usermode.
Oh right...
next prev parent reply other threads:[~2020-02-26 17:17 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 22:33 [patch 00/16] x86/entry: Consolidation - Part IV Thomas Gleixner
2020-02-25 22:33 ` [patch 01/16] x86/entry: Provide IDTENTRY_IST Thomas Gleixner
2020-02-25 22:33 ` [patch 02/16] x86/entry: Convert Machine Check to IDTENTRY_IST Thomas Gleixner
2020-02-25 22:33 ` [patch 03/16] x86/idtentry: Provide IDTENTRY_XEN for XEN/PV Thomas Gleixner
2020-02-25 22:33 ` [patch 04/16] x86/entry: Convert NMI to IDTENTRY_NMI Thomas Gleixner
2020-02-25 22:33 ` [patch 05/16] x86/entry: Convert Debug exception to IDTENTRY_DB Thomas Gleixner
2020-02-25 22:33 ` [patch 06/16] x86/entry/64: Remove error code clearing from #DB and #MCE ASM stub Thomas Gleixner
2020-02-25 22:33 ` [patch 07/16] x86/entry: Provide IDTRENTRY_NOIST variants for #DB and #MC Thomas Gleixner
2020-02-25 22:33 ` [patch 08/16] x86/entry: Implement user mode C entry points for #DB and #MCE Thomas Gleixner
2020-02-25 22:33 ` [patch 09/16] x86/entry: Provide IDTENTRY_DF Thomas Gleixner
2020-02-25 22:33 ` [patch 10/16] x86/entry: Convert double fault exception to IDTENTRY_DF Thomas Gleixner
2020-02-25 22:33 ` [patch 11/16] x86/entry: Switch XEN/PV hypercall entry to IDTENTRY Thomas Gleixner
2020-02-25 22:33 ` [patch 12/16] x86/entry/64: Simplify idtentry_body Thomas Gleixner
2020-02-25 22:33 ` [patch 13/16] x86/entry: Move irqflags and context tracking to C for simple idtentries Thomas Gleixner
2020-02-26 8:05 ` Peter Zijlstra
2020-02-26 9:20 ` Peter Zijlstra
2020-02-26 15:11 ` Andy Lutomirski
2020-02-26 16:28 ` Peter Zijlstra
2020-02-26 19:15 ` Andy Lutomirski
2020-02-26 20:25 ` Thomas Gleixner
2020-02-26 17:05 ` Frederic Weisbecker
2020-02-26 17:09 ` Andy Lutomirski
2020-02-26 17:17 ` Frederic Weisbecker [this message]
2020-02-25 22:33 ` [patch 14/16] x86/entry: Provide IDTENTRY_CR2 Thomas Gleixner
2020-02-25 22:33 ` [patch 15/16] x86/entry: Switch page fault exceptions to idtentry_simple Thomas Gleixner
2020-03-05 21:51 ` Andy Lutomirski
2020-03-05 23:02 ` Thomas Gleixner
2020-02-25 22:33 ` [patch 16/16] x86/entry: Disable interrupts in IDTENTRY Thomas Gleixner
2020-02-26 9:23 ` Peter Zijlstra
2020-02-26 20:21 ` Thomas Gleixner
2020-02-27 8:41 ` Peter Zijlstra
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=20200226171705.GC6075@lenoir \
--to=frederic@kernel.org \
--cc=JGross@suse.com \
--cc=arnd@arndb.de \
--cc=brgerst@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®