Date: Mon, 5 Jan 2009 15:02:05 +0000 (UTC) From: Doug Rabson <dfr@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r186780 - in user/dfr/xenhvm/6: . bin/cp contrib/bind9 contrib/ntp contrib/openpam contrib/sendmail contrib/tcsh contrib/telnet etc games/fortune/fortune include lib/libarchive lib/libb... Message-ID: <200901051502.n05F25dQ099518@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dfr Date: Mon Jan 5 15:02:05 2009 New Revision: 186780 URL: http://svn.freebsd.org/changeset/base/186780 Log: Merge r185180:186767 from projects/releng_6_xen Modified: user/dfr/xenhvm/6/ (props changed) user/dfr/xenhvm/6/Makefile.inc1 (props changed) user/dfr/xenhvm/6/bin/cp/ (props changed) user/dfr/xenhvm/6/contrib/bind9/ (props changed) user/dfr/xenhvm/6/contrib/ntp/ (props changed) user/dfr/xenhvm/6/contrib/openpam/ (props changed) user/dfr/xenhvm/6/contrib/sendmail/ (props changed) user/dfr/xenhvm/6/contrib/tcsh/ (props changed) user/dfr/xenhvm/6/contrib/telnet/ (props changed) user/dfr/xenhvm/6/etc/ (props changed) user/dfr/xenhvm/6/games/fortune/fortune/ (props changed) user/dfr/xenhvm/6/include/ (props changed) user/dfr/xenhvm/6/lib/libarchive/ (props changed) user/dfr/xenhvm/6/lib/libbluetooth/ (props changed) user/dfr/xenhvm/6/lib/libc/ (props changed) user/dfr/xenhvm/6/lib/libc/sys/ (props changed) user/dfr/xenhvm/6/lib/libexpat/ (props changed) user/dfr/xenhvm/6/lib/libfetch/ (props changed) user/dfr/xenhvm/6/lib/libftpio/ (props changed) user/dfr/xenhvm/6/lib/libgeom/ (props changed) user/dfr/xenhvm/6/lib/libpam/ (props changed) user/dfr/xenhvm/6/lib/libutil/ (props changed) user/dfr/xenhvm/6/libexec/rpc.rstatd/ (props changed) user/dfr/xenhvm/6/sbin/devfs/ (props changed) user/dfr/xenhvm/6/sbin/fdisk/ (props changed) user/dfr/xenhvm/6/sbin/ping6/ (props changed) user/dfr/xenhvm/6/sbin/routed/main.c (props changed) user/dfr/xenhvm/6/share/colldef/ (props changed) user/dfr/xenhvm/6/share/man/man4/ (props changed) user/dfr/xenhvm/6/share/man/man4/xl.4 (props changed) user/dfr/xenhvm/6/share/man/man5/ (props changed) user/dfr/xenhvm/6/share/man/man7/ports.7 (props changed) user/dfr/xenhvm/6/share/man/man9/ (props changed) user/dfr/xenhvm/6/share/mk/ (props changed) user/dfr/xenhvm/6/share/sendmail/ (props changed) user/dfr/xenhvm/6/share/syscons/keymaps/ (props changed) user/dfr/xenhvm/6/share/timedef/ (props changed) user/dfr/xenhvm/6/share/zoneinfo/ (props changed) user/dfr/xenhvm/6/sys/ (props changed) user/dfr/xenhvm/6/sys/conf/kern.pre.mk user/dfr/xenhvm/6/sys/dev/xen/blkfront/blkfront.c user/dfr/xenhvm/6/sys/dev/xen/console/console.c user/dfr/xenhvm/6/sys/dev/xen/console/xencons_ring.c user/dfr/xenhvm/6/sys/dev/xen/evtchn/evtchn_dev.c user/dfr/xenhvm/6/sys/dev/xen/netfront/netfront.c user/dfr/xenhvm/6/sys/i386/conf/XEN user/dfr/xenhvm/6/sys/i386/include/xen/xenfunc.h user/dfr/xenhvm/6/sys/i386/isa/npx.c user/dfr/xenhvm/6/sys/i386/xen/clock.c user/dfr/xenhvm/6/sys/i386/xen/mp_machdep.c user/dfr/xenhvm/6/sys/i386/xen/pmap.c user/dfr/xenhvm/6/sys/i386/xen/xen_machdep.c user/dfr/xenhvm/6/sys/kern/kern_condvar.c user/dfr/xenhvm/6/sys/kern/kern_lock.c user/dfr/xenhvm/6/sys/kern/kern_mutex.c user/dfr/xenhvm/6/sys/kern/kern_rwlock.c user/dfr/xenhvm/6/sys/kern/kern_sx.c user/dfr/xenhvm/6/sys/kern/kern_synch.c user/dfr/xenhvm/6/sys/kern/kern_timeout.c user/dfr/xenhvm/6/sys/sys/lock.h user/dfr/xenhvm/6/sys/sys/mutex.h user/dfr/xenhvm/6/sys/sys/sleepqueue.h user/dfr/xenhvm/6/sys/sys/sx.h user/dfr/xenhvm/6/sys/sys/systm.h user/dfr/xenhvm/6/sys/xen/evtchn.h user/dfr/xenhvm/6/sys/xen/evtchn/evtchn.c user/dfr/xenhvm/6/sys/xen/evtchn/evtchn_dev.c user/dfr/xenhvm/6/sys/xen/gnttab.c user/dfr/xenhvm/6/sys/xen/gnttab.h user/dfr/xenhvm/6/sys/xen/hypervisor.h user/dfr/xenhvm/6/sys/xen/interface/arch-x86/xen.h user/dfr/xenhvm/6/sys/xen/xen_intr.h user/dfr/xenhvm/6/sys/xen/xenbus/xenbus_comms.c user/dfr/xenhvm/6/sys/xen/xenbus/xenbus_comms.h user/dfr/xenhvm/6/sys/xen/xenbus/xenbus_if.m user/dfr/xenhvm/6/sys/xen/xenbus/xenbus_xs.c user/dfr/xenhvm/6/sys/xen/xenbus/xenbusvar.h user/dfr/xenhvm/6/tools/regression/usr.bin/ (props changed) user/dfr/xenhvm/6/tools/regression/usr.bin/calendar/ (props changed) user/dfr/xenhvm/6/usr.bin/calendar/ (props changed) user/dfr/xenhvm/6/usr.bin/cksum/ (props changed) user/dfr/xenhvm/6/usr.bin/fetch/ (props changed) user/dfr/xenhvm/6/usr.bin/gzip/ (props changed) user/dfr/xenhvm/6/usr.bin/ipcrm/ (props changed) user/dfr/xenhvm/6/usr.bin/ipcs/ (props changed) user/dfr/xenhvm/6/usr.bin/ldd/ (props changed) user/dfr/xenhvm/6/usr.bin/lockf/ (props changed) user/dfr/xenhvm/6/usr.bin/make/ (props changed) user/dfr/xenhvm/6/usr.bin/netstat/ (props changed) user/dfr/xenhvm/6/usr.bin/shar/ (props changed) user/dfr/xenhvm/6/usr.bin/su/ (props changed) user/dfr/xenhvm/6/usr.bin/tar/ (props changed) user/dfr/xenhvm/6/usr.bin/truncate/ (props changed) user/dfr/xenhvm/6/usr.bin/units/ (props changed) user/dfr/xenhvm/6/usr.bin/whereis/ (props changed) user/dfr/xenhvm/6/usr.bin/window/ (props changed) user/dfr/xenhvm/6/usr.sbin/adduser/ (props changed) user/dfr/xenhvm/6/usr.sbin/cdcontrol/ (props changed) user/dfr/xenhvm/6/usr.sbin/config/ (props changed) user/dfr/xenhvm/6/usr.sbin/cron/ (props changed) user/dfr/xenhvm/6/usr.sbin/freebsd-update/ (props changed) user/dfr/xenhvm/6/usr.sbin/mountd/ (props changed) user/dfr/xenhvm/6/usr.sbin/newsyslog/newsyslog.conf.5 (props changed) user/dfr/xenhvm/6/usr.sbin/ntp/ (props changed) user/dfr/xenhvm/6/usr.sbin/ntp/doc/ (props changed) user/dfr/xenhvm/6/usr.sbin/pkg_install/ (props changed) user/dfr/xenhvm/6/usr.sbin/portsnap/ (props changed) user/dfr/xenhvm/6/usr.sbin/pw/ (props changed) user/dfr/xenhvm/6/usr.sbin/rpc.lockd/ (props changed) user/dfr/xenhvm/6/usr.sbin/sysinstall/ (props changed) user/dfr/xenhvm/6/usr.sbin/syslogd/ (props changed) user/dfr/xenhvm/6/usr.sbin/tzsetup/ (props changed) Modified: user/dfr/xenhvm/6/sys/conf/kern.pre.mk ============================================================================== --- user/dfr/xenhvm/6/sys/conf/kern.pre.mk Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/conf/kern.pre.mk Mon Jan 5 15:02:05 2009 (r186780) @@ -20,12 +20,12 @@ SIZE?= size COPTFLAGS?= -O .else . if defined(DEBUG) -_MINUS_O= -O +_MINUS_O= -O -fno-optimize-sibling-calls . else _MINUS_O= -O2 . endif . if ${MACHINE_ARCH} == "amd64" -COPTFLAGS?=-O2 -frename-registers -pipe +COPTFLAGS?=${_MINUS_O} -frename-registers -pipe . else COPTFLAGS?=${_MINUS_O} -pipe . endif @@ -70,7 +70,7 @@ INCLUDES+= -I$S/dev/twa # .. and the same for em INCLUDES+= -I$S/dev/em -INCLUDES+= -I$S/xen/interface -I$S/xen/interface/io +INCLUDES+= -I$S/xen/interface -I$S/xen/interface/io -I$S/xen/interface/hvm CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} Modified: user/dfr/xenhvm/6/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- user/dfr/xenhvm/6/sys/dev/xen/blkfront/blkfront.c Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/dev/xen/blkfront/blkfront.c Mon Jan 5 15:02:05 2009 (r186780) @@ -41,9 +41,8 @@ __FBSDID("$FreeBSD$"); #include <machine/vmparam.h> #include <machine/xen/xen-os.h> -#include <xen/hypervisor.h> #include <machine/xen/xenfunc.h> - +#include <xen/hypervisor.h> #include <xen/xen_intr.h> #include <xen/evtchn.h> #include <xen/gnttab.h> @@ -1010,7 +1009,7 @@ blkif_free(struct blkfront_info *info, i info->ring.sring = NULL; } if (info->irq) - unbind_from_irqhandler(info->irq); + unbind_from_irqhandler(info->irq); info->irq = 0; } Modified: user/dfr/xenhvm/6/sys/dev/xen/console/console.c ============================================================================== --- user/dfr/xenhvm/6/sys/dev/xen/console/console.c Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/dev/xen/console/console.c Mon Jan 5 15:02:05 2009 (r186780) @@ -77,17 +77,17 @@ static unsigned int wc, wp; /* write_con #define XCUNIT(x) (minor(x)) #define ISTTYOPEN(tp) ((tp) && ((tp)->t_state & TS_ISOPEN)) #define CN_LOCK_INIT(x, _name) \ - mtx_init(&x, _name, NULL, MTX_SPIN|MTX_RECURSE) + mtx_init(&x, _name, NULL, MTX_DEF|MTX_RECURSE) #define CN_LOCK(l) \ do { \ if (panicstr == NULL) \ - mtx_lock_spin(&(l)); \ + mtx_lock(&(l)); \ } while (0) #define CN_UNLOCK(l) \ do { \ if (panicstr == NULL) \ - mtx_unlock_spin(&(l)); \ + mtx_unlock(&(l)); \ } while (0) #define CN_LOCK_ASSERT(x) mtx_assert(&x, MA_OWNED) #define CN_LOCK_DESTROY(x) mtx_destroy(&x) @@ -241,6 +241,7 @@ xc_probe(device_t dev) static int xc_attach(device_t dev) { + int error; struct xc_softc *sc = (struct xc_softc *)device_get_softc(dev); int error; @@ -267,9 +268,14 @@ xc_attach(device_t dev) callout_reset(&xc_callout, XC_POLLTIME, xc_timeout, xccons); if (xen_start_info->flags & SIF_INITDOMAIN) { - error = bind_virq_to_irqhandler(VIRQ_CONSOLE, 0, "console", - xencons_priv_interrupt, INTR_TYPE_TTY, NULL); - KASSERT(error >= 0, ("can't register console interrupt")); + error = bind_virq_to_irqhandler( + VIRQ_CONSOLE, + 0, + "console", + xencons_priv_interrupt, + INTR_TYPE_TTY, NULL); + + KASSERT(error >= 0, ("can't register console interrupt")); } /* register handler to flush console on shutdown */ Modified: user/dfr/xenhvm/6/sys/dev/xen/console/xencons_ring.c ============================================================================== --- user/dfr/xenhvm/6/sys/dev/xen/console/xencons_ring.c Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/dev/xen/console/xencons_ring.c Mon Jan 5 15:02:05 2009 (r186780) @@ -18,17 +18,22 @@ __FBSDID("$FreeBSD$"); #include <machine/stdarg.h> #include <machine/xen/xen-os.h> #include <xen/hypervisor.h> +#include <xen/xen_intr.h> +#include <sys/cons.h> #include <xen/xen_intr.h> #include <xen/evtchn.h> #include <xen/interface/io/console.h> #include <dev/xen/console/xencons_ring.h> +#include <xen/evtchn.h> +#include <xen/interface/io/console.h> #define console_evtchn console.domU.evtchn static unsigned int console_irq; extern char *console_page; - +extern struct mtx cn_mtx; + static inline struct xencons_interface * xencons_interface(void) { @@ -84,6 +89,7 @@ xencons_handle_input(void *unused) struct xencons_interface *intf; XENCONS_RING_IDX cons, prod; + mtx_lock(&cn_mtx); intf = xencons_interface(); cons = intf->in_cons; @@ -101,6 +107,7 @@ xencons_handle_input(void *unused) notify_remote_via_evtchn(xen_start_info->console_evtchn); xencons_tx(); + mtx_unlock(&cn_mtx); } void Modified: user/dfr/xenhvm/6/sys/dev/xen/evtchn/evtchn_dev.c ============================================================================== --- user/dfr/xenhvm/6/sys/dev/xen/evtchn/evtchn_dev.c Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/dev/xen/evtchn/evtchn_dev.c Mon Jan 5 15:02:05 2009 (r186780) @@ -26,13 +26,13 @@ __FBSDID("$FreeBSD$"); #include <machine/cpufunc.h> #include <machine/intr_machdep.h> #include <machine/xen-os.h> -#include <machine/xen_intr.h> +#include <xen/xen_intr.h> #include <machine/bus.h> #include <sys/rman.h> #include <machine/resource.h> #include <machine/synch_bitops.h> -#include <machine/hypervisor.h> +#include <xen/hypervisor.h> typedef struct evtchn_sotfc { Modified: user/dfr/xenhvm/6/sys/dev/xen/netfront/netfront.c ============================================================================== --- user/dfr/xenhvm/6/sys/dev/xen/netfront/netfront.c Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/dev/xen/netfront/netfront.c Mon Jan 5 15:02:05 2009 (r186780) @@ -63,10 +63,8 @@ __FBSDID("$FreeBSD$"); #include <machine/intr_machdep.h> #include <machine/xen/xen-os.h> +#include <machine/xen/xenfunc.h> #include <xen/hypervisor.h> -#include <machine/xen/xenvar.h> -#include <xen/features.h> - #include <xen/xen_intr.h> #include <xen/evtchn.h> #include <xen/gnttab.h> @@ -357,7 +355,7 @@ makembuf (struct mbuf *buf) m_copydata(buf, 0, buf->m_pkthdr.len, mtod(m,caddr_t) ); m->m_ext.ext_args = (caddr_t *)(uintptr_t)(vtophys(mtod(m,caddr_t)) >> PAGE_SHIFT); - + return m; } @@ -575,14 +573,14 @@ setup_device(device_t dev, struct netfro goto fail; error = bind_listening_port_to_irqhandler(xenbus_get_otherend_id(dev), - "xn", xn_intr, info, INTR_TYPE_NET | INTR_MPSAFE, &info->irq); + "xn", xn_intr, info, INTR_TYPE_NET | INTR_MPSAFE, &info->irq); if (error) { xenbus_dev_fatal(dev, error, "bind_evtchn_to_irqhandler failed"); goto fail; } - + show_device(info); return (0); @@ -1450,9 +1448,9 @@ xn_ioctl(struct ifnet *ifp, u_long cmd, if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) xn_ifinit_locked(sc); arp_ifinit(ifp, ifa); - XN_UNLOCK(sc); + XN_UNLOCK(sc); } else { - XN_UNLOCK(sc); + XN_UNLOCK(sc); error = ether_ioctl(ifp, cmd, data); } break; @@ -1779,8 +1777,6 @@ static void netif_free(struct netfront_i #endif } - - static void netif_disconnect_backend(struct netfront_info *info) { XN_RX_LOCK(info); @@ -1798,6 +1794,7 @@ static void netif_disconnect_backend(str if (info->irq) unbind_from_irqhandler(info->irq); + info->irq = 0; } Modified: user/dfr/xenhvm/6/sys/i386/conf/XEN ============================================================================== --- user/dfr/xenhvm/6/sys/i386/conf/XEN Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/i386/conf/XEN Mon Jan 5 15:02:05 2009 (r186780) @@ -67,8 +67,8 @@ options GDB # Support remote GDB. #options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed # To make an SMP kernel, the next two lines are needed -options SMP # Symmetric MultiProcessor Kernel -device apic # I/O APIC +#options SMP # Symmetric MultiProcessor Kernel +#device apic # I/O APIC options PAE @@ -153,3 +153,4 @@ options KTR_COMPILE=(KTR_PMAP) options KTR_CPUMASK=0xff options KTR_ENTRIES=65536 options KTR_MASK=(KTR_PMAP) +options KVA_PAGES=1600 Modified: user/dfr/xenhvm/6/sys/i386/include/xen/xenfunc.h ============================================================================== --- user/dfr/xenhvm/6/sys/i386/include/xen/xenfunc.h Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/i386/include/xen/xenfunc.h Mon Jan 5 15:02:05 2009 (r186780) @@ -30,6 +30,11 @@ #ifndef _XEN_XENFUNC_H_ #define _XEN_XENFUNC_H_ +#include <machine/xen/xen-os.h> +#include <xen/hypervisor.h> +#include <machine/xen/xenpmap.h> +#include <machine/segments.h> +#include <sys/pcpu.h> #define BKPT __asm__("int3"); #define XPQ_CALL_DEPTH 5 #define XPQ_CALL_COUNT 2 Modified: user/dfr/xenhvm/6/sys/i386/isa/npx.c ============================================================================== --- user/dfr/xenhvm/6/sys/i386/isa/npx.c Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/i386/isa/npx.c Mon Jan 5 15:02:05 2009 (r186780) @@ -69,8 +69,8 @@ __FBSDID("$FreeBSD$"); #include <machine/ucontext.h> #include <machine/intr_machdep.h> -#ifdef XEN #include <machine/xen/xen-os.h> +#ifdef XEN #include <xen/hypervisor.h> #endif #ifdef DEV_ISA Modified: user/dfr/xenhvm/6/sys/i386/xen/clock.c ============================================================================== --- user/dfr/xenhvm/6/sys/i386/xen/clock.c Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/i386/xen/clock.c Mon Jan 5 15:02:05 2009 (r186780) @@ -295,11 +295,12 @@ static struct timecounter xen_timecounte }; static void -clkintr(struct clockframe *frame) +clkintr(void *arg) { int64_t delta_cpu, delta; struct shadow_time_info *shadow = PCPU_PTR(shadow_time); - + struct clockframe *frame = (struct clockframe *)arg; + do { __get_time_values_from_xen(); @@ -839,7 +840,8 @@ static struct vcpu_set_periodic_timer xe void cpu_initclocks(void) { - + int error; + xen_set_periodic_tick.period_ns = NS_PER_TICK; HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, 0, @@ -849,11 +851,11 @@ cpu_initclocks(void) unbind_from_irqhandler(time_irq); time_irq = 0; - if (bind_virq_to_irqhandler(VIRQ_TIMER, 0, "clk", - (driver_intr_t *)clkintr, INTR_TYPE_CLK | INTR_FAST, - &time_irq)) { + error = bind_virq_to_irqhandler(VIRQ_TIMER, 0, "clk", + clkintr, + INTR_TYPE_CLK | INTR_FAST, &time_irq); + if (error) panic("failed to register clock interrupt\n"); - } /* should fast clock be enabled ? */ } @@ -861,23 +863,23 @@ cpu_initclocks(void) int ap_cpu_initclocks(int cpu) { - int time_irq; + unsigned int time_irq; + int error; xen_set_periodic_tick.period_ns = NS_PER_TICK; HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, cpu, &xen_set_periodic_tick); - - if ((time_irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, "clk", - (driver_intr_t *)clkintr, - INTR_TYPE_CLK | INTR_FAST, NULL)) < 0) { + error = bind_virq_to_irqhandler(VIRQ_TIMER, 0, "clk", + clkintr, + INTR_TYPE_CLK | INTR_FAST, &time_irq); + if (error) panic("failed to register clock interrupt\n"); - } + return (0); } - void cpu_startprofclock(void) { Modified: user/dfr/xenhvm/6/sys/i386/xen/mp_machdep.c ============================================================================== --- user/dfr/xenhvm/6/sys/i386/xen/mp_machdep.c Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/i386/xen/mp_machdep.c Mon Jan 5 15:02:05 2009 (r186780) @@ -83,9 +83,10 @@ __FBSDID("$FreeBSD$"); #include <machine/specialreg.h> #include <xen/hypervisor.h> - #include <xen/xen_intr.h> #include <xen/evtchn.h> +#include <xen/xen_intr.h> +#include <xen/hypervisor.h> #include <xen/interface/vcpu.h> #define WARMBOOT_TARGET 0 @@ -557,25 +558,31 @@ static int xen_smp_intr_init(unsigned int cpu) { int rc; - struct pcpu *pc = pcpu_find(cpu); - + unsigned int irq; + pc->pc_resched_irq = pc->pc_callfunc_irq = ~0; sprintf(resched_name[cpu], "resched%u", cpu); - rc = bind_ipi_to_irqhandler(RESCHEDULE_VECTOR, cpu, - resched_name[cpu], smp_reschedule_interrupt, - INTR_FAST|INTR_TYPE_TTY|INTR_MPSAFE, &pc->pc_resched_irq); + rc = bind_ipi_to_irqhandler(RESCHEDULE_VECTOR, + cpu, + resched_name[cpu], + smp_reschedule_interrupt, + INTR_FAST|INTR_TYPE_TTY|INTR_MPSAFE, &irq); printf("cpu=%d irq=%d vector=%d\n", cpu, pc->pc_resched_irq, RESCHEDULE_VECTOR); + per_cpu(resched_irq, cpu) = irq; + sprintf(callfunc_name[cpu], "callfunc%u", cpu); - rc = bind_ipi_to_irqhandler(CALL_FUNCTION_VECTOR, cpu, - callfunc_name[cpu], - smp_call_function_interrupt, - INTR_FAST|INTR_TYPE_TTY|INTR_MPSAFE, &pc->pc_callfunc_irq); + rc = bind_ipi_to_irqhandler(CALL_FUNCTION_VECTOR, + cpu, + callfunc_name[cpu], + smp_call_function_interrupt, + INTR_FAST|INTR_TYPE_TTY|INTR_MPSAFE, &irq); if (rc < 0) goto fail; + per_cpu(callfunc_irq, cpu) = irq; printf("cpu=%d irq=%d vector=%d\n", cpu, pc->pc_callfunc_irq, CALL_FUNCTION_VECTOR); @@ -586,10 +593,10 @@ xen_smp_intr_init(unsigned int cpu) return 0; fail: - if (pc->pc_resched_irq != ~0) - unbind_from_irqhandler(pc->pc_resched_irq); - if (pc->pc_callfunc_irq != ~0) - unbind_from_irqhandler(pc->pc_callfunc_irq); + if (per_cpu(resched_irq, cpu) >= 0) + unbind_from_irqhandler(per_cpu(resched_irq, cpu)); + if (per_cpu(callfunc_irq, cpu) >= 0) + unbind_from_irqhandler(per_cpu(callfunc_irq, cpu)); return rc; } Modified: user/dfr/xenhvm/6/sys/i386/xen/pmap.c ============================================================================== --- user/dfr/xenhvm/6/sys/i386/xen/pmap.c Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/i386/xen/pmap.c Mon Jan 5 15:02:05 2009 (r186780) @@ -159,6 +159,16 @@ __FBSDID("$FreeBSD$"); #include <machine/smp.h> #endif +#ifdef XBOX +#include <machine/xbox.h> +#endif + +#include <xen/interface/xen.h> +#include <xen/hypervisor.h> +#include <machine/xen/hypercall.h> +#include <machine/xen/xenvar.h> +#include <machine/xen/xenfunc.h> + #if !defined(CPU_DISABLE_SSE) && defined(I686_CPU) #define CPU_ENABLE_SSE #endif Modified: user/dfr/xenhvm/6/sys/i386/xen/xen_machdep.c ============================================================================== --- user/dfr/xenhvm/6/sys/i386/xen/xen_machdep.c Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/i386/xen/xen_machdep.c Mon Jan 5 15:02:05 2009 (r186780) @@ -413,10 +413,11 @@ void _xen_queue_pt_update(vm_paddr_t ptr, vm_paddr_t val, char *file, int line) { SET_VCPU(); - +#if 0 if (__predict_true(gdtset)) mtx_assert(&vm_page_queue_mtx, MA_OWNED); - +#endif + KASSERT((ptr & 7) == 0, ("misaligned update")); if (__predict_true(gdtset)) @@ -925,6 +926,39 @@ initvalues(start_info_t *startinfo) xen_start_info = startinfo; xen_phys_machine = (xen_pfn_t *)startinfo->mfn_list; + IdlePTD = (pd_entry_t *)((uint8_t *)startinfo->pt_base + PAGE_SIZE); + l1_pages = 0; + +#ifdef PAE + l3_pages = 1; + l2_pages = 0; + IdlePDPT = (pd_entry_t *)startinfo->pt_base; + IdlePDPTma = xpmap_ptom(VTOP(startinfo->pt_base)); + for (i = (KERNBASE >> 30); + (i < 4) && (IdlePDPT[i] != 0); i++) + l2_pages++; + /* + * Note that only one page directory has been allocated at this point. + * Thus, if KERNBASE + */ +#if 0 + for (i = 0; i < l2_pages; i++) + IdlePTDma[i] = xpmap_ptom(VTOP(IdlePTD + i*PAGE_SIZE)); +#endif + + l2_pages = (l2_pages == 0) ? 1 : l2_pages; +#else + l3_pages = 0; + l2_pages = 1; +#endif + for (i = (((KERNBASE>>18) & PAGE_MASK)>>PAGE_SHIFT); + (i<l2_pages*NPDEPG) && (i<(VM_MAX_KERNEL_ADDRESS>>PDRSHIFT)); i++) { + + if (IdlePTD[i] == 0) + break; + l1_pages++; + } + /* number of pages allocated after the pts + 1*/; cur_space = xen_start_info->pt_base + ((xen_start_info->nr_pt_frames) + 3 )*PAGE_SIZE; Modified: user/dfr/xenhvm/6/sys/kern/kern_condvar.c ============================================================================== --- user/dfr/xenhvm/6/sys/kern/kern_condvar.c Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/kern/kern_condvar.c Mon Jan 5 15:02:05 2009 (r186780) @@ -124,8 +124,7 @@ cv_wait(struct cv *cvp, struct mtx *mp) DROP_GIANT(); mtx_unlock(mp); - sleepq_add(cvp, &mp->mtx_object, cvp->cv_description, SLEEPQ_CONDVAR, - 0); + sleepq_add(cvp, &mp->mtx_object, cvp->cv_description, SLEEPQ_CONDVAR, 0); sleepq_wait(cvp); #ifdef KTRACE @@ -232,8 +231,7 @@ cv_timedwait(struct cv *cvp, struct mtx DROP_GIANT(); mtx_unlock(mp); - sleepq_add(cvp, &mp->mtx_object, cvp->cv_description, SLEEPQ_CONDVAR, - 0); + sleepq_add(cvp, &mp->mtx_object, cvp->cv_description, SLEEPQ_CONDVAR, 0); sleepq_set_timeout(cvp, timo); rval = sleepq_timedwait(cvp); Modified: user/dfr/xenhvm/6/sys/kern/kern_lock.c ============================================================================== --- user/dfr/xenhvm/6/sys/kern/kern_lock.c Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/kern/kern_lock.c Mon Jan 5 15:02:05 2009 (r186780) @@ -62,6 +62,43 @@ __FBSDID("$FreeBSD$"); #include <ddb/ddb.h> #endif + +#ifdef DDB +#include <ddb/ddb.h> +static void db_show_lockmgr(struct lock_object *lock); +#endif +static void lock_lockmgr(struct lock_object *lock, int how); +static int unlock_lockmgr(struct lock_object *lock); + +struct lock_class lock_class_lockmgr = { + .lc_name = "lockmgr", + .lc_flags = LC_SLEEPLOCK | LC_SLEEPABLE | LC_RECURSABLE | LC_UPGRADABLE, +#ifdef DDB + .lc_ddb_show = db_show_lockmgr, +#endif + .lc_lock = lock_lockmgr, + .lc_unlock = unlock_lockmgr, +}; + +/* + * Locking primitives implementation. + * Locks provide shared/exclusive sychronization. + */ + +void +lock_lockmgr(struct lock_object *lock, int how) +{ + + panic("lockmgr locks do not support sleep interlocking"); +} + +int +unlock_lockmgr(struct lock_object *lock) +{ + + panic("lockmgr locks do not support sleep interlocking"); +} + /* * Locking primitives implementation. * Locks provide shared/exclusive sychronization. @@ -639,14 +676,13 @@ ok: return (1); } -DB_SHOW_COMMAND(lockmgr, db_show_lockmgr) +void +db_show_lockmgr(struct lock_object *lock) { struct thread *td; struct lock *lkp; - if (!have_addr) - return; - lkp = (struct lock *)addr; + lkp = (struct lock *)lock; db_printf("lock type: %s\n", lkp->lk_wmesg); db_printf("state: "); Modified: user/dfr/xenhvm/6/sys/kern/kern_mutex.c ============================================================================== --- user/dfr/xenhvm/6/sys/kern/kern_mutex.c Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/kern/kern_mutex.c Mon Jan 5 15:02:05 2009 (r186780) @@ -92,25 +92,66 @@ __FBSDID("$FreeBSD$"); #ifdef DDB static void db_show_mtx(struct lock_object *lock); #endif +static void lock_mtx(struct lock_object *lock, int how); +static void lock_spin(struct lock_object *lock, int how); +static int unlock_mtx(struct lock_object *lock); +static int unlock_spin(struct lock_object *lock); + /* * Lock classes for sleep and spin mutexes. */ struct lock_class lock_class_mtx_sleep = { - "sleep mutex", - LC_SLEEPLOCK | LC_RECURSABLE, + .lc_name = "sleep mutex", + .lc_flags = LC_SLEEPLOCK | LC_RECURSABLE, #ifdef DDB - db_show_mtx + .lc_ddb_show = db_show_mtx, #endif + .lc_lock = lock_mtx, + .lc_unlock = unlock_mtx, }; struct lock_class lock_class_mtx_spin = { - "spin mutex", - LC_SPINLOCK | LC_RECURSABLE, + .lc_name = "spin mutex", + .lc_flags = LC_SPINLOCK | LC_RECURSABLE, #ifdef DDB - db_show_mtx + .lc_ddb_show = db_show_mtx, #endif + .lc_lock = lock_spin, + .lc_unlock = unlock_spin, }; +void +lock_mtx(struct lock_object *lock, int how) +{ + + mtx_lock((struct mtx *)lock); +} + +void +lock_spin(struct lock_object *lock, int how) +{ + + panic("spin locks can only use msleep_spin"); +} + +int +unlock_mtx(struct lock_object *lock) +{ + struct mtx *m; + + m = (struct mtx *)lock; + mtx_assert(m, MA_OWNED | MA_NOTRECURSED); + mtx_unlock(m); + return (0); +} + +int +unlock_spin(struct lock_object *lock) +{ + + panic("spin locks can only use msleep_spin"); +} + /* * System-wide mutexes */ Modified: user/dfr/xenhvm/6/sys/kern/kern_rwlock.c ============================================================================== --- user/dfr/xenhvm/6/sys/kern/kern_rwlock.c Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/kern/kern_rwlock.c Mon Jan 5 15:02:05 2009 (r186780) @@ -60,13 +60,19 @@ CTASSERT((RW_RECURSE & LO_CLASSFLAGS) == static void db_show_rwlock(struct lock_object *lock); #endif +static void lock_rw(struct lock_object *lock, int how); +static int unlock_rw(struct lock_object *lock); + struct lock_class lock_class_rw = { .lc_name = "rw", .lc_flags = LC_SLEEPLOCK | LC_RECURSABLE | LC_UPGRADABLE, #ifdef DDB .lc_ddb_show = db_show_rwlock, #endif + .lc_lock = lock_rw, + .lc_unlock = unlock_rw }; + /* * Return a pointer to the owning thread if the lock is write-locked or @@ -99,6 +105,34 @@ struct lock_class lock_class_rw = { #endif void +lock_rw(struct lock_object *lock, int how) +{ + struct rwlock *rw; + + rw = (struct rwlock *)lock; + if (how) + rw_wlock(rw); + else + rw_rlock(rw); +} + +int +unlock_rw(struct lock_object *lock) +{ + struct rwlock *rw; + + rw = (struct rwlock *)lock; + rw_assert(rw, RA_LOCKED | LA_NOTRECURSED); + if (rw->rw_lock & RW_LOCK_READ) { + rw_runlock(rw); + return (0); + } else { + rw_wunlock(rw); + return (1); + } +} + +void rw_init_flags(struct rwlock *rw, const char *name, int opts) { int flags; Modified: user/dfr/xenhvm/6/sys/kern/kern_sx.c ============================================================================== --- user/dfr/xenhvm/6/sys/kern/kern_sx.c Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/kern/kern_sx.c Mon Jan 5 15:02:05 2009 (r186780) @@ -108,12 +108,17 @@ CTASSERT(((SX_ADAPTIVESPIN | SX_RECURSE) static void db_show_sx(struct lock_object *lock); #endif +static void lock_sx(struct lock_object *lock, int how); +static int unlock_sx(struct lock_object *lock); + struct lock_class lock_class_sx = { .lc_name = "sx", .lc_flags = LC_SLEEPLOCK | LC_SLEEPABLE | LC_RECURSABLE | LC_UPGRADABLE, #ifdef DDB .lc_ddb_show = db_show_sx, #endif + .lc_lock = lock_sx, + .lc_unlock = unlock_sx, }; #ifndef INVARIANTS @@ -121,6 +126,34 @@ struct lock_class lock_class_sx = { #endif void +lock_sx(struct lock_object *lock, int how) +{ + struct sx *sx; + + sx = (struct sx *)lock; + if (how) + sx_xlock(sx); + else + sx_slock(sx); +} + +int +unlock_sx(struct lock_object *lock) +{ + struct sx *sx; + + sx = (struct sx *)lock; + sx_assert(sx, SA_LOCKED | SA_NOTRECURSED); + if (sx_xlocked(sx)) { + sx_xunlock(sx); + return (1); + } else { + sx_sunlock(sx); + return (0); + } +} + +void sx_sysinit(void *arg) { struct sx_args *sargs = arg; @@ -845,6 +878,7 @@ _sx_sunlock_hard(struct sx *sx, const ch } } +#if 0 /* * Atomically drop an sx lock while going to sleep. This is just a hack * for 6.x. In 7.0 and later this is done more cleanly. @@ -961,6 +995,7 @@ sx_sleep(void *ident, struct sx *sx, int } return (rval); } +#endif #ifdef INVARIANT_SUPPORT #ifndef INVARIANTS Modified: user/dfr/xenhvm/6/sys/kern/kern_synch.c ============================================================================== --- user/dfr/xenhvm/6/sys/kern/kern_synch.c Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/kern/kern_synch.c Mon Jan 5 15:02:05 2009 (r186780) @@ -75,6 +75,7 @@ SYSINIT(synch_setup, SI_SUB_KICK_SCHEDUL int hogticks; int lbolt; +static int pause_wchan; static struct callout loadav_callout; static struct callout lbolt_callout; @@ -106,6 +107,143 @@ sleepinit(void) init_sleepqueues(); } + +/* + * General sleep call. Suspends the current thread until a wakeup is + * performed on the specified identifier. The thread will then be made + * runnable with the specified priority. Sleeps at most timo/hz seconds + * (0 means no timeout). If pri includes PCATCH flag, signals are checked + * before and after sleeping, else signals are not checked. Returns 0 if + * awakened, EWOULDBLOCK if the timeout expires. If PCATCH is set and a + * signal needs to be delivered, ERESTART is returned if the current system + * call should be restarted if possible, and EINTR is returned if the system + * call should be interrupted by the signal (return EINTR). + * + * The lock argument is unlocked before the caller is suspended, and + * re-locked before _sleep() returns. If priority includes the PDROP + * flag the lock is not re-locked before returning. + */ +int +_sleep(void *ident, struct lock_object *lock, int priority, + const char *wmesg, int timo) +{ + struct thread *td; + struct proc *p; + struct lock_class *class; + int catch, flags, lock_state, pri, rval; + WITNESS_SAVE_DECL(lock_witness); + + td = curthread; + p = td->td_proc; +#ifdef KTRACE + if (KTRPOINT(td, KTR_CSW)) + ktrcsw(1, 0); +#endif + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, lock, + "Sleeping on \"%s\"", wmesg); + KASSERT(timo != 0 || mtx_owned(&Giant) || lock != NULL || + ident == &lbolt, ("sleeping without a lock")); + KASSERT(p != NULL, ("msleep1")); + KASSERT(ident != NULL && TD_IS_RUNNING(td), ("msleep")); + if (lock != NULL) + class = LOCK_CLASS(lock); + else + class = NULL; + + if (cold) { + /* + * During autoconfiguration, just return; + * don't run any other threads or panic below, + * in case this is the idle thread and already asleep. + * XXX: this used to do "s = splhigh(); splx(safepri); + * splx(s);" to give interrupts a chance, but there is + * no way to give interrupts a chance now. + */ + if (lock != NULL && priority & PDROP) + class->lc_unlock(lock); + return (0); + } + catch = priority & PCATCH; + rval = 0; + + /* + * If we are already on a sleep queue, then remove us from that + * sleep queue first. We have to do this to handle recursive + * sleeps. + */ + if (TD_ON_SLEEPQ(td)) + sleepq_remove(td, td->td_wchan); + + if (ident == &pause_wchan) + flags = SLEEPQ_PAUSE; + else + flags = SLEEPQ_SLEEP; + if (catch) + flags |= SLEEPQ_INTERRUPTIBLE; + + sleepq_lock(ident); + CTR5(KTR_PROC, "sleep: thread %ld (pid %ld, %s) on %s (%p)", + td->td_tid, p->p_pid, p->p_comm, wmesg, ident); + + DROP_GIANT(); + if (lock != NULL && !(class->lc_flags & LC_SLEEPABLE)) { + WITNESS_SAVE(lock, lock_witness); + lock_state = class->lc_unlock(lock); + } else + /* GCC needs to follow the Yellow Brick Road */ + lock_state = -1; + + /* + * We put ourselves on the sleep queue and start our timeout + * before calling thread_suspend_check, as we could stop there, + * and a wakeup or a SIGCONT (or both) could occur while we were + * stopped without resuming us. Thus, we must be ready for sleep + * when cursig() is called. If the wakeup happens while we're + * stopped, then td will no longer be on a sleep queue upon + * return from cursig(). + */ + sleepq_add(ident, ident == &lbolt ? NULL : lock, wmesg, flags, 0); + if (timo) + sleepq_set_timeout(ident, timo); + if (lock != NULL && class->lc_flags & LC_SLEEPABLE) { + sleepq_release(ident); + WITNESS_SAVE(lock, lock_witness); + lock_state = class->lc_unlock(lock); + sleepq_lock(ident); + } + + /* + * Adjust this thread's priority, if necessary. + */ + pri = priority & PRIMASK; + if (pri != 0 && pri != td->td_priority) { + mtx_lock_spin(&sched_lock); + sched_prio(td, pri); + mtx_unlock_spin(&sched_lock); + } + + if (timo && catch) + rval = sleepq_timedwait_sig(ident); + else if (timo) + rval = sleepq_timedwait(ident); + else if (catch) + rval = sleepq_wait_sig(ident); + else { + sleepq_wait(ident); + rval = 0; + } +#ifdef KTRACE + if (KTRPOINT(td, KTR_CSW)) + ktrcsw(0, 0); +#endif + PICKUP_GIANT(); + if (lock != NULL && !(priority & PDROP)) { + class->lc_lock(lock, lock_state); + WITNESS_RESTORE(lock, lock_witness); + } + return (rval); +} + /* * General sleep call. Suspends the current process until a wakeup is * performed on the specified identifier. The process will then be made @@ -170,7 +308,7 @@ msleep(ident, mtx, priority, wmesg, timo if (TD_ON_SLEEPQ(td)) sleepq_remove(td, td->td_wchan); - flags = SLEEPQ_MSLEEP; + flags = SLEEPQ_SLEEP; if (catch) flags |= SLEEPQ_INTERRUPTIBLE; @@ -271,7 +409,7 @@ msleep_spin(ident, mtx, wmesg, timo) /* * We put ourselves on the sleep queue and start our timeout. */ - sleepq_add(ident, &mtx->mtx_object, wmesg, SLEEPQ_MSLEEP, 0); + sleepq_add(ident, &mtx->mtx_object, wmesg, SLEEPQ_SLEEP, 0); if (timo) sleepq_set_timeout(ident, timo); @@ -320,7 +458,7 @@ wakeup(ident) { sleepq_lock(ident); - sleepq_broadcast(ident, SLEEPQ_MSLEEP, -1, 0); + sleepq_broadcast(ident, SLEEPQ_SLEEP, -1, 0); } /* @@ -334,7 +472,7 @@ wakeup_one(ident) { sleepq_lock(ident); - sleepq_signal(ident, SLEEPQ_MSLEEP, -1, 0); + sleepq_signal(ident, SLEEPQ_SLEEP, -1, 0); } /* Modified: user/dfr/xenhvm/6/sys/kern/kern_timeout.c ============================================================================== --- user/dfr/xenhvm/6/sys/kern/kern_timeout.c Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/kern/kern_timeout.c Mon Jan 5 15:02:05 2009 (r186780) @@ -557,7 +557,7 @@ again: mtx_unlock_spin(&callout_lock); sleepq_add(&callout_wait, &callout_lock.mtx_object, "codrain", - SLEEPQ_MSLEEP, 0); + SLEEPQ_SLEEP, 0); sleepq_wait(&callout_wait); sq_locked = 0; Modified: user/dfr/xenhvm/6/sys/sys/lock.h ============================================================================== --- user/dfr/xenhvm/6/sys/sys/lock.h Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/sys/lock.h Mon Jan 5 15:02:05 2009 (r186780) @@ -51,6 +51,8 @@ struct lock_class { const char *lc_name; u_int lc_flags; void (*lc_ddb_show)(struct lock_object *lock); + void (*lc_lock)(struct lock_object *lock, int how); + int (*lc_unlock)(struct lock_object *lock); }; #define LC_SLEEPLOCK 0x00000001 /* Sleep lock. */ Modified: user/dfr/xenhvm/6/sys/sys/mutex.h ============================================================================== --- user/dfr/xenhvm/6/sys/sys/mutex.h Mon Jan 5 14:48:43 2009 (r186779) +++ user/dfr/xenhvm/6/sys/sys/mutex.h Mon Jan 5 15:02:05 2009 (r186780) @@ -325,6 +325,9 @@ extern struct mtx_pool *mtxpool_sleep; #define mtx_trylock_flags(m, opts) \ _mtx_trylock((m), (opts), LOCK_FILE, LOCK_LINE) +#define mtx_sleep(chan, mtx, pri, wmesg, timo) \ + _sleep((chan), &(mtx)->mtx_object, (pri), (wmesg), (timo)) + #define mtx_initialized(m) lock_initalized(&(m)->mtx_object) *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901051502.n05F25dQ099518>