From: Ilia Mirkin <imirkin@alum.mit.edu>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Pekka Paalanen <ppaalanen@gmail.com>, Lyude <lyude@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
Thomas Gleixner <tglx@linutronix.de>,
Karol Herbst <kherbst@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
hpa@zytor.com, linux-tip-commits@vger.kernel.org,
Karol Herbst <karolherbst@gmail.com>
Subject: Re: [tip:x86/urgent] x86/mm/kmmio: Fix mmiotrace for page unaligned addresses
Date: Tue, 12 Dec 2017 09:47:05 -0500 [thread overview]
Message-ID: <CAKb7UvjsNE2Y6TWeBSoZ2dxqJndY-Sq6TYZhg9-jUjfw2A2zWQ@mail.gmail.com> (raw)
In-Reply-To: <20171212144334.slrpfdtptr5nhuhx@hirez.programming.kicks-ass.net>
On Tue, Dec 12, 2017 at 9:43 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Tue, Dec 12, 2017 at 09:21:10AM -0500, Ilia Mirkin wrote:
>> The "thing" being mmiotrace, or the "thing" being page-unaligned addresses?
>
> mmiotrace
>
>> If the former, its primary use-case is for snooping on the NVIDIA
>> proprietary GPU driver in order to figure out how to drive the
>> underlying hardware. The driver does ioremap's to get at PCI space,
>> which mmiotrace "steals" and provides pages without a present bit set,
>> along with a fault handler. When the fault handler is hit, it
>> reinstates the faulting page, and single-steps the faulting
>> instruction
>
> At which point you have valid page-tables and another CPU can access
> that page too.
>
>> reading the before/after regs to determine what happened
>> (doesn't work universally, but enough for instructions used for PCI
>> MMIO accesses). See mmio-mod.c::pre and post (the latter is called
>> from the debug handler).
>
> And after that you only invalidate the TLBs for the CPU that took the
> initial fault, leaving possibly stale TLBs on other CPUs.
>
>
> So this 'thing' has huge gaping SMP holes in.
Sure does! Probably why the following happens when mmiotrace is enabled:
void enable_mmiotrace(void)
{
mutex_lock(&mmiotrace_mutex);
if (is_enabled())
goto out;
if (nommiotrace)
pr_info("MMIO tracing disabled.\n");
kmmio_init();
enter_uniprocessor();
spin_lock_irq(&trace_lock);
atomic_inc(&mmiotrace_enabled);
spin_unlock_irq(&trace_lock);
pr_info("enabled.\n");
out:
mutex_unlock(&mmiotrace_mutex);
}
next prev parent reply other threads:[~2017-12-12 14:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-27 7:51 [PATCH] x86/mm/kmmio: Fix mmiotrace for page unaligned addresses Karol Herbst
2017-12-12 10:55 ` [tip:x86/urgent] " tip-bot for Karol Herbst
2017-12-12 13:49 ` Peter Zijlstra
2017-12-12 14:04 ` Ingo Molnar
2017-12-12 14:21 ` Ilia Mirkin
2017-12-12 14:43 ` Peter Zijlstra
2017-12-12 14:47 ` Ilia Mirkin [this message]
2017-12-12 14:51 ` Peter Zijlstra
2017-12-13 16:31 ` Steven Rostedt
2017-12-12 14:32 ` Karol Herbst
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=CAKb7UvjsNE2Y6TWeBSoZ2dxqJndY-Sq6TYZhg9-jUjfw2A2zWQ@mail.gmail.com \
--to=imirkin@alum.mit.edu \
--cc=hpa@zytor.com \
--cc=karolherbst@gmail.com \
--cc=kherbst@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=lyude@redhat.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=ppaalanen@gmail.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).