public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: "Han, Weidong" <weidong.han@intel.com>
Cc: Ben-Ami Yassour <benami@il.ibm.com>,
	amit.shah@qumranet.com, kvm@vger.kernel.org, muli@il.ibm.com,
	anthony@codemonkey.ws
Subject: Re: [PATCH 3/8] KVM: Handle device assignment to guests
Date: Thu, 17 Jul 2008 09:02:32 +0300	[thread overview]
Message-ID: <487EE078.8020001@qumranet.com> (raw)
In-Reply-To: <0122C7C995D32147B66BF4F440D30163015DC7E7@pdsmsx415.ccr.corp.intel.com>

Han, Weidong wrote:
> Avi Kivity wrote:
>   
>>> +static void kvm_pci_pt_work_fn(struct work_struct *work) +{
>>> +	struct kvm_pci_pt_dev_list *match;
>>> +	struct kvm_pci_pt_work *int_work;
>>> +	int source;
>>> +	unsigned long flags;
>>> +	int guest_irq;
>>> +	int host_irq;
>>> +
>>> +	int_work = container_of(work, struct kvm_pci_pt_work, work); +
>>> +	source = int_work->source ? KVM_PT_SOURCE_IRQ_ACK :
>>> KVM_PT_SOURCE_IRQ; + +	/* This is taken to safely inject irq
>>>       
> inside
>   
>>> the guest. When +	 * the interrupt injection (or the ioapic code)
>>> uses a +	 * finer-grained lock, update this
>>> +	 */
>>> +	mutex_lock(&int_work->kvm->lock);
>>> +	read_lock_irqsave(&kvm_pci_pt_lock, flags);
>>> +	match =
>>>       
> kvm_find_pci_pt_dev(&int_work->kvm->arch.pci_pt_dev_head,
>   
>>> NULL, +				    int_work->irq, source);
>>> +	if (!match) {
>>> +		printk(KERN_ERR "%s: no matching device assigned to
>>>       
> guest "
>   
>>> +		       "found for irq %d, source = %d!\n",
>>> +		       __func__, int_work->irq, int_work->source);
>>> +		read_unlock_irqrestore(&kvm_pci_pt_lock, flags); +
>>>       
> goto out;
>   
>>> +	}
>>> +	guest_irq = match->pt_dev.guest.irq;
>>> +	host_irq = match->pt_dev.host.irq;
>>> +	read_unlock_irqrestore(&kvm_pci_pt_lock, flags);
>>> +
>>> +	if (source == KVM_PT_SOURCE_IRQ)
>>> +		kvm_set_irq(int_work->kvm, guest_irq, 1);
>>> +	else {
>>> +		kvm_set_irq(int_work->kvm, int_work->irq, 0);
>>> +		enable_irq(host_irq);
>>> +	}
>>> +out:
>>> +	mutex_unlock(&int_work->kvm->lock);
>>> +	kvm_put_kvm(int_work->kvm);
>>> +}
>>>
>>> +
>>> +/* FIXME: Implement the OR logic needed to make shared interrupts
>>> on + * this line behave properly + */
>>>
>>>       
>> Isn't this a showstopper?  There is no easy way for a user to avoid
>> sharing, especially as we have only three pci irqs at present.
>>
>>     
>
> Currently it's not easy to avoid sharing. I think we can support MSI for
> assgined device to solve sharing problem. 
>   

MSI is definitely the right direction, but we also need to support the 
OR logic for guests that do not support MSI.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


  parent reply	other threads:[~2008-07-17  6:02 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-16 13:16 PCI passthrough with VT-d - native performance Ben-Ami Yassour
2008-07-16 13:16 ` [PATCH 1/8] KVM: Introduce a callback routine for IOAPIC ack handling Ben-Ami Yassour
2008-07-16 13:16   ` [PATCH 2/8] KVM: Introduce a callback routine for PIC " Ben-Ami Yassour
2008-07-16 13:17     ` [PATCH 3/8] KVM: Handle device assignment to guests Ben-Ami Yassour
2008-07-16 13:17       ` [PATCH 4/8] KVM: PCIPT: fix interrupt handling Ben-Ami Yassour
2008-07-16 13:17         ` [PATCH 5/8] KVM: PCIPT: change order of device release Ben-Ami Yassour
2008-07-16 13:17           ` [PATCH 6/8] VT-d: changes to support KVM Ben-Ami Yassour
2008-07-16 13:17             ` [PATCH 7/8] KVM: PCIPT: VT-d support Ben-Ami Yassour
2008-07-16 13:17               ` [PATCH 8/8] KVM: PCIPT: VT-d: dont map mmio memory slots Ben-Ami Yassour
2008-07-16 13:21                 ` PCI passthrough with VT-d - native performance Ben-Ami Yassour
2008-07-16 13:21                   ` [PATCH 1/2] KVM/userspace: Support for assigning PCI devices to guest Ben-Ami Yassour
2008-07-16 13:21                     ` [PATCH 2/2] PCIPT: direct mmio Ben-Ami Yassour
2008-07-17  7:52                     ` [PATCH 1/2] KVM/userspace: Support for assigning PCI devices to guest Han, Weidong
2008-07-22 12:28                       ` Ben-Ami Yassour
2008-07-22 12:44                         ` [PATCH 1/2] KVM/userspace: Support for assigning PCI devicesto guest Han, Weidong
2008-07-16 15:06           ` [PATCH 5/8] KVM: PCIPT: change order of device release Avi Kivity
2008-07-16 15:06         ` [PATCH 4/8] KVM: PCIPT: fix interrupt handling Avi Kivity
2008-07-23 13:37         ` Amit Shah
2008-07-24 11:28           ` Ben-Ami Yassour
2008-07-24 13:31             ` Amit Shah
2008-07-24 14:24               ` Ben-Ami Yassour
2008-07-16 15:04       ` [PATCH 3/8] KVM: Handle device assignment to guests Avi Kivity
2008-07-17  2:09         ` Han, Weidong
2008-07-17  2:29           ` Yang, Sheng
2008-07-17  6:02           ` Avi Kivity [this message]
2008-07-17  8:23             ` Ben-Ami Yassour
2008-07-17  8:31               ` Avi Kivity
2008-07-17 18:01                 ` Ben-Ami Yassour
2008-07-17 18:07                   ` Avi Kivity
2008-07-17  9:34         ` Ben-Ami Yassour
2008-07-17  9:50           ` Avi Kivity
2008-07-17 17:40             ` Ben-Ami Yassour
2008-07-17 18:04               ` Avi Kivity
2008-07-16 14:36 ` PCI passthrough with VT-d - native performance Avi Kivity
2008-07-16 15:18   ` Ben-Ami Yassour
2008-07-16 15:22     ` Avi Kivity
2008-07-16 15:23     ` Anthony Liguori
2008-07-16 16:13       ` Ben-Ami Yassour
2008-07-16 16:57         ` Avi Kivity
2008-07-17  6:24           ` Ben-Ami Yassour
2008-07-17  3:20       ` Han, Weidong

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=487EE078.8020001@qumranet.com \
    --to=avi@qumranet.com \
    --cc=amit.shah@qumranet.com \
    --cc=anthony@codemonkey.ws \
    --cc=benami@il.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=muli@il.ibm.com \
    --cc=weidong.han@intel.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