Paul Durrant [Fri, 31 Oct 2014 18:03:57 +0000 (18:03 +0000)]
Add support for the FIFO event channel ABI
If it is available 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 levels of ABI support.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 30 Oct 2014 10:00:12 +0000 (10:00 +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 [Mon, 20 Oct 2014 16:42:08 +0000 (17:42 +0100)]
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 potentially be used for
per-CPU event channel upcalls. The existing callback via is also limited to
upcall on CPU 0.
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 XENBUS_SHARED_INFO_INTERFACE,
which has the separate method. Version 1 is still supported.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 28 Oct 2014 09:13:44 +0000 (09:13 +0000)]
Remove home-spun bit ops from shared info code.
The shared info event channel handling code needs to do various atomic bitwise
operations on masks and was using its own compare-and-swap routines to to
these. This patch removes those and replaces them with the Windows kernel
equivalents, which should resolve to intrinsics in most cases.
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>
Paul Durrant [Wed, 13 Aug 2014 14:26:15 +0000 (15:26 +0100)]
Update branding
Remove the use of the 'XenServer' product name except where it is
still appropriate.
Remove use of 'Citrix' from all places except source file
copyrights.
Allow company and product name to be set at build time.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 24 Jul 2014 08:01:23 +0000 (09:01 +0100)]
Implement new API version scheme
This patch changes the way APIs work in an incompatible way. (See README.md
for details).
The patch also includes a *lot* of code tidying and movement and as such
is not really suitable for review as a patch; the resulting code should
itself be reviewed.
Given the scale of the change, the major version number has been revised to
8 and other version numbers reset to zero.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 30 May 2014 08:54:38 +0000 (09:54 +0100)]
Modify GNTTAB interface to support caches
Remove the Get/Set methods and replace with CreateCache/DestroyCache methods.
The PermitForeignAccess method the uses a cache to allocate an entry as it
requires. Also, as we're not only using grant table v1, we can get rid of
the idea of different types of permit and drop the use of varargs.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 23 May 2014 15:10:12 +0000 (16:10 +0100)]
It's not necessarily safe to access interfaces when device is not in D0
The Scan, Suspend and Balloon threads should not try to access interfaces
such as STORE when the device is not in D0 as the interfaces are not there
if the system is at S4 or higher.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 30 Apr 2014 10:47:01 +0000 (11:47 +0100)]
Fix RangeSet cursor problem
When the last or first range in the set is removed then the cursor may end
up pointing back at the anchor point. This confused RangeSetPop() so we
need to make sure that the cursor wraps round when this happens, such that
the only valid reason for the cursor to ever point at the anchor is when
the set goes empty.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 29 Apr 2014 14:46:17 +0000 (15:46 +0100)]
Add FIST capability for pools
By setting xenstore parameters 'fist/pool/<name>/defer' to X and
'fist/pool/<name>/probability' to Y you can now cause failures of PoolGet()
such that it will fail with probability Y% after X initial invocations.
The name of the grant table pool has been set to 'gnttab' to make typing it
in more convenients, and some debug-keys output has been added to give
the PoolGet() failure count.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Tue, 29 Apr 2014 10:03:48 +0000 (11:03 +0100)]
RangeSet fixes
- add spinlock to protect rangesets.
- add a Count value to check against empty condition in audit.
- use LONGLONG in ranges rather than ULONGLONG so that ranges can be
invalidated by setting Start > End.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Ben Chalmers [Fri, 25 Apr 2014 14:15:27 +0000 (15:15 +0100)]
[SCTX-1104] Add WindowsPEMode to xenfilt
ParentIdPrefixes are not avilable at Windows PE driver filtering time,
but we don't actually need them if we know emulated devices will be
unplugged, so, if ParentIdPrefix can't be read from the registry and
HKLM\System\CurrentControlSet\Services\xenfilt\WindowsPEMode is set to 1
then just set the prefix to be an empty string and continue
We never set WindowsPEMode anywhere except in the sample Windows PE
scripts, so non-WindowsPE environments are unaffected
Signed-off-by: Ben Chalmers <Ben.Chalmers@citrix.com>
Paul Durrant [Wed, 23 Apr 2014 09:04:59 +0000 (10:04 +0100)]
Various fixes in improvements to the XEX.SYS System module
- Improved error handling. Various errors were ignored before.
- Moved several globals inside scope of __SystemGetCpuInformation since
that's the only place they are used.
- Added a call to free memory range information. It was leaked before.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 23 Apr 2014 09:26:42 +0000 (10:26 +0100)]
Better way to ignore assertions in free builds
Disabling warnings is not a great thing to do so define an inline function
to take the assertion expression as an argument and then declare its
argument to be ignored.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Wed, 23 Apr 2014 09:00:48 +0000 (10:00 +0100)]
Fix bug in RangeSetGet()
If RangeSetGet() was invoked when the cursor just happened to be pointing at
the correct singleton range than that range was not removed and an ASSERT was
hit. This patch fixes that problem.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 11 Apr 2014 10:09:20 +0000 (11:09 +0100)]
Re-worked GNTTAB.
The new version of the interface no longer exposes raw references to clients.
They are now behind an opaque XENVIF_GNTTAB_DESCRIPTOR, analogous to the
XENVIF_EVTCHN_DESCRIPTOR which hides raw ports from clients.
The allocator is also more sophisticated. It uses a pool with per-cpu
magazines for lockless access backed by rangesets.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 1 Nov 2013 09:21:42 +0000 (10:21 +0100)]
Enable and disable callback via at source rather than
trying to keep a local disabled flag for the interrupt.
If we don't do this we can get into a interrupt storm on
startup.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Thu, 31 Oct 2013 15:37:42 +0000 (16:37 +0100)]
Enable and disable callback via at source rather than
trying to keep a local disabled flag for the interrupt.
If we don't do this we can get into a interrupt storm on
startup.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Paul Durrant [Fri, 4 Oct 2013 10:54:11 +0000 (11:54 +0100)]
Keep track of ActiveDevice rather than ActiveDeviceInstance. If we include
the instance then any change in the PCI bus can cause the PV drivers to
become inactive.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>