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

[XENBUS PATCH v3 0/9] Implement forced unplug and forced activation



The goal of these two features is to simplify driver servicing and avoid
requiring storing driver state in Registry.

Forced unplug, as name implies, forcefully unplugs emulated devices when
a driver is present, rather than when it's active. It defines a Registry
key at CurrentControlSet\XEN\ForceUnplug. Drivers can opt into forced
unplug by creating an appropriate value (DISKS/NICS) in this key.

Note that since it's no longer possible to guarantee removal of Registry
values during driver uninstallation by Windows, driver uninstallers are
expected to remove these values themselves.

Forced activation is the companion to forced unplug. It aims to make
activation of Xenbus FDOs deterministic and stateless, using a
precedence mapping based on device IDs, prioritizing the vendor device
over the generic ones. This avoids situations where the wrong FDO is
activated, which will prevent Windows Update from working.

With forced activation, Xenfilt is now installed via INF on top of the
current installation routines. This means PV drivers can be injected
offline without needing another reboot to be reconfigured.

Care is taken to keep compatibility with older drivers. The two features
are also conditioned behind new build environment variables FORCE_UNPLUG
and FORCE_ACTIVATE.

Forced activation introduces EMULATED v3 and PDO revision 0x0900000C.
Deprecate PDO revisions 0x09000007 and earlier to make room for the new
revision.

With forced unplug/activation, the whole boot chain of boot-critical
drivers must be available in the driver store to avoid
INACCESSIBLE_BOOT_DEVICE BSOD. Fix this issue by merging all hardware
IDs into one INF Models entry.

The following scenarios have been successfully tested, requiring only
one reboot each:
* Offline driver installation via DISM
* Fresh install, followed by switching from device 0001 to 0002
* Fresh install, followed by toggling vendor device
* Xenbus/Xenvbd update

Other tested scenarios:
* Mixing of old Xenbus and new Xenvbd (and vice versa) while toggling
  device ID
* Major OS upgrade (Windows 10 22H2 -> Windows 11 24H2)

Changes in v3:
* Deprecated PDO revisions 0x09000007 and earlier to make room for
  0x0900000C
* Merged all hardware IDs into one INF Models entry to avoid BSODs when
  changing platform device IDs and toggling vendor device
* Added a note mentioning the role of driver uninstallers in cleanup of
  forced unplug/activation drivers.

v2: 
https://lists.xenproject.org/archives/html/win-pv-devel/2025-07/msg00053.html
* Added forced activation

v1: 
https://lists.xenproject.org/archives/html/win-pv-devel/2025-07/msg00012.html

Tu Dinh (9):
  Deprecate PDO revisions 0x09000007 and earlier
  Merge all hardware IDs into one Models entry
  Add forced unplug support
  xenfilt: Add Xenbus device precedence mechanism
  Add EMULATED v3
  xenbus: Use nonpaged pool in FdoQueryId
  Use EMULATED v3 to force activate Xenbus FDOs
  Enable Xenbus precedence
  Install Xenfilt with INF AddReg

 include/cache_interface.h       |  32 +-----
 include/emulated_interface.h    |  57 +++++++----
 include/evtchn_interface.h      |  96 +-----------------
 include/gnttab_interface.h      |  48 +--------
 include/revision.h              |  11 +--
 include/shared_info_interface.h |  23 +----
 scripts/genfiles.ps1            |   2 +
 src/xen/driver.c                |  79 ++++++++++++---
 src/xen/driver.h                |   5 +
 src/xen/unplug.c                |  13 ++-
 src/xenbus.inf                  |  25 +++--
 src/xenbus/cache.c              |  54 -----------
 src/xenbus/evtchn.c             | 166 --------------------------------
 src/xenbus/fdo.c                | 122 ++++++++++++++++-------
 src/xenbus/gnttab.c             |  82 ----------------
 src/xenbus/shared_info.c        |  41 --------
 src/xenfilt/driver.c            |  51 +++++++++-
 src/xenfilt/driver.h            |   7 ++
 src/xenfilt/emulated.c          |  87 +++++++++--------
 src/xenfilt/emulated.h          |   1 +
 src/xenfilt/fdo.c               |  25 ++++-
 src/xenfilt/pdo.c               |  80 ++++++++++++---
 src/xenfilt/pdo.h               |  10 +-
 23 files changed, 428 insertions(+), 689 deletions(-)

-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




 


Rackspace

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