All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH 2/6] Provide a mechanism to register domain owner of a PCI device.
Date: Wed, 09 Dec 2009 15:33:40 -0800	[thread overview]
Message-ID: <4B2033D4.5020700@goop.org> (raw)
In-Reply-To: <1260398597-11468-3-git-send-email-konrad.wilk@oracle.com>

On 12/09/09 14:43, Konrad Rzeszutek Wilk wrote:
> . and also to find the domain owner based on the PCI device and
> to unregister a domain owner of a PCI device.
>    
Could you fix this up a bit?

> +int xen_register_device_domain_owner(struct pci_dev *dev, domid_t domain)
> +{
> +	struct xen_device_domain_owner *owner;
> +	unsigned long flags;
> +	int rc = 0;
> +
> +	spin_lock_irqsave(&dev_domain_list_spinlock, flags);
>    
Are you expecting interrupt routines could also hold the lock?

> +	if (find_device(dev)) {
> +		rc = -EEXIST;
> +		goto out;
> +	}
> +	owner = kzalloc(sizeof(struct xen_device_domain_owner), GFP_KERNEL);
>    

This can block, so you can't do it while holding the lock.  Its probably 
best to allocate it first on the assumption that it will be used (it 
seems probable that duplicate registrations are at least unlikely, and 
possibly a bug).

Thanks,
     J

      parent reply	other threads:[~2009-12-09 23:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-09 20:51 [PATCH PCIBACK] Konrad Rzeszutek Wilk
2009-12-09 20:51 ` [PATCH 1/6] Revert "In xen_create_msi_irq, extract the domain id of the MSI device." Konrad Rzeszutek Wilk
2009-12-09 20:51   ` [PATCH 2/6] Provide a mechanism to register domain owner of a PCI device Konrad Rzeszutek Wilk
2009-12-09 20:51     ` [PATCH 3/6] [events] Check if the PCI device is owner by a domain different than DOMID_SELF Konrad Rzeszutek Wilk
2009-12-09 20:51       ` [PATCH 4/6] [pciback] Register the owner (domain) of the PCI device Konrad Rzeszutek Wilk
2009-12-09 20:51         ` [PATCH 5/6] [pciback] Remove the vestiges of CONFIG_PCI_GUESTDEV Konrad Rzeszutek Wilk
2009-12-09 20:51           ` [PATCH 6/6] [pciback] Remove deprecated routine to find domain owner of PCI device Konrad Rzeszutek Wilk
2009-12-09 21:13         ` [PATCH 4/6] [pciback] Register the owner (domain) of the " Jeremy Fitzhardinge
2009-12-09 21:11     ` [PATCH 2/6] Provide a mechanism to register domain owner of a " Jeremy Fitzhardinge
2009-12-09 21:14 ` [PATCH PCIBACK] Jeremy Fitzhardinge
2009-12-09 22:43   ` Konrad Rzeszutek Wilk
2009-12-09 22:43     ` [PATCH 1/6] Revert "In xen_create_msi_irq, extract the domain id of the MSI device." Konrad Rzeszutek Wilk
2009-12-09 22:43       ` [PATCH 2/6] Provide a mechanism to register domain owner of a PCI device Konrad Rzeszutek Wilk
2009-12-09 22:43         ` [PATCH 3/6] [events] Check if the PCI device is owner by a domain different than DOMID_SELF Konrad Rzeszutek Wilk
2009-12-09 22:43           ` [PATCH 4/6] [pciback] Register the owner (domain) of the PCI device Konrad Rzeszutek Wilk
2009-12-09 22:43             ` [PATCH 5/6] [pciback] Remove the vestiges of CONFIG_PCI_GUESTDEV Konrad Rzeszutek Wilk
2009-12-09 22:43               ` [PATCH 6/6] [pciback] Remove deprecated routine to find domain owner of PCI device Konrad Rzeszutek Wilk
2009-12-09 23:33         ` Jeremy Fitzhardinge [this message]

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=4B2033D4.5020700@goop.org \
    --to=jeremy@goop.org \
    --cc=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.