public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm <kvm@vger.kernel.org>,
	Alex Williamson <alex.williamson@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH v4 4/9] KVM: Switch assigned device IRQ forwarding to threaded handler
Date: Tue, 09 Nov 2010 13:36:23 +0100	[thread overview]
Message-ID: <4CD94047.8090704@siemens.com> (raw)
In-Reply-To: <4CD93E00.6060609@redhat.com>

Am 09.11.2010 13:26, Avi Kivity wrote:
> On 11/08/2010 01:21 PM, Jan Kiszka wrote:
>> This improves the IRQ forwarding for assigned devices: By using the
>> kernel's threaded IRQ scheme, we can get rid of the latency-prone work
>> queue and simplify the code in the same run.
>>
>> Moreover, we no longer have to hold assigned_dev_lock while raising the
>> guest IRQ, which can be a lenghty operation as we may have to iterate
>> over all VCPUs. The lock is now only used for synchronizing masking vs.
>> unmasking of INTx-type IRQs, thus is renames to intx_lock.
> 
> Nice stuff.
> 
>>
>> -#define KVM_ASSIGNED_MSIX_PENDING		0x1
>> -struct kvm_guest_msix_entry {
>> -	u32 vector;
>> -	u16 entry;
>> -	u16 flags;
>> -};
>> -
> 
> Ok, so .flags was used to handle the delay between the interrupt handler 
> and the work queue, which is now done automatically by threaded 
> interrupts.  Good.

Yes, a nice consolidating side effect.

> 
>> @@ -313,10 +276,10 @@ static int assigned_device_enable_host_msix(struct kvm *kvm,
>>   		return r;
>>
>>   	for (i = 0; i<  dev->entries_nr; i++) {
>> -		r = request_irq(dev->host_msix_entries[i].vector,
>> -				kvm_assigned_dev_intr, 0,
>> -				"kvm_assigned_msix_device",
>> -				(void *)dev);
>> +		r = request_threaded_irq(dev->host_msix_entries[i].vector,
>> +					 NULL, kvm_assigned_dev_thread,
>> +					 0, "kvm_assigned_msix_device",
>> +					 (void *)dev);
>>   		if (r)
>>   			goto err;
>>   	}
> 
> 
> Should eventually be done from interrupt context.  msix delivery only 
> needs a routing table lookup and smp reschedule IPI, which can be done 
> from interrupt context.
> 

Yes, definitely. But we would have to catch the case when the guest
configures the MSI-X message to be a broadcast to all its trillion VCPUs
(once we support trillions of them).

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux

  reply	other threads:[~2010-11-09 12:36 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-08 11:21 [PATCH v4 0/9] KVM: Improve IRQ assignment for device passthrough Jan Kiszka
2010-11-08 11:21 ` [PATCH v4 1/9] KVM: Fix srcu struct leakage Jan Kiszka
2010-11-08 17:00   ` Michael S. Tsirkin
2010-11-08 17:32     ` Jan Kiszka
2010-11-08 11:21 ` [PATCH v4 2/9] KVM: Switch IRQ subsystem to SRCU Jan Kiszka
2010-11-09 10:49   ` Avi Kivity
2010-11-09 11:21     ` Jan Kiszka
2010-11-08 11:21 ` [PATCH v4 3/9] KVM: Clear assigned guest IRQ on release Jan Kiszka
2010-11-09 10:58   ` Avi Kivity
2010-11-09 11:20     ` Jan Kiszka
2010-11-09 18:36     ` Alex Williamson
2010-11-10  6:53       ` Avi Kivity
2010-11-26 10:36         ` Michael S. Tsirkin
2010-11-08 11:21 ` [PATCH v4 4/9] KVM: Switch assigned device IRQ forwarding to threaded handler Jan Kiszka
2010-11-09 12:26   ` Avi Kivity
2010-11-09 12:36     ` Jan Kiszka [this message]
2010-11-08 11:21 ` [PATCH v4 5/9] KVM: Refactor IRQ names of assigned devices Jan Kiszka
2010-11-08 11:21 ` [PATCH v4 6/9] KVM: Save/restore state of assigned PCI device Jan Kiszka
2010-11-09 12:35   ` Avi Kivity
2010-11-09 13:29     ` Jan Kiszka
2010-11-09 13:36       ` Avi Kivity
2010-11-09 13:44         ` Jan Kiszka
2010-11-09 13:46           ` Avi Kivity
2010-11-09 16:41             ` Don Dutile
2010-11-08 11:21 ` [PATCH v4 7/9] KVM: Clean up kvm_vm_ioctl_assigned_device Jan Kiszka
2010-11-08 11:21 ` [PATCH v4 8/9] KVM: Document device assigment API Jan Kiszka
2010-11-08 11:21 ` [PATCH v4 9/9] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices Jan Kiszka
2010-11-09 13:27   ` Avi Kivity
2010-11-09 13:35     ` Jan Kiszka
2010-11-09 13:41       ` Avi Kivity
2010-11-09 14:11         ` Jan Kiszka
2010-11-09 14:20           ` Avi Kivity
2010-11-16 16:55 ` [PATCH v4 0/9] KVM: Improve IRQ assignment for device passthrough Marcelo Tosatti
2010-11-16 18:26   ` Jan Kiszka
2010-11-17  8:25     ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CD94047.8090704@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=alex.williamson@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox