All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>, X86 ML <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 11:15:31 -0800	[thread overview]
Message-ID: <A4E714B9-ECBA-4984-986C-02B4EAF5018C@amacapital.net> (raw)
In-Reply-To: <20200226162811.GA18400@hirez.programming.kicks-ass.net>


> On Feb 26, 2020, at 8:28 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> 
> On Wed, Feb 26, 2020 at 07:11:39AM -0800, Andy Lutomirski wrote:
> 
>> In some sense, this is a weakness of the magic macro approach.  Some
>> of the entries just want to have code that runs before all the entry
>> fixups.  This is an example of it.  So are the cr2 reads.  It can all
>> be made to work, but it's a bit gross.
> 
> Right. In my current pile (new patche since last posting) I also have
> one that makes #DB save-clear/restore DR7.
> 
> I got it early enough that only a watchpoint on the task stack can still
> screw us over, since I also included your patch that excludes
> cpu_entry_area.

Hmm. It would be nice to prevent watchpoints on the task stack, but that would need some trickery.  It could be done.

> 
> Pushing it earlier still would require calling into C from the entry
> stack, which I know is on your todo list, but we're not quite there yet.

Indeed.

This is my main objection to the DEFINE_IDTENTRY stuff. It’s *great* for the easy cases, but it’s not so great for the nasty cases. Maybe we should open code PF, MC, DB, etc.  (And kill the kvm special case for PF.  I have a working patch for that and I can send it.)

Anyway, this isn’t actually what I was concerned about. I meant DR6, not DR7.  Specifically, if we get traced too early in do_debug / exc_debug, we can recursively debug and clobber DR6.  The result will be incorrect behavior in the outer do_debug. We can fix this the same way we handle CR2.  I just haven’t done it on the existing entry code because it’s too messy.

  reply	other threads:[~2020-02-26 19:15 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 [this message]
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
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=A4E714B9-ECBA-4984-986C-02B4EAF5018C@amacapital.net \
    --to=luto@amacapital.net \
    --cc=JGross@suse.com \
    --cc=arnd@arndb.de \
    --cc=brgerst@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 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.