Source-Changes-HG archive

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

[src/cherry-xenmp]: src Initial import of xen MP sources, with kernel and use...



details:   https://anonhg.NetBSD.org/src/rev/443828d7c3af
branches:  cherry-xenmp
changeset: 765612:443828d7c3af
user:      cherry <cherry%NetBSD.org@localhost>
date:      Fri Jun 03 13:27:37 2011 +0000

description:
Initial import of xen MP sources, with kernel and userspace tests.
 - this is a source priview.
 - boots to single user.
 - spurious interrupt and pmap related panics are normal

diffstat:

 sys/arch/amd64/amd64/db_interface.c     |    15 +-
 sys/arch/amd64/amd64/fpu.c              |     8 +-
 sys/arch/amd64/amd64/machdep.c          |     8 +-
 sys/arch/amd64/conf/XEN3_DOMU           |     4 +-
 sys/arch/amd64/conf/std.xen             |     3 +-
 sys/arch/amd64/include/frameasm.h       |    16 +-
 sys/arch/amd64/include/intrdefs.h       |     5 +-
 sys/arch/amd64/include/pmap.h           |    15 +-
 sys/arch/sparc/stand/ofwboot/md5.h      |    55 -
 sys/arch/x68k/include/cdefs.h           |     2 +-
 sys/arch/x68k/include/cpufunc.h         |     2 +-
 sys/arch/x68k/include/ieeefp.h          |     2 +-
 sys/arch/x68k/include/profile.h         |     2 +-
 sys/arch/x68k/include/setjmp.h          |     2 +-
 sys/arch/x68k/usr.bin/Makefile          |     2 +-
 sys/arch/x86/include/cpu.h              |    21 +-
 sys/arch/x86/include/cpuvar.h           |     6 +-
 sys/arch/x86/include/intrdefs.h         |     6 +-
 sys/arch/x86/include/pmap.h             |     4 +-
 sys/arch/x86/x86/ipi.c                  |    23 +-
 sys/arch/x86/x86/pmap.c                 |    98 ++-
 sys/arch/x86/x86/x86_machdep.c          |    23 +-
 sys/arch/xen/conf/files.xen             |     7 +-
 sys/arch/xen/include/amd64/hypercalls.h |    10 +-
 sys/arch/xen/include/evtchn.h           |     4 +-
 sys/arch/xen/include/intr.h             |    26 +-
 sys/arch/xen/include/intrdefs.h         |    17 +
 sys/arch/xen/include/xenpmap.h          |     8 +-
 sys/arch/xen/x86/cpu.c                  |   422 ++++++----
 sys/arch/xen/x86/hypervisor_machdep.c   |     6 +-
 sys/arch/xen/x86/intr.c                 |     9 +-
 sys/arch/xen/x86/x86_xpmap.c            |   173 ++++-
 sys/arch/xen/x86/xen_bus_dma.c          |     6 +-
 sys/arch/xen/x86/xen_ipi.c              |   268 ++++++
 sys/arch/xen/x86/xenfunc.c              |    11 +-
 sys/arch/xen/xen/clock.c                |   203 +++-
 sys/arch/xen/xen/evtchn.c               |   133 ++-
 sys/arch/xen/xen/hypervisor.c           |    43 +-
 sys/arch/xen/xen/xentests.c             |  1187 +++++++++++++++++++++++++++++++
 sys/sys/resourcevar.h                   |     3 +-
 tests/kernel/port-xen/Makefile          |    14 +
 tests/kernel/port-xen/arrayalloc.c      |   130 +++
 tests/kernel/port-xen/arrayalloc.h      |     8 +
 tests/kernel/port-xen/barriers.c        |   182 ++++
 tests/kernel/port-xen/barriers.h        |     9 +
 tests/kernel/port-xen/system.c          |    76 +
 tests/kernel/port-xen/system.h          |     6 +
 tests/kernel/port-xen/t_tlb_thrash.c    |   639 ++++++++++++++++
 tests/kernel/port-xen/t_xen_ipi.c       |   155 ++++
 tests/kernel/port-xen/thread.c          |   398 ++++++++++
 tests/kernel/port-xen/thread.h          |    20 +
 51 files changed, 4083 insertions(+), 412 deletions(-)

