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

[bug report] xen: add the Xenbus sysfs and virtual device hotplug driver


  • To: jeremy@xxxxxxxxxxxxx
  • From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
  • Date: Mon, 2 Aug 2021 17:40:37 +0300
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Qphtz8A3NoIyavcslI+pslFiaFXGek/XRrvVCEJAXLM=; b=kOFK1f/+GRp0qmF+q1OlY1zVTtFpFFqTcFZbpkfxiWOVC5ULxrLpgMDXMdLZ5fWWaElR66s5HrYUsBLRKYqiYHNI4HNy9V9X+7BcijYVRkhtT8C3wtxxLUfSxOjR0Y5TaL04IbndyqTMPKi8CPKJMZZJWCIg7qfxbH4XZoAbDk1RKzSayqQtcoxvvudivolYq5tQ2RYzCYNFDieN+zdAeretQOk1Kp8wt765/Qq9GJmnWAojW/HKQhSdhKSKrtvxxP4UjwHD77v4ll5uNtVdVUoJQSBiRddSeGr/PLg3N3eNZ0ztSydpAIH7HGs79w++qgESVZHlcfcYiiGzrEpTDQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e6mSLuk+FTH374+4REGDDZrKVtJR94qElsfEm/gzRbn+RvxifRsFvhJFv9h9vblN8as/G4hp8XsISZ+EhQqWqHQzE5dJH8o4jn3raa0XSc3oD26JiavwUpgnipwYLOJM4Mxa6ejmiJRCOtoVziLH3mOhthcO8jYbBtiowTb4HU2KPOAg5NDWsaS5sRJLmoJAD2rMjDx23xinPhG5WpnsSvN2+sK3lJ2qegk88GPnoukEW6BMgbMd74v6gzxTTP2V4kqN90SO2DPCDVqkvyxnBhWKTWfy/8fC0MpAQFwRfHMQzZeZHhgP+bGfJ730vPQecnBQQXmdF1oXUoXoiLKMGg==
  • Authentication-results: xensource.com; dkim=none (message not signed) header.d=none;xensource.com; dmarc=none action=none header.from=oracle.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 02 Aug 2021 14:41:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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



 


Rackspace

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