qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Bug 1926759] [NEW] WFI instruction results in unhandled CPU exception
@ 2021-04-30 11:31 JIANG Muhui
  2021-04-30 13:06 ` [Bug 1926759] " Peter Maydell
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: JIANG Muhui @ 2021-04-30 11:31 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

Hi

I refer to the WFI instruction. The bytecode is 0xe320f003. After the
execution, qemu exit with the following  crash log.

qemu: unhandled CPU exception 0x10001 - aborting
R00=00000001 R01=40800b34 R02=40800b3c R03=000102ec
R04=00010a28 R05=00010158 R06=00087460 R07=00010158
R08=00000000 R09=00000000 R10=00085b7c R11=408009f4
R12=40800a08 R13=408009f0 R14=0001057c R15=000102f8
PSR=60000010 -ZC- A usr32
qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x7f5c21d0fa12

WFI aims to enter a low-power state and wait for interrupt. The raised
exception seems not a right behavior. I can provide a testcase if you
needed. Many thanks.

Regards
Muhui

** Affects: qemu
     Importance: Undecided
         Status: New


** Tags: arm

** Tags added: arm

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926759

Title:
  WFI instruction results in unhandled CPU exception

Status in QEMU:
  New

Bug description:
  Hi

  I refer to the WFI instruction. The bytecode is 0xe320f003. After the
  execution, qemu exit with the following  crash log.

  qemu: unhandled CPU exception 0x10001 - aborting
  R00=00000001 R01=40800b34 R02=40800b3c R03=000102ec
  R04=00010a28 R05=00010158 R06=00087460 R07=00010158
  R08=00000000 R09=00000000 R10=00085b7c R11=408009f4
  R12=40800a08 R13=408009f0 R14=0001057c R15=000102f8
  PSR=60000010 -ZC- A usr32
  qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x7f5c21d0fa12

  WFI aims to enter a low-power state and wait for interrupt. The raised
  exception seems not a right behavior. I can provide a testcase if you
  needed. Many thanks.

  Regards
  Muhui

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926759/+subscriptions


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

* [Bug 1926759] Re: WFI instruction results in unhandled CPU exception
  2021-04-30 11:31 [Bug 1926759] [NEW] WFI instruction results in unhandled CPU exception JIANG Muhui
@ 2021-04-30 13:06 ` Peter Maydell
  2021-04-30 13:07 ` Peter Maydell
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2021-04-30 13:06 UTC (permalink / raw)
  To: qemu-devel

Please provide a test case binary and your QEMU command line.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926759

Title:
  WFI instruction results in unhandled CPU exception

Status in QEMU:
  New

Bug description:
  Hi

  I refer to the WFI instruction. The bytecode is 0xe320f003. After the
  execution, qemu exit with the following  crash log.

  qemu: unhandled CPU exception 0x10001 - aborting
  R00=00000001 R01=40800b34 R02=40800b3c R03=000102ec
  R04=00010a28 R05=00010158 R06=00087460 R07=00010158
  R08=00000000 R09=00000000 R10=00085b7c R11=408009f4
  R12=40800a08 R13=408009f0 R14=0001057c R15=000102f8
  PSR=60000010 -ZC- A usr32
  qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x7f5c21d0fa12

  WFI aims to enter a low-power state and wait for interrupt. The raised
  exception seems not a right behavior. I can provide a testcase if you
  needed. Many thanks.

  Regards
  Muhui

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926759/+subscriptions


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

* [Bug 1926759] Re: WFI instruction results in unhandled CPU exception
  2021-04-30 11:31 [Bug 1926759] [NEW] WFI instruction results in unhandled CPU exception JIANG Muhui
  2021-04-30 13:06 ` [Bug 1926759] " Peter Maydell
@ 2021-04-30 13:07 ` Peter Maydell
  2021-04-30 13:17 ` JIANG Muhui
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2021-04-30 13:07 UTC (permalink / raw)
  To: qemu-devel

