|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH 07/15] 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@xxxxxxxxxx>
---
src/xenbus/evtchn.c | 61 ++++++-----------------------------------------------
1 file changed, 7 insertions(+), 54 deletions(-)
diff --git a/src/xenbus/evtchn.c b/src/xenbus/evtchn.c
index f5f7c67..0d62cf0 100644
--- a/src/xenbus/evtchn.c
+++ b/src/xenbus/evtchn.c
@@ -84,7 +84,6 @@ struct _XENBUS_EVTCHN_CHANNEL {
BOOLEAN Mask;
ULONG LocalPort;
ULONG Cpu;
- PXENBUS_INTERRUPT Interrupt;
};
struct _XENBUS_EVTCHN_CONTEXT {
@@ -380,11 +379,6 @@ EvtchnOpen(
LocalPort = Channel->LocalPort;
- Channel->Cpu = 0;
- Channel->Interrupt = (Context->Affinity != 0) ? // Latched available
- Context->LatchedInterrupt[0] :
- Context->LevelSensitiveInterrupt;
-
status = XENBUS_EVTCHN_ABI(PortEnable,
&Context->EvtchnAbi,
LocalPort);
@@ -455,13 +449,6 @@ fail1:
return NULL;
}
-#define EVTCHN_SWAP_POINTER(_X, _Y) \
- do { \
- (_X) = (PVOID)((ULONG_PTR)(_X) ^ (ULONG_PTR)(_Y)); \
- (_Y) = (PVOID)((ULONG_PTR)(_X) ^ (ULONG_PTR)(_Y)); \
- (_X) = (PVOID)((ULONG_PTR)(_X) ^ (ULONG_PTR)(_Y)); \
- } while (FALSE)
-
static NTSTATUS
EvtchnBind(
IN PINTERFACE Interface,
@@ -470,7 +457,6 @@ EvtchnBind(
)
{
PXENBUS_EVTCHN_CONTEXT Context = Interface->Context;
- PXENBUS_INTERRUPT Interrupt;
ULONG LocalPort;
unsigned int vcpu_id;
KIRQL Irql;
@@ -494,19 +480,6 @@ EvtchnBind(
if (Channel->Cpu == Cpu)
goto done;
- Interrupt = Context->LatchedInterrupt[Cpu];
-
- (VOID) KfRaiseIrql(HIGH_LEVEL);
-
- // Make sure we always lock in a consistent order
- if ((ULONG_PTR)Interrupt < (ULONG_PTR)Channel->Interrupt) {
- (VOID) FdoAcquireInterruptLock(Context->Fdo, Interrupt);
- (VOID) FdoAcquireInterruptLock(Context->Fdo, Channel->Interrupt);
- } else {
- (VOID) FdoAcquireInterruptLock(Context->Fdo, Channel->Interrupt);
- (VOID) FdoAcquireInterruptLock(Context->Fdo, Interrupt);
- }
-
LocalPort = Channel->LocalPort;
vcpu_id = SystemVirtualCpuIndex(Cpu);
@@ -514,15 +487,8 @@ EvtchnBind(
if (!NT_SUCCESS(status))
goto fail3;
- EVTCHN_SWAP_POINTER(Channel->Interrupt, Interrupt);
Channel->Cpu = Cpu;
- FdoReleaseInterruptLock(Context->Fdo, Channel->Interrupt, HIGH_LEVEL);
- FdoReleaseInterruptLock(Context->Fdo, Interrupt, HIGH_LEVEL);
-
-#pragma prefast(suppress:28138) // Use constant rather than variable
- KeLowerIrql(DISPATCH_LEVEL);
-
Info("[%u]: CPU %u\n", LocalPort, Cpu);
done:
@@ -533,12 +499,6 @@ done:
fail3:
Error("fail3\n");
- FdoReleaseInterruptLock(Context->Fdo, Channel->Interrupt, HIGH_LEVEL);
- FdoReleaseInterruptLock(Context->Fdo, Interrupt, HIGH_LEVEL);
-
-#pragma prefast(suppress:28138) // Use constant rather than variable
- KeLowerIrql(DISPATCH_LEVEL);
-
KeReleaseSpinLock(&Channel->Lock, Irql);
fail2:
@@ -566,17 +526,22 @@ EvtchnCallback(
{
PXENBUS_EVTCHN_CONTEXT Context = _Context;
PXENBUS_EVTCHN_CHANNEL Channel = Argument1;
+ PXENBUS_INTERRUPT Interrupt;
KIRQL Irql;
UNREFERENCED_PARAMETER(Dpc);
UNREFERENCED_PARAMETER(Argument2);
- Irql = FdoAcquireInterruptLock(Context->Fdo, Channel->Interrupt);
+ Interrupt = (Context->Affinity != 0) ? // Latched available
+ Context->LatchedInterrupt[Channel->Cpu] :
+ Context->LevelSensitiveInterrupt;
+
+ Irql = FdoAcquireInterruptLock(Context->Fdo, Interrupt);
#pragma warning(suppress:6387) // NULL argument
(VOID) Channel->Callback(NULL, Channel->Argument);
- FdoReleaseInterruptLock(Context->Fdo, Channel->Interrupt, Irql);
+ FdoReleaseInterruptLock(Context->Fdo, Interrupt, Irql);
}
static VOID
@@ -747,7 +712,6 @@ EvtchnClose(
ASSERT(NT_SUCCESS(status));
}
- Channel->Interrupt = NULL;
Channel->Cpu = 0;
Channel->LocalPort = 0;
@@ -809,17 +773,6 @@ EvtchnPollCallback(
goto done;
}
- if (Context->Affinity != 0) {
- ULONG Cpu;
-
- ASSERT3U(KeGetCurrentIrql(), >=, DISPATCH_LEVEL);
- Cpu = KeGetCurrentProcessorNumber();
-
- // Only handle events on the correct CPU
- if (Channel->Interrupt != Context->LatchedInterrupt[Cpu])
- goto done;
- }
-
if (Channel->Mask)
XENBUS_EVTCHN_ABI(PortMask,
&Context->EvtchnAbi,
--
2.1.1
_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |