Re: [Qemu-devel] Bad icount read when running qemu-system-ppc64 and mfspr atbu guest instruction

2018-04-12 Thread Richard Henderson
On 04/11/2018 04:37 PM, Darrell Leinwand wrote:
> Ah I see, that makes sense and the atb instructions are marked as unused in
the mainline which when I compared I recall now that we modifed them because
the guest software we are running is trying to use those special registers.
> 
> I added the wrappers into those function, is that correct?

Yes.


r~



Re: [Qemu-devel] Bad icount read when running qemu-system-ppc64 and mfspr atbu guest instruction

2018-04-11 Thread Darrell Leinwand
Ah I see, that makes sense and the atb instructions are marked as unused in the 
mainline which when I compared I recall now that we modifed them because the 
guest software we are running is trying to use those special registers. 

I added the wrappers into those function, is that correct?

Thanks for the help.

Darrell

On 4/11/18, 4:39 PM, "Richard Henderson"  wrote:

On 04/12/2018 04:18 AM, Darrell Leinwand wrote:
> Hi,
> 
> When I enable icount using an e5500 core I get an exit with “Bad icount
> read” when the guest software executes a load atbu command.

Yep, it looks like there are some bugs in the ppc front end wrt icount.

In target/ppc/translate_init.c, spr_read_tbu has the proper wrappers for
integrating with icount, but a few lines lower spr_read_atbl and 
spr_read_atbu
do not.

This will probably have to wait until the 2.13 cycle to fix...


r~


PS:

> 
> CONFIDENTIALITY NOTICE: The information contained in this e-mail and any 
accompanying documents may contain information that is confidential, 
proprietary to Performance Software, or otherwise protected from disclosure. If 
you are not the intended recipient of this message, or if this message has been 
addressed to you in error, please immediately alert the sender by reply e-mail 
and then delete this message, including any attachments. Any dissemination, 
distribution or other use of the contents of this message by anyone other than 
the intended recipient is strictly prohibited.
> 

You really should strip this from your signature when posting to a public 
list.



smime.p7s
Description: S/MIME cryptographic signature


Re: [Qemu-devel] Bad icount read when running qemu-system-ppc64 and mfspr atbu guest instruction

2018-04-11 Thread Richard Henderson
On 04/12/2018 04:18 AM, Darrell Leinwand wrote:
> Hi,
> 
> When I enable icount using an e5500 core I get an exit with “Bad icount
> read” when the guest software executes a load atbu command.

Yep, it looks like there are some bugs in the ppc front end wrt icount.

In target/ppc/translate_init.c, spr_read_tbu has the proper wrappers for
integrating with icount, but a few lines lower spr_read_atbl and spr_read_atbu
do not.

This will probably have to wait until the 2.13 cycle to fix...


r~


PS:

> 
> CONFIDENTIALITY NOTICE: The information contained in this e-mail and any 
> accompanying documents may contain information that is confidential, 
> proprietary to Performance Software, or otherwise protected from disclosure. 
> If you are not the intended recipient of this message, or if this message has 
> been addressed to you in error, please immediately alert the sender by reply 
> e-mail and then delete this message, including any attachments. Any 
> dissemination, distribution or other use of the contents of this message by 
> anyone other than the intended recipient is strictly prohibited.
> 

You really should strip this from your signature when posting to a public list.



Re: [Qemu-devel] Bad icount read when running qemu-system-ppc64 and mfspr atbu guest instruction

2018-04-11 Thread Emilio G. Cota
On Wed, Apr 11, 2018 at 18:18:18 +, Darrell Leinwand wrote:
> Hi,
> 
> When I enable icount using an e5500 core I get an exit with “Bad icount read” 
> when the guest software executes a load atbu command.
> 
> It looks like in qemu/accel/tcg/cpu_exec.c:166 sets can_do_io false when 
> using icount.
> cpu->can_do_io = !use_icount;
> ret = tcg_qemu_tb_exec(env, tb_ptr);
> cpu->can_do_io = 1;
> 
> Since can_do_io is set to false there and the cpu_get_icount_raw() function 
> checks that flag qemu/cpus.c:260:
> if (!cpu->can_do_io) {
> fprintf(stderr, "Bad icount read\n");
> exit(1);
> }
> 
> The load_atbu function will always fail. I commented out the !use_icount and 
> set it to a 1 in cpu_exec.c and it continues and seems to run normally, but I 
> am not sure what side effects while running icount that could have since it 
> may allow actual IO to occur while translation is happening.