Oh, and the QEMU version you're using as well, please.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926759

Title:
  WFI instruction results in unhandled CPU exception

Status in QEMU:
  New

Bug description:
  Hi

  I refer to the WFI instruction. The bytecode is 0xe320f003. After the
  execution, qemu exit with the following  crash log.

  qemu: unhandled CPU exception 0x10001 - aborting
  R00=00000001 R01=40800b34 R02=40800b3c R03=000102ec
  R04=00010a28 R05=00010158 R06=00087460 R07=00010158
  R08=00000000 R09=00000000 R10=00085b7c R11=408009f4
  R12=40800a08 R13=408009f0 R14=0001057c R15=000102f8
  PSR=60000010 -ZC- A usr32
  qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x7f5c21d0fa12

  WFI aims to enter a low-power state and wait for interrupt. The raised
  exception seems not a right behavior. I can provide a testcase if you
  needed. Many thanks.

  Regards
  Muhui

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926759/+subscriptions


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

* [Bug 1926759] Re: WFI instruction results in unhandled CPU exception
  2021-04-30 11:31 [Bug 1926759] [NEW] WFI instruction results in unhandled CPU exception JIANG Muhui
  2021-04-30 13:06 ` [Bug 1926759] " Peter Maydell
  2021-04-30 13:07 ` Peter Maydell
@ 2021-04-30 13:17 ` JIANG Muhui
  2021-04-30 13:40 ` Peter Maydell
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: JIANG Muhui @ 2021-04-30 13:17 UTC (permalink / raw)
  To: qemu-devel

cmd: ~/qemu-5.1.0/arm-linux-user/qemu-arm ~/test2

QEMU version: qemu-arm version 5.1.0

Sorry that I didn't test it on the latest version of QEMU.

** Attachment added: "test2"
   https://bugs.launchpad.net/qemu/+bug/1926759/+attachment/5493873/+files/test2

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926759

Title:
  WFI instruction results in unhandled CPU exception

Status in QEMU:
  New

Bug description:
  Hi

  I refer to the WFI instruction. The bytecode is 0xe320f003. After the
  execution, qemu exit with the following  crash log.

  qemu: unhandled CPU exception 0x10001 - aborting
  R00=00000001 R01=40800b34 R02=40800b3c R03=000102ec
  R04=00010a28 R05=00010158 R06=00087460 R07=00010158
  R08=00000000 R09=00000000 R10=00085b7c R11=408009f4
  R12=40800a08 R13=408009f0 R14=0001057c R15=000102f8
  PSR=60000010 -ZC- A usr32
  qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x7f5c21d0fa12

  WFI aims to enter a low-power state and wait for interrupt. The raised
  exception seems not a right behavior. I can provide a testcase if you
  needed. Many thanks.

  Regards
  Muhui

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926759/+subscriptions


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

* [Bug 1926759] Re: WFI instruction results in unhandled CPU exception
  2021-04-30 11:31 [Bug 1926759] [NEW] WFI instruction results in unhandled CPU exception JIANG Muhui
                   ` (2 preceding siblings ...)
  2021-04-30 13:17 ` JIANG Muhui
@ 2021-04-30 13:40 ` Peter Maydell
  2021-04-30 13:52 ` Peter Maydell
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2021-04-30 13:40 UTC (permalink / raw)
  To: qemu-devel

Crash repros on current QEMU.

This is a bug, in that we shouldn't crash like this. However, it doesn't
really make any sense for a userspace program (which is what a binary
run by qemu-arm is) to execute the WFI instruction, which is largely
intended for OSes to use. If your guest binary needs to use WFI, you
should probably be running it on the system emulation QEMU, which does
handle WFI correctly.


** Changed in: qemu
       Status: New => Confirmed

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926759

Title:
  WFI instruction results in unhandled CPU exception

Status in QEMU:
  Confirmed

