freebsd-dev/sys/xen/xenbus
Roger Pau Monné f3d54ded28 xenbus: improve device tracking
xenbus needs to keep track of the devices exposed on xenstore, so that
it can trigger frontend and backend device creation.

Removal of backend devices is currently detected by checking the
existence of the device (backend) xenstore directory, but that's prone
to races as the device driver would usually add entries to such
directory itself, so under certain circumstances it's possible for a
driver to add node to the directory after the toolstack has removed
it.  This leads to devices not removed, which can eventually exhaust
the memory of FreeBSD.

Fix this by checking for the existence of the 'state' node instead of
the directory, as such node will always be present when a device is
active, and will be removed by the toolstack when the device is shut
down.  In order to avoid any races with the updating of the 'state'
node by FreeBSD and the toolstack removing it use a transaction in
xenbusb_write_ivar() for that purpose.

Reported by: Ze Dupsys <zedupsys@gmail.com>
Sponsored by: Citrix Systems R&D
2022-06-07 12:29:53 +02:00
..
xenbus_if.m
xenbus.c xen: Use __diagused for a variable only used in KASSERT(). 2022-04-13 16:08:20 -07:00
xenbusb_back.c xen: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:46:58 -07:00
xenbusb_front.c xen: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:46:58 -07:00
xenbusb_if.m
xenbusb.c xenbus: improve device tracking 2022-06-07 12:29:53 +02:00
xenbusb.h
xenbusvar.h xen: switch to use headers in contrib 2022-02-07 10:11:56 +01:00