Received: from eggs.gnu.org ([140.186.70.92]:58854) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYmH5-0004Wn-HY for qemu-devel@nongnu.org; Thu, 08 Dec 2011 17:17:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RYmH3-0003kx-Nw for qemu-devel@nongnu.org; Thu, 08 Dec 2011 17:17:07 -0500 Received: from gw.ac.upc.es ([147.83.30.3]:40708 helo=gw.ac.upc.edu) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RYmH3-0003kW-AT for qemu-devel@nongnu.org; Thu, 08 Dec 2011 17:17:05 -0500 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <20111205222208.31271.65662.stgit@ginnungagap.bsc.es> <87hb1a28oh.fsf@ginnungagap.bsc.es> Date: Thu, 08 Dec 2011 23:16:52 +0100 In-Reply-To: (Blue Swirl's message of "Thu, 8 Dec 2011 20:57:54 +0000") Message-ID: <87ehweyai3.fsf@ginnungagap.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 0/5] backdoor: lightweight guest-to-QEMU backdoor channel List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: Zhi Yong Wu , Stefan Hajnoczi , qemu-devel@nongnu.org Blue Swirl writes: > 2011/12/8 Llu=C3=ADs Vilanova : >> Stefan Hajnoczi writes: >> [...] >>>> * Support for tracing guest code through TCG. >>=20 >>> I'm not clear on whether a backdoor mechanism is needed or not. =C2=A0A >>> backdoor mechanism allows a modified guest to participate in tracing. >>=20 >>> Depending on the type of analysis you are doing it might be possible >>> to achieve the same thing by emitting calls to custom instrumentation >>> in TCG (or is this too low-level for what you're trying to trace in >>> the guest?). =C2=A0The advantage is also that you can do this to unmodi= fied >>> guests. >>=20 >> You're right with the first; it exists for two reasons: >>=20 >> * simplicity: it's easier to have, for example, a backdoor + linux trace= points >> =C2=A0than obtaining the IP of an "interesting" function (think of the >> =C2=A0multiprogramming on a full system) >>=20 >> * performance: it's faster to let the guest tell you rather than (ab)usi= ng >> =C2=A0breakpoints or checking the IP of every instruction > I still think that a breakpoint based system could be a useful method > in addition to others, simply because it is entirely invisible to the > guest and can then be used with unmodified and non-cooperating guests. > Properly implemented, it should not have much overhead. Yup. My plan was to implement this sometime in the future :) On the performance side, there's only the degenerated case of a very hot co= de page that repeatedly triggers false mmu faults due to the (never reached) breakpoint. As for simplicity, I can use the backdoor to tell my analuzer to insert a breakpoint in the given address, instead of having some complex system to g= et symbol information from the outside (specially in softmmy mode). [...] >>> So I'm suggesting that we don't *need* explicit support for >>> instrumenting trace events. =C2=A0Instead add plain old functions where= you >>> need them. =C2=A0You may decide to invoke trace events from your >>> instrumentation function, but that's already covered today by >>> docs/tracing.txt. >>=20 >>> Am I missing the point of instrumentation tracing events or do you >>> agree that we can work well without it? >>=20 >> The point is to avoid diving into QEMU's code and instead use the current >> out-of-the-box tracing points as the instrumentation hooks, which can be >> achieved both through the current approach or an unofficial tracing back= end. >>=20 >> The nice thing about the current approach is that the user can do some e= xtra >> checks on the tracing event and then (maybe) call the original backend-g= enerated >> tracing routine (as a quick and easy way to extend what to actually trac= e). > Tracepoints shouldn't also suffer from bit rot so easily. Exactly. That's why I thought that tracepoint instrumentation is not such a= bad option. Lluis --=20 "And it's much the same thing with knowledge, for whenever you learn something new, the whole world becomes that much richer." -- The Princess of Pure Reason, as told by Norton Juster in The Phantom Tollbooth