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

[win-pv-devel] [PATCH] Make sure we only use the first 32 (-8) grant entries for crash kernel



XENBUS only uses grant entries 32 onwards so that the first 32 (minus the 8
reserved entries) are clean for the crash kernel. This patch makes sure that
the crash kernel does not go over that limit.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/xencrsh/gnttab.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/xencrsh/gnttab.c b/src/xencrsh/gnttab.c
index bbaa519..9d56bb2 100644
--- a/src/xencrsh/gnttab.c
+++ b/src/xencrsh/gnttab.c
@@ -66,7 +66,9 @@
 #define GNTTAB_IS_OUT_OF_RANGE_REFERENCE(_Reference) \
         ((_Reference) > GNTTAB_ENTRY_PER_FRAME)
 
-#define GNTTAB_MAX_DESCRIPTOR   (GNTTAB_MAXIMUM_FRAME_COUNT * 
GNTTAB_ENTRY_PER_FRAME)
+#define GNTTAB_CRASH_RESERVATION    32
+
+#define GNTTAB_ENTRY_COUNT   (GNTTAB_CRASH_RESERVATION)
 
 typedef struct _GNTTAB_REFERENCE_DESCRIPTOR {
     ULONG               Next;   // next free entry
@@ -75,19 +77,15 @@ typedef struct _GNTTAB_REFERENCE_DESCRIPTOR {
 
 typedef struct _XENBUS_GNTTAB_CONTEXT {
     grant_entry_v1_t*           Entry;  // mapped page
-    GNTTAB_REFERENCE_DESCRIPTOR Descriptor[GNTTAB_MAX_DESCRIPTOR]; // free list
+    GNTTAB_REFERENCE_DESCRIPTOR Descriptor[GNTTAB_ENTRY_COUNT]; // free list
     ULONG                       HeadFreeReference; // head free list
     ULONG                       Count;  // number in use
 } XENBUS_GNTTAB_CONTEXT, *PXENBUS_GNTTAB_CONTEXT;
 
 static XENBUS_GNTTAB_CONTEXT    GnttabContext;
 
-#define MAXIMUM_GRANT_ENTRY_PAGES   1
-// Entry(s), Status(s)
-#define MAXIMUM_GRANT_PAGES 1
-
 __declspec(allocate(".gnttab_section"))
-static UCHAR __GnttabSection[(MAXIMUM_GRANT_PAGES + 1) * PAGE_SIZE];
+static UCHAR __GnttabSection[(GNTTAB_MAXIMUM_FRAME_COUNT + 1) * PAGE_SIZE];
 
 extern PHYSICAL_ADDRESS MmGetPhysicalAddress(IN PVOID Buffer);
 static FORCEINLINE PFN_NUMBER
@@ -243,11 +241,11 @@ GnttabInitialize(
     LogVerbose("grant_entry_v1_t* : %p\n", GnttabContext.Entry);
 
     // initialize free list
-    LogVerbose("adding refrences [%08x - %08x]\n", 
GNTTAB_RESERVED_ENTRY_COUNT, GNTTAB_ENTRY_PER_FRAME - 1);
+    LogVerbose("adding refrences [%08x - %08x]\n", 
GNTTAB_RESERVED_ENTRY_COUNT, GNTTAB_ENTRY_COUNT - 1);
 
     GnttabContext.HeadFreeReference = GNTTAB_INVALID_REFERENCE;
     GnttabContext.Count = 0;
-    for (Reference = GNTTAB_ENTRY_PER_FRAME - 1; Reference >= 
GNTTAB_RESERVED_ENTRY_COUNT; --Reference) {
+    for (Reference = GNTTAB_ENTRY_COUNT - 1; Reference >= 
GNTTAB_RESERVED_ENTRY_COUNT; --Reference) {
         PGNTTAB_REFERENCE_DESCRIPTOR    Descriptor = 
&GnttabContext.Descriptor[Reference];
 
         ASSERT(GNTTAB_IS_INVALID_REFERENCE(Descriptor->Next));
-- 
2.1.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel


 


Rackspace

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