Date: Sat, 6 Nov 2004 12:39:32 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 64416 for review Message-ID: <200411061239.iA6CdWbI089462@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=64416 Change 64416 by rwatson@rwatson_zoo on 2004/11/06 12:39:14 Integ netperf_socket: - Alpha uses cpu id model consistent with other platforms, mapping from pal id to a logical id. - busdma KTR tracing merged to amd64. - non-atomic interrupt counters on amd64, i386. - amd64 invades i386. - Per-CPU disable capability for amd64 using hints. - Various armisms. - Securelevel back in specfs. - NTFS, UFS fixed up for geom and bufobj world order. - GEOM mirror shutdown much cleaned up. - Entropy registration cleanup for interrupt handlers. Storm detection cleanup. - When shutting down on amd64 and i386, pin to CPU 0 to satisfy ACPI. - Various VMisms. - i386 HZ is now 1000. - ng_timeout facility. - swapoff() fixes. - Start of UMA cleanup for per-cpu caches using critical sections. - Misc changes, fixes, etc. Netperf: - UDP use of global variables to hold temporary socket addresses eliminated, fixing a race when udp_input() is run in parallel. Affected files ... .. //depot/projects/netperf_socket/sys/alpha/alpha/machdep.c#9 integrate .. //depot/projects/netperf_socket/sys/alpha/alpha/mp_machdep.c#2 integrate .. //depot/projects/netperf_socket/sys/alpha/include/pcpu.h#2 integrate .. //depot/projects/netperf_socket/sys/alpha/include/smp.h#2 integrate .. //depot/projects/netperf_socket/sys/amd64/amd64/busdma_machdep.c#6 integrate .. //depot/projects/netperf_socket/sys/amd64/amd64/intr_machdep.c#8 integrate .. //depot/projects/netperf_socket/sys/amd64/amd64/mp_machdep.c#14 integrate .. //depot/projects/netperf_socket/sys/arm/arm/cpufunc.c#4 integrate .. //depot/projects/netperf_socket/sys/arm/arm/critical.c#2 integrate .. //depot/projects/netperf_socket/sys/arm/arm/elf_machdep.c#4 integrate .. //depot/projects/netperf_socket/sys/arm/arm/fusu.S#3 integrate .. //depot/projects/netperf_socket/sys/arm/arm/identcpu.c#3 integrate .. //depot/projects/netperf_socket/sys/arm/arm/locore.S#4 integrate .. //depot/projects/netperf_socket/sys/arm/arm/machdep.c#6 integrate .. //depot/projects/netperf_socket/sys/arm/arm/support.S#4 integrate .. //depot/projects/netperf_socket/sys/arm/arm/swtch.S#3 integrate .. //depot/projects/netperf_socket/sys/arm/arm/trap.c#3 integrate .. //depot/projects/netperf_socket/sys/arm/arm/vm_machdep.c#5 integrate .. //depot/projects/netperf_socket/sys/arm/include/atomic.h#2 integrate .. //depot/projects/netperf_socket/sys/arm/include/cpu.h#3 integrate .. //depot/projects/netperf_socket/sys/arm/include/cpuconf.h#2 integrate .. //depot/projects/netperf_socket/sys/arm/include/cpufunc.h#4 integrate .. //depot/projects/netperf_socket/sys/arm/include/endian.h#5 integrate .. //depot/projects/netperf_socket/sys/arm/include/param.h#4 integrate .. //depot/projects/netperf_socket/sys/arm/include/pcpu.h#2 integrate .. //depot/projects/netperf_socket/sys/arm/include/reg.h#2 integrate .. //depot/projects/netperf_socket/sys/arm/xscale/i80321/iq31244_machdep.c#2 integrate .. //depot/projects/netperf_socket/sys/boot/i386/boot0/boot0.S#5 integrate .. //depot/projects/netperf_socket/sys/contrib/pf/net/pf_if.c#6 integrate .. //depot/projects/netperf_socket/sys/dev/em/if_em.c#12 integrate .. //depot/projects/netperf_socket/sys/dev/random/randomdev_soft.c#8 integrate .. //depot/projects/netperf_socket/sys/dev/snp/snp.c#9 integrate .. //depot/projects/netperf_socket/sys/dev/usb/ehci.c#10 integrate .. //depot/projects/netperf_socket/sys/dev/vinum/COPYRIGHT#2 delete .. //depot/projects/netperf_socket/sys/dev/vinum/makestatetext#2 delete .. //depot/projects/netperf_socket/sys/dev/vinum/request.h#2 delete .. //depot/projects/netperf_socket/sys/dev/vinum/statetexts.h#2 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinum.c#5 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumconfig.c#5 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumdaemon.c#2 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumext.h#5 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumhdr.h#3 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinuminterrupt.c#3 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumio.c#7 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumio.h#2 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumioctl.c#4 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumkw.h#2 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumlock.c#2 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinummemory.c#4 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumobj.h#4 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumparser.c#2 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumraid5.c#2 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumrequest.c#4 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumrevive.c#2 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumstate.c#2 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumstate.h#2 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumutil.c#3 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumutil.h#2 delete .. //depot/projects/netperf_socket/sys/dev/vinum/vinumvar.h#4 delete .. //depot/projects/netperf_socket/sys/fs/devfs/devfs_vnops.c#7 integrate .. //depot/projects/netperf_socket/sys/fs/fifofs/fifo_vnops.c#12 integrate .. //depot/projects/netperf_socket/sys/fs/ntfs/ntfs.h#3 integrate .. //depot/projects/netperf_socket/sys/fs/ntfs/ntfs_subr.c#3 integrate .. //depot/projects/netperf_socket/sys/fs/ntfs/ntfs_vfsops.c#6 integrate .. //depot/projects/netperf_socket/sys/geom/geom_vfs.c#2 integrate .. //depot/projects/netperf_socket/sys/geom/mirror/g_mirror.c#14 integrate .. //depot/projects/netperf_socket/sys/geom/mirror/g_mirror.h#7 integrate .. //depot/projects/netperf_socket/sys/geom/raid3/g_raid3.c#8 integrate .. //depot/projects/netperf_socket/sys/geom/raid3/g_raid3.h#4 integrate .. //depot/projects/netperf_socket/sys/gnu/ext2fs/ext2_vnops.c#9 integrate .. //depot/projects/netperf_socket/sys/i386/acpica/acpi_asus.c#10 integrate .. //depot/projects/netperf_socket/sys/i386/i386/intr_machdep.c#8 integrate .. //depot/projects/netperf_socket/sys/i386/include/sysarch.h#3 integrate .. //depot/projects/netperf_socket/sys/kern/kern_intr.c#13 integrate .. //depot/projects/netperf_socket/sys/kern/kern_physio.c#6 integrate .. //depot/projects/netperf_socket/sys/kern/kern_shutdown.c#18 integrate .. //depot/projects/netperf_socket/sys/kern/kern_subr.c#8 integrate .. //depot/projects/netperf_socket/sys/kern/kern_thread.c#29 integrate .. //depot/projects/netperf_socket/sys/kern/subr_param.c#6 integrate .. //depot/projects/netperf_socket/sys/kern/subr_sleepqueue.c#11 integrate .. //depot/projects/netperf_socket/sys/kern/tty.c#17 integrate .. //depot/projects/netperf_socket/sys/kern/uipc_jumbo.c#3 integrate .. //depot/projects/netperf_socket/sys/kern/uipc_syscalls.c#28 integrate .. //depot/projects/netperf_socket/sys/kern/vfs_aio.c#11 integrate .. //depot/projects/netperf_socket/sys/kern/vfs_bio.c#13 integrate .. //depot/projects/netperf_socket/sys/kern/vfs_cluster.c#6 integrate .. //depot/projects/netperf_socket/sys/kern/vfs_default.c#8 integrate .. //depot/projects/netperf_socket/sys/kern/vfs_subr.c#26 integrate .. //depot/projects/netperf_socket/sys/modules/vinum/Makefile#2 delete .. //depot/projects/netperf_socket/sys/netgraph/atm/sscop/ng_sscop_cust.h#2 integrate .. //depot/projects/netperf_socket/sys/netgraph/atm/uni/ng_uni_cust.h#3 integrate .. //depot/projects/netperf_socket/sys/netgraph/bluetooth/hci/ng_hci_main.c#4 integrate .. //depot/projects/netperf_socket/sys/netgraph/bluetooth/hci/ng_hci_misc.c#4 integrate .. //depot/projects/netperf_socket/sys/netgraph/bluetooth/hci/ng_hci_var.h#3 integrate .. //depot/projects/netperf_socket/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c#4 integrate .. //depot/projects/netperf_socket/sys/netgraph/bluetooth/l2cap/ng_l2cap_var.h#3 integrate .. //depot/projects/netperf_socket/sys/netgraph/ng_base.c#13 integrate .. //depot/projects/netperf_socket/sys/netinet/ip_fastfwd.c#13 integrate .. //depot/projects/netperf_socket/sys/netinet/udp_usrreq.c#17 integrate .. //depot/projects/netperf_socket/sys/nfsclient/nfs_bio.c#12 integrate .. //depot/projects/netperf_socket/sys/pc98/conf/GENERIC#17 integrate .. //depot/projects/netperf_socket/sys/sparc64/sparc64/pmap.c#14 integrate .. //depot/projects/netperf_socket/sys/sys/buf.h#7 integrate .. //depot/projects/netperf_socket/sys/sys/param.h#31 integrate .. //depot/projects/netperf_socket/sys/sys/syslog.h#3 integrate .. //depot/projects/netperf_socket/sys/sys/ttydefaults.h#5 integrate .. //depot/projects/netperf_socket/sys/ufs/ffs/ffs_vfsops.c#12 integrate .. //depot/projects/netperf_socket/sys/ufs/ufs/ufs_vnops.c#11 integrate .. //depot/projects/netperf_socket/sys/vm/swap_pager.c#11 integrate .. //depot/projects/netperf_socket/sys/vm/uma_core.c#16 integrate .. //depot/projects/netperf_socket/sys/vm/vm_contig.c#12 integrate .. //depot/projects/netperf_socket/sys/vm/vm_glue.c#15 integrate .. //depot/projects/netperf_socket/sys/vm/vm_object.c#12 integrate .. //depot/projects/netperf_socket/sys/vm/vm_object.h#5 integrate .. //depot/projects/netperf_socket/sys/vm/vm_page.c#17 integrate .. //depot/projects/netperf_socket/sys/vm/vm_pageout.c#12 integrate .. //depot/projects/netperf_socket/sys/vm/vm_pager.c#5 integrate .. //depot/projects/netperf_socket/sys/vm/vm_zeroidle.c#8 integrate .. //depot/projects/netperf_socket/sys/vm/vnode_pager.c#8 integrate Differences ... ==== //depot/projects/netperf_socket/sys/alpha/alpha/machdep.c#9 (text+ko) ==== @@ -88,7 +88,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/alpha/machdep.c,v 1.223 2004/09/05 02:09:51 julian Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/alpha/machdep.c,v 1.224 2004/11/05 19:16:43 jhb Exp $"); #include "opt_compat.h" #include "opt_ddb.h" @@ -864,7 +864,8 @@ /* This is not a 'struct user' */ size_t sz = round_page(KSTACK_PAGES * PAGE_SIZE); pcpup = (struct pcpu *) pmap_steal_memory(sz); - pcpu_init(pcpup, alpha_pal_whami(), sz); + pcpu_init(pcpup, 0, sz); + pcpup->pc_pal_id = alpha_pal_whami(); alpha_pal_wrval((u_int64_t) pcpup); PCPU_GET(next_asn) = 1; /* 0 used for proc0 pmap */ PCPU_SET(curthread, &thread0); ==== //depot/projects/netperf_socket/sys/alpha/alpha/mp_machdep.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/alpha/mp_machdep.c,v 1.52 2004/01/07 23:00:20 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/alpha/mp_machdep.c,v 1.53 2004/11/05 19:16:43 jhb Exp $"); #include "opt_kstack_pages.h" @@ -61,23 +61,23 @@ static struct mtx ap_boot_mtx; -u_int boot_cpu_id; +u_int64_t boot_cpu_id; static void release_aps(void *dummy); static int smp_cpu_enabled(struct pcs *pcsp); extern void smp_init_secondary_glue(void); -static int smp_send_secondary_command(const char *command, int cpuid); -static int smp_start_secondary(int cpuid); +static int smp_send_secondary_command(const char *command, int pal_id); +static int smp_start_secondary(int pal_id, int cpuid); /* * Communicate with a console running on a secondary processor. * Return 1 on failure. */ static int -smp_send_secondary_command(const char *command, int cpuid) +smp_send_secondary_command(const char *command, int pal_id) { - u_int64_t mask = 1L << cpuid; - struct pcs *cpu = LOCATE_PCS(hwrpb, cpuid); + u_int64_t mask = 1L << pal_id; + struct pcs *cpu = LOCATE_PCS(hwrpb, pal_id); int i, len; /* @@ -165,7 +165,7 @@ /* * Set flags in our per-CPU slot in the HWRPB. */ - cpu = LOCATE_PCS(hwrpb, PCPU_GET(cpuid)); + cpu = LOCATE_PCS(hwrpb, PCPU_GET(pal_id)); cpu->pcs_flags &= ~PCS_BIP; cpu->pcs_flags |= PCS_RC; alpha_mb(); @@ -216,9 +216,9 @@ } static int -smp_start_secondary(int cpuid) +smp_start_secondary(int pal_id, int cpuid) { - struct pcs *cpu = LOCATE_PCS(hwrpb, cpuid); + struct pcs *cpu = LOCATE_PCS(hwrpb, pal_id); struct pcs *bootcpu = LOCATE_PCS(hwrpb, boot_cpu_id); struct alpha_pcb *pcb = (struct alpha_pcb *) cpu->pcs_hwpcb; struct pcpu *pcpu; @@ -226,12 +226,12 @@ size_t sz; if ((cpu->pcs_flags & PCS_PV) == 0) { - printf("smp_start_secondary: cpu %d PALcode invalid\n", cpuid); + printf("smp_start_secondary: cpu %d PALcode invalid\n", pal_id); return 0; } if (bootverbose) - printf("smp_start_secondary: starting cpu %d\n", cpuid); + printf("smp_start_secondary: starting cpu %d\n", pal_id); sz = round_page((UAREA_PAGES + KSTACK_PAGES) * PAGE_SIZE); pcpu = malloc(sz, M_TEMP, M_NOWAIT); @@ -241,6 +241,7 @@ } pcpu_init(pcpu, cpuid, sz); + pcpu->pc_pal_id = pal_id; /* * Copy the idle pcb and setup the address to start executing. @@ -270,7 +271,7 @@ /* * Fire it up and hope for the best. */ - if (!smp_send_secondary_command("START\r\n", cpuid)) { + if (!smp_send_secondary_command("START\r\n", pal_id)) { printf("smp_start_secondary: can't send START command\n"); pcpu_destroy(pcpu); free(pcpu, M_TEMP); @@ -296,7 +297,7 @@ * It worked (I think). */ if (bootverbose) - printf("smp_start_secondary: cpu %d started\n", cpuid); + printf("smp_start_secondary: cpu %d started\n", pal_id); return 1; } @@ -329,16 +330,18 @@ void cpu_mp_setmaxid(void) { - int i; + u_int64_t i; mp_maxid = 0; - for (i = 0; i < hwrpb->rpb_pcs_cnt && i < MAXCPU; i++) { - if (i == PCPU_GET(cpuid)) + for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) { + if (i == PCPU_GET(pal_id)) continue; if (!smp_cpu_enabled(LOCATE_PCS(hwrpb, i))) continue; - mp_maxid = i; + mp_maxid++; } + if (mp_maxid > MAXCPU) + mp_maxid = MAXCPU; } int @@ -348,7 +351,7 @@ /* XXX: Need to check for valid platforms here. */ - boot_cpu_id = PCPU_GET(cpuid); + boot_cpu_id = PCPU_GET(pal_id); KASSERT(boot_cpu_id == hwrpb->rpb_primary_cpu_id, ("cpu_mp_probe() called on non-primary CPU")); all_cpus = PCPU_GET(cpumask); @@ -358,12 +361,10 @@ /* Make sure we have at least one secondary CPU. */ cpus = 0; for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) { - if (i == PCPU_GET(cpuid)) + if (i == PCPU_GET(pal_id)) continue; if (!smp_cpu_enabled(LOCATE_PCS(hwrpb, i))) continue; - if (i > MAXCPU) - continue; cpus++; } return (cpus); @@ -372,10 +373,11 @@ void cpu_mp_start(void) { - int i; + int i, cpuid; mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); + cpuid = 1; for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) { struct pcs *pcsp; @@ -410,22 +412,30 @@ printf("CPU %d disabled by loader.\n", i); continue; } - all_cpus |= (1 << i); - mp_ncpus++; + if (smp_start_secondary(i, cpuid)) { + all_cpus |= (1 << cpuid); + mp_ncpus++; + cpuid++; + } } PCPU_SET(other_cpus, all_cpus & ~PCPU_GET(cpumask)); - - for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) { - if (i == boot_cpu_id) - continue; - if (!CPU_ABSENT(i)) - smp_start_secondary(i); - } } void cpu_mp_announce(void) { + struct pcpu *pc; + int i; + + /* List CPUs */ + printf(" cpu0 (BSP): PAL ID: %2lu\n", boot_cpu_id); + for (i = 1; i < MAXCPU; i++) { + if (CPU_ABSENT(i)) + continue; + pc = pcpu_find(i); + MPASS(pc != NULL); + printf(" cpu%d (AP): PAL ID: %2lu\n", i, pc->pc_pal_id); + } } /* @@ -446,8 +456,9 @@ if (pcpu) { atomic_set_64(&pcpu->pc_pending_ipis, ipi); alpha_mb(); - CTR1(KTR_SMP, "calling alpha_pal_wripir(%d)", cpuid); - alpha_pal_wripir(cpuid); + CTR1(KTR_SMP, "calling alpha_pal_wripir(%d)", + pcpu->pc_pal_id); + alpha_pal_wripir(pcpu->pc_pal_id); } } } @@ -529,8 +540,8 @@ * requests to provide PALcode to secondaries and to start up new * secondaries that are added to the system on the fly. */ - if (PCPU_GET(cpuid) == boot_cpu_id) { - u_int cpuid; + if (PCPU_GET(pal_id) == boot_cpu_id) { + u_int pal_id; u_int64_t txrdy; #ifdef DIAGNOSTIC struct pcs *cpu; @@ -539,18 +550,18 @@ alpha_mb(); while (hwrpb->rpb_txrdy != 0) { - cpuid = ffs(hwrpb->rpb_txrdy) - 1; + pal_id = ffs(hwrpb->rpb_txrdy) - 1; #ifdef DIAGNOSTIC - cpu = LOCATE_PCS(hwrpb, cpuid); + cpu = LOCATE_PCS(hwrpb, pal_id); bcopy(&cpu->pcs_buffer.txbuf, buf, cpu->pcs_buffer.txlen); buf[cpu->pcs_buffer.txlen] = '\0'; - printf("SMP From CPU%d: %s\n", cpuid, buf); + printf("SMP From CPU%d: %s\n", pal_id, buf); #endif do { txrdy = hwrpb->rpb_txrdy; } while (atomic_cmpset_64(&hwrpb->rpb_txrdy, txrdy, - txrdy & ~(1 << cpuid)) == 0); + txrdy & ~(1 << pal_id)) == 0); } } } ==== //depot/projects/netperf_socket/sys/alpha/include/pcpu.h#2 (text+ko) ==== @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/alpha/include/pcpu.h,v 1.14 2001/12/11 23:33:39 jhb Exp $ + * $FreeBSD: src/sys/alpha/include/pcpu.h,v 1.15 2004/11/05 19:16:44 jhb Exp $ */ #ifndef _MACHINE_PCPU_H_ @@ -34,6 +34,7 @@ #define PCPU_MD_FIELDS \ struct alpha_pcb pc_idlepcb; /* pcb for idling */ \ + u_int64_t pc_pal_id; /* physical CPU ID */ \ u_int64_t pc_idlepcbphys; /* pa of pc_idlepcb */ \ u_int64_t pc_pending_ipis; /* pending IPI's */ \ u_int32_t pc_next_asn; /* next ASN to alloc */ \ ==== //depot/projects/netperf_socket/sys/alpha/include/smp.h#2 (text+ko) ==== @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $FreeBSD: src/sys/alpha/include/smp.h,v 1.6 2001/08/13 22:41:15 jhb Exp $ + * $FreeBSD: src/sys/alpha/include/smp.h,v 1.7 2004/11/05 19:16:44 jhb Exp $ * */ @@ -26,7 +26,7 @@ #ifndef LOCORE -extern u_int boot_cpu_id; +extern u_int64_t boot_cpu_id; void ipi_selected(u_int cpus, u_int64_t ipi); void ipi_all(u_int64_t ipi); ==== //depot/projects/netperf_socket/sys/amd64/amd64/busdma_machdep.c#6 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/busdma_machdep.c,v 1.58 2004/09/08 04:54:18 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/busdma_machdep.c,v 1.59 2004/11/05 18:24:01 peter Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -33,12 +33,14 @@ #include <sys/bus.h> #include <sys/interrupt.h> #include <sys/kernel.h> +#include <sys/ktr.h> #include <sys/lock.h> #include <sys/proc.h> #include <sys/mutex.h> #include <sys/mbuf.h> #include <sys/uio.h> #include <sys/sysctl.h> +#include <sys/ktr.h> #include <vm/vm.h> #include <vm/vm_page.h> @@ -218,8 +220,11 @@ *dmat = NULL; newtag = (bus_dma_tag_t)malloc(sizeof(*newtag), M_DEVBUF, M_NOWAIT); - if (newtag == NULL) + if (newtag == NULL) { + CTR3(KTR_BUSDMA, "bus_dma_tag_create returned tag %p tag " + "flags 0x%x error %d", newtag, 0, error); return (ENOMEM); + } newtag->parent = parent; newtag->alignment = alignment; @@ -296,16 +301,26 @@ } else { *dmat = newtag; } + CTR3(KTR_BUSDMA, "bus_dma_tag_create returned tag %p tag flags 0x%x " + "error %d", newtag, (newtag != NULL ? newtag->flags : 0), error); return (error); } int bus_dma_tag_destroy(bus_dma_tag_t dmat) { + bus_dma_tag_t dmat_copy; + int error; + + error = 0; + dmat_copy = dmat; + if (dmat != NULL) { - if (dmat->map_count != 0) - return (EBUSY); + if (dmat->map_count != 0) { + error = EBUSY; + goto out; + } while (dmat != NULL) { bus_dma_tag_t parent; @@ -326,7 +341,10 @@ dmat = NULL; } } - return (0); +out: + CTR2(KTR_BUSDMA, "bus_dma_tag_destroy tag %p error %d", dmat_copy, + error); + return (error); } /* @@ -344,8 +362,11 @@ dmat->segments = (bus_dma_segment_t *)malloc( sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, M_NOWAIT); - if (dmat->segments == NULL) + if (dmat->segments == NULL) { + CTR2(KTR_BUSDMA, "bus_dmamap_create: tag %p error %d", + dmat, ENOMEM); return (ENOMEM); + } } /* @@ -360,8 +381,11 @@ *mapp = (bus_dmamap_t)malloc(sizeof(**mapp), M_DEVBUF, M_NOWAIT | M_ZERO); - if (*mapp == NULL) + if (*mapp == NULL) { + CTR2(KTR_BUSDMA, "bus_dmamap_create: tag %p error %d", + dmat, ENOMEM); return (ENOMEM); + } /* Initialize the new map */ STAILQ_INIT(&((*mapp)->bpages)); @@ -400,6 +424,8 @@ } if (error == 0) dmat->map_count++; + CTR3(KTR_BUSDMA, "bus_dmamap_create: tag %p tag flags 0x%x error %d", + dmat, dmat->flags, error); return (error); } @@ -411,11 +437,15 @@ bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map) { if (map != NULL && map != &nobounce_dmamap) { - if (STAILQ_FIRST(&map->bpages) != NULL) + if (STAILQ_FIRST(&map->bpages) != NULL) { + CTR2(KTR_BUSDMA, "bus_dmamap_destroy: tag %p error %d", + dmat, EBUSY); return (EBUSY); + } free(map, M_DEVBUF); } dmat->map_count--; + CTR1(KTR_BUSDMA, "bus_dmamap_destroy: tag %p error 0", dmat); return (0); } @@ -445,8 +475,11 @@ dmat->segments = (bus_dma_segment_t *)malloc( sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, M_NOWAIT); - if (dmat->segments == NULL) + if (dmat->segments == NULL) { + CTR3(KTR_BUSDMA, "bus_dmamem_alloc: tag %p tag " + "flags 0x%x error %d", dmat, dmat->flags, ENOMEM); return (ENOMEM); + } } if ((dmat->maxsize <= PAGE_SIZE) && @@ -463,8 +496,13 @@ 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, dmat->boundary); } - if (*vaddr == NULL) + if (*vaddr == NULL) { + CTR3(KTR_BUSDMA, "bus_dmamem_alloc: tag %p tag flags 0x%x " + "error %d", dmat, dmat->flags, ENOMEM); return (ENOMEM); + } + CTR3(KTR_BUSDMA, "bus_dmamem_alloc: tag %p tag flags 0x%x error %d", + dmat, dmat->flags, ENOMEM); return (0); } @@ -487,6 +525,8 @@ else { contigfree(vaddr, dmat->maxsize, M_DEVBUF); } + CTR2(KTR_BUSDMA, "bus_dmamem_free: tag %p flags 0x%x", dmat, + dmat->flags); } /* @@ -495,11 +535,11 @@ * the starting segment on entrace, and the ending segment on exit. * first indicates if this is the first invocation of this function. */ -static int +static __inline int _bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, bus_size_t buflen, - struct thread *td, + pmap_t pmap, int flags, bus_addr_t *lastaddrp, int *segp, @@ -512,23 +552,22 @@ bus_addr_t paddr; int needbounce = 0; int seg; - pmap_t pmap; segs = dmat->segments; if (map == NULL) map = &nobounce_dmamap; - if (td != NULL) - pmap = vmspace_pmap(td->td_proc->p_vmspace); - else - pmap = NULL; - - if ((dmat->lowaddr < ptoa((vm_paddr_t)Maxmem) - || dmat->boundary > 0 || dmat->alignment > 1) - && map != &nobounce_dmamap && map->pagesneeded == 0) { + if ((map != &nobounce_dmamap && map->pagesneeded == 0) + && (dmat->lowaddr < ptoa((vm_paddr_t)Maxmem) + || dmat->boundary > 0 || dmat->alignment > 1)) { vm_offset_t vendaddr; + CTR4(KTR_BUSDMA, "lowaddr= %d Maxmem= %d, boundary= %d, " + "alignment= %d", dmat->lowaddr, ptoa((vm_paddr_t)Maxmem), + dmat->boundary, dmat->alignment); + CTR3(KTR_BUSDMA, "map= %p, nobouncemap= %p, pagesneeded= %d", + map, &nobounce_dmamap, map->pagesneeded); /* * Count the number of bounce pages * needed in order to complete this transfer @@ -544,10 +583,9 @@ } vaddr += PAGE_SIZE; } + CTR1(KTR_BUSDMA, "pagesneeded= %d\n", map->pagesneeded); } - vaddr = (vm_offset_t)buf; - /* Reserve Necessary Bounce Pages */ if (map->pagesneeded != 0) { mtx_lock(&bounce_lock); @@ -571,6 +609,7 @@ mtx_unlock(&bounce_lock); } + vaddr = (vm_offset_t)buf; lastaddr = *lastaddrp; bmask = ~(dmat->boundary - 1); @@ -658,14 +697,19 @@ error = _bus_dmamap_load_buffer(dmat, map, buf, buflen, NULL, flags, &lastaddr, &nsegs, 1); - if (error == EINPROGRESS) + if (error == EINPROGRESS) { + CTR3(KTR_BUSDMA, "bus_dmamap_load: tag %p tag flags 0x%x " + "error %d", dmat, dmat->flags, error); return (error); + } if (error) (*callback)(callback_arg, dmat->segments, 0, error); else (*callback)(callback_arg, dmat->segments, nsegs + 1, 0); + CTR2(KTR_BUSDMA, "bus_dmamap_load: tag %p tag flags 0x%x error 0", + dmat, dmat->flags); return (0); } @@ -711,6 +755,8 @@ (*callback)(callback_arg, dmat->segments, nsegs+1, m0->m_pkthdr.len, error); } + CTR3(KTR_BUSDMA, "bus_dmamap_load_mbuf: tag %p tag flags 0x%x " + "error %d", dmat, dmat->flags, error); return (error); } @@ -727,17 +773,18 @@ int nsegs, error, first, i; bus_size_t resid; struct iovec *iov; - struct thread *td = NULL; + pmap_t pmap; flags |= BUS_DMA_NOWAIT; resid = uio->uio_resid; iov = uio->uio_iov; if (uio->uio_segflg == UIO_USERSPACE) { - td = uio->uio_td; - KASSERT(td != NULL, + KASSERT(uio->uio_td != NULL, ("bus_dmamap_load_uio: USERSPACE but no proc")); - } + pmap = vmspace_pmap(uio->uio_td->td_proc->p_vmspace); + } else + pmap = NULL; nsegs = 0; error = 0; @@ -754,7 +801,7 @@ if (minlen > 0) { error = _bus_dmamap_load_buffer(dmat, map, addr, minlen, - td, flags, &lastaddr, &nsegs, first); + pmap, flags, &lastaddr, &nsegs, first); first = 0; resid -= minlen; @@ -768,6 +815,8 @@ (*callback)(callback_arg, dmat->segments, nsegs+1, uio->uio_resid, error); } + CTR3(KTR_BUSDMA, "bus_dmamap_load_uio: tag %p tag flags 0x%x " + "error %d", dmat, dmat->flags, error); return (error); } @@ -797,6 +846,8 @@ * the caches on broken hardware */ total_bounced++; + CTR3(KTR_BUSDMA, "_bus_dmamap_sync: tag %p tag flags 0x%x " + "op 0x%x performing bounce", op, dmat, dmat->flags); if (op & BUS_DMASYNC_PREWRITE) { while (bpage != NULL) { ==== //depot/projects/netperf_socket/sys/amd64/amd64/intr_machdep.c#8 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/amd64/amd64/intr_machdep.c,v 1.10 2004/11/01 22:15:13 jhb Exp $ + * $FreeBSD: src/sys/amd64/amd64/intr_machdep.c,v 1.11 2004/11/03 18:03:06 scottl Exp $ */ /* @@ -166,8 +166,8 @@ * argument for counting hardware interrupts when they're * processed too. */ - atomic_add_long(isrc->is_count, 1); - atomic_add_int(&cnt.v_intr, 1); + (*isrc->is_count)++; + cnt.v_intr++; it = isrc->is_ithread; if (it == NULL) @@ -219,7 +219,7 @@ error = ithread_schedule(it); } if (error == EINVAL) { - atomic_add_long(isrc->is_straycount, 1); + (*isrc->is_straycount)++; if (*isrc->is_straycount < MAX_STRAY_LOG) log(LOG_ERR, "stray irq%d\n", vector); else if (*isrc->is_straycount == MAX_STRAY_LOG) ==== //depot/projects/netperf_socket/sys/amd64/amd64/mp_machdep.c#14 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.247 2004/09/29 01:59:10 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.248 2004/11/05 18:25:22 peter Exp $"); #include "opt_cpu.h" #include "opt_kstack_pages.h" @@ -127,6 +127,7 @@ struct cpu_info { int cpu_present:1; int cpu_bsp:1; + int cpu_disabled:1; } static cpu_info[MAXCPU]; static int cpu_apic_ids[MAXCPU]; @@ -350,7 +351,11 @@ /* List CPUs */ printf(" cpu0 (BSP): APIC ID: %2d\n", boot_cpu_id); for (i = 1, x = 0; x < MAXCPU; x++) { - if (cpu_info[x].cpu_present && !cpu_info[x].cpu_bsp) { + if (!cpu_info[x].cpu_present || cpu_info[x].cpu_bsp) + continue; + if (cpu_info[x].cpu_disabled) + printf(" cpu (AP): APIC ID: %2d (disabled)\n", x); + else { KASSERT(i < mp_ncpus, ("mp_ncpus and actual cpus are out of whack")); printf(" cpu%d (AP): APIC ID: %2d\n", i++, x); @@ -582,9 +587,19 @@ /* start each AP */ cpu = 0; for (apic_id = 0; apic_id < MAXCPU; apic_id++) { + + /* Ignore non-existent CPUs and the BSP. */ if (!cpu_info[apic_id].cpu_present || cpu_info[apic_id].cpu_bsp) continue; + + /* Don't use this CPU if it has been disabled by a tunable. */ + if (resource_disabled("lapic", apic_id)) { + cpu_info[apic_id].cpu_disabled = 1; + mp_ncpus--; + continue; + } + cpu++; /* save APIC ID for this logical ID */ ==== //depot/projects/netperf_socket/sys/arm/arm/cpufunc.c#4 (text+ko) ==== @@ -45,7 +45,7 @@ * Created : 30/01/97 */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/arm/cpufunc.c,v 1.3 2004/09/23 21:59:43 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/cpufunc.c,v 1.4 2004/11/05 19:48:40 cognet Exp $"); #include <sys/cdefs.h> @@ -973,7 +973,11 @@ cpufuncs = arm9_cpufuncs; cpu_reset_needs_v4_MMU_disable = 1; /* V4 or higher */ get_cachetype_cp15(); +#ifdef ARM9_CACHE_WRITE_THROUGH pmap_pte_init_arm9(); +#else + pmap_pte_init_generic(); +#endif return 0; } #endif /* CPU_ARM9 */ ==== //depot/projects/netperf_socket/sys/arm/arm/critical.c#2 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/arm/critical.c,v 1.1 2004/05/14 11:46:42 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/critical.c,v 1.2 2004/11/05 18:29:45 cognet Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/signalvar.h> @@ -46,5 +46,7 @@ void cpu_critical_fork_exit(void) { + + curthread->td_md.md_savecrit = __set_cpsr_c(0, 0) &~ I32_bit; } ==== //depot/projects/netperf_socket/sys/arm/arm/elf_machdep.c#4 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/arm/elf_machdep.c,v 1.4 2004/09/23 22:03:25 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/elf_machdep.c,v 1.5 2004/11/04 18:48:52 cognet Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -155,13 +155,13 @@ case R_ARM_NONE: /* none */ break; - case R_ARM_PC24: /* S + A - P */ + case R_ARM_ABS32: addr = lookup(lf, symidx, 1); if (addr == 0) return -1; - addr += addend - (Elf_Addr)where; if (*where != addr) *where = addr; + break; case R_ARM_COPY: /* none */ @@ -173,14 +173,13 @@ return -1; break; - case R_ARM_GLOB_DAT: /* S */ + case R_ARM_JUMP_SLOT: addr = lookup(lf, symidx, 1); - if (addr == 0) - return -1; - if (*where != addr) + if (addr) { *where = addr; - break; - + return (0); + } + return (-1); case R_ARM_RELATIVE: break; @@ -212,6 +211,8 @@ elf_cpu_load_file(linker_file_t lf __unused) { + cpu_idcache_wbinv_all(); + cpu_tlb_flushID(); return (0); } ==== //depot/projects/netperf_socket/sys/arm/arm/fusu.S#3 (text+ko) ==== @@ -37,7 +37,7 @@ #include <machine/asmacros.h> #include <machine/armreg.h> #include "assym.s" -__FBSDID("$FreeBSD: src/sys/arm/arm/fusu.S,v 1.2 2004/09/28 14:39:26 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/fusu.S,v 1.3 2004/11/05 19:50:48 cognet Exp $"); #ifdef MULTIPROCESSOR .Lcpu_info: @@ -52,6 +52,56 @@ * Fetch an int from the user's address space. */ +ENTRY(casuptr) +#ifdef MULTIPROCESSOR + /* XXX Probably not appropriate for non-Hydra SMPs */ + stmfd sp!, {r0, r14} + bl _C_LABEL(cpu_number) + ldr r2, .Lcpu_info + ldr r2, [r2, r0, lsl #2] + ldr r2, [r2, #CI_CURPCB] + ldmfd sp!, {r0, r14} +#else + ldr r3, .Lcurpcb + ldr r3, [r3] +#endif + +#ifdef DIAGNOSTIC + teq r3, #0x00000000 + beq .Lfusupcbfault +#endif >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411061239.iA6CdWbI089462>