Bug description:
  Hi

  I refer to the WFI instruction. The bytecode is 0xe320f003. After the
  execution, qemu exit with the following  crash log.

  qemu: unhandled CPU exception 0x10001 - aborting
  R00=00000001 R01=40800b34 R02=40800b3c R03=000102ec
  R04=00010a28 R05=00010158 R06=00087460 R07=00010158
  R08=00000000 R09=00000000 R10=00085b7c R11=408009f4
  R12=40800a08 R13=408009f0 R14=0001057c R15=000102f8
  PSR=60000010 -ZC- A usr32
  qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x7f5c21d0fa12

  WFI aims to enter a low-power state and wait for interrupt. The raised
  exception seems not a right behavior. I can provide a testcase if you
  needed. Many thanks.

  Regards
  Muhui

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926759/+subscriptions


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

* [Bug 1926759] Re: WFI instruction results in unhandled CPU exception
  2021-04-30 11:31 [Bug 1926759] [NEW] WFI instruction results in unhandled CPU exception JIANG Muhui
                   ` (3 preceding siblings ...)
  2021-04-30 13:40 ` Peter Maydell
@ 2021-04-30 13:52 ` Peter Maydell
  2021-04-30 14:54 ` JIANG Muhui
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2021-04-30 13:52 UTC (permalink / raw)
  To: qemu-devel

The aarch64 kernel traps and handles WFI as a NOP: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c219bc4e9205 -- so that's probably the most sensible implementation for our linux-user mode. (The aarch32 kernel doesn't trap it, yet, but 
"WFI is a NOP" is a valid architectural implementation anyway.)

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926759

Title:
  WFI instruction results in unhandled CPU exception

Status in QEMU:
  Confirmed

Bug description:
  Hi

  I refer to the WFI instruction. The bytecode is 0xe320f003. After the
  execution, qemu exit with the following  crash log.

  qemu: unhandled CPU exception 0x10001 - aborting
  R00=00000001 R01=40800b34 R02=40800b3c R03=000102ec
  R04=00010a28 R05=00010158 R06=00087460 R07=00010158
  R08=00000000 R09=00000000 R10=00085b7c R11=408009f4
  R12=40800a08 R13=408009f0 R14=0001057c R15=000102f8
  PSR=60000010 -ZC- A usr32
  qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x7f5c21d0fa12

  WFI aims to enter a low-power state and wait for interrupt. The raised
  exception seems not a right behavior. I can provide a testcase if you
  needed. Many thanks.

  Regards
  Muhui

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926759/+subscriptions


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

* [Bug 1926759] Re: WFI instruction results in unhandled CPU exception
  2021-04-30 11:31 [Bug 1926759] [NEW] WFI instruction results in unhandled CPU exception JIANG Muhui
                   ` (4 preceding siblings ...)
  2021-04-30 13:52 ` Peter Maydell
@ 2021-04-30 14:54 ` JIANG Muhui
  2021-04-30 15:09 ` Peter Maydell
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: JIANG Muhui @ 2021-04-30 14:54 UTC (permalink / raw)
  To: qemu-devel

I agree with this implementation. Though WFI seems make no sense for a
userspace program, we should not have assumption that the userspace
program will not use this instruction.

It seems ARM manual does not defined the implementation of function
EnterLowPowerState();  However, before executing this instruction, there
are some checks like below:

if PSTATE.EL == EL0 then
     // Check for traps described by the OS which may be EL1 or EL2.
     AArch32.CheckForWFxTrap(EL1, FALSE);

I am not sure whether it is complex/required to implement this in QEMU.
Maybe patch the WFI as a NOP looks like the best idea at this moment.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926759

Title:
  WFI instruction results in unhandled CPU exception

Status in QEMU:
  Confirmed

