Skip to content
Snippets Groups Projects
  1. Sep 24, 2019
    • Paul Durrant's avatar
      MAINTAINERS: update my email address · 784e9727
      Paul Durrant authored
      
      My Citrix email address will expire shortly.
      
      Signed-off-by: default avatarPaul Durrant <paul.durrant@citrix.com>
      Reviewed-by: default avatarAnthony PERARD <anthony.perard@citrix.com>
      Message-Id: <20190913122418.848-1-paul.durrant@citrix.com>
      Signed-off-by: default avatarAnthony PERARD <anthony.perard@citrix.com>
      784e9727
    • Paul Durrant's avatar
      xen: perform XenDevice clean-up in XenBus watch handler · 3809f758
      Paul Durrant authored
      
      Cleaning up offline XenDevice objects directly in
      xen_device_backend_changed() is dangerous as xen_device_unrealize() will
      modify the watch list that is being walked. Even the QLIST_FOREACH_SAFE()
      used in notifier_list_notify() is insufficient as *two* notifiers (for
      the frontend and backend watches) are removed, thus potentially rendering
      the 'next' pointer unsafe.
      
      The solution is to use the XenBus backend_watch handler to do the clean-up
      instead, as it is invoked whilst walking a separate watch list.
      
      This patch therefore adds a new 'inactive_devices' list to XenBus, to which
      offline devices are added by xen_device_backend_changed(). The XenBus
      backend_watch registration is also changed to not only invoke
      xen_bus_enumerate() but also a new xen_bus_cleanup() function, which will
      walk 'inactive_devices' and perform the necessary actions.
      For safety an extra 'online' check is also added to xen_bus_type_enumerate()
      to make sure that no attempt is made to create a new XenDevice object for a
      backend that is offline.
      
      NOTE: This patch also includes some cosmetic changes:
            - substitute the local variable name 'backend_state'
              in xen_bus_type_enumerate() with 'state', since there
              is no ambiguity with any other state in that context.
            - change xen_device_state_is_active() to
              xen_device_frontend_is_active() (and pass a XenDevice directly)
              since the state tests contained therein only apply to a frontend.
            - use 'state' rather then 'xendev->backend_state' in
              xen_device_backend_changed() to shorten the code.
      
      Signed-off-by: default avatarPaul Durrant <paul.durrant@citrix.com>
      Reviewed-by: default avatarAnthony PERARD <anthony.perard@citrix.com>
      Message-Id: <20190913082159.31338-4-paul.durrant@citrix.com>
      Signed-off-by: default avatarAnthony PERARD <anthony.perard@citrix.com>
      3809f758
    • Paul Durrant's avatar
      xen: introduce separate XenWatchList for XenDevice objects · d198b711
      Paul Durrant authored
      
      This patch uses the XenWatchList abstraction to add a separate watch list
      for each device. This is more scalable than walking a single notifier
      list for all watches and is also necessary to implement a bug-fix in a
      subsequent patch.
      
      Signed-off-by: default avatarPaul Durrant <paul.durrant@citrix.com>
      Reviewed-by: default avatarAnthony Perard <anthony.perard@citrix.com>
      Message-Id: <20190913082159.31338-3-paul.durrant@citrix.com>
      Signed-off-by: default avatarAnthony PERARD <anthony.perard@citrix.com>
      d198b711
    • Paul Durrant's avatar
      xen / notify: introduce a new XenWatchList abstraction · 374752a2
      Paul Durrant authored
      
      Xenstore watch call-backs are already abstracted away from XenBus using
      the XenWatch data structure but the associated NotifierList manipulation
      and file handle registration is still open coded in various xen_bus_...()
      functions.
      This patch creates a new XenWatchList data structure to allow these
      interactions to be abstracted away from XenBus as well. This is in
      preparation for a subsequent patch which will introduce separate watch lists
      for XenBus and XenDevice objects.
      
      NOTE: This patch also introduces a new notifier_list_empty() helper function
            for the purposes of adding an assertion that a XenWatchList is not
            freed whilst its associated NotifierList is still occupied.
      
      Signed-off-by: default avatarPaul Durrant <paul.durrant@citrix.com>
      Reviewed-by: default avatarAnthony Perard <anthony.perard@citrix.com>
      Message-Id: <20190913082159.31338-2-paul.durrant@citrix.com>
      Signed-off-by: default avatarAnthony PERARD <anthony.perard@citrix.com>
      374752a2
    • Paul Durrant's avatar
      xen-bus: check whether the frontend is active during device reset... · df6180bb
      Paul Durrant authored
      
      ...not the backend
      
      Commit cb323146 "xen-bus: Fix backend state transition on device reset"
      contained a subtle mistake. The hunk
      
      @@ -539,11 +556,11 @@ static void xen_device_backend_changed(void *opaque)
      
           /*
            * If the toolstack (or unplug request callback) has set the backend
      -     * state to Closing, but there is no active frontend (i.e. the
      -     * state is not Connected) then set the backend state to Closed.
      +     * state to Closing, but there is no active frontend then set the
      +     * backend state to Closed.
            */
           if (xendev->backend_state == XenbusStateClosing &&
      -        xendev->frontend_state != XenbusStateConnected) {
      +        !xen_device_state_is_active(state)) {
               xen_device_backend_set_state(xendev, XenbusStateClosed);
           }
      
      mistakenly replaced the check of 'xendev->frontend_state' with a check
      (now in a helper function) of 'state', which actually equates to
      'xendev->backend_state'.
      
      This patch fixes the mistake.
      
      Fixes: cb323146
      Signed-off-by: default avatarPaul Durrant <paul.durrant@citrix.com>
      Reviewed-by: default avatarAnthony PERARD <anthony.perard@citrix.com>
      Message-Id: <20190910171753.3775-1-paul.durrant@citrix.com>
      Signed-off-by: default avatarAnthony PERARD <anthony.perard@citrix.com>
      df6180bb
  2. Sep 23, 2019
Loading