All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Bad icount read when running qemu-system-ppc64 and mfspr atbu guest instruction
@ 2018-04-11 18:18 Darrell Leinwand
  2018-04-11 22:17 ` Emilio G. Cota
  2018-04-11 23:39 ` Richard Henderson
  0 siblings, 2 replies; 5+ messages in thread
From: Darrell Leinwand @ 2018-04-11 18:18 UTC (permalink / raw)
  To: qemu-devel

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  0x00005555557fdc4f in cpu_get_icount_locked () at qemu/cpus.c:277
#2  0x00005555557fdc8c in cpu_get_icount () at qemu/cpus.c:288
#3  0x0000555555d47a1b in qemu_clock_get_ns (type=QEMU_CLOCK_VIRTUAL) at qemu/util/qemu-timer.c:608
#4  0x00005555558a7b61 in cpu_ppc_load_atbu (env=0x555556ccfff0) at qemu/hw/ppc/ppc.c:574
#5  0x00005555559eec2a in helper_load_atbu (env=0x555556ccfff0) at qemu/target/ppc/timebase_helper.c:45
#6  0x00007fffea0bb92b in code_gen_buffer ()
#7  0x000055555583c1e5 in cpu_tb_exec (cpu=0x555556cc7d40, itb=0x7fffea0bb840 <code_gen_buffer+14338070>) at qemu/accel/tcg/cpu-exec.c:167
#8  0x000055555583cfc4 in cpu_loop_exec_tb (cpu=0x555556cc7d40, tb=0x7fffea0bb840 <code_gen_buffer+14338070>, last_tb=0x7fffe34d8978, tb_exit=0x7fffe34d8970) at qemu/accel/tcg/cpu-exec.c:627
#9  0x000055555583d2d3 in cpu_exec (cpu=0x555556cc7d40) at qemu/accel/tcg/cpu-exec.c:736
#10 0x00005555557ff6c2 in tcg_cpu_exec (cpu=0x555556cc7d40) at qemu/cpus.c:1270
#11 0x00005555557ff8f1 in qemu_tcg_rr_cpu_thread_fn (arg=0x555556cc7d40) at qemu/cpus.c:1366
#12 0x00007ffff4fab6ba in start_thread (arg=0x7fffe34d9700) at pthread_create.c:333
#13 0x00007ffff4ce141d 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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Bad icount read when running qemu-system-ppc64 and mfspr atbu guest instruction
  2018-04-11 18:18 [Qemu-devel] Bad icount read when running qemu-system-ppc64 and mfspr atbu guest instruction Darrell Leinwand
@ 2018-04-11 22:17 ` Emilio G. Cota
  2018-04-11 23:39 ` Richard Henderson
  1 sibling, 0 replies; 5+ messages in thread
From: Emilio G. Cota @ 2018-04-11 22:17 UTC (permalink / raw)
  To: Darrell Leinwand; +Cc: qemu-devel

On Wed, Apr 11, 2018 at 18:18:18 +0000, 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Bad icount read when running qemu-system-ppc64 and mfspr atbu guest instruction
  2018-04-11 18:18 [Qemu-devel] Bad icount read when running qemu-system-ppc64 and mfspr atbu guest instruction Darrell Leinwand
  2018-04-11 22:17 ` Emilio G. Cota
@ 2018-04-11 23:39 ` Richard Henderson
  2018-04-12  2:37   ` Darrell Leinwand
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Henderson @ 2018-04-11 23:39 UTC (permalink / raw)
  To: Darrell Leinwand, qemu-devel, qemu-ppc

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Bad icount read when running qemu-system-ppc64 and mfspr atbu guest instruction
  2018-04-11 23:39 ` Richard Henderson
@ 2018-04-12  2:37   ` Darrell Leinwand
  2018-04-12 20:44     ` Richard Henderson
  0 siblings, 1 reply; 5+ messages in thread
From: Darrell Leinwand @ 2018-04-12  2:37 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel, qemu-ppc

[-- Attachment #1: Type: text/plain, Size: 1725 bytes --]

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" <richard.henderson@linaro.org> 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.
    

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5151 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Bad icount read when running qemu-system-ppc64 and mfspr atbu guest instruction
  2018-04-12  2:37   ` Darrell Leinwand
@ 2018-04-12 20:44     ` Richard Henderson
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2018-04-12 20:44 UTC (permalink / raw)
  To: Darrell Leinwand, qemu-devel, qemu-ppc

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~

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-04-12 20:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-11 18:18 [Qemu-devel] Bad icount read when running qemu-system-ppc64 and mfspr atbu guest instruction Darrell Leinwand
2018-04-11 22:17 ` Emilio G. Cota
2018-04-11 23:39 ` Richard Henderson
2018-04-12  2:37   ` Darrell Leinwand
2018-04-12 20:44     ` Richard Henderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.