xen: add the Xenbus sysfs and virtual device hotplug driver
Hello Jeremy Fitzhardinge,
The patch 4bac07c993d0: "xen: add the Xenbus sysfs and virtual device hotplug driver" from Jul 17, 2007, leads to the following static checker warning:
drivers/xen/xenbus/xenbus_xs.c:125 xs_request_enter()
warn: sleeping in atomic context
drivers/xen/xenbus/xenbus_client.c
413 /**
414 * Allocate an event channel for the given xenbus_device, assigning the newly
415 * created local port to *port. Return 0 on success, or -errno on error. On
416 * error, the device will switch to XenbusStateClosing, and the error will be
417 * saved in the store.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^The documentation is very clear how it's supposed to handle the error.
418 */
419 int xenbus_alloc_evtchn(struct xenbus_device *dev, evtchn_port_t *port) 420 {
421 struct evtchn_alloc_unbound alloc_unbound;
422 int err;
423
424 alloc_unbound.dom = DOMID_SELF;
425 alloc_unbound.remote_dom = dev->otherend_id;
426
427 err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound,
428 &alloc_unbound);
429 if (err)
430 xenbus_dev_fatal(dev, err, "allocating event channel");
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^The xenbus_dev_fatal() has a bunch of sleeping functions like xenbus_write() and we could be holding a spinlock here.
pvcalls_front_connect() <-- holds &bedata->socket_lock
--> create_active()
--> xenbus_alloc_evtchn()
431 else 432 *port = alloc_unbound.port; 433 434 return err; 435 }
regards,
dan carpenter