Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752288AbdLLOVP (ORCPT ); Tue, 12 Dec 2017 09:21:15 -0500 Received: from mail-qt0-f195.google.com ([209.85.216.195]:42280 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751503AbdLLOVL (ORCPT ); Tue, 12 Dec 2017 09:21:11 -0500 X-Google-Smtp-Source: ACJfBoumRnOV01lDdPyee3aUH1uq+ybORikHlEvi7VuJg470a6Z+pnPam3hLlvsSGsb6ZQl2NnNxTVTAUPMiJXDL+nw= MIME-Version: 1.0 In-Reply-To: <20171212140418.56xld2lxja5rywp7@gmail.com> References: <20171127075139.4928-1-kherbst@redhat.com> <20171212134952.2hok6754245qshv3@hirez.programming.kicks-ass.net> <20171212140418.56xld2lxja5rywp7@gmail.com> From: Ilia Mirkin Date: Tue, 12 Dec 2017 09:21:10 -0500 X-Google-Sender-Auth: za1fAB_NFabOBOZ9WtokzwPZE3A Message-ID: Subject: Re: [tip:x86/urgent] x86/mm/kmmio: Fix mmiotrace for page unaligned addresses To: Ingo Molnar Cc: Peter Zijlstra , "linux-kernel@vger.kernel.org" , Pekka Paalanen , Lyude , Steven Rostedt , Thomas Gleixner , Karol Herbst , Linus Torvalds , hpa@zytor.com, linux-tip-commits@vger.kernel.org, Karol Herbst Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1688 Lines: 40 On Tue, Dec 12, 2017 at 9:04 AM, Ingo Molnar wrote: > > * Peter Zijlstra wrote: > >> On Tue, Dec 12, 2017 at 02:55:30AM -0800, tip-bot for Karol Herbst wrote: >> > Commit-ID: 6d60ce384d1d5ca32b595244db4077a419acc687 >> > Gitweb: https://git.kernel.org/tip/6d60ce384d1d5ca32b595244db4077a419acc687 >> > Author: Karol Herbst >> > AuthorDate: Mon, 27 Nov 2017 08:51:39 +0100 >> > Committer: Ingo Molnar >> > CommitDate: Mon, 11 Dec 2017 15:35:18 +0100 >> > >> > x86/mm/kmmio: Fix mmiotrace for page unaligned addresses >> >> OK, let me hijack this thread since apparently people use and care about >> mmiotrace. >> >> I was recently auditing the x86 tlb flushing and ran across this >> 'thing'. Can someone please explain to me how this is supposed to work >> and how its not completely broken? The "thing" being mmiotrace, or the "thing" being page-unaligned addresses? 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 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). You may be interested in reading Documentation/trace/mmiotrace.txt::How Mmiotrace Works Cheers, -ilia