Received: from eggs.gnu.org ([2001:4830:134:3::10]:38352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOrKY-0000hT-0t for qemu-devel@nongnu.org; Thu, 28 Jan 2016 13:30:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOrKU-0000o3-Pl for qemu-devel@nongnu.org; Thu, 28 Jan 2016 13:30:05 -0500 Received: from roura.ac.upc.es ([147.83.33.10]:52946) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOrKU-0000n9-DV for qemu-devel@nongnu.org; Thu, 28 Jan 2016 13:30:02 -0500 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <1452768923-13787-1-git-send-email-peer.adelt@c-lab.de> <56A75230.4070008@mail.uni-paderborn.de> <87egd2kg4m.fsf@fimbulvetr.bsc.es> <56AA1A67.7030609@mail.uni-paderborn.de> Date: Thu, 28 Jan 2016 19:29:53 +0100 In-Reply-To: <56AA1A67.7030609@mail.uni-paderborn.de> (Bastian Koppelmann's message of "Thu, 28 Jan 2016 14:40:55 +0100") Message-ID: <87twlxv9pa.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC PATCH 0/3] (Resend) TranslationBlock annotation mechanism List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bastian Koppelmann Cc: Peter Maydell , Peer Adelt , kbastian@mail.upb.de, QEMU Developers , Paolo Bonzini Bastian Koppelmann writes: > Hi Lluis, > On 01/27/2016 07:54 PM, Llu=C3=ADs Vilanova wrote: >> There is this modified version I wrote [1], which precisely provides a p= lugin >> infrastructure to attach callbacks into guest code events (a binary >> instrumentation framework based on QEMU). At the time, the discussion re= solved >> that a full code instrumentation interface for plugins was too much code= that >> regular QEMU users & developers would not care about, easily leading to = bitrot. >>=20 > This is too bad but looking at the discussion back then the > argumentation is reasonable since an instrumentation API would and > should touch everything in QEMU. I tried (and I think succeeded) to keep the separation reasonably clean. The main problem was adding public functions for plugins to peek/poke at guest = state and to inline additional TCG code, which would not be used anywhere else in QEMU. >> Instead, the list resolved (AFAIU) that it would be better to mainstream= support >> for guest code events, and make instrumentation an unofficial extension.= I've >> been (slowly) working to separate both pieces, making instrumentation a = QEMU >> patch that can be easily maintained out of tree. >>=20 >> The last patch series I sent sets the final stone on the core infrastruc= ture for >> the mainline part, just missing the patches I have queued to start addin= g guest >> code trace events. > Can you give me the name of the series. This is it: https://lists.gnu.org/archive/html/qemu-devel/2016-01/msg02833.= html >>=20 >> So, I'd say that such support is on the list of current developments (at= least >> mine, specially now that I have a bit more time for it). But getting the= core >> infrastructure mainlined takes some time to ensure it makes sense and ca= n be >> easily maintained and be generally usefull to vanilla QEMU. >>=20 > For us such a API would make a lot of sense and there is no benefit for > us to do our own API. Would it make sense for you if we helped you? Definitely. The instrumentation code needs some serious update to bring it up-to-date with the latest QEMU, but adding generally useful guest code tra= cing events is something that can be easily pararellized. For one, my current implementation for instruction/bbl tracing modifies the= main disassembler loop on all targets. This can easily get out of sync as targets evolve or new ones are added, so my plan was to refactor that into a common disassembly loop with per-target hooks (since it's C, probably using ugly m= acros like in softmmu_template.in). Also, I never got to add meaningful events for CPU interrupts, for example. As a side note, I wanted to write a paper about it once the interface stabi= lized a bit more, but I haven't had time to implement some interesting/useful use cases to accompany and motivate it (I've mainly used it to write ad-hoc ana= lysis tools for my PhD). Cheers, Lluis