From 50d6e424348162df7ef871da1db76fab6681f414 Mon Sep 17 00:00:00 2001 From: Kip Macy Date: Sun, 19 Oct 2008 01:35:27 +0000 Subject: [PATCH] - Forward port flush of page table updates on context switch or userret - Forward port vfork XEN hack --- sys/kern/kern_fork.c | 9 +++++++-- sys/kern/kern_synch.c | 9 +++++++++ sys/kern/subr_trap.c | 9 +++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index e5a3779ec5ca..673913b6fa84 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -117,10 +117,15 @@ vfork(td, uap) struct thread *td; struct vfork_args *uap; { - int error; + int error, flags; struct proc *p2; - error = fork1(td, RFFDG | RFPROC | RFPPWAIT | RFMEM, 0, &p2); +#ifdef XEN + flags = RFFDG | RFPROC; /* validate that this is still an issue */ +#else + flags = RFFDG | RFPROC | RFPPWAIT | RFMEM; +#endif + error = fork1(td, flags, 0, &p2); if (error == 0) { td->td_retval[0] = p2->p_pid; td->td_retval[1] = 0; diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 4f1205d17156..53e3ced77721 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -65,6 +65,12 @@ __FBSDID("$FreeBSD$"); #include +#ifdef XEN +#include +#include +#include +#endif + static void synch_setup(void *dummy); SYSINIT(synch_setup, SI_SUB_KICK_SCHEDULER, SI_ORDER_FIRST, synch_setup, NULL); @@ -431,6 +437,9 @@ mi_switch(int flags, struct thread *newtd) "mi_switch: %p(%s) prio %d inhibit %d wmesg %s lock %s", td, td->td_name, td->td_priority, td->td_inhibitors, td->td_wmesg, td->td_lockname); +#endif +#ifdef XEN + PT_UPDATES_FLUSH(); #endif sched_switch(td, newtd, flags); CTR3(KTR_SCHED, "mi_switch: running %p(%s) prio %d", diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 3d1948dce4e1..e7e8120c912e 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -73,6 +73,12 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef XEN +#include +#include +#include +#endif + #include /* @@ -118,6 +124,9 @@ userret(struct thread *td, struct trapframe *frame) sched_userret(td); KASSERT(td->td_locks == 0, ("userret: Returning with %d locks held.", td->td_locks)); +#ifdef XEN + PT_UPDATES_FLUSH(); +#endif } /*