All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] PCI device waiting for some external (shared memory) events
@ 2013-09-10 16:10 Michael Moese
  2013-09-10 16:47 ` Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Moese @ 2013-09-10 16:10 UTC (permalink / raw)
  To: qemu-devel

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

Hello dear Qemu developers,
I have some weird issues with a PCI device I have developed.
I am using shared memory to create an abstraction from the Qemu-PCI device
I developed and forward all requests to another process running a SystemC
device (this should not matter here).

In my pci-read and write implementations I lock a mutex on the shared
memory, then write address, data and r/w-flag to the shared memory, then I
poll for a completion-flag.

This seems to work quite fine while writing data, which happen in some kind
of posted writes, so I finish the operation as soon as possible.
When I execute a pci memory read from inside the guest the read-function
still gets executed, but Qemu gets stuck then.

Using gdb I could find out Qemu claims some pthread mutexes (I don't use
pthreads-mutexes myself, so there won't be any conflicts with that) - which
seems to take forever (gave it like 30 minutes).

I hope I could describe my situation somewhat understandable.

Now my question is, am I doing something I must not when just busy-waiting
for the completion flag?

Is there another way to "stop" the simulated CPU during this transfer and
resume afterwards?


Thanks for your time reading this. I'd be happy to get any suggestions, and
if required I could add some code of my experiments.


Michael

-- 
Michael Moese
Baumgartenweg 1
91452 Wilhermsdorf
Mobil: +49 176 61 05 94 99
Fax: +49 3212 11 42 49 7

[-- Attachment #2: Type: text/html, Size: 1776 bytes --]

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

* Re: [Qemu-devel] PCI device waiting for some external (shared memory) events
  2013-09-10 16:10 [Qemu-devel] PCI device waiting for some external (shared memory) events Michael Moese
@ 2013-09-10 16:47 ` Peter Maydell
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2013-09-10 16:47 UTC (permalink / raw)
  To: Michael Moese; +Cc: QEMU Developers

On 10 September 2013 17:10, Michael Moese <michael.moese@gmail.com> wrote:
> Hello dear Qemu developers,
> I have some weird issues with a PCI device I have developed.
> I am using shared memory to create an abstraction from the Qemu-PCI device I
> developed and forward all requests to another process running a SystemC
> device (this should not matter here).
>
> In my pci-read and write implementations I lock a mutex on the shared
> memory, then write address, data and r/w-flag to the shared memory, then I
> poll for a completion-flag.
>
> This seems to work quite fine while writing data, which happen in some kind
> of posted writes, so I finish the operation as soon as possible.
> When I execute a pci memory read from inside the guest the read-function
> still gets executed, but Qemu gets stuck then.

This sounds suspiciously like you've introduced a deadlock somewhere
(ie the other end of your system is not returning the data to QEMU
because it's waiting for QEMU to respond to it for something else).

> Now my question is, am I doing something I must not when just busy-waiting
> for the completion flag?
>
> Is there another way to "stop" the simulated CPU during this transfer and
> resume afterwards?

No. You have to return data immediately from a read or write
callback.

-- PMM

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

end of thread, other threads:[~2013-09-10 16:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-10 16:10 [Qemu-devel] PCI device waiting for some external (shared memory) events Michael Moese
2013-09-10 16:47 ` Peter Maydell

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.