[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.