diffs (truncated from 6345 to 300 lines):

diff -r 85ad16c043a2 -r 443828d7c3af sys/arch/amd64/amd64/db_interface.c
--- a/sys/arch/amd64/amd64/db_interface.c       Wed Jun 01 11:43:12 2011 +0000
+++ b/sys/arch/amd64/amd64/db_interface.c       Fri Jun 03 13:27:37 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_interface.c,v 1.23 2011/04/03 22:29:25 dyoung Exp $ */
+/*     $NetBSD: db_interface.c,v 1.23.2.1 2011/06/03 13:27:37 cherry Exp $     */
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.23 2011/04/03 22:29:25 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.23.2.1 2011/06/03 13:27:37 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -98,9 +98,13 @@
 {
 
 #ifdef MULTIPROCESSOR
+#ifndef XEN
        ddb_vec = idt_vec_alloc(0xf0, 0xff);
        setgate((struct gate_descriptor *)&idt[ddb_vec], &Xintrddb, 1,
            SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
+#else
+       /* Initialised as part of xen_ipi_init() */
+#endif /* XEN */
 #endif
 }
 
@@ -114,8 +118,10 @@
        int cpu_me = cpu_number();
        int win;
 
+#ifndef XEN
        if (ddb_vec == 0)
                return 1;
+#endif /* XEN */
 
        __cpu_simple_lock(&db_lock);
        if (ddb_cpu == NOCPU)
@@ -123,7 +129,12 @@
        win = (ddb_cpu == cpu_me);
        __cpu_simple_unlock(&db_lock);
        if (win) {
+#ifdef XEN
+               xen_broadcast_ipi(XEN_IPI_DDB);
+#else
                x86_ipi(ddb_vec, LAPIC_DEST_ALLEXCL, LAPIC_DLMODE_FIXED);
+#endif /* XEN */
+
        }
        ddb_mp_online = x86_mp_online;
        x86_mp_online = false;
diff -r 85ad16c043a2 -r 443828d7c3af sys/arch/amd64/amd64/fpu.c
--- a/sys/arch/amd64/amd64/fpu.c        Wed Jun 01 11:43:12 2011 +0000
+++ b/sys/arch/amd64/amd64/fpu.c        Fri Jun 03 13:27:37 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu.c,v 1.34 2011/03/07 02:24:57 cherry Exp $  */
+/*     $NetBSD: fpu.c,v 1.34.2.1 2011/06/03 13:27:37 cherry Exp $      */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.  All
@@ -100,7 +100,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.34 2011/03/07 02:24:57 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.34.2.1 2011/06/03 13:27:37 cherry Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -406,7 +406,11 @@
                        break;
                }
                splx(s);
+#ifdef XEN
+               xen_send_ipi(oci, XEN_IPI_SYNCH_FPU);
+#else /* XEN */
                x86_send_ipi(oci, X86_IPI_SYNCH_FPU);
+#endif
                while (pcb->pcb_fpcpu == oci && ticks == hardclock_ticks) {
                        x86_pause();
                        spins++;
diff -r 85ad16c043a2 -r 443828d7c3af sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c    Wed Jun 01 11:43:12 2011 +0000
+++ b/sys/arch/amd64/amd64/machdep.c    Fri Jun 03 13:27:37 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.160 2011/03/04 22:25:24 joerg Exp $      */
+/*     $NetBSD: machdep.c,v 1.160.2.1 2011/06/03 13:27:37 cherry Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008
@@ -107,7 +107,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.160 2011/03/04 22:25:24 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.160.2.1 2011/06/03 13:27:37 cherry Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -712,7 +712,11 @@
 #endif /* XEN */
        }
 
+#ifdef XEN
+       xen_broadcast_ipi(XEN_IPI_HALT);
+#else /* XEN */
        x86_broadcast_ipi(X86_IPI_HALT);