Can you reproduce with the current master, i.e. 38e83a71d02 ?
A few patches have very recently been merged that might fix
your problem.

If master is still broken and it used to work in the past for you,
it would be useful if you could bisect this to point out the commit
that broke this.

Thanks,

Emilio



[Qemu-devel] Bad icount read when running qemu-system-ppc64 and mfspr atbu guest instruction

2018-04-11 Thread Darrell Leinwand
Hi,

When I enable icount using an e5500 core I get an exit with “Bad icount read” 
when the guest software executes a load atbu command.

It looks like in qemu/accel/tcg/cpu_exec.c:166 sets can_do_io false when using 
icount.
cpu->can_do_io = !use_icount;
ret = tcg_qemu_tb_exec(env, tb_ptr);
cpu->can_do_io = 1;

Since can_do_io is set to false there and the cpu_get_icount_raw() function 
checks that flag qemu/cpus.c:260:
if (!cpu->can_do_io) {
fprintf(stderr, "Bad icount read\n");
exit(1);
}

The load_atbu function will always fail. I commented out the !use_icount and 
set it to a 1 in cpu_exec.c and it continues and seems to run normally, but I 
am not sure what side effects while running icount that could have since it may 
allow actual IO to occur while translation is happening.

I included the stack trace below:

#0  cpu_get_icount_raw () at qemu/cpus.c:261
#1  0x557fdc4f in cpu_get_icount_locked () at qemu/cpus.c:277
#2  0x557fdc8c in cpu_get_icount () at qemu/cpus.c:288
#3  0x55d47a1b in qemu_clock_get_ns (type=QEMU_CLOCK_VIRTUAL) at 
qemu/util/qemu-timer.c:608
#4  0x558a7b61 in cpu_ppc_load_atbu (env=0x56ccfff0) at 
qemu/hw/ppc/ppc.c:574
#5  0x559eec2a in helper_load_atbu (env=0x56ccfff0) at 
qemu/target/ppc/timebase_helper.c:45
#6  0x7fffea0bb92b in code_gen_buffer ()
#7  0x5583c1e5 in cpu_tb_exec (cpu=0x56cc7d40, itb=0x7fffea0bb840 
) at qemu/accel/tcg/cpu-exec.c:167
#8  0x5583cfc4 in cpu_loop_exec_tb (cpu=0x56cc7d40, 
tb=0x7fffea0bb840 , last_tb=0x7fffe34d8978, 
tb_exit=0x7fffe34d8970) at qemu/accel/tcg/cpu-exec.c:627
#9  0x5583d2d3 in cpu_exec (cpu=0x56cc7d40) at 
qemu/accel/tcg/cpu-exec.c:736
#10 0x557ff6c2 in tcg_cpu_exec (cpu=0x56cc7d40) at qemu/cpus.c:1270
#11 0x557ff8f1 in qemu_tcg_rr_cpu_thread_fn (arg=0x56cc7d40) at 
qemu/cpus.c:1366
#12 0x74fab6ba in start_thread (arg=0x7fffe34d9700) at 
pthread_create.c:333
#13 0x74ce141d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thanks,
Darrell




CONFIDENTIALITY NOTICE: The information contained in this e-mail and any 
accompanying documents may contain information that is confidential, 
proprietary to Performance Software, or otherwise protected from disclosure. If 
you are not the intended recipient of this message, or if this message has been 
addressed to you in error, please immediately alert the sender by reply e-mail 
and then delete this message, including any attachments. Any dissemination, 
distribution or other use of the contents of this message by anyone other than 
the intended recipient is strictly prohibited.