public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark McLoughlin <markmc@redhat.com>
To: Ben-Ami Yassour <benami@il.ibm.com>
Cc: Amit Shah <amit.shah@qumranet.com>,
	"Kay, Allen M" <allen.m.kay@intel.com>,
	Muli Ben-Yehuda <muli@il.ibm.com>,
	kvm@vger.kernel.org
Subject: Re: PCI-passthrough: interrupt work structure per device
Date: Thu, 29 May 2008 19:09:37 +0100	[thread overview]
Message-ID: <1212084577.21998.28.camel@muff> (raw)
In-Reply-To: <alpine.DEB.1.10.0805292004310.24732@cluwyn.haifa.ibm.com>

On Thu, 2008-05-29 at 20:17 +0300, Ben-Ami Yassour wrote:

> Attached is a patch for the pci-passthrough tree.
> This patch changes the workq structure of the interrupt handling to be per 
> device.

Heh, I just happened to notice this myself yesterday.

...
> >From b847cef27c6c6dfff15b8fc9682e4c6563e997f3 Mon Sep 17 00:00:00 2001
> From: Ben-Ami Yassour <benami@il.ibm.com>
> Date: Thu, 29 May 2008 19:39:14 +0300
> Subject: [PATCH] KVM: PCIPT: interrupt work structure per device
> 
> Signed-off-by: Ben-Ami Yassour <benami@il.ibm.com>
> ---
>   arch/x86/kvm/x86.c         |   90 ++++++++++++++++++++++++++++----------------
>   include/asm-x86/kvm_host.h |   23 +++++++----
>   include/asm-x86/kvm_para.h |    1 +
>   3 files changed, 72 insertions(+), 42 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index d1cc582..cf3a47c 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
...
> @@ -184,16 +190,27 @@ out:
>   static irqreturn_t kvm_pci_pt_dev_intr(int irq, void *dev_id)
>   {
>   	struct kvm *kvm = (struct kvm *) dev_id;
> +	struct kvm_pci_pt_dev_list *pci_pt_dev;
> 
>   	if (!test_bit(irq, pt_irq_handled))
>   		return IRQ_NONE;
> 
> -	kvm->arch.pci_pt_int_work.irq = irq;
> -	kvm->arch.pci_pt_int_work.kvm = kvm;
> -	kvm->arch.pci_pt_int_work.source = 0;
> +	read_lock(&kvm_pci_pt_lock);
> +	pci_pt_dev = kvm_find_pci_pt_dev(&kvm->arch.pci_pt_dev_head, NULL,
> +					 irq, KVM_PT_SOURCE_IRQ);
> +	if (!pci_pt_dev) {
> +		read_unlock(&kvm_pci_pt_lock);
> +		return IRQ_NONE;
> +	}
> +
> +	pci_pt_dev->pt_dev.int_work.irq = irq;
> +	pci_pt_dev->pt_dev.int_work.kvm = kvm;
> +	pci_pt_dev->pt_dev.int_work.source = 0;
> 
>   	kvm_get_kvm(kvm);

Won't we leak this reference if we get another interrupt before the
workqueue is scheduled?

> -	printk(KERN_INFO "kvm: Handling hypercalls for device %02x:%02x.%1x\n",
> -	       pci_pt_dev->host.busnr, PCI_SLOT(pci_pt_dev->host.devfn),
> -	       PCI_FUNC(pci_pt_dev->host.devfn));

Spurious change.

...

> diff --git a/include/asm-x86/kvm_para.h b/include/asm-x86/kvm_para.h
> index 5f93b78..5813ed0 100644
> --- a/include/asm-x86/kvm_para.h
> +++ b/include/asm-x86/kvm_para.h
> @@ -171,4 +171,5 @@ struct kvm_pci_passthrough_dev {
>   	struct kvm_pci_pt_info guest;
>   	struct kvm_pci_pt_info host;
>   };
> +
>   #endif

Ditto.

Cheers,
Mark.


  reply	other threads:[~2008-05-29 18:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-29 17:17 PCI-passthrough: interrupt work structure per device Ben-Ami Yassour
2008-05-29 18:09 ` Mark McLoughlin [this message]
2008-05-30  2:15   ` Amit Shah

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=1212084577.21998.28.camel@muff \
    --to=markmc@redhat.com \
    --cc=allen.m.kay@intel.com \
    --cc=amit.shah@qumranet.com \
    --cc=benami@il.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=muli@il.ibm.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