public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: Avi Kivity <avi@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>, kvm <kvm@vger.kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jesse Barnes <jbarnes@virtuousgeek.org>
Subject: Re: [PATCH] KVM: Allow host IRQ sharing for assigned PCI 2.3 devices
Date: Mon, 09 Jan 2012 15:05:54 -0700	[thread overview]
Message-ID: <1326146754.1605.77.camel@bling.home> (raw)
In-Reply-To: <4F0B5B49.2040305@web.de>

On Mon, 2012-01-09 at 22:25 +0100, Jan Kiszka wrote:
> On 2012-01-09 20:45, Alex Williamson wrote:
> > On Mon, 2012-01-09 at 15:03 +0100, Jan Kiszka wrote:
> >> +static int kvm_vm_ioctl_set_pci_irq_mask(struct kvm *kvm,
> >> +		struct kvm_assigned_pci_dev *assigned_dev)
> >> +{
> >> +	int r = 0;
> >> +	struct kvm_assigned_dev_kernel *match;
> >> +
> >> +	mutex_lock(&kvm->lock);
> >> +
> >> +	match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head,
> >> +				      assigned_dev->assigned_dev_id);
> >> +	if (!match) {
> >> +		r = -ENODEV;
> >> +		goto out;
> >> +	}
> >> +
> >> +	mutex_lock(&match->intx_mask_lock);
> >> +
> >> +	match->flags &= ~KVM_DEV_ASSIGN_MASK_INTX;
> >> +	match->flags |= assigned_dev->flags & KVM_DEV_ASSIGN_MASK_INTX;
> >> +
> >> +	if (match->irq_requested_type & KVM_DEV_IRQ_GUEST_INTX) {
> >> +		if (assigned_dev->flags & KVM_DEV_ASSIGN_MASK_INTX) {
> >> +			kvm_set_irq(match->kvm, match->irq_source_id,
> >> +				    match->guest_irq, 0);
> >> +			/*
> >> +			 * Masking at hardware-level is performed on demand,
> >> +			 * i.e. when an IRQ actually arrives at the host.
> >> +			 */
> > 
> > Is there any harm in doing this synchronous to the ioctl?  We're on a
> > slow path here anyway since the mask is likely drive by a config space
> > write.
> 
> Not sure, maybe locking. What would be the advantage of doing it
> synchronously?

It would just be a closer match to hardware.  I'm wondering (FUD) if
there could be a case where a driver does some sensitive operations on
the device that could be interfered with if the device generates that
one last interrupt to actually disable interrupts instead of them being
disabled after setting config space.  It's probably a long shot, but
doesn't seem too difficult to switch to synchronous disabling.  Thanks,

Alex




  reply	other threads:[~2012-01-09 22:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-09 14:03 [PATCH] KVM: Allow host IRQ sharing for assigned PCI 2.3 devices Jan Kiszka
2012-01-09 19:45 ` Alex Williamson
2012-01-09 21:25   ` Jan Kiszka
2012-01-09 22:05     ` Alex Williamson [this message]
2012-01-09 22:26       ` Jan Kiszka
2012-01-10 13:47       ` Jan Kiszka
2012-01-10 23:41         ` Alex Williamson
2012-01-11  9:47           ` Michael S. Tsirkin
2012-01-10 16:17 ` Michael S. Tsirkin
2012-01-10 17:29   ` Jan Kiszka
2012-01-10 18:10     ` Michael S. Tsirkin
2012-01-10 18:21       ` Jan Kiszka
2012-01-10 18:31         ` Michael S. Tsirkin
2012-01-10 18:43           ` Jan Kiszka
2012-01-10 19:04             ` Michael S. Tsirkin
2012-01-10 19:40               ` Jan Kiszka
2012-01-10 20:44                 ` Michael S. Tsirkin
2012-01-10 21:18                   ` Jan Kiszka
2012-01-10 21:36                     ` Michael S. Tsirkin
2012-01-12 15:49 ` [PATCH v2] " Jan Kiszka

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=1326146754.1605.77.camel@bling.home \
    --to=alex.williamson@redhat.com \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@web.de \
    --cc=jbarnes@virtuousgeek.org \
    --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