qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Bug 1850378] [NEW] RISC-V unreliable IPIs
@ 2019-10-29 13:19 tm
  2019-10-29 15:21 ` [Bug 1850378] " Palmer Dabbelt
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: tm @ 2019-10-29 13:19 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

I am working on a project with custom inter processor interrupts (IPIs) on the RISC-V virt machine.
After upgrading from version 3.1.0 to 4.1.0 which fixes a related issue (https://github.com/riscv/riscv-qemu/issues/132) I am able to use the CPU hotplug feature.

However, if I try to use IPIs for communication between two cores, the
wfi instruction behaves strangely. Either it does not return, or it
returns on timer interrupts, even though they are disabled. The code, I
use on one core to wait for an interrupt is the following.

	csr_clear(sie, SIE_SEIE | SIE_STIE);
	do {
		wait_for_interrupt();
		sipval = csr_read(sip);
		sieval = csr_read(sie);
		scauseval = csr_read(scause) & 0xFF;
	/* only break if wfi returns for an software interrupt */
	} while ((sipval & sieval) == 0 && scauseval != 1);
	csr_set(sie, SIE_SEIE | SIE_STIE);

Since the resulting sequence does not seem to be deterministic, my guess
is, that it has something to do with the communication of qemu's threads
for the different cores.

** Affects: qemu
     Importance: Undecided
         Status: New


** Tags: riscv

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

Title:
  RISC-V unreliable IPIs

Status in QEMU:
  New

Bug description:
  I am working on a project with custom inter processor interrupts (IPIs) on the RISC-V virt machine.
  After upgrading from version 3.1.0 to 4.1.0 which fixes a related issue (https://github.com/riscv/riscv-qemu/issues/132) I am able to use the CPU hotplug feature.

  However, if I try to use IPIs for communication between two cores, the
  wfi instruction behaves strangely. Either it does not return, or it
  returns on timer interrupts, even though they are disabled. The code,
  I use on one core to wait for an interrupt is the following.

  	csr_clear(sie, SIE_SEIE | SIE_STIE);
  	do {
  		wait_for_interrupt();
  		sipval = csr_read(sip);
  		sieval = csr_read(sie);
  		scauseval = csr_read(scause) & 0xFF;
  	/* only break if wfi returns for an software interrupt */
  	} while ((sipval & sieval) == 0 && scauseval != 1);
  	csr_set(sie, SIE_SEIE | SIE_STIE);

  Since the resulting sequence does not seem to be deterministic, my
  guess is, that it has something to do with the communication of qemu's
  threads for the different cores.

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


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

* [Bug 1850378] Re: RISC-V unreliable IPIs
  2019-10-29 13:19 [Bug 1850378] [NEW] RISC-V unreliable IPIs tm
@ 2019-10-29 15:21 ` Palmer Dabbelt
  2019-10-29 17:44 ` tm
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Palmer Dabbelt @ 2019-10-29 15:21 UTC (permalink / raw)
  To: qemu-devel

Can you post a whole program that reproduces this?  freedom-e-sdk
<https://github.com/sifive/freedom-e-sdk> will run bare-metal code on
QEMU if you don't want to post the rest of the surrounding
infrastructure.

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

Title:
  RISC-V unreliable IPIs

Status in QEMU:
  New

Bug description:
  I am working on a project with custom inter processor interrupts (IPIs) on the RISC-V virt machine.
  After upgrading from version 3.1.0 to 4.1.0 which fixes a related issue (https://github.com/riscv/riscv-qemu/issues/132) I am able to use the CPU hotplug feature.

  However, if I try to use IPIs for communication between two cores, the
  wfi instruction behaves strangely. Either it does not return, or it
  returns on timer interrupts, even though they are disabled. The code,
  I use on one core to wait for an interrupt is the following.

  	csr_clear(sie, SIE_SEIE | SIE_STIE);
  	do {
  		wait_for_interrupt();
  		sipval = csr_read(sip);
  		sieval = csr_read(sie);
  		scauseval = csr_read(scause) & 0xFF;
  	/* only break if wfi returns for an software interrupt */
  	} while ((sipval & sieval) == 0 && scauseval != 1);
  	csr_set(sie, SIE_SEIE | SIE_STIE);

  Since the resulting sequence does not seem to be deterministic, my
  guess is, that it has something to do with the communication of qemu's
  threads for the different cores.

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


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

* [Bug 1850378] Re: RISC-V unreliable IPIs
  2019-10-29 13:19 [Bug 1850378] [NEW] RISC-V unreliable IPIs tm
  2019-10-29 15:21 ` [Bug 1850378] " Palmer Dabbelt
@ 2019-10-29 17:44 ` tm
  2019-10-30  9:44 ` tm
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tm @ 2019-10-29 17:44 UTC (permalink / raw)
  To: qemu-devel