+#endif
 
        if (howto & RB_HALT) {
 #if NACPICA > 0
diff -r 85ad16c043a2 -r 443828d7c3af sys/arch/amd64/conf/XEN3_DOMU
--- a/sys/arch/amd64/conf/XEN3_DOMU     Wed Jun 01 11:43:12 2011 +0000
+++ b/sys/arch/amd64/conf/XEN3_DOMU     Fri Jun 03 13:27:37 2011 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: XEN3_DOMU,v 1.30 2011/05/28 16:58:51 ryo Exp $
+# $NetBSD: XEN3_DOMU,v 1.30.2.1 2011/06/03 13:27:38 cherry Exp $
 
 include        "arch/amd64/conf/std.xen"
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#options       UVMHIST
+options        UVMHIST
 #options       UVMHIST_PRINT
 #options       SYSCALL_DEBUG
 
diff -r 85ad16c043a2 -r 443828d7c3af sys/arch/amd64/conf/std.xen
--- a/sys/arch/amd64/conf/std.xen       Wed Jun 01 11:43:12 2011 +0000
+++ b/sys/arch/amd64/conf/std.xen       Fri Jun 03 13:27:37 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: std.xen,v 1.6 2009/07/29 12:02:05 cegger Exp $
+# $NetBSD: std.xen,v 1.6.10.1 2011/06/03 13:27:38 cherry Exp $
 # NetBSD: std.i386,v 1.24 2003/02/26 21:33:36 fvdl Exp 
 #
 # standard, required NetBSD/i386 'options'
@@ -13,6 +13,7 @@
 options        EXEC_ELF64      # exec ELF binaries
 options        EXEC_SCRIPT     # exec #! scripts
 options        MTRR
+options                MULTIPROCESSOR
 
 # Atheros HAL options
 include "external/isc/atheros_hal/conf/std.ath_hal"
diff -r 85ad16c043a2 -r 443828d7c3af sys/arch/amd64/include/frameasm.h
--- a/sys/arch/amd64/include/frameasm.h Wed Jun 01 11:43:12 2011 +0000
+++ b/sys/arch/amd64/include/frameasm.h Fri Jun 03 13:27:37 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: frameasm.h,v 1.15 2011/01/12 23:12:11 joerg Exp $      */
+/*     $NetBSD: frameasm.h,v 1.15.6.1 2011/06/03 13:27:38 cherry Exp $ */
 
 #ifndef _AMD64_MACHINE_FRAMEASM_H
 #define _AMD64_MACHINE_FRAMEASM_H
@@ -132,15 +132,13 @@
 
 #ifdef XEN
 #define CLI(temp_reg) \
-       movl CPUVAR(CPUID),%e ## temp_reg ;                     \
-       shlq $6,%r ## temp_reg ;                                \
-       addq CPUVAR(VCPU),%r ## temp_reg ;                      \
-       movb $1,EVTCHN_UPCALL_MASK(%r ## temp_reg)
+       movq CPUVAR(VCPU),%r ## temp_reg ;                      \
+       movb $1,EVTCHN_UPCALL_MASK(%r ## temp_reg);
+
 #define STI(temp_reg) \
-       movl CPUVAR(CPUID),%e ## temp_reg ;                     \
-       shlq $6,%r ## temp_reg ;                                \
-       addq CPUVAR(VCPU),%r ## temp_reg ;                      \
-       movb $0,EVTCHN_UPCALL_MASK(%r ## temp_reg)
+       movq CPUVAR(VCPU),%r ## temp_reg ;                      \
+       movb $0,EVTCHN_UPCALL_MASK(%r ## temp_reg);
+
 #else /* XEN */
 #define CLI(temp_reg) cli
 #define STI(temp_reg) sti
diff -r 85ad16c043a2 -r 443828d7c3af sys/arch/amd64/include/intrdefs.h
--- a/sys/arch/amd64/include/intrdefs.h Wed Jun 01 11:43:12 2011 +0000
+++ b/sys/arch/amd64/include/intrdefs.h Fri Jun 03 13:27:37 2011 +0000
@@ -1,3 +1,6 @@
-/*     $NetBSD: intrdefs.h,v 1.1 2003/04/26 18:39:43 fvdl Exp $        */
+/*     $NetBSD: intrdefs.h,v 1.1.140.1 2011/06/03 13:27:38 cherry Exp $        */
 
 #include <x86/intrdefs.h>
+#ifdef XEN
+#include <xen/intrdefs.h>
+#endif /* XEN */
diff -r 85ad16c043a2 -r 443828d7c3af sys/arch/amd64/include/pmap.h
--- a/sys/arch/amd64/include/pmap.h     Wed Jun 01 11:43:12 2011 +0000
+++ b/sys/arch/amd64/include/pmap.h     Fri Jun 03 13:27:37 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.24 2011/02/01 20:09:08 chuck Exp $  */
+/*     $NetBSD: pmap.h,v 1.24.2.1 2011/06/03 13:27:38 cherry Exp $     */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -276,7 +276,9 @@
 pmap_pte_set(pt_entry_t *pte, pt_entry_t npte)
 {
        int s = splvm();
+       xpq_queue_lock();
        xpq_queue_pte_update(xpmap_ptetomach(pte), npte);
+       xpq_queue_unlock();
        splx(s);
 }
 
@@ -284,12 +286,15 @@
 pmap_pte_cas(volatile pt_entry_t *ptep, pt_entry_t o, pt_entry_t n)
 {
        int s = splvm();
+
+       xpq_queue_lock();
        pt_entry_t opte = *ptep;
 
        if (opte == o) {
                xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(ptep)), n);
                xpq_flush_queue();
        }
+       xpq_queue_unlock();
        splx(s);
        return opte;
 }
@@ -298,9 +303,11 @@
 pmap_pte_testset(volatile pt_entry_t *pte, pt_entry_t npte)
 {
        int s = splvm();
+       xpq_queue_lock();
        pt_entry_t opte = *pte;
        xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)), npte);
        xpq_flush_queue();
+       xpq_queue_unlock();
        splx(s);
        return opte;
 }
