Received: from eggs.gnu.org ([2001:4830:134:3::10]:40639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTd1J-0004vR-LW for qemu-devel@nongnu.org; Fri, 28 Mar 2014 16:05:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WTd1A-0002jd-Jt for qemu-devel@nongnu.org; Fri, 28 Mar 2014 16:04:53 -0400 Received: from smtp.ispras.ru ([83.149.199.79]:56591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTd1A-0002jM-CB for qemu-devel@nongnu.org; Fri, 28 Mar 2014 16:04:44 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Date: Sat, 29 Mar 2014 00:04:41 +0400 From: Kirill Batuzov In-Reply-To: <87lhvub7ue.fsf@linaro.org> References: <1395938253-9225-1-git-send-email-alex.bennee@linaro.org> <87lhvub7ue.fsf@linaro.org> Message-ID: Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC PATCH] tcg: add ability to dump /tmp/perf-.map files List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Alex_Benn=C3=A9e?= Cc: Yeongkyoon Lee , qemu-devel@nongnu.org, Alexander Graf , Blue Swirl , Stefan Weil , Anthony Liguori , Amit Shah , Matthew Fernandez , Richard Henderson On 28.03.2014 20:34, Alex Benn=C3=A9e wrote: >>> @@ -2575,6 +2579,8 @@ static inline int=20 >>> tcg_gen_code_common(TCGContext *s, uint64_t target_pc, >>> the_end: >>> /* Generate TB finalization at the end of block */ >>> tcg_out_tb_finalize(s); >>> + >>> + tcg_write_perfmap(gen_code_buf, s->code_ptr - gen_code_buf,=20 >>> target_pc); >>> return -1; >>> } >>=20 >> I think a part of the patch is missing here. tcg_gen_code_common does=20 >> not >> have target_pc argument in current master. >=20 > Ahh yes - it's currently sitting on-top of my qemu-log series which > pulled target_pc into the tcg_gen_code_common loop for the -dfilter > patch. I'll be sending the updated series in a moment. >=20 >> >>=20 >>> diff --git a/vl.c b/vl.c >>> index c036367..f1c3c3d 100644 >>> --- a/vl.c >>> +++ b/vl.c >>> @@ -123,6 +123,9 @@ int main(int argc, char **argv) >>> #define MAX_VIRTIO_CONSOLES 1 >>> #define MAX_SCLP_CONSOLES 1 >>>=20 >>> +/* seems better than pulling in all the tcg headers? */ >>> +extern void qemu_tcg_enable_perfmap(void); >>> + >=20 > I'm surprised no one has pulled me up on this yet, perhaps it is just > less ugly! >=20 I think I have a better solution for this. You can move=20 qemu_tcg_enable_refmap and tcg_write_refmap away from tcg to=20 translate-all.c (you'll need to rename them obviously). write_refmap=20 should be called from cpu_gen_code. It has number of advantages: * For writing refmap you do not need any backend details. The only=20 thing you need is to know that some guest address has been translated to=20 some host range. That is exactly what cpu_gen_code does. * In cpu_gen_code you have all needed information. No need to pull=20 target_pc specifically. * Declaration could be moved somewhere into exec folder. To exec-all.h=20 probably, but I'm not sure here. Anyway, you will not need tcg staff in=20 unrelated areas any more. * You'll avoid writing map entries for tcg_gen_code_search_pc calls.=20 This is good because tcg_gen_code_search_pc does not create new=20 translation blocks.