3809f7583b
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: Paul Durrant <paul.durrant@citrix.com> Reviewed-by: Anthony PERARD <anthony.perard@citrix.com> Message-Id: <20190913082159.31338-4-paul.durrant@citrix.com> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
44 lines
2.6 KiB
Plaintext
44 lines
2.6 KiB
Plaintext
# See docs/devel/tracing.txt for syntax documentation.
|
|
|
|
# ../../include/hw/xen/xen_common.h
|
|
xen_default_ioreq_server(void) ""
|
|
xen_ioreq_server_create(uint32_t id) "id: %u"
|
|
xen_ioreq_server_destroy(uint32_t id) "id: %u"
|
|
xen_ioreq_server_state(uint32_t id, bool enable) "id: %u: enable: %i"
|
|
xen_map_mmio_range(uint32_t id, uint64_t start_addr, uint64_t end_addr) "id: %u start: 0x%"PRIx64" end: 0x%"PRIx64
|
|
xen_unmap_mmio_range(uint32_t id, uint64_t start_addr, uint64_t end_addr) "id: %u start: 0x%"PRIx64" end: 0x%"PRIx64
|
|
xen_map_portio_range(uint32_t id, uint64_t start_addr, uint64_t end_addr) "id: %u start: 0x%"PRIx64" end: 0x%"PRIx64
|
|
xen_unmap_portio_range(uint32_t id, uint64_t start_addr, uint64_t end_addr) "id: %u start: 0x%"PRIx64" end: 0x%"PRIx64
|
|
xen_map_pcidev(uint32_t id, uint8_t bus, uint8_t dev, uint8_t func) "id: %u bdf: %02x.%02x.%02x"
|
|
xen_unmap_pcidev(uint32_t id, uint8_t bus, uint8_t dev, uint8_t func) "id: %u bdf: %02x.%02x.%02x"
|
|
xen_domid_restrict(int err) "err: %u"
|
|
|
|
# xen-bus.c
|
|
xen_bus_realize(void) ""
|
|
xen_bus_unrealize(void) ""
|
|
xen_bus_enumerate(void) ""
|
|
xen_bus_cleanup(void) ""
|
|
xen_bus_type_enumerate(const char *type) "type: %s"
|
|
xen_bus_backend_create(const char *type, const char *path) "type: %s path: %s"
|
|
xen_bus_device_cleanup(const char *type, char *name) "type: %s name: %s"
|
|
xen_bus_add_watch(const char *node, const char *key) "node: %s key: %s"
|
|
xen_bus_remove_watch(const char *node, const char *key) "node: %s key: %s"
|
|
xen_device_realize(const char *type, char *name) "type: %s name: %s"
|
|
xen_device_unrealize(const char *type, char *name) "type: %s name: %s"
|
|
xen_device_backend_state(const char *type, char *name, const char *state) "type: %s name: %s -> %s"
|
|
xen_device_backend_online(const char *type, char *name, bool online) "type: %s name: %s -> %u"
|
|
xen_device_backend_changed(const char *type, char *name) "type: %s name: %s"
|
|
xen_device_frontend_state(const char *type, char *name, const char *state) "type: %s name: %s -> %s"
|
|
xen_device_frontend_changed(const char *type, char *name) "type: %s name: %s"
|
|
xen_device_unplug(const char *type, char *name) "type: %s name: %s"
|
|
xen_device_add_watch(const char *type, char *name, const char *node, const char *key) "type: %s name: %s node: %s key: %s"
|
|
xen_device_remove_watch(const char *type, char *name, const char *node, const char *key) "type: %s name: %s node: %s key: %s"
|
|
|
|
# xen-bus-helper.c
|
|
xs_node_create(const char *node) "%s"
|
|
xs_node_destroy(const char *node) "%s"
|
|
xs_node_vprintf(char *path, char *value) "%s %s"
|
|
xs_node_vscanf(char *path, char *value) "%s %s"
|
|
xs_node_watch(char *path) "%s"
|
|
xs_node_unwatch(char *path) "%s"
|