@@ -309,8 +316,10 @@
 pmap_pte_setbits(volatile pt_entry_t *pte, pt_entry_t bits)
 {
        int s = splvm();
+       xpq_queue_lock();
        xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)), (*pte) | bits);
        xpq_flush_queue();
+       xpq_queue_unlock();
        splx(s);
 }
 
@@ -318,9 +327,11 @@
 pmap_pte_clearbits(volatile pt_entry_t *pte, pt_entry_t bits)
 {      
        int s = splvm();
+       xpq_queue_lock();
        xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)),
            (*pte) & ~bits);
        xpq_flush_queue();
+       xpq_queue_unlock();
        splx(s);
 }
 
@@ -328,7 +339,9 @@
 pmap_pte_flush(void)
 {
        int s = splvm();
+       xpq_queue_lock();
        xpq_flush_queue();
+       xpq_queue_unlock();
        splx(s);
 }
 #endif
diff -r 85ad16c043a2 -r 443828d7c3af sys/arch/sparc/stand/ofwboot/md5.h
--- a/sys/arch/sparc/stand/ofwboot/md5.h        Wed Jun 01 11:43:12 2011 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*     $NetBSD: md5.h,v 1.5 2006/07/13 20:03:34 uwe Exp $      */
-
-/*
- * This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
- * Algorithm and has been modified by Jason R. Thorpe <thorpej%NetBSD.org@localhost>
- * for portability and formatting.
- */
-
-/*
- * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- * rights reserved.
- *
- * License to copy and use this software is granted provided that it
- * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
- * Algorithm" in all material mentioning or referencing this software
- * or this function.
- * 
- * License is also granted to make and use derivative works provided
- * that such works are identified as "derived from the RSA Data
- * Security, Inc. MD5 Message-Digest Algorithm" in all material
- * mentioning or referencing the derived work.
- * 
- * RSA Data Security, Inc. makes no representations concerning either
- * the merchantability of this software or the suitability of this
- * software for any particular purpose. It is provided "as is"



Home | Main Index | Thread Index | Old Index