Bug description:
  Hi

  I refer to the WFI instruction. The bytecode is 0xe320f003. After the
  execution, qemu exit with the following  crash log.

  qemu: unhandled CPU exception 0x10001 - aborting
  R00=00000001 R01=40800b34 R02=40800b3c R03=000102ec
  R04=00010a28 R05=00010158 R06=00087460 R07=00010158
  R08=00000000 R09=00000000 R10=00085b7c R11=408009f4
  R12=40800a08 R13=408009f0 R14=0001057c R15=000102f8
  PSR=60000010 -ZC- A usr32
  qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x7f5c21d0fa12

  WFI aims to enter a low-power state and wait for interrupt. The raised
  exception seems not a right behavior. I can provide a testcase if you
  needed. Many thanks.

  Regards
  Muhui

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926759/+subscriptions


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

* [Bug 1926759] Re: WFI instruction results in unhandled CPU exception
  2021-04-30 11:31 [Bug 1926759] [NEW] WFI instruction results in unhandled CPU exception JIANG Muhui
                   ` (5 preceding siblings ...)
  2021-04-30 14:54 ` JIANG Muhui
@ 2021-04-30 15:09 ` Peter Maydell
  2021-04-30 17:51 ` Peter Maydell
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2021-04-30 15:09 UTC (permalink / raw)
  To: qemu-devel

We do implement those traps, but only in the system mode emulator,
because it makes no sense to trap to EL2 in the usermode emulator where
EL2 doesn't exist.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926759

Title:
  WFI instruction results in unhandled CPU exception

Status in QEMU:
  Confirmed

Bug description:
  Hi

  I refer to the WFI instruction. The bytecode is 0xe320f003. After the
  execution, qemu exit with the following  crash log.

  qemu: unhandled CPU exception 0x10001 - aborting
  R00=00000001 R01=40800b34 R02=40800b3c R03=000102ec
  R04=00010a28 R05=00010158 R06=00087460 R07=00010158
  R08=00000000 R09=00000000 R10=00085b7c R11=408009f4
  R12=40800a08 R13=408009f0 R14=0001057c R15=000102f8
  PSR=60000010 -ZC- A usr32
  qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x7f5c21d0fa12

  WFI aims to enter a low-power state and wait for interrupt. The raised
  exception seems not a right behavior. I can provide a testcase if you
  needed. Many thanks.

  Regards
  Muhui

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926759/+subscriptions


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

* [Bug 1926759] Re: WFI instruction results in unhandled CPU exception
  2021-04-30 11:31 [Bug 1926759] [NEW] WFI instruction results in unhandled CPU exception JIANG Muhui
                   ` (6 preceding siblings ...)
  2021-04-30 15:09 ` Peter Maydell
