CVS commit: [netbsd-5] src/sys/arch/alpha/alpha
Module Name:src Committed By: snj Date: Sun Nov 15 05:54:38 UTC 2009 Modified Files: src/sys/arch/alpha/alpha [netbsd-5]: pmap.c Log Message: Pull up following revision(s) (requested by mhitch in ticket #1137): sys/arch/alpha/alpha/pmap.c: revision 1.250 The tlb shootdown IPI can interrupt the pool_cache_get() in places that can cause a deadlock or pool cache corruption. Take the shootdown job queue mutex before calling pool_cache_get(), which will block the IPI interrupts and seems to fix the remaining tlb shootdown deadlocks and pool cache corruption I've been seeing. Should address both PR port-alpha/38335 and PR port-alpha/42174. To generate a diff of this commit: cvs rdiff -u -r1.236.10.3 -r1.236.10.4 src/sys/arch/alpha/alpha/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.236.10.3 src/sys/arch/alpha/alpha/pmap.c:1.236.10.4 --- src/sys/arch/alpha/alpha/pmap.c:1.236.10.3 Fri Oct 16 06:42:53 2009 +++ src/sys/arch/alpha/alpha/pmap.c Sun Nov 15 05:54:38 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.236.10.3 2009/10/16 06:42:53 snj Exp $ */ +/* $NetBSD: pmap.c,v 1.236.10.4 2009/11/15 05:54:38 snj Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc. @@ -140,7 +140,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.236.10.3 2009/10/16 06:42:53 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.236.10.4 2009/11/15 05:54:38 snj Exp $"); #include #include @@ -3684,6 +3684,7 @@ cpumask |= 1UL << ci->ci_cpuid; pq = &pmap_tlb_shootdown_q[ci->ci_cpuid]; + mutex_spin_enter(&pq->pq_lock); /* * Allocate a job. @@ -3699,7 +3700,6 @@ * If a global flush is already pending, we * don't really have to do anything else. */ - mutex_spin_enter(&pq->pq_lock); pq->pq_pte |= pte; if (pq->pq_tbia) { mutex_spin_exit(&pq->pq_lock);
CVS commit: [netbsd-5] src/sys/arch/alpha/alpha
Module Name:src Committed By: sborrill Date: Sat Oct 31 13:25:56 UTC 2009 Modified Files: src/sys/arch/alpha/alpha [netbsd-5]: machdep.c Log Message: Pull up the following revisions(s) (requested by mhitch in ticket #1118): sys/arch/alpha/alpha/machdep.c: revision 1.321 Ensures the cpu running the shutdown waits for the correct cpus to halt and thus stop the machine hanging at shutdown. To generate a diff of this commit: cvs rdiff -u -r1.307.4.1 -r1.307.4.2 src/sys/arch/alpha/alpha/machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/alpha/alpha/machdep.c diff -u src/sys/arch/alpha/alpha/machdep.c:1.307.4.1 src/sys/arch/alpha/alpha/machdep.c:1.307.4.2 --- src/sys/arch/alpha/alpha/machdep.c:1.307.4.1 Mon Feb 2 03:30:32 2009 +++ src/sys/arch/alpha/alpha/machdep.c Sat Oct 31 13:25:56 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.307.4.1 2009/02/02 03:30:32 snj Exp $ */ +/* $NetBSD: machdep.c,v 1.307.4.2 2009/10/31 13:25:56 sborrill Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.307.4.1 2009/02/02 03:30:32 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.307.4.2 2009/10/31 13:25:56 sborrill Exp $"); #include #include @@ -965,8 +965,7 @@ { #if defined(MULTIPROCESSOR) u_long cpu_id = cpu_number(); - u_long wait_mask = (1UL << cpu_id) | - (1UL << hwrpb->rpb_primary_cpu_id); + u_long wait_mask; int i; #endif @@ -1000,6 +999,9 @@ * Halt all other CPUs. If we're not the primary, the * primary will spin, waiting for us to halt. */ + cpu_id = cpu_number(); /* may have changed cpu */ + wait_mask = (1UL << cpu_id) | (1UL << hwrpb->rpb_primary_cpu_id); + alpha_broadcast_ipi(ALPHA_IPI_HALT); /* Ensure any CPUs paused by DDB resume execution so they can halt */
CVS commit: [netbsd-5] src/sys/arch/alpha/alpha
Module Name:src Committed By: snj Date: Fri Oct 16 06:42:53 UTC 2009 Modified Files: src/sys/arch/alpha/alpha [netbsd-5]: pmap.c Log Message: Pull up following revision(s) (requested by mhitch in ticket #1073): sys/arch/alpha/alpha/pmap.c: revision 1.243 IPI interrupts occur above IPL_VM, so using IPL_VM in for the tlb shootdown queue mutex doesn't work very well. I get various deadlocks and corrupted queue entries. Change to IPL_SCHED [IPL_CLOCK] to block IPI interrupts while the cpu is mucking with the shootdown queue. To generate a diff of this commit: cvs rdiff -u -r1.236.10.2 -r1.236.10.3 src/sys/arch/alpha/alpha/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.236.10.2 src/sys/arch/alpha/alpha/pmap.c:1.236.10.3 --- src/sys/arch/alpha/alpha/pmap.c:1.236.10.2 Wed Sep 16 04:41:13 2009 +++ src/sys/arch/alpha/alpha/pmap.c Fri Oct 16 06:42:53 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.236.10.2 2009/09/16 04:41:13 snj Exp $ */ +/* $NetBSD: pmap.c,v 1.236.10.3 2009/10/16 06:42:53 snj Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc. @@ -140,7 +140,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.236.10.2 2009/09/16 04:41:13 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.236.10.3 2009/10/16 06:42:53 snj Exp $"); #include #include @@ -963,7 +963,7 @@ for (i = 0; i < ALPHA_MAXPROCS; i++) { TAILQ_INIT(&pmap_tlb_shootdown_q[i].pq_head); mutex_init(&pmap_tlb_shootdown_q[i].pq_lock, MUTEX_DEFAULT, - IPL_VM); + IPL_SCHED); } #endif
CVS commit: [netbsd-5] src/sys/arch/alpha/alpha
Module Name:src Committed By: snj Date: Sat Sep 26 18:41:42 UTC 2009 Modified Files: src/sys/arch/alpha/alpha [netbsd-5]: dec_1000a.c dec_2100_a500.c dec_6600.c dec_kn300.c Log Message: Pull up following revision(s) (requested by mhitch in ticket #1010): sys/arch/alpha/alpha/dec_1000a.c: revision 1.29 sys/arch/alpha/alpha/dec_2100_a500.c: revision 1.19 sys/arch/alpha/alpha/dec_6600.c: revision 1.29 sys/arch/alpha/alpha/dec_kn300.c: revision 1.37 Add support for booting off a couple of common RAID adapters found on several models of alpha systems: mlx [Mylex DAC060] and iop [I2O]. Addresses PR #25829. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.26.10.1 src/sys/arch/alpha/alpha/dec_1000a.c cvs rdiff -u -r1.18 -r1.18.10.1 src/sys/arch/alpha/alpha/dec_2100_a500.c cvs rdiff -u -r1.26 -r1.26.54.1 src/sys/arch/alpha/alpha/dec_6600.c cvs rdiff -u -r1.34 -r1.34.54.1 src/sys/arch/alpha/alpha/dec_kn300.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/alpha/alpha/dec_1000a.c diff -u src/sys/arch/alpha/alpha/dec_1000a.c:1.26 src/sys/arch/alpha/alpha/dec_1000a.c:1.26.10.1 --- src/sys/arch/alpha/alpha/dec_1000a.c:1.26 Mon Apr 28 20:23:10 2008 +++ src/sys/arch/alpha/alpha/dec_1000a.c Sat Sep 26 18:41:42 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: dec_1000a.c,v 1.26 2008/04/28 20:23:10 martin Exp $ */ +/* $NetBSD: dec_1000a.c,v 1.26.10.1 2009/09/26 18:41:42 snj Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: dec_1000a.c,v 1.26 2008/04/28 20:23:10 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dec_1000a.c,v 1.26.10.1 2009/09/26 18:41:42 snj Exp $"); #include #include @@ -98,6 +98,9 @@ #include #include +#include +#include + #include "pckbd.h" #ifndef CONSPEED @@ -257,7 +260,8 @@ return; if (!initted) { - diskboot = (strcasecmp(b->protocol, "SCSI") == 0); + diskboot = (strcasecmp(b->protocol, "SCSI") == 0) || + (strcasecmp(b->protocol, "RAID") == 0); netboot = (strcasecmp(b->protocol, "BOOTP") == 0) || (strcasecmp(b->protocol, "MOP") == 0); #if 0 @@ -337,4 +341,25 @@ #endif found = 1; } + + if (device_is_a(dev, "ld") && device_is_a(parent, "mlx")) { + /* + * Argh! The attach arguments for ld devices is not + * consistent, so each supported raid controller requires + * different checks. + */ + struct mlx_attach_args *mlxa = aux; + + if (parent != ctrlrdev) + return; + + if (b->unit != mlxa->mlxa_unit) + return; + /* we've found it! */ + booted_device = dev; +#if 0 + printf("\nbooted_device = %s\n", dev->dv_xname); +#endif + found = 1; + } } Index: src/sys/arch/alpha/alpha/dec_2100_a500.c diff -u src/sys/arch/alpha/alpha/dec_2100_a500.c:1.18 src/sys/arch/alpha/alpha/dec_2100_a500.c:1.18.10.1 --- src/sys/arch/alpha/alpha/dec_2100_a500.c:1.18 Mon Apr 28 20:23:10 2008 +++ src/sys/arch/alpha/alpha/dec_2100_a500.c Sat Sep 26 18:41:42 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: dec_2100_a500.c,v 1.18 2008/04/28 20:23:10 martin Exp $ */ +/* $NetBSD: dec_2100_a500.c,v 1.18.10.1 2009/09/26 18:41:42 snj Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: dec_2100_a500.c,v 1.18 2008/04/28 20:23:10 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dec_2100_a500.c,v 1.18.10.1 2009/09/26 18:41:42 snj Exp $"); #include #include @@ -92,6 +92,9 @@ #include #include +#include +#include + #include "pckbd.h" #ifndef CONSPEED @@ -243,7 +246,8 @@ return; if (!initted) { - diskboot = (strcasecmp(b->protocol, "SCSI") == 0); + diskboot = (strcasecmp(b->protocol, "SCSI") == 0) || + (strcasecmp(b->protocol, "RAID") == 0); netboot = (strcasecmp(b->protocol, "BOOTP") == 0) || (strcasecmp(b->protocol, "MOP") == 0); #if 0 @@ -323,6 +327,27 @@ #endif found = 1; } + + if (device_is_a(dev, "ld") && device_is_a(parent, "mlx")) { + /* + * Argh! The attach arguments for ld devices is not + * consistent, so each supported raid controller requires + * different checks. + */ + struct mlx_attach_args *mlxa = aux; + + if (parent != ctrlrdev) + return; + + if (b->unit != mlxa->mlxa_unit) + return; + /* we've found it! */ + booted_device = dev; +#if 0 + printf("\nbooted_device = %s\n", dev->dv_xname); +#endif + found = 1; + } } /* Index: src/sys/arch/alpha/alpha/dec_6600.c diff -u src/sys/arch/alpha/alpha/dec_6600.c:1.26 src/sys/arch/alpha/alpha/dec_6600.c:1.26.54.1 --- src/sys/arch/alpha/alpha/dec_6600.c:1.26 Sun Mar 4 15:18:10 2007 +++ src/sys/arch/alpha/alpha/dec_6600.c Sat Sep 26 18:41:42 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: dec_6600.c,v 1.26 2007/03/04 15:18:10 yamt Exp $ */ +/* $NetBSD: dec_6600.c,v 1.26.54.1 2009/09/26 18:41:42 sn
CVS commit: [netbsd-5] src/sys/arch/alpha/alpha
Module Name:src Committed By: snj Date: Wed Sep 16 04:41:14 UTC 2009 Modified Files: src/sys/arch/alpha/alpha [netbsd-5]: pmap.c Log Message: Pull up following revision(s) (requested by mhitch in ticket #954): sys/arch/alpha/alpha/pmap.c: revision 1.242 Alpha will size the mutex structure in pmap_tlb_shootdown_q to 16 bytes. Change the command and pad accordingly; now pmap_tlb_shootdown_q entries really are cache-aligned. To generate a diff of this commit: cvs rdiff -u -r1.236.10.1 -r1.236.10.2 src/sys/arch/alpha/alpha/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.236.10.1 src/sys/arch/alpha/alpha/pmap.c:1.236.10.2 --- src/sys/arch/alpha/alpha/pmap.c:1.236.10.1 Wed Sep 16 04:24:46 2009 +++ src/sys/arch/alpha/alpha/pmap.c Wed Sep 16 04:41:13 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.236.10.1 2009/09/16 04:24:46 snj Exp $ */ +/* $NetBSD: pmap.c,v 1.236.10.2 2009/09/16 04:41:13 snj Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc. @@ -140,7 +140,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.236.10.1 2009/09/16 04:24:46 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.236.10.2 2009/09/16 04:41:13 snj Exp $"); #include #include @@ -421,11 +421,11 @@ static struct pmap_tlb_shootdown_q { TAILQ_HEAD(, pmap_tlb_shootdown_job) pq_head; /* queue 16b */ - kmutex_t pq_lock; /* spin lock on queue 12b */ + kmutex_t pq_lock; /* spin lock on queue 16b */ int pq_pte; /* aggregate PTE bits 4b */ int pq_count; /* number of pending requests 4b */ int pq_tbia; /* pending global flush 4b */ - uint8_t pq_pad[64-16-12-4-4-4]; /* pad to 64 bytes */ + uint8_t pq_pad[64-16-16-4-4-4]; /* pad to 64 bytes */ } pmap_tlb_shootdown_q[ALPHA_MAXPROCS] __aligned(CACHE_LINE_SIZE); /* If we have more pending jobs than this, we just nail the whole TLB. */
CVS commit: [netbsd-5] src/sys/arch/alpha/alpha
Module Name:src Committed By: snj Date: Wed Sep 16 04:24:46 UTC 2009 Modified Files: src/sys/arch/alpha/alpha [netbsd-5]: pmap.c Log Message: Pull up following revision(s) (requested by mhitch in ticket #953): sys/arch/alpha/alpha/pmap.c: revision 1.241 Now that secondary cpus are added the cpu_info list earlier, attempt to send pmap tlb shootdowns to them cause the shootdown job queue to fill up, but since the cpus aren't running yet, no IPIs get sent. When the job queue is full, the bit mask of cpus to send the IPI to is not set and no shootdown IPI ever gets sent after the cpu is marked running. Always set the cpumask even when the queue is full. Now I get shootdown ipis on all the secondary cpus. To generate a diff of this commit: cvs rdiff -u -r1.236 -r1.236.10.1 src/sys/arch/alpha/alpha/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.236 src/sys/arch/alpha/alpha/pmap.c:1.236.10.1 --- src/sys/arch/alpha/alpha/pmap.c:1.236 Mon Apr 28 20:23:10 2008 +++ src/sys/arch/alpha/alpha/pmap.c Wed Sep 16 04:24:46 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.236 2008/04/28 20:23:10 martin Exp $ */ +/* $NetBSD: pmap.c,v 1.236.10.1 2009/09/16 04:24:46 snj Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc. @@ -140,7 +140,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.236 2008/04/28 20:23:10 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.236.10.1 2009/09/16 04:24:46 snj Exp $"); #include #include @@ -3681,6 +3681,8 @@ continue; } + cpumask |= 1UL << ci->ci_cpuid; + pq = &pmap_tlb_shootdown_q[ci->ci_cpuid]; /* @@ -3720,7 +3722,6 @@ pq->pq_count++; TAILQ_INSERT_TAIL(&pq->pq_head, pj, pj_list); } - cpumask |= 1UL << ci->ci_cpuid; mutex_spin_exit(&pq->pq_lock); }
CVS commit: [netbsd-5] src/sys/arch/alpha/alpha
Module Name:src Committed By: snj Date: Wed Sep 16 04:12:49 UTC 2009 Modified Files: src/sys/arch/alpha/alpha [netbsd-5]: cpu.c Log Message: Pull up following revision(s) (requested by mhitch in ticket #949): sys/arch/alpha/alpha/cpu.c: revision 1.86 There's now some per-cpu initialization that occurs before the secondary cpus are told to begin running. Since the seconedary cpus weren't being added to the cpu_info list until then, that initialization wasn't being done and resulted in crashes on the secondary cpus. Add the secondary cpus to the cpu_info_list after they've been started (but waiting to be told to start running). This fixes the problem specifically stated in PR port-alpha/41106. MP alphas will now at least boot and begin running, but will eventually crash in various ways later. To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.82.10.1 src/sys/arch/alpha/alpha/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/alpha/alpha/cpu.c diff -u src/sys/arch/alpha/alpha/cpu.c:1.82 src/sys/arch/alpha/alpha/cpu.c:1.82.10.1 --- src/sys/arch/alpha/alpha/cpu.c:1.82 Mon Apr 28 20:23:10 2008 +++ src/sys/arch/alpha/alpha/cpu.c Wed Sep 16 04:12:48 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.82 2008/04/28 20:23:10 martin Exp $ */ +/* $NetBSD: cpu.c,v 1.82.10.1 2009/09/16 04:12:48 snj Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.82 2008/04/28 20:23:10 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.82.10.1 2009/09/16 04:12:48 snj Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -337,6 +337,12 @@ * on its merry way. */ cpu_boot_secondary(ci); + + /* + * Link the processor into the list. + */ + ci->ci_next = cpu_info_list->ci_next; + cpu_info_list->ci_next = ci; #else /* ! MULTIPROCESSOR */ printf("%s: processor off-line; multiprocessor support " "not present in kernel\n", sc->sc_dev.dv_xname); @@ -408,10 +414,8 @@ } /* - * Link the processor into the list, and launch it. + * Launch the processor. */ - ci->ci_next = cpu_info_list->ci_next; - cpu_info_list->ci_next = ci; atomic_or_ulong(&ci->ci_flags, CPUF_RUNNING); atomic_or_ulong(&cpus_running, (1U << i)); }