From owner-p4-projects@FreeBSD.ORG Sun Aug 7 14:29:51 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7697116A422; Sun, 7 Aug 2005 14:29:50 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1786D16A420 for ; Sun, 7 Aug 2005 14:29:50 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0A4EA43D9A for ; Sun, 7 Aug 2005 14:29:44 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j77EThAU092903 for ; Sun, 7 Aug 2005 14:29:43 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j77ETh7N092900 for perforce@freebsd.org; Sun, 7 Aug 2005 14:29:43 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Sun, 7 Aug 2005 14:29:43 GMT Message-Id: <200508071429.j77ETh7N092900@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 81598 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Aug 2005 14:29:51 -0000 http://perforce.freebsd.org/chv.cgi?CH=81598 Change 81598 by rwatson@rwatson_peppercorn on 2005/08/07 14:29:02 Integrate netsmp: - ia64isms - change in types for sysvshm limits - kobj_machdep_init() - sam's if_free() fix for if_addr_mtx. - jhb takes if_pcn locking by storm - VV_NOKNOTE Affected files ... .. //depot/projects/netsmp/src/sys/alpha/conf/GENERIC.hints#2 integrate .. //depot/projects/netsmp/src/sys/boot/forth/loader.conf#3 integrate .. //depot/projects/netsmp/src/sys/boot/i386/boot2/boot2.c#2 integrate .. //depot/projects/netsmp/src/sys/dev/acpica/acpi_battery.c#4 integrate .. //depot/projects/netsmp/src/sys/dev/puc/puc_ebus.c#2 integrate .. //depot/projects/netsmp/src/sys/dev/uart/uart_bus_ebus.c#2 integrate .. //depot/projects/netsmp/src/sys/dev/uart/uart_cpu_sparc64.c#2 integrate .. //depot/projects/netsmp/src/sys/i386/conf/GENERIC#3 integrate .. //depot/projects/netsmp/src/sys/ia64/ia64/exception.S#2 integrate .. //depot/projects/netsmp/src/sys/ia64/ia64/interrupt.c#2 integrate .. //depot/projects/netsmp/src/sys/ia64/ia64/machdep.c#2 integrate .. //depot/projects/netsmp/src/sys/ia64/ia64/mp_machdep.c#2 integrate .. //depot/projects/netsmp/src/sys/ia64/ia64/pmap.c#2 integrate .. //depot/projects/netsmp/src/sys/ia64/ia64/trap.c#2 integrate .. //depot/projects/netsmp/src/sys/ia64/ia64/vm_machdep.c#2 integrate .. //depot/projects/netsmp/src/sys/ia64/include/ia64_cpu.h#2 integrate .. //depot/projects/netsmp/src/sys/ia64/include/param.h#2 integrate .. //depot/projects/netsmp/src/sys/ia64/include/proc.h#2 integrate .. //depot/projects/netsmp/src/sys/ia64/include/smp.h#2 integrate .. //depot/projects/netsmp/src/sys/kern/subr_kobj.c#2 integrate .. //depot/projects/netsmp/src/sys/kern/sysv_shm.c#2 integrate .. //depot/projects/netsmp/src/sys/kern/vfs_subr.c#4 integrate .. //depot/projects/netsmp/src/sys/net/if.c#10 integrate .. //depot/projects/netsmp/src/sys/net80211/ieee80211_input.c#4 integrate .. //depot/projects/netsmp/src/sys/net80211/ieee80211_node.c#5 integrate .. //depot/projects/netsmp/src/sys/net80211/ieee80211_node.h#3 integrate .. //depot/projects/netsmp/src/sys/pci/if_pcn.c#5 integrate .. //depot/projects/netsmp/src/sys/pci/if_pcnreg.h#2 integrate .. //depot/projects/netsmp/src/sys/sparc64/sparc64/tick.c#2 integrate .. //depot/projects/netsmp/src/sys/sys/ata.h#3 integrate .. //depot/projects/netsmp/src/sys/sys/kobj.h#2 integrate .. //depot/projects/netsmp/src/sys/sys/mount.h#2 integrate .. //depot/projects/netsmp/src/sys/sys/shm.h#2 integrate .. //depot/projects/netsmp/src/sys/sys/vnode.h#3 integrate Differences ... ==== //depot/projects/netsmp/src/sys/alpha/conf/GENERIC.hints#2 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/alpha/conf/GENERIC.hints,v 1.8 2004/07/11 03:07:28 marcel Exp $ +# $FreeBSD: src/sys/alpha/conf/GENERIC.hints,v 1.9 2005/08/06 19:24:22 marcel Exp $ hint.fdc.0.at="isa" hint.fdc.0.port="0x3F0" hint.fdc.0.irq="6" @@ -32,3 +32,10 @@ hint.sio.1.flags="0x80" hint.ppc.0.at="isa" hint.ppc.0.irq="7" +hint.uart.0.at="isa" +hint.uart.0.irq="4" +hint.uart.0.port="0x3F8" +hint.uart.1.at="isa" +hint.uart.1.flags="0x80" +hint.uart.1.irq="3" +hint.uart.1.port="0x2F8" ==== //depot/projects/netsmp/src/sys/boot/forth/loader.conf#3 (text+ko) ==== @@ -6,7 +6,7 @@ # # All arguments must be in double quotes. # -# $FreeBSD: src/sys/boot/forth/loader.conf,v 1.96 2005/07/29 12:41:37 brian Exp $ +# $FreeBSD: src/sys/boot/forth/loader.conf,v 1.98 2005/08/07 09:41:53 krion Exp $ ############################################################## ### Basic configuration options ############################ @@ -91,7 +91,7 @@ #kern.maxswzone="" # Set the max swmeta KVA storage #kern.maxtsiz="" # Set the max text size #kern.maxusers="32" # Set size of various static tables -#kern.nbuf="" # Set the number of buffer headers +#kern.nbuf="" # Set the number of buffer headers #kern.ncallout="" # Set the maximum # of timer events #kern.sgrowsiz="" # Set the amount to grow stack #kern.cam.scsi_delay="2000" # Delay (in ms) before probing SCSI @@ -184,10 +184,16 @@ miibus_load="NO" # miibus support, needed for some drivers if_an_load="NO" # Aironet 4500/4800 802.11 wireless NICs if_ar_load="NO" # Digi SYNC/570i +if_arl_load="NO" # Aironet Arlan 655 wireless network adapter +if_ath_load="NO" # Atheros IEEE 802.11 wireless NICs +if_aue_load="NO" # ADMtek AN986 Pegasus USB Ethernet if_awi_load="NO" # AMD PCnetMobile IEEE 802.11 wireless NICs +if_axe_load="NO" # ASIX Electronics AX88172 USB Ethernet if_bfe_load="NO" # Broadcom BCM4401 if_bge_load="NO" # Broadcom BCM570x PCI gigabit ethernet if_cm_load="NO" # SMC (90c26, 90c56, 90c66) +if_cs_load="NO" # Crystal Semiconductor CS8920 +if_cue_load="NO" # CATC USB-EL1210A USB Ethernet if_dc_load="NO" # DEC/Intel 21143 and various workalikes if_de_load="NO" # DEC DC21x4x ethernet if_ed_load="NO" # National Semiconductor DS8390/WD83C690 ethernet @@ -199,16 +205,19 @@ if_fe_load="NO" # Fujitsu MB86960A/MB86965A based Ethernet adapters if_fxp_load="NO" # Intel EtherExpress PRO/100B (82557, 82558) if_gx_load="NO" # Intel Pro/1000 gigabit ethernet +if_hme_load="NO" # Sun Microelectronics STP2002-STQ Ethernet if_ie_load="NO" # Intel 82586 if_lge_load="NO" # Level 1 LXT1001 NetCellerator PCI gigabit ethernet if_lnc_load="NO" # AMD Lance/PCnet Ethernet if_my_load="NO" # Myson PCI fast ethernet if_nge_load="NO" # National Semiconductor PCI gigabit ethernet +if_nve_load="NO" # NVIDIA nForce MCP Networking Adapter if_oltr_load="NO" # Olicom if_pcn_load="NO" # AMD PCnet PCI if_ray_load="NO" # Raytheon Raylink/Webgear Aviator PCCard if_re_load="NO" # RealTek 8139C+/8169/8169S/8110S if_rl_load="NO" # RealTek 8129/8139 +if_rue_load="NO" # RealTek RTL8150 USB to Fast Ethernet if_sbni_load="NO" # Granch SBNI12 leased line adapters if_sf_load="NO" # Adaptec Duralink PCI (AIC-6915 "starfire") if_sis_load="NO" # Silicon Integrated Systems SiS 900/7016 @@ -221,6 +230,7 @@ if_tx_load="NO" # SMC 83c17x fast ethernet if_txp_load="NO" # 3Com 3XP Typhoon/Sidewinder (3CR990) if_vge_load="NO" # VIA VT6122 PCI Gigabit Ethernet +if_udav_load="NO" # Davicom DM9601 USB Ethernet if_vr_load="NO" # VIA Rhine I and Rhine II if_vx_load="NO" # 3Com 3C590 family if_wb_load="NO" # Winbond W89C840F ==== //depot/projects/netsmp/src/sys/boot/i386/boot2/boot2.c#2 (text+ko) ==== @@ -14,7 +14,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/boot/i386/boot2/boot2.c,v 1.72 2005/05/27 19:26:11 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/i386/boot2/boot2.c,v 1.73 2005/08/06 00:33:42 ssouhlal Exp $"); #include #include @@ -71,7 +71,7 @@ #define PATH_CONFIG "/boot.config" #define PATH_BOOT3 "/boot/loader" -#define PATH_KERNEL "/kernel" +#define PATH_KERNEL "/boot/kernel/kernel" #define ARGS 0x900 #define NOPT 12 ==== //depot/projects/netsmp/src/sys/dev/acpica/acpi_battery.c#4 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_battery.c,v 1.16 2005/07/28 19:34:51 njl Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_battery.c,v 1.17 2005/08/05 17:00:58 njl Exp $"); #include "opt_acpi.h" #include @@ -225,6 +225,10 @@ else bi[i].min = 0; total_min += bi[i].min; + + /* If this battery is not present, don't use its capacity. */ + if (bi[i].cap == -1) + bi[i].cap = 0; total_cap += bi[i].cap; } ==== //depot/projects/netsmp/src/sys/dev/puc/puc_ebus.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/puc/puc_ebus.c,v 1.5 2005/06/04 20:29:28 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/puc/puc_ebus.c,v 1.6 2005/08/07 13:37:25 marius Exp $"); #include "opt_puc.h" @@ -48,10 +48,11 @@ static int puc_ebus_probe(device_t dev) { - const char *nm; + const char *nm, *cmpt; nm = ofw_bus_get_name(dev); - if (!strcmp(nm, "se")) { + cmpt = ofw_bus_get_compat(dev); + if (!strcmp(nm, "se") || (cmpt != NULL && !strcmp(cmpt, "sab82532"))) { device_set_desc(dev, "Siemens SAB 82532 dual channel SCC"); return (0); } ==== //depot/projects/netsmp/src/sys/dev/uart/uart_bus_ebus.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/uart/uart_bus_ebus.c,v 1.6 2005/06/04 21:52:56 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/uart/uart_bus_ebus.c,v 1.7 2005/08/07 13:37:25 marius Exp $"); #include #include @@ -96,7 +96,7 @@ sc->sc_class = &uart_ns8250_class; return (uart_bus_probe(dev, 0, 0, 0, 0)); } - if (!strcmp(nm, "se")) { + if (!strcmp(nm, "se") || (cmpt != NULL && !strcmp(cmpt, "sab82532"))) { sc->sc_class = &uart_sab82532_class; error = uart_bus_probe(dev, 0, 0, 0, 1); return ((error) ? error : -1); ==== //depot/projects/netsmp/src/sys/dev/uart/uart_cpu_sparc64.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/uart/uart_cpu_sparc64.c,v 1.19 2005/06/04 21:33:18 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/uart/uart_cpu_sparc64.c,v 1.20 2005/08/07 13:37:25 marius Exp $"); #include #include @@ -216,7 +216,7 @@ compat[0] = '\0'; di->bas.regshft = 0; di->bas.rclk = 0; - if (!strcmp(buf, "se")) { + if (!strcmp(buf, "se") || !strcmp(compat, "sab82532")) { di->ops = uart_sab82532_ops; /* SAB82532 are only known to be used for TTYs. */ if ((di->bas.chan = uart_cpu_channel(dev)) == 0) ==== //depot/projects/netsmp/src/sys/i386/conf/GENERIC#3 (text+ko) ==== @@ -16,7 +16,7 @@ # If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # -# $FreeBSD: src/sys/i386/conf/GENERIC,v 1.430 2005/07/14 15:39:05 kensmith Exp $ +# $FreeBSD: src/sys/i386/conf/GENERIC,v 1.432 2005/08/06 23:05:48 davidxu Exp $ machine i386 cpu I486_CPU ==== //depot/projects/netsmp/src/sys/ia64/ia64/exception.S#2 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/ia64/ia64/exception.S,v 1.56 2004/09/25 04:27:44 marcel Exp $"); +__FBSDID("$FreeBSD: src/sys/ia64/ia64/exception.S,v 1.57 2005/08/06 20:28:19 marcel Exp $"); #include #include @@ -644,6 +644,7 @@ add r20=24,r18 // collision chain ;; ld8 r21=[r21] // check VHPT tag + ld8 r20=[r20] // bucket head ;; cmp.ne p15,p0=r21,r19 (p15) br.dpnt.few 1f @@ -722,6 +723,7 @@ add r20=24,r18 // collision chain ;; ld8 r21=[r21] // check VHPT tag + ld8 r20=[r20] // bucket head ;; cmp.ne p15,p0=r21,r19 (p15) br.dpnt.few 1f @@ -937,6 +939,8 @@ ttag r19=r16 add r20=24,r18 // collision chain ;; + ld8 r20=[r20] // bucket head + ;; ld8 r20=[r20] // first entry ;; rsm psr.dt // turn off data translations @@ -1003,6 +1007,8 @@ ttag r19=r16 add r20=24,r18 // collision chain ;; + ld8 r20=[r20] // bucket head + ;; ld8 r20=[r20] // first entry ;; rsm psr.dt // turn off data translations @@ -1069,6 +1075,8 @@ ttag r19=r16 add r20=24,r18 // collision chain ;; + ld8 r20=[r20] // bucket head + ;; ld8 r20=[r20] // first entry ;; rsm psr.dt // turn off data translations ==== //depot/projects/netsmp/src/sys/ia64/ia64/interrupt.c#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/ia64/ia64/interrupt.c,v 1.49 2005/04/12 23:18:54 jhb Exp $ */ +/* $FreeBSD: src/sys/ia64/ia64/interrupt.c,v 1.50 2005/08/06 20:28:19 marcel Exp $ */ /* $NetBSD: interrupt.c,v 1.23 1998/02/24 07:38:01 thorpej Exp $ */ /*- @@ -147,6 +147,8 @@ if (vector == 0) { vector = ib->ib_inta; printf("ExtINT interrupt: vector=%ld\n", vector); + if (vector == 15) + goto stray; } if (vector == CLOCK_VECTOR) {/* clock interrupt */ @@ -207,9 +209,11 @@ } else if (vector == ipi_vector[IPI_HIGH_FP]) { struct thread *thr = PCPU_GET(fpcurthread); if (thr != NULL) { + mtx_lock(&thr->td_md.md_highfp_mtx); save_high_fp(&thr->td_pcb->pcb_high_fp); thr->td_pcb->pcb_fpcpu = NULL; PCPU_SET(fpcurthread, NULL); + mtx_unlock(&thr->td_md.md_highfp_mtx); } } else if (vector == ipi_vector[IPI_RENDEZVOUS]) { rdvs[PCPU_GET(cpuid)]++; @@ -239,6 +243,7 @@ ia64_dispatch_intr(tf, vector); } +stray: atomic_subtract_int(&td->td_intr_nesting_level, 1); return (TRAPF_USERMODE(tf)); } ==== //depot/projects/netsmp/src/sys/ia64/ia64/machdep.c#2 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/ia64/ia64/machdep.c,v 1.200 2005/07/05 17:12:18 marcel Exp $"); +__FBSDID("$FreeBSD: src/sys/ia64/ia64/machdep.c,v 1.201 2005/08/06 20:28:19 marcel Exp $"); #include "opt_compat.h" #include "opt_ddb.h" @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -764,8 +765,8 @@ */ proc0kstack = (vm_offset_t)kstack; thread0.td_kstack = proc0kstack; - thread0.td_pcb = (struct pcb *) - (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; + thread0.td_kstack_pages = KSTACK_PAGES; + /* * Setup the global data for the bootstrap cpu. */ @@ -774,6 +775,8 @@ pcpu_init(pcpup, 0, PAGE_SIZE); PCPU_SET(curthread, &thread0); + mutex_init(); + /* * Initialize the rest of proc 0's PCB. * @@ -781,14 +784,11 @@ * and make proc0's trapframe pointer point to it for sanity. * Initialise proc0's backing store to start after u area. */ - thread0.td_frame = (struct trapframe *)thread0.td_pcb - 1; - thread0.td_frame->tf_length = sizeof(struct trapframe); + cpu_thread_setup(&thread0); thread0.td_frame->tf_flags = FRAME_SYSCALL; thread0.td_pcb->pcb_special.sp = (u_int64_t)thread0.td_frame - 16; - thread0.td_pcb->pcb_special.bspstore = (u_int64_t)proc0kstack; - - mutex_init(); + thread0.td_pcb->pcb_special.bspstore = thread0.td_kstack; /* * Initialize the virtual memory system. @@ -1428,7 +1428,6 @@ /* * High FP register functions. - * XXX no synchronization yet. */ int @@ -1438,13 +1437,17 @@ struct pcpu *cpu; struct thread *thr; + mtx_lock(&td->td_md.md_highfp_mtx); pcb = td->td_pcb; cpu = pcb->pcb_fpcpu; - if (cpu == NULL) + if (cpu == NULL) { + mtx_unlock(&td->td_md.md_highfp_mtx); return (0); + } pcb->pcb_fpcpu = NULL; thr = cpu->pc_fpcurthread; cpu->pc_fpcurthread = NULL; + mtx_unlock(&td->td_md.md_highfp_mtx); /* Post-mortem sanity checking. */ KASSERT(thr == td, ("Inconsistent high FP state")); @@ -1462,22 +1465,36 @@ if ((td->td_frame->tf_special.psr & IA64_PSR_MFH) == 0) return (ia64_highfp_drop(td)); + mtx_lock(&td->td_md.md_highfp_mtx); pcb = td->td_pcb; cpu = pcb->pcb_fpcpu; - if (cpu == NULL) + if (cpu == NULL) { + mtx_unlock(&td->td_md.md_highfp_mtx); return (0); + } #ifdef SMP + if (td == curthread) + sched_pin(); if (cpu != pcpup) { - ipi_send(cpu->pc_lid, IPI_HIGH_FP); - while (pcb->pcb_fpcpu != cpu) + mtx_unlock(&td->td_md.md_highfp_mtx); + ipi_send(cpu, IPI_HIGH_FP); + if (td == curthread) + sched_unpin(); + while (pcb->pcb_fpcpu == cpu) DELAY(100); return (1); + } else { + save_high_fp(&pcb->pcb_high_fp); + if (td == curthread) + sched_unpin(); } +#else + save_high_fp(&pcb->pcb_high_fp); #endif - save_high_fp(&pcb->pcb_high_fp); pcb->pcb_fpcpu = NULL; thr = cpu->pc_fpcurthread; cpu->pc_fpcurthread = NULL; + mtx_unlock(&td->td_md.md_highfp_mtx); /* Post-mortem sanity cxhecking. */ KASSERT(thr == td, ("Inconsistent high FP state")); ==== //depot/projects/netsmp/src/sys/ia64/ia64/mp_machdep.c#2 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/ia64/ia64/mp_machdep.c,v 1.55 2005/04/15 00:21:23 marcel Exp $"); +__FBSDID("$FreeBSD: src/sys/ia64/ia64/mp_machdep.c,v 1.56 2005/08/06 20:28:19 marcel Exp $"); #include "opt_kstack_pages.h" @@ -64,8 +64,9 @@ void ia64_ap_startup(void); -extern vm_offset_t vhpt_base, vhpt_size; -extern u_int64_t ia64_lapic_address; +extern uint64_t vhpt_base[]; +extern size_t vhpt_size; +extern uint64_t ia64_lapic_address; #define LID_SAPIC_ID(x) ((int)((x) >> 24) & 0xff) #define LID_SAPIC_EID(x) ((int)((x) >> 16) & 0xff) @@ -74,9 +75,10 @@ int mp_ipi_test = 0; -/* Variables used by os_boot_rendez */ +/* Variables used by os_boot_rendez and ia64_ap_startup */ +struct pcpu *ap_pcpu; void *ap_stack; -struct pcpu *ap_pcpu; +uint64_t ap_vhpt; volatile int ap_delay; volatile int ap_awake; volatile int ap_spin; @@ -86,14 +88,15 @@ void ia64_ap_startup(void) { - ap_awake = 1; - ap_delay = 0; + + pcpup = ap_pcpu; + ia64_set_k4((intptr_t)pcpup); __asm __volatile("mov cr.pta=%0;; srlz.i;;" :: - "r" (vhpt_base + (1<<8) + (vhpt_size<<2) + 1)); + "r" (ap_vhpt + (1<<8) + (vhpt_size<<2) + 1)); - pcpup = ap_pcpu; - ia64_set_k4((intptr_t)pcpup); + ap_awake = 1; + ap_delay = 0; map_pal_code(); map_gateway_page(); @@ -102,7 +105,7 @@ /* Wait until it's time for us to be unleashed */ while (ap_spin) - /* spin */; + DELAY(0); __asm __volatile("ssm psr.i;; srlz.d;;"); @@ -119,7 +122,7 @@ ap_awake++; while (!smp_started) - /* spin */; + DELAY(0); CTR1(KTR_SMP, "SMP: cpu%d launched", PCPU_GET(cpuid)); @@ -242,16 +245,17 @@ pc->pc_current_pmap = kernel_pmap; pc->pc_other_cpus = all_cpus & ~pc->pc_cpumask; if (pc->pc_cpuid > 0) { + ap_pcpu = pc; ap_stack = malloc(KSTACK_PAGES * PAGE_SIZE, M_PMAP, M_WAITOK); - ap_pcpu = pc; + ap_vhpt = vhpt_base[pc->pc_cpuid]; ap_delay = 2000; ap_awake = 0; if (bootverbose) printf("SMP: waking up cpu%d\n", pc->pc_cpuid); - ipi_send(pc->pc_lid, IPI_AP_WAKEUP); + ipi_send(pc, IPI_AP_WAKEUP); do { DELAY(1000); @@ -292,7 +296,7 @@ ap_spin = 0; while (ap_awake != smp_cpus) - /* spin */; + DELAY(0); if (smp_cpus != cpus || cpus != mp_ncpus) { printf("SMP: %d CPUs found; %d CPUs usable; %d CPUs woken\n", @@ -307,13 +311,13 @@ * send an IPI to a set of cpus. */ void -ipi_selected(u_int64_t cpus, int ipi) +ipi_selected(cpumask_t cpus, int ipi) { struct pcpu *pc; SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { if (cpus & pc->pc_cpumask) - ipi_send(pc->pc_lid, ipi); + ipi_send(pc, ipi); } } @@ -326,7 +330,7 @@ struct pcpu *pc; SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { - ipi_send(pc->pc_lid, ipi); + ipi_send(pc, ipi); } } @@ -340,7 +344,7 @@ SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { if (pc != pcpup) - ipi_send(pc->pc_lid, ipi); + ipi_send(pc, ipi); } } @@ -351,7 +355,7 @@ ipi_self(int ipi) { - ipi_send(ia64_get_lid(), ipi); + ipi_send(pcpup, ipi); } /* @@ -360,17 +364,17 @@ * fields are used here. */ void -ipi_send(u_int64_t lid, int ipi) +ipi_send(struct pcpu *cpu, int ipi) { - volatile u_int64_t *pipi; - u_int64_t vector; + volatile uint64_t *pipi; + uint64_t vector; pipi = __MEMIO_ADDR(ia64_lapic_address | - ((lid & LID_SAPIC_MASK) >> 12)); - vector = (u_int64_t)(ipi_vector[ipi] & 0xff); + ((cpu->pc_lid & LID_SAPIC_MASK) >> 12)); + vector = (uint64_t)(ipi_vector[ipi] & 0xff); + *pipi = vector; CTR3(KTR_SMP, "ipi_send(%p, %ld), cpuid=%d", pipi, vector, PCPU_GET(cpuid)); - *pipi = vector; } SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_FIRST, cpu_mp_unleash, NULL); ==== //depot/projects/netsmp/src/sys/ia64/ia64/pmap.c#2 (text+ko) ==== @@ -46,7 +46,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/ia64/ia64/pmap.c,v 1.160 2005/06/10 03:33:36 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/ia64/ia64/pmap.c,v 1.161 2005/08/06 20:28:19 marcel Exp $"); #include #include @@ -155,8 +155,15 @@ vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss) */ vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */ -vm_offset_t vhpt_base, vhpt_size; -struct mtx pmap_vhptmutex; +struct ia64_bucket { + uint64_t chain; + struct mtx mutex; + u_int length; +}; + +struct ia64_bucket *vhpt_bucket; +uint64_t vhpt_base[MAXCPU]; +size_t vhpt_size; /* * Kernel virtual memory management. @@ -177,6 +184,7 @@ static uint64_t pmap_ptc_e_count2 = 2; static uint64_t pmap_ptc_e_stride1 = 0x2000; static uint64_t pmap_ptc_e_stride2 = 0x100000000; +struct mtx pmap_ptcmutex; /* * Data for the RID allocator @@ -204,14 +212,11 @@ * VHPT instrumentation. */ static int pmap_vhpt_inserts; -static int pmap_vhpt_collisions; static int pmap_vhpt_resident; SYSCTL_DECL(_vm_stats); SYSCTL_NODE(_vm_stats, OID_AUTO, vhpt, CTLFLAG_RD, 0, ""); SYSCTL_INT(_vm_stats_vhpt, OID_AUTO, inserts, CTLFLAG_RD, &pmap_vhpt_inserts, 0, ""); -SYSCTL_INT(_vm_stats_vhpt, OID_AUTO, collisions, CTLFLAG_RD, - &pmap_vhpt_collisions, 0, ""); SYSCTL_INT(_vm_stats_vhpt, OID_AUTO, resident, CTLFLAG_RD, &pmap_vhpt_resident, 0, ""); @@ -257,8 +262,11 @@ void pmap_bootstrap() { + struct ia64_pal_result res; + struct ia64_lpte *pte; + vm_offset_t base, limit; + size_t size; int i, j, count, ridbits; - struct ia64_pal_result res; /* * Query the PAL Code to find the loop parameters for the @@ -280,6 +288,7 @@ pmap_ptc_e_count2, pmap_ptc_e_stride1, pmap_ptc_e_stride2); + mtx_init(&pmap_ptcmutex, "Global PTC lock", NULL, MTX_SPIN); /* * Setup RIDs. RIDs 0..7 are reserved for the kernel. @@ -335,7 +344,8 @@ kernel_vm_end = NKPT * PAGE_SIZE * NKPTEPG + VM_MIN_KERNEL_ADDRESS - VM_GATEWAY_SIZE; - for (i = 0; phys_avail[i+2]; i+= 2) ; + for (i = 0; phys_avail[i+2]; i+= 2) + ; count = i+2; /* @@ -345,19 +355,20 @@ * size and aligned to a natural boundary). */ vhpt_size = 15; - while ((1<>= 1; + } else + vhpt_base[0] = IA64_PHYS_TO_RR7(base); } if (vhpt_size < 15) panic("Can't find space for VHPT"); if (bootverbose) - printf("Putting VHPT at %p\n", (void *) vhpt_base); - if (vhpt_base != phys_avail[i]) { - /* - * Split this region. - */ + printf("Putting VHPT at 0x%lx\n", base); + + if (base != phys_avail[i]) { + /* Split this region. */ if (bootverbose) - printf("Splitting [%p-%p]\n", - (void *) phys_avail[i], - (void *) phys_avail[i+1]); + printf("Splitting [%p-%p]\n", (void *)phys_avail[i], + (void *)phys_avail[i+1]); for (j = count; j > i; j -= 2) { phys_avail[j] = phys_avail[j-2]; phys_avail[j+1] = phys_avail[j-2+1]; } - phys_avail[count+2] = 0; - phys_avail[count+3] = 0; - phys_avail[i+1] = vhpt_base; - phys_avail[i+2] = vhpt_base + (1L << vhpt_size); - } else { - phys_avail[i] = vhpt_base + (1L << vhpt_size); + phys_avail[i+1] = base; + phys_avail[i+2] = limit; + } else + phys_avail[i] = limit; + + count = size / sizeof(struct ia64_lpte); + + vhpt_bucket = (void *)pmap_steal_memory(count * sizeof(struct ia64_bucket)); + pte = (struct ia64_lpte *)vhpt_base[0]; + for (i = 0; i < count; i++) { + pte[i].pte = 0; + pte[i].itir = 0; + pte[i].tag = 1UL << 63; /* Invalid tag */ + pte[i].chain = (uintptr_t)(vhpt_bucket + i); + /* Stolen memory is zeroed! */ + mtx_init(&vhpt_bucket[i].mutex, "VHPT bucket lock", NULL, + MTX_SPIN); } - vhpt_base = IA64_PHYS_TO_RR7(vhpt_base); - bzero((void *) vhpt_base, (1L << vhpt_size)); + for (i = 1; i < MAXCPU; i++) { + vhpt_base[i] = vhpt_base[i - 1] + size; + bcopy((void *)vhpt_base[i - 1], (void *)vhpt_base[i], size); + } - mtx_init(&pmap_vhptmutex, "VHPT collision chain lock", NULL, MTX_DEF); - - __asm __volatile("mov cr.pta=%0;; srlz.i;;" - :: "r" (vhpt_base + (1<<8) + (vhpt_size<<2) + 1)); + __asm __volatile("mov cr.pta=%0;; srlz.i;;" :: + "r" (vhpt_base[0] + (1<<8) + (vhpt_size<<2) + 1)); virtual_avail = VM_MIN_KERNEL_ADDRESS; virtual_end = VM_MAX_KERNEL_ADDRESS; @@ -494,12 +512,73 @@ * Manipulate TLBs for a pmap ***************************************************/ +#if 0 +static __inline void +pmap_invalidate_page_locally(void *arg) +{ + vm_offset_t va = (uintptr_t)arg; + struct ia64_lpte *pte; + + pte = (struct ia64_lpte *)ia64_thash(va); + if (pte->tag == ia64_ttag(va)) + pte->tag = 1UL << 63; + ia64_ptc_l(va, PAGE_SHIFT << 2); +} + +#ifdef SMP static void +pmap_invalidate_page_1(void *arg) +{ + void **args = arg; + pmap_t oldpmap; + + critical_enter(); + oldpmap = pmap_install(args[0]); + pmap_invalidate_page_locally(args[1]); + pmap_install(oldpmap); + critical_exit(); +} +#endif + +static void +pmap_invalidate_page(pmap_t pmap, vm_offset_t va) +{ + + KASSERT((pmap == kernel_pmap || pmap == PCPU_GET(current_pmap)), + ("invalidating TLB for non-current pmap")); + +#ifdef SMP + if (mp_ncpus > 1) { + void *args[2]; + args[0] = pmap; + args[1] = (void *)va; + smp_rendezvous(NULL, pmap_invalidate_page_1, NULL, args); + } else +#endif + pmap_invalidate_page_locally((void *)va); +} +#endif /* 0 */ + +static void pmap_invalidate_page(pmap_t pmap, vm_offset_t va) { + struct ia64_lpte *pte; + int i, vhpt_ofs; + KASSERT((pmap == kernel_pmap || pmap == PCPU_GET(current_pmap)), ("invalidating TLB for non-current pmap")); - ia64_ptc_g(va, PAGE_SHIFT << 2); + + vhpt_ofs = ia64_thash(va) - vhpt_base[PCPU_GET(cpuid)]; + critical_enter(); + for (i = 0; i < MAXCPU; i++) { + pte = (struct ia64_lpte *)(vhpt_base[i] + vhpt_ofs); + if (pte->tag == ia64_ttag(va)) + pte->tag = 1UL << 63; + } + critical_exit(); + mtx_lock_spin(&pmap_ptcmutex); + ia64_ptc_ga(va, PAGE_SHIFT << 2); + mtx_unlock_spin(&pmap_ptcmutex); } static void @@ -507,9 +586,8 @@ { uint64_t addr; int i, j; - register_t psr; - psr = intr_disable(); + critical_enter(); addr = pmap_ptc_e_base; for (i = 0; i < pmap_ptc_e_count1; i++) { for (j = 0; j < pmap_ptc_e_count2; j++) { @@ -518,21 +596,22 @@ } addr += pmap_ptc_e_stride1; } - intr_restore(psr); + critical_exit(); } static void pmap_invalidate_all(pmap_t pmap) { + KASSERT((pmap == kernel_pmap || pmap == PCPU_GET(current_pmap)), ("invalidating TLB for non-current pmap")); - #ifdef SMP - smp_rendezvous(0, pmap_invalidate_all_1, 0, 0); -#else - pmap_invalidate_all_1(0); + if (mp_ncpus > 1) + smp_rendezvous(NULL, pmap_invalidate_all_1, NULL, NULL); + else #endif + pmap_invalidate_all_1(NULL); } static uint32_t @@ -582,48 +661,7 @@ mtx_unlock(&pmap_ridmutex); } -/*************************************************** - * Low level helper routines..... - ***************************************************/ - /* - * Install a pte into the VHPT - */ -static PMAP_INLINE void -pmap_install_pte(struct ia64_lpte *vhpte, struct ia64_lpte *pte) -{ - uint64_t *vhp, *p; - - vhp = (uint64_t *)vhpte; - p = (uint64_t *)pte; - - critical_enter(); - - /* Invalidate the tag so the VHPT walker will not match this entry. */ - vhp[2] = 1UL << 63; - ia64_mf(); - - vhp[0] = p[0]; - vhp[1] = p[1]; - ia64_mf(); - - /* Install a proper tag now that we're done. */ - vhp[2] = p[2]; - ia64_mf(); - - critical_exit(); -} - -/* - * Compare essential parts of pte. - */ -static PMAP_INLINE int -pmap_equal_pte(struct ia64_lpte *pte1, struct ia64_lpte *pte2) -{ - return *(uint64_t *) pte1 == *(uint64_t *) pte2; >>> TRUNCATED FOR MAIL (1000 lines) <<<