Paul Durrant [Wed, 8 Jul 2015 12:53:45 +0000 (13:53 +0100)]
Avoid PDO namespace conflicts...
...by encoding the driver major version in the upper byte of the
revision.
This clearly implies that any future change in the driver major version
will start a new PDO namespace, but that it almost certainly the correct
thing to do in that case.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 2 Jul 2015 09:23:26 +0000 (10:23 +0100)]
Fix fall-back to two-level EVTCHN ABI
When the EVTCHN code attempts to acquire the FIFO ABI it may fail to do
so because the version of Xen may not support it. In this case the code
was issuing an EventChannelReset() which has the unfortunate side effect of
killing any toolstack-created channels, such as the xenstored channel.
This patch moves the existent EvtchnFifoReset function into the base
evtchn source module (since it's not ABI specific) and uses that function
as the only mechanism of issuing an EventChannelReset() since it contains
code to preserve event channel bindings. (Prior to the move it only
preserved the xenstore channel but this patch adds code to preserve the
console event channel too, if it exists).
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 1 Jul 2015 15:11:22 +0000 (16:11 +0100)]
Fix potential buffer overflow
The __min in XENFILT's FdoQueryDeviceRelations() should be a __max. The only
reason this mistake did not lead to an immediate buffer overflow was because
the allocation incorrectly used sizeof (DEVICE_OBJECT) rather than
sizeof (PDEVICE_OBJECT).
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 2 Apr 2015 10:32:42 +0000 (11:32 +0100)]
Fix unplugging of emulated devices on resume from suspend
Due to a mis-ordering of the interface initialization calls in FdoCreate(),
the SUSPEND interface never gets hold of the UNPLUG interface and thus,
on resume from suspend, emulated device unplug is not done and the
emulated network and disk devices re-appear in the VM.
This patch re-orders the initialization code to fix this problem and also
makes SuspendTrigger() fail if the UNPLUG interface is not available.
NOTE: The change of type of SuspendTrigger() does not require a new
interface revision since it is a change from a void function to a
non-void function, so older client code will simply ignore the return
value.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 1 Apr 2015 07:53:54 +0000 (08:53 +0100)]
Make sure SYNC per-processor structures are zeroed after resume
Since the per-processor data in the SYNC code was split out from the
main context structure, the code that zeroes that structure on resume
no longer clears the per-processor Exit flag. This means that a multi-
vcpu VM can only be suspended once; subsequent attempts will fail.
This patch fixes the problem by zeroing the full page containing the SYNC
context structure and any per-processor data.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Mon, 30 Mar 2015 12:46:06 +0000 (13:46 +0100)]
Windows Server 2008 compatibility fix
Use of the CONNECT_FULLY_SPECIFIED_GROUP flag to IoConnectInterruptEx() is
not supported prior to Windows 7, so when Group == 0 (which will always be
true for any OS prior to Windows 7) just use CONNECT_FULLY_SPECIFIED
in which case it is documented that Windows will assume Group == 0.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 26 Mar 2015 13:43:01 +0000 (13:43 +0000)]
Don't use a stack based DPC structure in the System per-CPU code
Whilst this is believed to be safe, there is no documentation to say that
Windows does not make use of the DPC structure after the DPC routine has
completed. Instead, make the DPC structure part of the per-CPU structure.
Also fix an ASSERT on the per-CPU array pointer not being NULLed.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 26 Mar 2015 13:39:32 +0000 (13:39 +0000)]
Fix an ASSERT failure and BugCheck on XENBUS unload
The Prcoessor array pointer in the EVTCHN code is not being NULLed, leading
to an ASSERT faiure. There is also a race in zero-ing out the per-processor
DPCs and them being present on kernel queues, which leads to a BugCheck.
This patch fixes both issues.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 24 Mar 2015 10:11:35 +0000 (10:11 +0000)]
Improve auditing in CACHE and GNTTAB interfaces
Add 'Get' and 'Put' counters to CACHEs which can then be checked for
equality at destruction time to make sure all objects have been returned.
Also add a list of GNTTAB caches so that the code can BUG on any
outstanding caches at Release.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 17 Mar 2015 15:53:05 +0000 (15:53 +0000)]
Make XEN, XENFILT and XENBUS processor group aware
Processor groups have been around for a long time in Windows and
contnuing to ignore them becomes ever more painful when trying to
pass the HCM multiple processor group device test. This patch, therefore,
modifies all the code that uses the non-group-aware kernel calls to use
the newer group aware calls.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 19 Mar 2015 12:35:15 +0000 (12:35 +0000)]
Add strict version check between XEN and XENFILT/XENBUS
Because the ABI between XEN and the other drivers in the package is
(intentionally) unstable, add a strict version check using the single
function XenTouch to prevent XENBUS or XENFILT loading if an incumbent
XEN is from a previous package installation.
Also add code to the co-installer to request a reboot, as this is needed
to bring up a compatible set of modules.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
The code relies on post-4.5.0 header changes so we need a more recent
repository. The commit id here is just master on the day this update was
done. The headers will be updated to a tag once a suitable one is
available.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 11 Mar 2015 17:14:45 +0000 (17:14 +0000)]
Squash a prefast warning
Prefast warns that following the Flink pointer of the EVTCHN context list
may be unsafe due to it being NULL. It should never be NULL so this patch
adds an ASSERTion and hence squashes the warning.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 5 Mar 2015 12:08:08 +0000 (12:08 +0000)]
__DbgPrintEnable() cannot be called on paging path
The system power up code in XENFILT re-enables DbgPrint hooking.
Unfortunately the undocumented kernel call it uses may require a page-in
and so causes a deadlock when XENVBD is responsible for the page file,
since it depends upon XENFILT to power up.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 4 Mar 2015 12:55:50 +0000 (12:55 +0000)]
Fix WHQL Multiple processor group device test BSOD
Some of the fakery done by this test causes a BSOD in the code in the
XEN driver that attempts to build a mapping from Windows CPU index to
Xen vcpu id. Applying this patch to re-work the code slightly fixes the
BSOD and allows the test to pass.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 4 Mar 2015 10:09:51 +0000 (10:09 +0000)]
Only call PdoSuspend() and PdoResume() when in the correct state
The FDO code calls PdoSuspend() and PdoResume() when a PDO is removed or
added (respectively) to the FDO list. However, if the FDO is not in state
D0, this is not the correct thing to do. Currently PdoSuspend() and
PdoResume() do nothing in XENBUS, but the equivalent functions in XENVIF
do and a call to PdoSuspend() when the FDO was in D3 was causing a BSOD.
Commit 5b895423957de23a82dc763dc378e305be16817a fixes this problem in
XENVIF. This patch brings XENBUS into line.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Mon, 2 Mar 2015 13:08:12 +0000 (13:08 +0000)]
Fix VS2013 SDV failures
A mis-annotation of some ZwQueryXXX operations is causing SDV to fail
when it notices code in registry.c using the length being passed back
from a failed call. The code is correct according to the documentation of
those functions so this patch suppresses the warnings.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 27 Feb 2015 18:03:18 +0000 (18:03 +0000)]
Add registry tweak to make PDOs ejectable
Add a registry tweak called 'AllowPdoEject' so that PDOs can be made
ejectable and rename the tweak to make PDOs removable to 'AllowPdoRemove'
to bring it in line.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 27 Feb 2015 18:00:09 +0000 (18:00 +0000)]
Release lower bus interface before passing removal IRP to PDO
If the PDO is surprised removed then the FDO tries to retain its
reference to the PDO's bus interface byond its destruction. This may cause
memory corruption.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 27 Feb 2015 13:48:46 +0000 (13:48 +0000)]
Fix event channel unmasking for two-level ABI
The two-level ABI requires that an event is masked for the unmask
hypercall to raise the event, so the test-and-clear operation in the
guest basically means that pending events get stuck. The simple fix
is to re-mask pending events before making the hypercall. This is
unnecessary when the FIFO ABI is used, but it's safe. Hence this patch
unconditionally re-masks pending events, regardless of ABI, before
making the unmask hypercall.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 26 Feb 2015 14:23:43 +0000 (14:23 +0000)]
Re-instate bus enumation filtering in XENFILT
The filtering code was removed in commit ff034f7ebd4010f7b502c56cb1cca6ba40a7f1aa when it was realized that
simply modifying the reported instance ID of the active device to be
constant, even if it moves location on the PCI bus was sufficient to
keep PV drivers binding. However, this does not protect against the
active device going away so you can still end up with a non-bootable VM.
This patch re-instates the code, modified to check for presence of the
active device with a wildcard instance rather than a fixed instance.
NOTE: This patch does include a change to emulated_interface.h, to allow
a NULL instance ID to be passed to IsDevicePresent. Whilst this is
a new semantic, it does not affect compatibility so there is no
change to the interface version.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Mon, 9 Feb 2015 13:12:39 +0000 (13:12 +0000)]
Fix SDV build
SDV builds are failing with this error:
..\..\src\xenbus\fdo.c(758) : error C2220: warning treated as error - no 'object' file generated
c:\git\xenbus\src\xenbus\fdo.c(744) : warning C6246: Local declaration of 'status' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '675' of 'c:\git\xenbus\src\xenbus\fdo.c'.: Lines: 675
This patch removes the erroneous declaration.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 3 Feb 2015 11:38:33 +0000 (11:38 +0000)]
EVTCHN FIFO ABI should keep per-vcpu queue head shadow
There is currently only one shadow head per priority which means that
polling event channels of the same priority on different CPUs can conflict,
leading to lost events. This patch fixes the problem.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 28 Jan 2015 16:27:36 +0000 (16:27 +0000)]
Remove use of KeNumberProcessors from EVTCHN code
The crucial things are the virtual CPUs to which the ABI can steer
interrupts and the number of interrupts which the FDO code successfully
allocated. By using an intersection of these two things we can drop any
use of KeNumberProcessors.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 28 Jan 2015 14:47:31 +0000 (14:47 +0000)]
Remove use of KeNumberProcessors from SYSTEM code
The Xen SYSTEM module queries system information, including per-cpu
information. It is therefore best to make use if processor callback
functions rather than iterating over boot-time active processors, as this
makes the code robust to processors hot-added after boot.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 20 Jan 2015 17:39:58 +0000 (17:39 +0000)]
Re-work EVTCHN Close
When using the FIFO ABI, the Close operation needs to be synchronized with
polling. This requires some re-structuring of the close code to defer the
actual closure of the event channel in Xen until at least one poll after
masking and starting the tear-down.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 20 Jan 2015 11:40:39 +0000 (11:40 +0000)]
Re-work EVTCHN Trigger
By re-working the event channel poll callback to add pending channels to a
list and then service them, we can tidy up Trigger by forcibly appending a
channel to the same list and then scheduling a DPC on the correct cpu to
service in the list (unless an interrupt callback came along in the interim
and did the job).
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 16 Jan 2015 15:09:40 +0000 (15:09 +0000)]
Use a DPC per CPU for EVTCHN Trigger
Using a single DPC potentially means re-afinitizing it for each use, and
this potentially means Windows could try to insert it onto multiple CPU
queues at the same time, which probably won't end well. Using a DPC per
CPU seems a lot safer.
Also add a DPC flush before we zero out data structures.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Mon, 19 Jan 2015 09:54:38 +0000 (09:54 +0000)]
Eagerly enable and disable interrupts
There's really no need to lazily enable event channel interrupts. It makes
the code simpler to enable at the end of the first acquire and disable at
the start of the last release.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Mon, 19 Jan 2015 16:18:05 +0000 (16:18 +0000)]
Get rid of per-channel interrupt pointer
It's kind of redundant as we have a Cpu index value. Also, remove code that
tries to ensure everything is on the right cpu even across an event channel
re-bind. Since we now always use the hypercall to handle unmasking then we
don't need to care so much.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 20 Jan 2015 15:11:28 +0000 (15:11 +0000)]
Fix EvtchnOpen() error path
It's possible for an error in the latter stages of EvtchnOpen() to cause the
channel to be left open in Xen. Also the Mask boolean was not being cleared
which would lead to ASSERTion failures in checked builds.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Mon, 26 Jan 2015 15:48:04 +0000 (15:48 +0000)]
Fix type mismatch
The size of PWCHAR and the size of ULONG are the same for 32-bit
installations so this bug only affects 64-bit installations, but the
symptom is a crash on PDO destruction due to a corrupted heap.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 14 Jan 2015 09:49:01 +0000 (09:49 +0000)]
Reserve some grant entries for the crash kernel
The xencrsh driver (which is loaded into the crash kernel) needs some grant
entries to write out the dump file. It is important that these entries are
guaranteed to be unused by any backend other than the one the xencrsh uses
so reserve them in the normal grant table.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 9 Jan 2015 13:42:57 +0000 (13:42 +0000)]
Reflect interface versions in PDO description
For convenience add a string containing the latest versions of all the
interfaces exported by the driver into the PDO description. This can be
seen in Device Manager as the 'Bus reported device description' detail.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 18 Dec 2014 17:18:48 +0000 (17:18 +0000)]
Map Local APIC IDs to Processor IDs through the MADT
To use the FIFO EVTCHN ABI the frontend code needs to know the vcpu id of
the guest CPUs. This mapping is currently done by taking the the CPU local
APIC ID and dividing by 2. This currently works on most Xen installations
but Matt Wilson advises that this will not work on AWS.
This patch introduces code to map and parse the ACPI RSDP, XSDT and MADT
(APIC) tables such that the local APIC substructures present in the latter
can be used to map local APIC ID to processor ID (which is identical to
vcpu id).
Signed-off-by: Paul Durrant <paul.durrant@citrix.com> Cc: Matt Wilson <msw@linux.com>
Paul Durrant [Tue, 16 Dec 2014 11:07:00 +0000 (11:07 +0000)]
Fix free-at-wrong-IRQL bug
The hash table code introduced for the FIFO EVTCHN ABI work tries to free
memory at HIGH IRQL. This causes a bugcheck when verifier is turned on. This
patch re-orders the unlock (which drops IRQL back to DISPATCH) and the free.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Mon, 15 Dec 2014 14:07:20 +0000 (14:07 +0000)]
Fix 0xD6 bugcheck found with verifier
PdoAddRevision() reads beyond the end of an allocation when copying the old
revision table to the new one. This is becaause it is incorrectly using the
Count stack variable rather then the Count field in the Pdo structure. This
patch fixes the problem.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Owen Smith [Fri, 28 Nov 2014 13:36:34 +0000 (13:36 +0000)]
Add registry setting for removable capability of PDOs
Setting "Removable" to 0 under the key
HKLM/System/CurrentControlSet/services/XENBUS/Parameters/<PDO-Name>
will disable the PDOs removable and surprise removable capability.
Signed-off-by: Owen Smith <owen.smith@citrix.com> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 20 Nov 2014 15:56:32 +0000 (15:56 +0000)]
Avoid making hypercalls in the SyncWorker DPC
The code has to run with interrupts disabled on all CPUs apart from 0 to
corale them across a suspend/resume. Making hypercalls from within that
code is thus incompatible with re-populating the hypercall table on resume
since it transpites then Xen writes each byte in the page to 0xcc (int 3)
before actually setting up the hypercall thunks. The only hypercall that the
code was actually making was a SCHEDOP_yield and this is trivially replaced
by an _mm_pause intrinsic which calls through to SCHEDOP_yield in the
VMEXIT handler.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 12 Nov 2014 15:02:46 +0000 (15:02 +0000)]
Fix ASSERTion failure in EVTCHN Close
The EVTCHN Channel structure contains a BOOLEAN Mask field that specifies
whether the Channel is aut0-masked on event upcall. The Close method was
failing to zero then and then falling over a later assertion that the
Channel structure had been zeroed out.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 11 Nov 2014 13:33:48 +0000 (13:33 +0000)]
Use EVTCHNOP_unmask to unmask in some cases
If the EVTCHN Unmask method is called in context of the event channel
upcall, or on a CPU to which the event is not bound then use the unmask
hypercall. In the former case not doing this may lead to priorty
inversion once setting event channel priorities is enabled. In the latter
case not doing it again stops a lower priority event handler trigger from
blocking a higher priority event injection.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 6 Nov 2014 12:44:26 +0000 (12:44 +0000)]
Use per-CPU event channel upcalls if available
A recent patch to Xen introduced a new HVM op to set a per-vcpu event
channel upcall. This patch adds code to make use of the latched interrupts
allocated by the FDO code to enable per-vcpu upcalls and adds an extra
EvtchnBind operation to a new v2 EVTCHN interface so that events can be
steered to a specified CPU.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 6 Nov 2014 10:30:58 +0000 (10:30 +0000)]
Re-work interrupt code in FDO
This patch adds code to the FDO handler to acquire extra message signaled
(i.e. edge triggered) interrupt vectors that can be used for per-CPU event
channel upcalls (with extra support in Xen).
The existing callback via is also limited to upcall on CPU 0 meaning the
interrupt callback in the EVTCHN code can pass the current CPU value through
to the ABI.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 5 Nov 2014 18:00:12 +0000 (18:00 +0000)]
Re-populate hypercall page on resume from suspend/hibernate
Doing this has the side effect of latching the shared info page width,
which is currently done when the callback via is set. When we move to a
per-cpu event channel upcall then this side effect will be lost, so
doing this makes sure that the shared info is still of the correct width.
Additionally in this patch the reporting of the Xen version is improved
by using the XENVER hypercalls to get major, minor and extra version
informattion. As part of that change, more headers have been copied in
from Xen.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 7 Nov 2014 12:40:16 +0000 (12:40 +0000)]
Remove needless checks on ParametersKey validity
It used to be the case that XENBUS would tolerate a lack of Parameters key
in its Service key but that has not been true for some time, so remove
validity checks that are no longer needed.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 7 Nov 2014 10:56:32 +0000 (10:56 +0000)]
Add registry override for EVTCHN ABI
Add a registry parameter DWORD:UseEvtchnFifoAbi than can be set to zero
to prevent use of the FIFO ABI or non-zero to allow it. The default value is
non-zero.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 5 Nov 2014 17:38:32 +0000 (17:38 +0000)]
Add support for the FIFO event channel ABI
If it is available then the fifo ABI will be used. If it is not then the
two-level ABI will be used instead.
The ABI is released and re-acquired across suspend/resume so this should
allow moving between hosts with different capabilities.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 5 Nov 2014 17:04:16 +0000 (17:04 +0000)]
Separate event channel ABI from core evtchn interface code
The event channel ABI now known as two-level is implemented using the
domain shared info. Use of the SHARED_INFO interface is therefore baked
into the EVTCHN interface.
Xen has recently acquired a new event channel ABI called fifo, which
improves on both scalability and performance as compared to two-level.
Hence this patch separates the ABI code from the core EVTCHN interface
code so that a subsequent patch can add support for the fifo ABI on
capable versions of Xen.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 5 Nov 2014 16:31:03 +0000 (16:31 +0000)]
Make auto-masking a generic event channel property
Keeping the Mask boolean in the per-type event channel parameters makes the
code needlessly complex in several places. Just make it a generic property.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 5 Nov 2014 15:50:10 +0000 (15:50 +0000)]
Use a hash table for event channel lookup
Rather than using a large array for mapping port values to channel
structures, use a hash table. This means we no longer need to code a
hard port number limit into the EVTCHN implementation.
Because the hash table implementation manages its own locking, we also no
longer need to make such liberal use of the interrupt lock in the EVTCHN
implementation and can use the spinlock instead.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 28 Oct 2014 10:23:25 +0000 (10:23 +0000)]
Separate checking upcall_pending in shared info from EvtchnPoll
The current EvtchnPoll routine in in the shared info code is tied to
the two level event channel ABI, wheras checking upcall_pending is ABI
independent. Hence the check should be separated into its own method.
This patch therefore introduces version 2 of the SHARED_INFO interface,
which has a new EvtchnUpcallPending method. Version 1 is still
supported by having its EvtchnPoll variant call EvtchnUpcallPending
method internally.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 28 Oct 2014 09:13:44 +0000 (09:13 +0000)]
Use InterlockedBitTestAnd[Set|Reset] in SHARED_INFO
Rather then using InterlockedCompareAndExchange to set and clear bits
in the SHARED_INFO event channel masks, use
InterlockedBitTestAnd[Set|Reset] as these will resolve to instrinsics
when available.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 6 Nov 2014 12:53:23 +0000 (12:53 +0000)]
Fix bug in EVTCHN interrupt enabling
The code in EvtchnOpen attempts to enable interrupts on demand when new
channels are added to a list. However there is a bug in the logic that
means interrupts will not be enabled until the second channel is opened.
This patch fixes the bug.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Mon, 6 Oct 2014 16:37:16 +0000 (17:37 +0100)]
Add missing acquisition of the UNPLUG interface
Commit cba6dad2df306885dfc65908f14ce6e2d8a86211 changed the way that
emulated devices are unplugged. It used to be that XENFILT waited until it
detected the presence of the 'active' device that XENBUS bound to before
deciding whether to unplug, but that commit simply made sure that the
'active' device always appears unless something has drastically changed in
the VM configuration. Unfortunately, in making that change, the code that
acquired the initial reference to the unplug interface - and thereby caused
emulated devices to be unplugged - was lost. This patch adds in the missing
acquisition.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 5 Sep 2014 16:58:51 +0000 (17:58 +0100)]
Update active device's instance id at point of PDO filter creation
It's tidier to have xenfilt simply return its own versions of device and
instance id when it intercepts IRP_MN_QUERY_ID. The override of the instance
id can be done and logged once when the PDO filter device object is created.
This patch does that, and also replaces the rather vacuuous Name field in
the filter device object extensions with DeviceID and InstanceID fields.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 3 Sep 2014 16:23:41 +0000 (17:23 +0100)]
Squash changes in active platform device instance id
If the instance id of the platform device changes then Windows will need
to rebind the xenbus driver. This means that if the system disk is hanging
off a child of xenbus then we get a 0x7B BSOD before the rebind (which is
done in user space) can occur.
This patch makes sure that the instance id of the platform device remains
invariant after initial driver installation.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>