From: Peter Zijlstra <peterz@infradead.org>
To: Andy Lutomirski <luto@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Juergen Gross <jgross@suse.com>,
LKML <linux-kernel@vger.kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@alien8.de>,
Joel Fernandes <joel@joelfernandes.org>,
He Zhe <zhe.he@windriver.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Clark Williams <williams@redhat.com>
Subject: Re: [RFC][PATCH] tracing/x86: Save CR2 before tracing irqsoff on error_entry
Date: Thu, 21 Mar 2019 21:50:11 +0100 [thread overview]
Message-ID: <20190321205011.GE2490@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <CALCETrV1YRo8C6=VtFfrSDFAjQBs=Z6+uw-5hbus4frqAbUqGQ@mail.gmail.com>
On Thu, Mar 21, 2019 at 11:27:00AM -0700, Andy Lutomirski wrote:
> Well, here's pass zero at this. Untested, because it obviously
> doesn't work. Here are just a few things that are almost certainly
> wrong with it
Aah, you're proposing to simply not do TRACE_IRQS_OFF and
CALL_enter_from_user_mode and let \do_sym deal with it all.
Yes, that looks like it could almost work; esp. if you start by only
doing this for the idtentry stuff.
> - The IRQ tracing needs to be re-added.
>
> - Some real semantics need to be defined for precisely what code is
> responsible for tracing.
So we get passed \do_sym, how about we do:
call __\do_sym
And then use some CPP magic to generate the those functions such that we
have a consistent part of C glue between our asm and our 'real' C
handler.
This glue can then do the tracing in a consistent manner.
#define IDT_HANDLER(do_sym) \
asmlinkage __visible notrace void __do_sym(struct pt_regs *regs) \
{ \
trace_hardirqs_off(); \
if (user_mode(regs)) \
enter_from_user_mode(); \
do_sym(regs); \
}
Except more complicated I'm afraid, we need to handle more args etc..
> - We need some asm-callable assertions to check the following
> conditions as appropriate:
>
> (a) that IRQ flags are currently traced as off.
What do you need this for? When returning from do_sym ?
> (b) that IRQ flags are currently traced to match the IRET frame.
idem. Can't we have our C glue do that?
> (c) that our context tracking is currently in good shape. I'm not
> 100% sure how to define this.
So looking at this more; I used the %ebx games employed by
paranoid_entry to convey the state, but I didn't have to do that, the
actual condition seems to be:
regs->cs & 3
aka. user_mode(regs). In this case our C glue would need to do the
context tracking user exit.
In fact, I can change my patch to use that and reduce the ebx ugly.
> - We need to do some serious don't-instrument-me stuff to all the C
> entries, since we're now in an awful context when calling them.
Yah, but that's not new. do_page_fault(), sync_regs() at the very least
have this, so we can easily have our C glue have this too.
next prev parent reply other threads:[~2019-03-21 20:50 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-21 2:15 [RFC][PATCH] tracing/x86: Save CR2 before tracing irqsoff on error_entry Steven Rostedt
2019-03-21 8:33 ` Peter Zijlstra
2019-03-21 9:02 ` Peter Zijlstra
2019-03-21 10:45 ` Peter Zijlstra
2019-03-21 13:32 ` Steven Rostedt
2019-03-21 13:55 ` Steven Rostedt
2019-03-21 17:23 ` Linus Torvalds
2019-03-21 17:22 ` Peter Zijlstra
2019-03-21 18:05 ` Andy Lutomirski
2019-03-21 18:10 ` Steven Rostedt
2019-03-21 18:27 ` Andy Lutomirski
2019-03-21 20:50 ` Peter Zijlstra [this message]
2019-03-22 2:52 ` Andy Lutomirski
2019-03-21 18:28 ` Peter Zijlstra
2019-03-21 18:55 ` Steven Rostedt
2019-03-21 19:31 ` Peter Zijlstra
2019-03-21 19:50 ` Steven Rostedt
2019-03-21 20:03 ` Peter Zijlstra
2019-03-21 20:11 ` Steven Rostedt
2019-03-21 18:18 ` Linus Torvalds
2019-03-21 18:20 ` Andy Lutomirski
2019-03-21 18:25 ` Linus Torvalds
2019-03-21 18:37 ` Peter Zijlstra
2019-03-21 18:39 ` Andy Lutomirski
2019-03-21 20:00 ` Andrew Cooper
2019-03-21 20:35 ` Steven Rostedt
2019-03-21 18:38 ` Andy Lutomirski
2019-03-21 18:42 ` Peter Zijlstra
2019-03-21 18:22 ` hpa
2019-03-22 5:54 ` Juergen Gross
2019-03-21 18:27 ` Peter Zijlstra
2019-03-21 18:28 ` Andy Lutomirski
2019-03-21 18:33 ` Peter Zijlstra
2019-03-21 13:04 ` Steven Rostedt
2019-04-17 1:52 ` He Zhe
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=20190321205011.GE2490@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=williams@redhat.com \
--cc=zhe.he@windriver.com \
/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;
as well as URLs for NNTP newsgroup(s).