Skip to contentSkip to conversation

disable writable pagetables on FreeBSD

PATCH In review Kip Macy 2 participants 5 messages Apr 30, 2005

lore
Share & tools
lore

Kip Macy

author
#0 lore raw

PATCH 1/1 disable writable pagetables on FreeBSD

Presumably as a result of recent changes, FreeBSD no longer works with writable page tables. In the short-term I'm more interested in functionality than performance. This patch disables them and fixes a compile issue.

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet

#   2005/04/29 19:26:00-07:00 [email protected] 
#   disable writable pagetables + compile fix 
#   Signed-off-by: Kip Macy <[email protected]>
# 
# freebsd-5.3-xen-sparse/i386-xen/include/xenpmap.h
#   2005/04/29 19:25:58-07:00 [email protected] +5 -3
#   disable writable pagetables + compile fix
# 
diff -Nru a/freebsd-5.3-xen-sparse/i386-xen/include/xenpmap.h
b/freebsd-5.3-xen-sparse/i386-xen/include/xenpmap.h
--- a/freebsd-5.3-xen-sparse/i386-xen/include/xenpmap.h 2005-04-28
19:30:44 -07:00
+++ b/freebsd-5.3-xen-sparse/i386-xen/include/xenpmap.h 2005-04-28
19:30:44 -07:00
@@ -59,7 +59,9 @@
 #define PMAP_DEC_REF_PAGE(a)
 #endif

+#if 0
#define WRITABLE_PAGETABLES
+#endif
#define ALWAYS_SYNC 0

#ifdef PT_DEBUG
@@ -118,18 +120,18 @@

 #define PT_SET_VA(_ptp,_npte,sync) do {                                \
         PMAP_REF((_ptp), xpmap_ptom(_npte));                    \
-       xen_queue_pt_update((pt_entry_t *)vtomach(_ptp),        \
+       xen_queue_pt_update(vtomach(_ptp),                      \
                            xpmap_ptom(_npte));                 \
        if (sync || ALWAYS_SYNC) xen_flush_queue();             \
 } while (/*CONSTCOND*/0)
 #define PT_SET_VA_MA(_ptp,_npte,sync) do {                     \
         PMAP_REF((_ptp), (_npte));                              \
-       xen_queue_pt_update((pt_entry_t *)vtomach(_ptp), _npte);\
+       xen_queue_pt_update(vtomach(_ptp), _npte);              \
        if (sync || ALWAYS_SYNC) xen_flush_queue();             \
 } while (/*CONSTCOND*/0)
 #define PT_CLEAR_VA(_ptp, sync) do {                           \
         PMAP_REF((pt_entry_t *)(_ptp), 0);                      \
-       xen_queue_pt_update((pt_entry_t *)vtomach(_ptp), 0);    \
+       xen_queue_pt_update(vtomach(_ptp), 0);                  \
        if (sync || ALWAYS_SYNC)                                \
                xen_flush_queue();                              \

} while (/*CONSTCOND*/0)

#1 lore raw
Quoted 4 lines · Kip Macy

Presumably as a result of recent changes, FreeBSD no longer works with writable page tables. In the short-term I'm more interested in functionality than performance. This patch disables them and fixes a compile issue.

The obvious change is we reenabled batched wrpt mode. This requires the guest to deal with reading page directory entries that have the present bit (bit 0) cleared, even though that entry is logically present. :-)

You may hav eforgotten to handle this, since it was not required all the while we were using emulation mode only.

-- Keir

#3 lore raw
In reply to Kip Macy
Quoted 4 lines

Presumably as a result of recent changes, FreeBSD no longer works with writable page tables. In the short-term I'm more interested in functionality than performance. This patch disables them and fixes a compile issue.

Your mail client eats patches (at the very least, hard tabs become soft). I haven't applied this patch, or the 'dump guest core if enable-dump true' patch because of this problem.

The two you sent links for applied okay, and I manually applied the fix to xc_ptrace.c for paravirtualised guests.

I'll take the other two if you send links, or as attachments, or if you work out how to fix your mail client. :-) I somewhat prefer the last option as it's easier to automatically pull the patch out of the email.

-- Keir

author
#2 lore raw
In reply to Keir Fraser
Quoted 8 lines · Keir Fraser
Quoted 4 lines · Kip Macy

Presumably as a result of recent changes, FreeBSD no longer works with writable page tables. In the short-term I'm more interested in functionality than performance. This patch disables them and fixes a compile issue.

Quoted 6 lines

The obvious change is we reenabled batched wrpt mode. This requires the guest to deal with reading page directory entries that have the present bit (bit 0) cleared, even though that entry is logically present. :-)

You may hav eforgotten to handle this, since it was not required all the while we were using emulation mode only.

Entirely possible. There is only one place in the machine-independent code where we check for it. Removing it there doesn't help. It may require changing the machine-dependent code (I hope not, I'd rather it be a bug in my port or in xen).

