From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57951) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXPUV-0003PA-Ba for qemu-devel@nongnu.org; Thu, 03 Sep 2015 04:03:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXPUP-0002uH-1l for qemu-devel@nongnu.org; Thu, 03 Sep 2015 04:03:27 -0400 Received: from smtp.ispras.ru ([83.149.199.79]:41393) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXPUO-0002u2-N8 for qemu-devel@nongnu.org; Thu, 03 Sep 2015 04:03:21 -0400 References: <55E6F1DF.1090807@ispras.ru> <55E6FEA6.5080708@ispras.ru> <5964af82a6f8f9b491dc4407b631895b@ispras.ru> From: Sergey Smolov Message-ID: <55E7F219.9020408@ispras.ru> Date: Thu, 3 Sep 2015 11:09:13 +0400 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------030606070409030000000905" Subject: Re: [Qemu-devel] QEMU+Aarch64: in_asm log skips instructions of loop-programs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers This is a multi-part message in MIME format. --------------030606070409030000000905 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable 03.09.2015 10:33, Peter Maydell =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > On 3 September 2015 at 06:27, Sergey Smolov wrote: >> I mean that in this example QEMU does not write to log "intermediate" = SUBS >> instructions which appear in loop-unrolling process. >> For me it woulb be ok if QEMU generate the following in_asm log: >> >> [log] >> IN: >> 0x0000000000000000: 94000001 bl #+0x4 (addr 0x4) >> >> ---------------- >> IN: >> 0x0000000000000004: d2800140 mov x0, #0xa >> >> ---------------- >> IN: >> 0x0000000000000008: f1000400 subs x0, x0, #0x1 (1) >> >> ---------------- >> IN: >> 0x000000000000000c: 54000040 b.eq #+0x8 (addr 0x14) >> >> ---------------- >> IN: >> 0x0000000000000008: f1000400 subs x0, x0, #0x1 (1) > QEMU's in_asm logging doesn't work like that. We log the > instructions that we *translate*, not instructions that we > *execute*. Generally we translate basic blocks and then > cache them so they can be executed multiple times. (It's > not actually guaranteed that a translated block will ever > be executed, though it almost always will be.) The > logging of input instructions happens at the translate phase. > When we execute we don't have any information about the > guest instructions involved. > > This has nothing to do with "loop-unrolling", which QEMU > doesn't try to do at all. > > You might find the 'exec' logging helpful for tracking > which translated blocks get executed. > > thanks > -- PMM > Peter, Thank you for your answer! I've tested 'exec' logging and it does not contain unrolled llops too.=20 For my sample it looks like: [log] Trace 0x7f999385a000 [0000000000000000] Trace 0x7f999385a050 [0000000000000004] Trace 0x7f999385a090 [*0000000000000008*] Trace 0x7f999385a120 [000000000000000c] Trace 0x7f999385a190 [0000000000000010] Trace 0x7f999385a090 [*0000000000000008*] Trace 0x7f999385a1d0 [0000000000000014] Trace 0x7f999385a210 [0000000000000200] Trace 0x7f999385a210 [0000000000000200] ... [/log] and contains only two records related to 'subs' instruction (it is=20 situated on 0x0000000000000008 addresses whcih i've highlighted). Also, is it true that after translation to internal representation=20 (TCG-representation, yes?) there is no possibility at all to restore=20 guest instructions? Thanks, Sergey Smolov --------------030606070409030000000905 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

03.09.2015 10:33, Peter Maydell =D0=BF= =D0=B8=D1=88=D0=B5=D1=82:
On 3 September 2015 at 06:27, Sergey Smolov <smolov@is=
pras.ru> wrote:
I mean that in this example QEMU does not write to=
 log "intermediate" SUBS
instructions which appear in loop-unrolling process.
For me it woulb be ok if QEMU generate the following in_asm log:

[log]
IN:
0x0000000000000000:  94000001      bl #+0x4 (addr 0x4)

----------------
IN:
0x0000000000000004:  d2800140      mov x0, #0xa

----------------
IN:
0x0000000000000008:  f1000400      subs x0, x0, #0x1 (1)

----------------
IN:
0x000000000000000c:  54000040      b.eq #+0x8 (addr 0x14)

----------------
IN:
0x0000000000000008:  f1000400      subs x0, x0, #0x1 (1)
QEMU's in_asm logging doesn't work like that. We log the
instructions that we *translate*, not instructions that we
*execute*. Generally we translate basic blocks and then
cache them so they can be executed multiple times. (It's
not actually guaranteed that a translated block will ever
be executed, though it almost always will be.) The
logging of input instructions happens at the translate phase.
When we execute we don't have any information about the
guest instructions involved.

This has nothing to do with "loop-unrolling", which QEMU
doesn't try to do at all.

You might find the 'exec' logging helpful for tracking
which translated blocks get executed.

thanks
-- PMM


Peter,

Thank you for your answer!

I've tested 'exec' logging and it does not contain unrolled llops too. For my sample it looks like:

[log]
Trace 0x7f999385a000 [0000000000000000]
Trace 0x7f999385a050 [0000000000000004]
Trace 0x7f999385a090 [0000000000000008]
Trace 0x7f999385a120 [000000000000000c]
Trace 0x7f999385a190 [0000000000000010]
Trace 0x7f999385a090 [0000000000000008]
Trace 0x7f999385a1d0 [0000000000000014]
Trace 0x7f999385a210 [0000000000000200]
Trace 0x7f999385a210 [0000000000000200]
...
[/log]

and contains only two records related to 'subs' instruction (it is situated on 0x0000000000000008 addresses whcih i've highlighted).

Also, is it true that after translation to internal representation (TCG-representation, yes?) there is no possibility at all to restore guest instructions?

Thanks,

Sergey Smolov
--------------030606070409030000000905--