From: Pekka Paalanen <pq@iki.fi>
To: "Vegard Nossum" <vegard.nossum@gmail.com>
Cc: linux-kernel@vger.kernel.org, "Ingo Molnar" <mingo@elte.hu>,
"Christoph Hellwig" <hch@infradead.org>,
"Arjan van de Ven" <arjan@infradead.org>,
"Pavel Roskin" <proski@gnu.org>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Peter Zijlstra" <a.p.zijlstra@chello.nl>
Subject: Re: [RFC] mmiotrace full patch, preview 2
Date: Fri, 28 Mar 2008 20:24:35 +0200 [thread overview]
Message-ID: <20080328202435.6a58e21d@daedalus.pq.iki.fi> (raw)
In-Reply-To: <19f34abd0803271613vc6d6e9ic0491643eb25a3e8@mail.gmail.com>
On Fri, 28 Mar 2008 00:13:48 +0100
"Vegard Nossum" <vegard.nossum@gmail.com> wrote:
> I may of course be wrong, but... Shouldn't the post_kmmio_handler(),
> called from the die notifier chain, check for the DR_STEP condition?
> This makes sure that the function is not called in the cases where the
> source of the debug exception was not a single-stepping event. Though
> I guess you'll also have other checks in place to notice that the
> interrupt was not the one you were expecting. I guess a little extra
> safety won't hurt though?
>
> On Sun, Mar 9, 2008 at 3:40 PM, Pekka Paalanen <pq@iki.fi> wrote:
> > +/*
> > + * Interrupts are disabled on entry as trap1 is an interrupt gate
> > + * and they remain disabled thorough out this function.
> > + * This must always get called as the pair to kmmio_handler().
> > + */
> > +static int post_kmmio_handler(unsigned long condition, struct pt_regs *regs)
> > +{
> > + int ret = 0;
> > + struct kmmio_context *ctx = &get_cpu_var(kmmio_ctx);
>
> if (!(condition & DR_STEP))
> return;
I guess that would be appropriate. I think it should go into this
function:
+static int kmmio_die_notifier(struct notifier_block *nb, unsigned long val,
+ void *args)
+{
+ struct die_args *arg = args;
+
+ if (val == DIE_DEBUG)
+ if (post_kmmio_handler(arg->err, arg->regs) == 1)
+ return NOTIFY_STOP;
+
+ return NOTIFY_DONE;
+}
On the other hand I am thinking of not using the die notifier chain
at all and adding a direct call from do_debug() or something.
This is the last dynamic hook remaining from the out-of-tree module
era of mmiotrace.
I guess with the notifier list there is a possibility that another
module intercepts my single step trap, so that this is never called,
which would leave mmiotrace half blind, and also trigger a recursive
probe hit.
btw. what if someone uses kmemcheck and mmiotrace at the same time?
Mmiotrace will not fiddle with any other pages than returned via
__ioremap(), but can kmemcheck "hide" the same mmio pages?
Also keeping in mind, that some day I'd like to make mmiotrace able
to catch mmio accesses originating in user space.
Thanks.
--
Pekka Paalanen
http://www.iki.fi/pq/
next prev parent reply other threads:[~2008-03-28 18:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-09 14:40 Pekka Paalanen
2008-03-09 14:46 ` Pekka Paalanen
2008-03-27 23:13 ` Vegard Nossum
2008-03-28 18:24 ` Pekka Paalanen [this message]
2008-03-28 20:25 ` mmiotrace bug: recursive probe hit Pekka Paalanen
2008-03-30 17:26 ` Pekka Paalanen
2008-04-03 21:07 ` Pekka Paalanen
2008-04-03 21:40 ` Vegard Nossum
2008-04-04 13:18 ` Pekka Paalanen
2008-04-05 7:36 ` Avi Kivity
2008-04-05 7:40 ` Pekka Enberg
2008-04-05 12:39 ` Avi Kivity
2008-04-05 15:58 ` Avi Kivity
2008-04-06 17:32 ` Pekka Paalanen
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=20080328202435.6a58e21d@daedalus.pq.iki.fi \
--to=pq@iki.fi \
--cc=a.p.zijlstra@chello.nl \
--cc=arjan@infradead.org \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=proski@gnu.org \
--cc=rostedt@goodmis.org \
--cc=vegard.nossum@gmail.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
all inboxes | Powered by JetHome®