-Kip

author
#4 lore raw
In reply to Keir Fraser

At some point I may switch to a "real" mail reader, in the meantime I'll have to send them as attachments.

-Kip

Quoted 12 lines · Keir Fraser
Quoted 4 lines

Presumably as a result of recent changes, FreeBSD no longer works with writable page tables. In the short-term I'm more interested in functionality than performance. This patch disables them and fixes a compile issue.

Your mail client eats patches (at the very least, hard tabs become soft). I haven't applied this patch, or the 'dump guest core if enable-dump true' patch because of this problem.

The two you sent links for applied okay, and I manually applied the fix to xc_ptrace.c for paravirtualised guests.

Quoted 7 lines

I'll take the other two if you send links, or as attachments, or if you work out how to fix your mail client. :-) I somewhat prefer the last option as it's easier to automatically pull the patch out of the email.

-- Keir

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet

#   2005/04/29 23:01:40-07:00 [email protected] 
#   dump guest core if enable-dump is set
#   Signed-off-by: Kip Macy <[email protected]>

#
# tools/python/xen/xend/XendRoot.py
# 2005/04/29 23:01:32-07:00 [email protected] +3 -0
# add enable-dump check
#
# tools/python/xen/xend/XendDomain.py
# 2005/04/29 23:01:32-07:00 [email protected] +2 -0
# dump core if enabled
#

tools/python/xen/xend/XendDomain.py +2 -0
diff -Nru a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py
@@ -255,6 +255,8 @@
                     eserver.inject('xend.domain.exit', [name, id, reason])
                     self.domain_restart_schedule(id, reason)
             else:
+               if xroot.get_enable_dump() == 'true':
+                   xc.domain_dumpcore(dom = int(id), corefile = "/var/xen/dump/%s.%s.core"%(name,id))
                eserver.inject('xend.domain.exit', [name, id, 'crash']) 
             destroyed += 1
             self.final_domain_destroy(id)
tools/python/xen/xend/XendRoot.py +3 -0
diff -Nru a/tools/python/xen/xend/XendRoot.py b/tools/python/xen/xend/XendRoot.py
@@ -255,6 +255,9 @@
     def get_network_script(self):
         return self.get_config_value('network-script', 'network')
 
+    def get_enable_dump(self):
+        return self.get_config_value('enable-dump', 'false')
+
     def get_vif_bridge(self):
         return self.get_config_value('vif-bridge', 'xen-br0')
 

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet

#   2005/04/29 19:26:00-07:00 [email protected] 
#   disable writable pagetables + compile fix 
#   Signed-off-by: Kip Macy <[email protected]>
# 
# freebsd-5.3-xen-sparse/i386-xen/include/xenpmap.h
#   2005/04/29 19:25:58-07:00 [email protected] +5 -3
#   disable writable pagetables + compile fix
# 
diff -Nru a/freebsd-5.3-xen-sparse/i386-xen/include/xenpmap.h b/freebsd-5.3-xen-sparse/i386-xen/include/xenpmap.h
--- a/freebsd-5.3-xen-sparse/i386-xen/include/xenpmap.h	2005-04-29 08:12:11 -07:00
+++ b/freebsd-5.3-xen-sparse/i386-xen/include/xenpmap.h	2005-04-29 08:12:11 -07:00
@@ -59,7 +59,9 @@
 #define PMAP_DEC_REF_PAGE(a)
 #endif

+#if 0
#define WRITABLE_PAGETABLES
+#endif
#define ALWAYS_SYNC 0

#ifdef PT_DEBUG
@@ -118,18 +120,18 @@

 #define PT_SET_VA(_ptp,_npte,sync) do {				\
         PMAP_REF((_ptp), xpmap_ptom(_npte));                    \

- xen_queue_pt_update((pt_entry_t *)vtomach(_ptp), \
+ xen_queue_pt_update(vtomach(_ptp), \
xpmap_ptom(_npte)); \
if (sync || ALWAYS_SYNC) xen_flush_queue(); \
} while (/*CONSTCOND*/0)

 #define PT_SET_VA_MA(_ptp,_npte,sync) do {		        \
         PMAP_REF((_ptp), (_npte));                              \

- xen_queue_pt_update((pt_entry_t *)vtomach(_ptp), _npte);\
+ xen_queue_pt_update(vtomach(_ptp), _npte); \
if (sync || ALWAYS_SYNC) xen_flush_queue(); \
} while (/*CONSTCOND*/0)

 #define PT_CLEAR_VA(_ptp, sync) do {				\
         PMAP_REF((pt_entry_t *)(_ptp), 0);                      \

- xen_queue_pt_update((pt_entry_t *)vtomach(_ptp), 0); \
+ xen_queue_pt_update(vtomach(_ptp), 0); \
if (sync || ALWAYS_SYNC) \
xen_flush_queue(); \
} while (/*CONSTCOND*/0)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel