WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH 2/6] Provide a mechanism to register domain owner

To: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH 2/6] Provide a mechanism to register domain owner of a PCI device.
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Wed, 09 Dec 2009 15:33:40 -0800
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 09 Dec 2009 15:34:01 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1260398597-11468-3-git-send-email-konrad.wilk@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4B20131E.4080801@xxxxxxxx> <1260398597-11468-1-git-send-email-konrad.wilk@xxxxxxxxxx> <1260398597-11468-2-git-send-email-konrad.wilk@xxxxxxxxxx> <1260398597-11468-3-git-send-email-konrad.wilk@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091125 Fedora/3.0-3.12.rc1.fc12 Lightning/1.0pre Thunderbird/3.0
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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>