I created a minimal example from my setup. I'm running a kernel 4.19.57 with a custom firmware based on bbl (https://github.com/riscv/riscv-pk). 
An ioctl device from a kernel module is used to execute the code above in kernel space.
In the example, the userspace application proceeds after a couple of seconds without receiving the custom IPI.

** Attachment added: "example.tar.gz"
   https://bugs.launchpad.net/qemu/+bug/1850378/+attachment/5301219/+files/example.tar.gz

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

Title:
  RISC-V unreliable IPIs

Status in QEMU:
  New

Bug description:
  I am working on a project with custom inter processor interrupts (IPIs) on the RISC-V virt machine.
  After upgrading from version 3.1.0 to 4.1.0 which fixes a related issue (https://github.com/riscv/riscv-qemu/issues/132) I am able to use the CPU hotplug feature.

  However, if I try to use IPIs for communication between two cores, the
  wfi instruction behaves strangely. Either it does not return, or it
  returns on timer interrupts, even though they are disabled. The code,
  I use on one core to wait for an interrupt is the following.

  	csr_clear(sie, SIE_SEIE | SIE_STIE);
  	do {
  		wait_for_interrupt();
  		sipval = csr_read(sip);
  		sieval = csr_read(sie);
  		scauseval = csr_read(scause) & 0xFF;
  	/* only break if wfi returns for an software interrupt */
  	} while ((sipval & sieval) == 0 && scauseval != 1);
  	csr_set(sie, SIE_SEIE | SIE_STIE);

  Since the resulting sequence does not seem to be deterministic, my
  guess is, that it has something to do with the communication of qemu's
  threads for the different cores.

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


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

* [Bug 1850378] Re: RISC-V unreliable IPIs
  2019-10-29 13:19 [Bug 1850378] [NEW] RISC-V unreliable IPIs tm
  2019-10-29 15:21 ` [Bug 1850378] " Palmer Dabbelt
  2019-10-29 17:44 ` tm
@ 2019-10-30  9:44 ` tm
  2021-04-22  8:45 ` Thomas Huth
  2021-06-22  4:18 ` Launchpad Bug Tracker
  4 siblings, 0 replies; 6+ messages in thread
From: tm @ 2019-10-30  9:44 UTC (permalink / raw)
  To: qemu-devel

** Description changed:

  I am working on a project with custom inter processor interrupts (IPIs) on the RISC-V virt machine.
  After upgrading from version 3.1.0 to 4.1.0 which fixes a related issue (https://github.com/riscv/riscv-qemu/issues/132) I am able to use the CPU hotplug feature.
  
  However, if I try to use IPIs for communication between two cores, the
  wfi instruction behaves strangely. Either it does not return, or it
  returns on timer interrupts, even though they are disabled. The code, I
  use on one core to wait for an interrupt is the following.
  
- 	csr_clear(sie, SIE_SEIE | SIE_STIE);
- 	do {
- 		wait_for_interrupt();
- 		sipval = csr_read(sip);
- 		sieval = csr_read(sie);
- 		scauseval = csr_read(scause) & 0xFF;
- 	/* only break if wfi returns for an software interrupt */
- 	} while ((sipval & sieval) == 0 && scauseval != 1);
- 	csr_set(sie, SIE_SEIE | SIE_STIE);
+  csr_clear(sie, SIE_SEIE | SIE_STIE);
+  do {
+   wait_for_interrupt();
+   sipval = csr_read(sip);
+   sieval = csr_read(sie);
+   scauseval = csr_read(scause) & 0xFF;
+  /* only break if wfi returns for an software interrupt */
+  } while ((sipval & sieval) == 0 && scauseval != 1);
+  csr_set(sie, SIE_SEIE | SIE_STIE);
  
  Since the resulting sequence does not seem to be deterministic, my guess
  is, that it has something to do with the communication of qemu's threads
  for the different cores.
+ 
+ Update:
+ The exact same setup works fine in spike (the actual sim, not the qemu board), which might give a hint, that it is related to the interrupt controller implementation.

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

Title:
  RISC-V unreliable IPIs

Status in QEMU:
  New

Bug description:
  I am working on a project with custom inter processor interrupts (IPIs) on the RISC-V virt machine.
  After upgrading from version 3.1.0 to 4.1.0 which fixes a related issue (https://github.com/riscv/riscv-qemu/issues/132) I am able to use the CPU hotplug feature.

  However, if I try to use IPIs for communication between two cores, the
  wfi instruction behaves strangely. Either it does not return, or it
  returns on timer interrupts, even though they are disabled. The code,
  I use on one core to wait for an interrupt is the following.

   csr_clear(sie, SIE_SEIE | SIE_STIE);
   do {
    wait_for_interrupt();
    sipval = csr_read(sip);
    sieval = csr_read(sie);
    scauseval = csr_read(scause) & 0xFF;
   /* only break if wfi returns for an software interrupt */
   } while ((sipval & sieval) == 0 && scauseval != 1);
   csr_set(sie, SIE_SEIE | SIE_STIE);

  Since the resulting sequence does not seem to be deterministic, my
  guess is, that it has something to do with the communication of qemu's
  threads for the different cores.

  Update:
  The exact same setup works fine in spike (the actual sim, not the qemu board), which might give a hint, that it is related to the interrupt controller implementation.

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


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

* [Bug 1850378] Re: RISC-V unreliable IPIs
  2019-10-29 13:19 [Bug 1850378] [NEW] RISC-V unreliable IPIs tm
                   ` (2 preceding siblings ...)
  2019-10-30  9:44 ` tm
@ 2021-04-22  8:45 ` Thomas Huth
  2021-06-22  4:18 ` Launchpad Bug Tracker
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2021-04-22  8:45 UTC (permalink / raw)
  To: qemu-devel

The QEMU project is currently considering to move its bug tracking to
another system. For this we need to know which bugs are still valid
and which could be closed already. Thus we are setting older bugs to
"Incomplete" now.

If you still think this bug report here is valid, then please switch
the state back to "New" within the next 60 days, otherwise this report
will be marked as "Expired". Or please mark it as "Fix Released" if
the problem has been solved with a newer version of QEMU already.

Thank you and sorry for the inconvenience.


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

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

Title:
  RISC-V unreliable IPIs

Status in QEMU:
  Incomplete

Bug description:
  I am working on a project with custom inter processor interrupts (IPIs) on the RISC-V virt machine.
  After upgrading from version 3.1.0 to 4.1.0 which fixes a related issue (https://github.com/riscv/riscv-qemu/issues/132) I am able to use the CPU hotplug feature.

  However, if I try to use IPIs for communication between two cores, the
  wfi instruction behaves strangely. Either it does not return, or it
  returns on timer interrupts, even though they are disabled. The code,
  I use on one core to wait for an interrupt is the following.

   csr_clear(sie, SIE_SEIE | SIE_STIE);
   do {
    wait_for_interrupt();
    sipval = csr_read(sip);
    sieval = csr_read(sie);
    scauseval = csr_read(scause) & 0xFF;
   /* only break if wfi returns for an software interrupt */
   } while ((sipval & sieval) == 0 && scauseval != 1);
   csr_set(sie, SIE_SEIE | SIE_STIE);

  Since the resulting sequence does not seem to be deterministic, my
  guess is, that it has something to do with the communication of qemu's
  threads for the different cores.

  Update:
  The exact same setup works fine in spike (the actual sim, not the qemu board), which might give a hint, that it is related to the interrupt controller implementation.

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


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

* [Bug 1850378] Re: RISC-V unreliable IPIs
  2019-10-29 13:19 [Bug 1850378] [NEW] RISC-V unreliable IPIs tm
                   ` (3 preceding siblings ...)
  2021-04-22  8:45 ` Thomas Huth
@ 2021-06-22  4:18 ` Launchpad Bug Tracker
  4 siblings, 0 replies; 6+ messages in thread
From: Launchpad Bug Tracker @ 2021-06-22  4:18 UTC (permalink / raw)
  To: qemu-devel

[Expired for QEMU because there has been no activity for 60 days.]

** Changed in: qemu
       Status: Incomplete => Expired

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

Title:
  RISC-V unreliable IPIs

Status in QEMU:
  Expired

Bug description:
  I am working on a project with custom inter processor interrupts (IPIs) on the RISC-V virt machine.
  After upgrading from version 3.1.0 to 4.1.0 which fixes a related issue (https://github.com/riscv/riscv-qemu/issues/132) I am able to use the CPU hotplug feature.

  However, if I try to use IPIs for communication between two cores, the
  wfi instruction behaves strangely. Either it does not return, or it
  returns on timer interrupts, even though they are disabled. The code,
  I use on one core to wait for an interrupt is the following.

   csr_clear(sie, SIE_SEIE | SIE_STIE);
   do {
    wait_for_interrupt();
    sipval = csr_read(sip);
    sieval = csr_read(sie);
    scauseval = csr_read(scause) & 0xFF;
   /* only break if wfi returns for an software interrupt */
   } while ((sipval & sieval) == 0 && scauseval != 1);
   csr_set(sie, SIE_SEIE | SIE_STIE);

  Since the resulting sequence does not seem to be deterministic, my
  guess is, that it has something to do with the communication of qemu's
  threads for the different cores.

  Update:
  The exact same setup works fine in spike (the actual sim, not the qemu board), which might give a hint, that it is related to the interrupt controller implementation.

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


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

end of thread, other threads:[~2021-06-22  4:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29 13:19 [Bug 1850378] [NEW] RISC-V unreliable IPIs tm
2019-10-29 15:21 ` [Bug 1850378] " Palmer Dabbelt
2019-10-29 17:44 ` tm
2019-10-30  9:44 ` tm
2021-04-22  8:45 ` Thomas Huth
2021-06-22  4:18 ` Launchpad Bug Tracker

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).