|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH for 8.1 1/2] Verify that all interfaces have been released when going into S4
Because a transition into and out of S4 means a new domain is built, it's
crucial that all XENBUS interfaces are released (so that things like
event channels, grant tables and the xenstore ring get re-constructed).
This patch adds BUG_ONs to ensure this is the case.
Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
src/xenbus/balloon.c | 8 ++++++++
src/xenbus/balloon.h | 5 +++++
src/xenbus/cache.c | 8 ++++++++
src/xenbus/cache.h | 5 +++++
src/xenbus/debug.c | 9 ++++++++-
src/xenbus/debug.h | 5 +++++
src/xenbus/evtchn.c | 8 ++++++++
src/xenbus/evtchn.h | 5 +++++
src/xenbus/fdo.c | 11 +++++++++++
src/xenbus/gnttab.c | 8 ++++++++
src/xenbus/gnttab.h | 5 +++++
src/xenbus/range_set.c | 10 ++++++++--
src/xenbus/range_set.h | 5 +++++
src/xenbus/shared_info.c | 9 ++++++++-
src/xenbus/shared_info.h | 5 +++++
src/xenbus/store.c | 19 +++++++++++++++----
src/xenbus/store.h | 5 +++++
src/xenbus/suspend.c | 8 ++++++++
src/xenbus/suspend.h | 5 +++++
src/xenbus/unplug.c | 8 ++++++++
src/xenbus/unplug.h | 5 +++++
21 files changed, 148 insertions(+), 8 deletions(-)
diff --git a/src/xenbus/balloon.c b/src/xenbus/balloon.c
index 2dc4a6c..1b3f5fa 100644
--- a/src/xenbus/balloon.c
+++ b/src/xenbus/balloon.c
@@ -987,6 +987,14 @@ BalloonGetInterface(
return status;
}
+ULONG
+BalloonGetReferences(
+ IN PXENBUS_BALLOON_CONTEXT Context
+ )
+{
+ return Context->References;
+}
+
VOID
BalloonTeardown(
IN PXENBUS_BALLOON_CONTEXT Context
diff --git a/src/xenbus/balloon.h b/src/xenbus/balloon.h
index cc47d7d..03570f3 100644
--- a/src/xenbus/balloon.h
+++ b/src/xenbus/balloon.h
@@ -54,6 +54,11 @@ BalloonGetInterface(
IN ULONG Size
);
+extern ULONG
+BalloonGetReferences(
+ IN PXENBUS_BALLOON_CONTEXT Context
+ );
+
extern VOID
BalloonTeardown(
IN PXENBUS_BALLOON_CONTEXT Context
diff --git a/src/xenbus/cache.c b/src/xenbus/cache.c
index 83993ca..9727b14 100644
--- a/src/xenbus/cache.c
+++ b/src/xenbus/cache.c
@@ -1014,6 +1014,14 @@ CacheGetInterface(
return status;
}
+ULONG
+CacheGetReferences(
+ IN PXENBUS_CACHE_CONTEXT Context
+ )
+{
+ return Context->References;
+}
+
VOID
CacheTeardown(
IN PXENBUS_CACHE_CONTEXT Context
diff --git a/src/xenbus/cache.h b/src/xenbus/cache.h
index 582c77d..be94973 100644
--- a/src/xenbus/cache.h
+++ b/src/xenbus/cache.h
@@ -54,6 +54,11 @@ CacheGetInterface(
IN ULONG Size
);
+extern ULONG
+CacheGetReferences(
+ IN PXENBUS_CACHE_CONTEXT Context
+ );
+
extern VOID
CacheTeardown(
IN PXENBUS_CACHE_CONTEXT Context
diff --git a/src/xenbus/debug.c b/src/xenbus/debug.c
index bd62b51..7b2ec73 100644
--- a/src/xenbus/debug.c
+++ b/src/xenbus/debug.c
@@ -427,6 +427,14 @@ DebugGetInterface(
return status;
}
+ULONG
+DebugGetReferences(
+ IN PXENBUS_DEBUG_CONTEXT Context
+ )
+{
+ return Context->References;
+}
+
VOID
DebugTeardown(
IN PXENBUS_DEBUG_CONTEXT Context
@@ -444,4 +452,3 @@ DebugTeardown(
Trace("<====\n");
}
-
diff --git a/src/xenbus/debug.h b/src/xenbus/debug.h
index 370f302..dd7ec08 100644
--- a/src/xenbus/debug.h
+++ b/src/xenbus/debug.h
@@ -54,6 +54,11 @@ DebugGetInterface(
IN ULONG Size
);
+extern ULONG
+DebugGetReferences(
+ IN PXENBUS_DEBUG_CONTEXT Context
+ );
+
extern VOID
DebugTeardown(
IN PXENBUS_DEBUG_CONTEXT Context
diff --git a/src/xenbus/evtchn.c b/src/xenbus/evtchn.c
index 4a6ebd2..5769cf3 100644
--- a/src/xenbus/evtchn.c
+++ b/src/xenbus/evtchn.c
@@ -1880,6 +1880,14 @@ EvtchnGetInterface(
return status;
}
+ULONG
+EvtchnGetReferences(
+ IN PXENBUS_EVTCHN_CONTEXT Context
+ )
+{
+ return Context->References;
+}
+
VOID
EvtchnTeardown(
IN PXENBUS_EVTCHN_CONTEXT Context
diff --git a/src/xenbus/evtchn.h b/src/xenbus/evtchn.h
index 69b557e..31250b2 100644
--- a/src/xenbus/evtchn.h
+++ b/src/xenbus/evtchn.h
@@ -54,6 +54,11 @@ EvtchnGetInterface(
IN ULONG Size
);
+extern ULONG
+EvtchnGetReferences(
+ IN PXENBUS_EVTCHN_CONTEXT Context
+ );
+
extern VOID
EvtchnTeardown(
IN PXENBUS_EVTCHN_CONTEXT Context
diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index ce4840c..e889871 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -3206,6 +3206,17 @@ FdoS3ToS4(
ASSERT3U(KeGetCurrentIrql(), ==, PASSIVE_LEVEL);
ASSERT3U(__FdoGetSystemPowerState(Fdo), ==, PowerSystemSleeping3);
+ BUG_ON(SuspendGetReferences(Fdo->SuspendContext) != 0);
+ BUG_ON(SharedInfoGetReferences(Fdo->SharedInfoContext) != 0);
+ BUG_ON(EvtchnGetReferences(Fdo->EvtchnContext) != 0);
+ BUG_ON(DebugGetReferences(Fdo->DebugContext) != 0);
+ BUG_ON(StoreGetReferences(Fdo->StoreContext) != 0);
+ BUG_ON(RangeSetGetReferences(Fdo->RangeSetContext) != 0);
+ BUG_ON(CacheGetReferences(Fdo->CacheContext) != 0);
+ BUG_ON(GnttabGetReferences(Fdo->GnttabContext) != 0);
+ BUG_ON(UnplugGetReferences(Fdo->UnplugContext) != 0);
+ BUG_ON(BalloonGetReferences(Fdo->BalloonContext) != 0);
+
__FdoSetSystemPowerState(Fdo, PowerSystemHibernate);
Trace("<====\n");
diff --git a/src/xenbus/gnttab.c b/src/xenbus/gnttab.c
index 9057eed..56158d8 100644
--- a/src/xenbus/gnttab.c
+++ b/src/xenbus/gnttab.c
@@ -1058,6 +1058,14 @@ GnttabGetInterface(
return status;
}
+ULONG
+GnttabGetReferences(
+ IN PXENBUS_GNTTAB_CONTEXT Context
+ )
+{
+ return Context->References;
+}
+
VOID
GnttabTeardown(
IN PXENBUS_GNTTAB_CONTEXT Context
diff --git a/src/xenbus/gnttab.h b/src/xenbus/gnttab.h
index 0214a9e..a8cf409 100644
--- a/src/xenbus/gnttab.h
+++ b/src/xenbus/gnttab.h
@@ -54,6 +54,11 @@ GnttabGetInterface(
IN ULONG Size
);
+extern ULONG
+GnttabGetReferences(
+ IN PXENBUS_GNTTAB_CONTEXT Context
+ );
+
extern VOID
GnttabTeardown(
IN PXENBUS_GNTTAB_CONTEXT Context
diff --git a/src/xenbus/range_set.c b/src/xenbus/range_set.c
index a0b1311..1ce113f 100644
--- a/src/xenbus/range_set.c
+++ b/src/xenbus/range_set.c
@@ -869,6 +869,14 @@ RangeSetGetInterface(
return status;
}
+ULONG
+RangeSetGetReferences(
+ IN PXENBUS_RANGE_SET_CONTEXT Context
+ )
+{
+ return Context->References;
+}
+
VOID
RangeSetTeardown(
IN PXENBUS_RANGE_SET_CONTEXT Context
@@ -889,5 +897,3 @@ RangeSetTeardown(
Trace("<====\n");
}
-
-
diff --git a/src/xenbus/range_set.h b/src/xenbus/range_set.h
index 6af8f27..a150fda 100644
--- a/src/xenbus/range_set.h
+++ b/src/xenbus/range_set.h
@@ -54,6 +54,11 @@ RangeSetGetInterface(
IN ULONG Size
);
+extern ULONG
+RangeSetGetReferences(
+ IN PXENBUS_RANGE_SET_CONTEXT Context
+ );
+
extern VOID
RangeSetTeardown(
IN PXENBUS_RANGE_SET_CONTEXT Context
diff --git a/src/xenbus/shared_info.c b/src/xenbus/shared_info.c
index 1279ac4..01621ac 100644
--- a/src/xenbus/shared_info.c
+++ b/src/xenbus/shared_info.c
@@ -794,6 +794,14 @@ SharedInfoGetInterface(
return status;
}
+ULONG
+SharedInfoGetReferences(
+ IN PXENBUS_SHARED_INFO_CONTEXT Context
+ )
+{
+ return Context->References;
+}
+
VOID
SharedInfoTeardown(
IN PXENBUS_SHARED_INFO_CONTEXT Context
@@ -816,4 +824,3 @@ SharedInfoTeardown(
Trace("<====\n");
}
-
diff --git a/src/xenbus/shared_info.h b/src/xenbus/shared_info.h
index 74d72b8..2d52576 100644
--- a/src/xenbus/shared_info.h
+++ b/src/xenbus/shared_info.h
@@ -54,6 +54,11 @@ SharedInfoGetInterface(
IN ULONG Size
);
+extern ULONG
+SharedInfoGetReferences(
+ IN PXENBUS_SHARED_INFO_CONTEXT Context
+ );
+
extern VOID
SharedInfoTeardown(
IN PXENBUS_SHARED_INFO_CONTEXT Context
diff --git a/src/xenbus/store.c b/src/xenbus/store.c
index dc4e7f3..dad0f39 100644
--- a/src/xenbus/store.c
+++ b/src/xenbus/store.c
@@ -2107,6 +2107,9 @@ StoreDisable(
IN PXENBUS_STORE_CONTEXT Context
)
{
+ LogPrintf(LOG_LEVEL_INFO,
+ "STORE: DISABLE\n");
+
Context->Enabled = FALSE;
XENBUS_EVTCHN(Close,
@@ -2129,10 +2132,6 @@ StoreEnable(
Port = (ULONG)Value;
- LogPrintf(LOG_LEVEL_INFO,
- "STORE: EVTCHN %u\n",
- Port);
-
Context->Channel = XENBUS_EVTCHN(Open,
&Context->EvtchnInterface,
XENBUS_EVTCHN_TYPE_FIXED,
@@ -2149,6 +2148,10 @@ StoreEnable(
Context->Enabled = TRUE;
+ LogPrintf(LOG_LEVEL_INFO,
+ "STORE: ENABLE (%u)\n",
+ Port);
+
// Trigger an initial poll
KeInsertQueueDpc(&Context->Dpc, NULL, NULL);
}
@@ -2770,6 +2773,14 @@ StoreGetInterface(
return status;
}
+ULONG
+StoreGetReferences(
+ IN PXENBUS_STORE_CONTEXT Context
+ )
+{
+ return Context->References;
+}
+
VOID
StoreTeardown(
IN PXENBUS_STORE_CONTEXT Context
diff --git a/src/xenbus/store.h b/src/xenbus/store.h
index 6455ca0..54fff9d 100644
--- a/src/xenbus/store.h
+++ b/src/xenbus/store.h
@@ -54,6 +54,11 @@ StoreGetInterface(
IN ULONG Size
);
+extern ULONG
+StoreGetReferences(
+ IN PXENBUS_STORE_CONTEXT Context
+ );
+
extern VOID
StoreTeardown(
IN PXENBUS_STORE_CONTEXT Context
diff --git a/src/xenbus/suspend.c b/src/xenbus/suspend.c
index fad35e4..d272862 100644
--- a/src/xenbus/suspend.c
+++ b/src/xenbus/suspend.c
@@ -468,6 +468,14 @@ SuspendGetInterface(
return status;
}
+ULONG
+SuspendGetReferences(
+ IN PXENBUS_SUSPEND_CONTEXT Context
+ )
+{
+ return Context->References;
+}
+
VOID
SuspendTeardown(
IN PXENBUS_SUSPEND_CONTEXT Context
diff --git a/src/xenbus/suspend.h b/src/xenbus/suspend.h
index df0e185..4a36e07 100644
--- a/src/xenbus/suspend.h
+++ b/src/xenbus/suspend.h
@@ -54,6 +54,11 @@ SuspendGetInterface(
IN ULONG Size
);
+extern ULONG
+SuspendGetReferences(
+ IN PXENBUS_SUSPEND_CONTEXT Context
+ );
+
extern VOID
SuspendTeardown(
IN PXENBUS_SUSPEND_CONTEXT Context
diff --git a/src/xenbus/unplug.c b/src/xenbus/unplug.c
index 0a1b27a..7414b0c 100644
--- a/src/xenbus/unplug.c
+++ b/src/xenbus/unplug.c
@@ -224,6 +224,14 @@ UnplugGetInterface(
return status;
}
+ULONG
+UnplugGetReferences(
+ IN PXENBUS_UNPLUG_CONTEXT Context
+ )
+{
+ return Context->References;
+}
+
VOID
UnplugTeardown(
IN PXENBUS_UNPLUG_CONTEXT Context
diff --git a/src/xenbus/unplug.h b/src/xenbus/unplug.h
index 416b2d4..6a2382d 100644
--- a/src/xenbus/unplug.h
+++ b/src/xenbus/unplug.h
@@ -54,6 +54,11 @@ UnplugGetInterface(
IN ULONG Size
);
+extern ULONG
+UnplugGetReferences(
+ IN PXENBUS_UNPLUG_CONTEXT Context
+ );
+
extern VOID
UnplugTeardown(
IN PXENBUS_UNPLUG_CONTEXT Context
--
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 |