qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Re: [Qemu-devel] [Qemu-discuss] IRQ per CPU
       [not found] <CA++5wji+jjiTcBT+Uhd4VL2U70vmRFnvacbRqhnxWX3M=f7svA@mail.gmail.com>
@ 2018-07-05  3:50 ` Dongli Zhang
  2018-07-05  4:12   ` Probir Roy
  0 siblings, 1 reply; 4+ messages in thread
From: Dongli Zhang @ 2018-07-05  3:50 UTC (permalink / raw)
  To: Probir Roy; +Cc: qemu-discuss, qemu-devel



On 07/04/2018 10:32 PM, Probir Roy wrote:
> I am writing a virtual device that would generate IRQ per CPU basis. I

Does 'per CPU basis' indicates irq per cpu, or irq per device queue?

AFAIK, the device may create multiple queues in the driver (in OS) and we would
have one irq (vector) per queue?

If you are talking about irq (vector) per queue, I would suggest read about
following on nvme which involves per-queue vector.

https://github.com/qemu/qemu/blob/master/hw/block/nvme.c

Although I am not expert on qemu, in my opinion the qemu nvme code is very
helpful for understanding per-queue vector.

> have written a PCI device from the template which does not generate
> IRQ per CPU. How can write such device in Qemu?
> 
> The code of current device is here:
> https://gist.github.com/proywm/6ca98d3e8ca001965e2c8792fcf97911
> 
> Regards,
> Probir
> 

Dongli Zhang

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

* Re: [Qemu-devel] [Qemu-discuss] IRQ per CPU
  2018-07-05  3:50 ` [Qemu-devel] [Qemu-discuss] IRQ per CPU Dongli Zhang
@ 2018-07-05  4:12   ` Probir Roy
  2018-07-05  7:16     ` Dongli Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Probir Roy @ 2018-07-05  4:12 UTC (permalink / raw)
  To: Dongli Zhang; +Cc: qemu-discuss, qemu-devel

> Does 'per CPU basis' indicates irq per cpu, or irq per device queue?

IRQ per CPU core, meaning that IRQ will be raised at and served by
that CPU. Does IRQ per queue mean the same thing?

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

* Re: [Qemu-devel] [Qemu-discuss] IRQ per CPU
  2018-07-05  4:12   ` Probir Roy
@ 2018-07-05  7:16     ` Dongli Zhang
  2018-07-11 12:49       ` Stefan Hajnoczi
  0 siblings, 1 reply; 4+ messages in thread
From: Dongli Zhang @ 2018-07-05  7:16 UTC (permalink / raw)
  To: Probir Roy; +Cc: qemu-discuss, qemu-devel



On 07/05/2018 12:12 PM, Probir Roy wrote:
>> Does 'per CPU basis' indicates irq per cpu, or irq per device queue?
> 
> IRQ per CPU core, meaning that IRQ will be raised at and served by
> that CPU. Does IRQ per queue mean the same thing?
> 

About 'IRQ per queue', the device may create multiple queue in the OS driver.
The number of queues are always proportional to the number of CPU core/thread
(although this is also always configurable by OS driver).

Usually the per-queue irq/vector is bound to each CPU. As the number of
queue/irq is always the same as the number of CPU, it is sort of 'per CPU
basis', as each CPU will be serving irq for its own queue.

Dongli Zhang

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

* Re: [Qemu-devel] [Qemu-discuss] IRQ per CPU
  2018-07-05  7:16     ` Dongli Zhang
@ 2018-07-11 12:49       ` Stefan Hajnoczi
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2018-07-11 12:49 UTC (permalink / raw)
  To: Dongli Zhang; +Cc: Probir Roy, qemu-devel, qemu-discuss

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

On Thu, Jul 05, 2018 at 03:16:44PM +0800, Dongli Zhang wrote:
> 
> 
> On 07/05/2018 12:12 PM, Probir Roy wrote:
> >> Does 'per CPU basis' indicates irq per cpu, or irq per device queue?
> > 
> > IRQ per CPU core, meaning that IRQ will be raised at and served by
> > that CPU. Does IRQ per queue mean the same thing?
> > 
> 
> About 'IRQ per queue', the device may create multiple queue in the OS driver.
> The number of queues are always proportional to the number of CPU core/thread
> (although this is also always configurable by OS driver).
> 
> Usually the per-queue irq/vector is bound to each CPU. As the number of
> queue/irq is always the same as the number of CPU, it is sort of 'per CPU
> basis', as each CPU will be serving irq for its own queue.

Some more background on devices with multiple irqs:

It's the guest kernel that configures interrupt routing on modern
systems where the interrupt controller hardware supports that.

With a PCI device you would need multiple Message-Signalled Interrupt
vectors.  Then the guest driver can set the irq affinity so that the
vcpu of your choice receives each of these interrupts.

Interrupts are a limited resource, even when using Message-Signalled
Interrupts, so you'll have to choose a maximum number of interrupts that
the device supports.

https://en.wikipedia.org/wiki/Message_Signaled_Interrupts#MSI-X

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

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

end of thread, other threads:[~2018-07-11 12:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CA++5wji+jjiTcBT+Uhd4VL2U70vmRFnvacbRqhnxWX3M=f7svA@mail.gmail.com>
2018-07-05  3:50 ` [Qemu-devel] [Qemu-discuss] IRQ per CPU Dongli Zhang
2018-07-05  4:12   ` Probir Roy
2018-07-05  7:16     ` Dongli Zhang
2018-07-11 12:49       ` Stefan Hajnoczi

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