@ 2021-04-30 17:51 ` Peter Maydell
  2021-05-16 14:29 ` Thomas Huth
  2021-08-25  7:06 ` Thomas Huth
  9 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2021-04-30 17:51 UTC (permalink / raw)
  To: qemu-devel

Should be fixed by:
https://patchew.org/QEMU/20210430162212.825-1-peter.maydell@linaro.org/


** Changed in: qemu
       Status: Confirmed => Won't Fix

** Changed in: qemu
       Status: Won't Fix => In Progress

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926759

Title:
  WFI instruction results in unhandled CPU exception

Status in QEMU:
  In Progress

Bug description:
  Hi

  I refer to the WFI instruction. The bytecode is 0xe320f003. After the
  execution, qemu exit with the following  crash log.

  qemu: unhandled CPU exception 0x10001 - aborting
  R00=00000001 R01=40800b34 R02=40800b3c R03=000102ec
  R04=00010a28 R05=00010158 R06=00087460 R07=00010158
  R08=00000000 R09=00000000 R10=00085b7c R11=408009f4
  R12=40800a08 R13=408009f0 R14=0001057c R15=000102f8
  PSR=60000010 -ZC- A usr32
  qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x7f5c21d0fa12

  WFI aims to enter a low-power state and wait for interrupt. The raised
  exception seems not a right behavior. I can provide a testcase if you
  needed. Many thanks.

  Regards
  Muhui

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926759/+subscriptions


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

* [Bug 1926759] Re: WFI instruction results in unhandled CPU exception
  2021-04-30 11:31 [Bug 1926759] [NEW] WFI instruction results in unhandled CPU exception JIANG Muhui
                   ` (7 preceding siblings ...)
  2021-04-30 17:51 ` Peter Maydell
@ 2021-05-16 14:29 ` Thomas Huth
  2021-08-25  7:06 ` Thomas Huth
  9 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2021-05-16 14:29 UTC (permalink / raw)
  To: qemu-devel

Fix has been merged:
https://gitlab.com/qemu-project/qemu/-/commit/5b2c8af89b82a671137a

** Changed in: qemu
       Status: In Progress => Fix Committed

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926759

Title:
  WFI instruction results in unhandled CPU exception

Status in QEMU:
  Fix Committed

Bug description:
  Hi

  I refer to the WFI instruction. The bytecode is 0xe320f003. After the
  execution, qemu exit with the following  crash log.

  qemu: unhandled CPU exception 0x10001 - aborting
  R00=00000001 R01=40800b34 R02=40800b3c R03=000102ec
  R04=00010a28 R05=00010158 R06=00087460 R07=00010158
  R08=00000000 R09=00000000 R10=00085b7c R11=408009f4
  R12=40800a08 R13=408009f0 R14=0001057c R15=000102f8
  PSR=60000010 -ZC- A usr32
  qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x7f5c21d0fa12

  WFI aims to enter a low-power state and wait for interrupt. The raised
  exception seems not a right behavior. I can provide a testcase if you
  needed. Many thanks.

  Regards
  Muhui

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926759/+subscriptions


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

* [Bug 1926759] Re: WFI instruction results in unhandled CPU exception
  2021-04-30 11:31 [Bug 1926759] [NEW] WFI instruction results in unhandled CPU exception JIANG Muhui
                   ` (8 preceding siblings ...)
  2021-05-16 14:29 ` Thomas Huth
@ 2021-08-25  7:06 ` Thomas Huth
  9 siblings, 0 replies; 11+ messages in thread
From: Thomas Huth @ 2021-08-25  7:06 UTC (permalink / raw)
  To: qemu-devel

** Changed in: qemu
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1926759

Title:
  WFI instruction results in unhandled CPU exception

Status in QEMU:
  Fix Released

Bug description:
  Hi

  I refer to the WFI instruction. The bytecode is 0xe320f003. After the
  execution, qemu exit with the following  crash log.

  qemu: unhandled CPU exception 0x10001 - aborting
  R00=00000001 R01=40800b34 R02=40800b3c R03=000102ec
  R04=00010a28 R05=00010158 R06=00087460 R07=00010158
  R08=00000000 R09=00000000 R10=00085b7c R11=408009f4
  R12=40800a08 R13=408009f0 R14=0001057c R15=000102f8
  PSR=60000010 -ZC- A usr32
  qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x7f5c21d0fa12

  WFI aims to enter a low-power state and wait for interrupt. The raised
  exception seems not a right behavior. I can provide a testcase if you
  needed. Many thanks.

  Regards
  Muhui

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1926759/+subscriptions



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

end of thread, other threads:[~2021-08-25  7:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-30 11:31 [Bug 1926759] [NEW] WFI instruction results in unhandled CPU exception JIANG Muhui
2021-04-30 13:06 ` [Bug 1926759] " Peter Maydell
2021-04-30 13:07 ` Peter Maydell
2021-04-30 13:17 ` JIANG Muhui
2021-04-30 13:40 ` Peter Maydell
2021-04-30 13:52 ` Peter Maydell
2021-04-30 14:54 ` JIANG Muhui
2021-04-30 15:09 ` Peter Maydell
2021-04-30 17:51 ` Peter Maydell
2021-05-16 14:29 ` Thomas Huth
2021-08-25  7:06 ` Thomas Huth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).