Date: Wed, 29 Mar 2006 22:42:42 GMT From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 94274 for review Message-ID: <200603292242.k2TMggdJ079138@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=94274 Change 94274 by marcel@marcel_nfs on 2006/03/29 22:41:58 IFC @94262 Affected files ... .. //depot/projects/uart/alpha/alpha/clock.c#9 integrate .. //depot/projects/uart/alpha/include/cpu.h#6 integrate .. //depot/projects/uart/amd64/acpica/madt.c#5 integrate .. //depot/projects/uart/amd64/conf/GENERIC#14 integrate .. //depot/projects/uart/arm/arm/pmap.c#12 integrate .. //depot/projects/uart/compat/linux/linux_misc.c#14 integrate .. //depot/projects/uart/conf/Makefile.arm#8 integrate .. //depot/projects/uart/conf/NOTES#31 integrate .. //depot/projects/uart/conf/files#53 integrate .. //depot/projects/uart/conf/options#25 integrate .. //depot/projects/uart/dev/acpica/Osd/OsdHardware.c#8 integrate .. //depot/projects/uart/dev/acpica/acpi.c#19 integrate .. //depot/projects/uart/dev/hwpmc/hwpmc_piv.c#5 integrate .. //depot/projects/uart/dev/md/md.c#16 integrate .. //depot/projects/uart/dev/mfi/mfi.c#2 integrate .. //depot/projects/uart/dev/mfi/mfi_disk.c#2 integrate .. //depot/projects/uart/geom/raid3/g_raid3.c#14 integrate .. //depot/projects/uart/i386/acpica/madt.c#5 integrate .. //depot/projects/uart/i386/conf/GENERIC#13 integrate .. //depot/projects/uart/i386/include/atomic.h#8 integrate .. //depot/projects/uart/kern/kern_acct.c#9 integrate .. //depot/projects/uart/kern/kern_alq.c#7 integrate .. //depot/projects/uart/kern/kern_event.c#9 integrate .. //depot/projects/uart/kern/kern_ktrace.c#11 integrate .. //depot/projects/uart/kern/kern_sig.c#27 integrate .. //depot/projects/uart/kern/syscalls.master#17 integrate .. //depot/projects/uart/kern/uipc_socket2.c#10 integrate .. //depot/projects/uart/kern/uipc_syscalls.c#16 integrate .. //depot/projects/uart/kern/vfs_syscalls.c#23 integrate .. //depot/projects/uart/kern/vfs_vnops.c#16 integrate .. //depot/projects/uart/modules/Makefile#29 integrate .. //depot/projects/uart/net80211/ieee80211_ioctl.c#16 integrate .. //depot/projects/uart/netinet6/in6.h#8 integrate .. //depot/projects/uart/netinet6/ipsec.c#9 integrate .. //depot/projects/uart/netipx/README#6 integrate .. //depot/projects/uart/netipx/ipx_input.c#9 integrate .. //depot/projects/uart/netipx/spx_usrreq.c#11 integrate .. //depot/projects/uart/opencrypto/cryptosoft.c#5 integrate .. //depot/projects/uart/sparc64/fhc/clkbrd.c#3 integrate .. //depot/projects/uart/sparc64/fhc/clkbrdreg.h#2 integrate .. //depot/projects/uart/sparc64/include/asi.h#2 integrate .. //depot/projects/uart/sparc64/include/bus.h#10 integrate .. //depot/projects/uart/sparc64/sparc64/machdep.c#15 integrate .. //depot/projects/uart/sparc64/sparc64/mp_machdep.c#8 integrate .. //depot/projects/uart/sparc64/sparc64/tick.c#8 integrate .. //depot/projects/uart/sys/gmon.h#3 integrate .. //depot/projects/uart/sys/pmc.h#5 integrate .. //depot/projects/uart/sys/pmclog.h#3 integrate .. //depot/projects/uart/sys/sysctl.h#10 integrate .. //depot/projects/uart/sys/sysproto.h#16 integrate .. //depot/projects/uart/sys/umtx.h#7 integrate Differences ... ==== //depot/projects/uart/alpha/alpha/clock.c#9 (text+ko) ==== @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/alpha/clock.c,v 1.44 2006/03/07 22:12:09 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/alpha/clock.c,v 1.45 2006/03/28 21:20:11 jhb Exp $"); #include "opt_clock.h" @@ -137,7 +137,6 @@ static void calibrate_clocks(u_int32_t firmware_freq, u_int32_t *pcc, u_int32_t *timer); static void set_timer_freq(u_int freq, int intr_freq); -static uint64_t read_cycle_count(void); void clockattach(device_t dev) ==== //depot/projects/uart/alpha/include/cpu.h#6 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/alpha/include/cpu.h,v 1.43 2005/12/22 22:16:04 jhb Exp $ */ +/* $FreeBSD: src/sys/alpha/include/cpu.h,v 1.44 2006/03/28 21:20:12 jhb Exp $ */ /* From: NetBSD: cpu.h,v 1.18 1997/09/23 23:17:49 mjacob Exp */ /*- @@ -88,11 +88,12 @@ #define cpu_getstack(td) (alpha_pal_rdusp()) #define cpu_spinwait() /* nothing */ -#define get_cyclecount alpha_rpcc +#define get_cyclecount() read_cycle_count() void cpu_halt(void); void cpu_reset(void); void fork_trampoline(void); /* MAGIC */ +uint64_t read_cycle_count(void); void swi_vm(void *); #endif /* _KERNEL */ ==== //depot/projects/uart/amd64/acpica/madt.c#5 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/acpica/madt.c,v 1.19 2005/11/01 22:44:06 jkim Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/acpica/madt.c,v 1.20 2006/03/27 15:59:48 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -219,11 +219,12 @@ } /* - * For ACPI < 2.0, use the RSDT. For ACPI >= 2.0, use the XSDT. - * We map the XSDT and RSDT at page 1 in the crashdump area. - * Page 0 is used to map in the headers of candidate ACPI tables. + * For ACPI >= 2.0, use the XSDT if it is available. + * Otherwise, use the RSDT. We map the XSDT or RSDT at page 1 + * in the crashdump area. Page 0 is used to map in the + * headers of candidate ACPI tables. */ - if (rsdp->Revision >= 2) { + if (rsdp->Revision >= 2 && rsdp->XsdtPhysicalAddress != 0) { /* * AcpiOsGetRootPointer only verifies the checksum for * the version 1.0 portion of the RSDP. Version 2.0 has ==== //depot/projects/uart/amd64/conf/GENERIC#14 (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/amd64/conf/GENERIC,v 1.449 2006/01/12 01:20:59 obrien Exp $ +# $FreeBSD: src/sys/amd64/conf/GENERIC,v 1.450 2006/03/29 09:57:21 scottl Exp $ cpu HAMMER ident GENERIC @@ -137,6 +137,7 @@ device aac # Adaptec FSA RAID device aacp # SCSI passthrough for aac (requires CAM) device ida # Compaq Smart RAID +device mfi # LSI MegaRAID SAS device mlx # Mylex DAC960 family #XXX pointer/int warnings #device pst # Promise Supertrak SX6000 ==== //depot/projects/uart/arm/arm/pmap.c#12 (text+ko) ==== @@ -147,7 +147,7 @@ #include "opt_vm.h" #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/arm/pmap.c,v 1.44 2006/03/22 22:11:10 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/pmap.c,v 1.45 2006/03/26 22:03:43 cognet Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> @@ -3065,7 +3065,10 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, vm_object_t object, vm_pindex_t pindex, vm_size_t size) { - printf("pmap_object_init_pt()\n"); + + VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + KASSERT(object->type == OBJT_DEVICE, + ("pmap_object_init_pt: non-device object")); } ==== //depot/projects/uart/compat/linux/linux_misc.c#14 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.175 2006/03/19 11:10:33 ru Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.177 2006/03/27 23:27:11 avatar Exp $"); #include "opt_compat.h" #include "opt_mac.h" @@ -1405,13 +1405,12 @@ int linux_sethostname(struct thread *td, struct linux_sethostname_args *args) { - struct proc *p = td->td_proc; int name[2]; int error; name[0] = CTL_KERN; name[1] = KERN_HOSTNAME; - if ((error = suser_cred(p->p_ucred, SUSER_ALLOWJAIL))) + if ((error = suser_cred(td->td_ucred, SUSER_ALLOWJAIL))) return (error); return (userland_sysctl(td, name, 2, 0, 0, 0, args->hostname, args->len, 0, 0)); ==== //depot/projects/uart/conf/Makefile.arm#8 (text+ko) ==== @@ -1,7 +1,7 @@ # Makefile.arm -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $FreeBSD: src/sys/conf/Makefile.arm,v 1.25 2006/01/20 00:46:44 cognet Exp $ +# $FreeBSD: src/sys/conf/Makefile.arm,v 1.26 2006/03/27 00:32:46 cognet Exp $ # # Makefile for FreeBSD # @@ -42,7 +42,7 @@ .endif -.if !defined(DEBUG) +.if !defined(DEBUG) && !defined(PROFLEVEL) CFLAGS += -mno-apcs-frame STRIP_FLAGS = -S .endif ==== //depot/projects/uart/conf/NOTES#31 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/NOTES,v 1.1354 2006/03/05 22:52:16 yar Exp $ +# $FreeBSD: src/sys/conf/NOTES,v 1.1355 2006/03/29 09:57:22 scottl Exp $ # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # @@ -1542,6 +1542,7 @@ device ida # Compaq Smart RAID device mlx # Mylex DAC960 device amr # AMI MegaRAID +device mfi # LSI MegaRAID SAS # # 3ware ATA RAID ==== //depot/projects/uart/conf/files#53 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/files,v 1.1104 2006/03/23 23:06:14 sam Exp $ +# $FreeBSD: src/sys/conf/files,v 1.1105 2006/03/29 09:57:22 scottl Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -705,6 +705,9 @@ dev/mcd/mcd_isa.c optional mcd isa nowerror dev/md/md.c optional md dev/mem/memdev.c optional mem +dev/mfi/mfi.c optional mfi +dev/mfi/mfi_pci.c optional mfi pci +dev/mfi/mfi_disk.c optional mfi dev/mii/acphy.c optional miibus | acphy dev/mii/amphy.c optional miibus | amphy dev/mii/bmtphy.c optional miibus | bmtphy ==== //depot/projects/uart/conf/options#25 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/options,v 1.531 2006/03/05 22:52:16 yar Exp $ +# $FreeBSD: src/sys/conf/options,v 1.532 2006/03/29 09:57:22 scottl Exp $ # # On the handling of kernel options # @@ -115,6 +115,7 @@ MAC_TEST opt_dontuse.h MD_ROOT opt_md.h MD_ROOT_SIZE opt_md.h +MFI_DEBUG opt_mfi.h MPROF_BUFFERS opt_mprof.h MPROF_HASH_SIZE opt_mprof.h MUTEX_WAKE_ALL ==== //depot/projects/uart/dev/acpica/Osd/OsdHardware.c#8 (text+ko) ==== @@ -30,10 +30,11 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/acpica/Osd/OsdHardware.c,v 1.17 2005/09/11 18:39:02 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/acpica/Osd/OsdHardware.c,v 1.19 2006/03/29 18:47:59 njl Exp $"); #include <contrib/dev/acpica/acpi.h> +#include <sys/kernel.h> #include <machine/bus.h> #include <machine/pci_cfgreg.h> #include <dev/pci/pcireg.h> @@ -62,9 +63,74 @@ #define ACPI_BUS_HANDLE 0 #endif +/* + * Some BIOS vendors use AML to read/write directly to IO space. This + * can cause a problem if such accesses interfere with the OS's access to + * the same ports. Windows XP and newer systems block accesses to certain + * IO ports. We print a message or block accesses based on a tunable. + */ +static int illegal_bios_ports[] = { + 0x000, 0x00f, /* DMA controller 1 */ + 0x020, 0x021, /* PIC */ + 0x040, 0x043, /* Timer 1 */ + 0x048, 0x04b, /* Timer 2 failsafe */ + 0x070, 0x071, /* CMOS and RTC */ + 0x074, 0x076, /* Extended CMOS */ + 0x081, 0x083, /* DMA1 page registers */ + 0x087, 0x087, /* DMA1 ch0 low page */ + 0x089, 0x08b, /* DMA2 ch2 (0x89), ch3 low page (0x8a, 0x8b) */ + 0x08f, 0x091, /* DMA2 low page refresh (0x8f) */ + /* Arb ctrl port, card select feedback (0x90, 0x91) */ + 0x093, 0x094, /* System board setup */ + 0x096, 0x097, /* POS channel select */ + 0x0a0, 0x0a1, /* PIC (cascaded) */ + 0x0c0, 0x0df, /* ISA DMA */ + 0x4d0, 0x4d1, /* PIC ELCR (edge/level control) */ + 0xcf8, 0xcff, /* PCI config space. Microsoft adds 0xd00 also but + that seems incorrect. */ + -1, -1 +}; + +/* Block accesses to bad IO port addresses or just print a warning. */ +static int block_bad_io; +TUNABLE_INT("debug.acpi.block_bad_io", &block_bad_io); + +/* + * Look up bad ports in our table. Returns 0 if ok, 1 if marked bad but + * access is still allowed, or -1 to deny access. + */ +static int +acpi_os_check_port(UINT32 addr, UINT32 width) +{ + int error, *port; + + error = 0; + for (port = illegal_bios_ports; *port != -1; port += 2) { + if ((addr >= port[0] && addr <= port[1]) || + (addr < port[0] && addr + (width / 8) >= port[0])) { + if (block_bad_io) + error = -1; + else + error = 1; + break; + } + } + + return (error); +} + ACPI_STATUS AcpiOsReadPort(ACPI_IO_ADDRESS InPort, UINT32 *Value, UINT32 Width) { + int error; + + error = acpi_os_check_port(InPort, Width); + if (error != 0) { + printf("acpi: bad read from port 0x%03x (%d)\n", (int)InPort, Width); + if (error == -1) + return (AE_BAD_PARAMETER); + } + switch (Width) { case 8: *(u_int8_t *)Value = bus_space_read_1(ACPI_BUS_SPACE_IO, @@ -89,6 +155,16 @@ ACPI_STATUS AcpiOsWritePort(ACPI_IO_ADDRESS OutPort, UINT32 Value, UINT32 Width) { + int error; + + error = acpi_os_check_port(OutPort, Width); + if (error != 0) { + printf("acpi: bad write to port 0x%03x (%d), val %#x\n", (int)OutPort, + Width, Value); + if (error == -1) + return (AE_BAD_PARAMETER); + } + switch (Width) { case 8: bus_space_write_1(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, OutPort, Value); ==== //depot/projects/uart/dev/acpica/acpi.c#19 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.219 2005/11/07 21:52:06 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.220 2006/03/29 06:30:47 njl Exp $"); #include "opt_acpi.h" #include <sys/param.h> @@ -58,6 +58,7 @@ #include <contrib/dev/acpica/acpi.h> #include <dev/acpica/acpivar.h> #include <dev/acpica/acpiio.h> +#include <contrib/dev/acpica/achware.h> #include <contrib/dev/acpica/acnamesp.h> #include "pci_if.h" @@ -1636,6 +1637,16 @@ DELAY(1000000); printf("ACPI power-off failed - timeout\n"); } + } else if ((howto & RB_AUTOBOOT) != 0 && AcpiGbl_FADT->ResetRegSup) { + status = AcpiHwLowLevelWrite( + AcpiGbl_FADT->ResetRegister.RegisterBitWidth, + AcpiGbl_FADT->ResetValue, &AcpiGbl_FADT->ResetRegister); + if (ACPI_FAILURE(status)) { + printf("ACPI reset failed - %s\n", AcpiFormatException(status)); + } else { + DELAY(1000000); + printf("ACPI reset failed - timeout\n"); + } } else if (panicstr == NULL) { printf("Shutting down ACPI\n"); AcpiTerminate(); ==== //depot/projects/uart/dev/hwpmc/hwpmc_piv.c#5 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_piv.c,v 1.12 2005/12/26 09:27:24 jkoshy Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_piv.c,v 1.13 2006/03/28 14:09:21 jkoshy Exp $"); #include <sys/param.h> #include <sys/lock.h> @@ -674,6 +674,7 @@ static int p4_cleanup(int cpu) { + int i; struct p4_cpu *pcs; PMCDBG(MDP,INI,0, "p4-cleanup cpu=%d", cpu); @@ -681,6 +682,11 @@ if ((pcs = (struct p4_cpu *) pmc_pcpu[cpu]) == NULL) return 0; + /* Turn off all PMCs on this CPU */ + for (i = 0; i < P4_NPMCS - 1; i++) + wrmsr(P4_CCCR_MSR_FIRST + i, + rdmsr(P4_CCCR_MSR_FIRST + i) & ~P4_CCCR_ENABLE); + /* * If the CPU is physical we need to teardown the * full MD state. ==== //depot/projects/uart/dev/md/md.c#16 (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/dev/md/md.c,v 1.162 2006/01/31 13:35:30 luigi Exp $ + * $FreeBSD: src/sys/dev/md/md.c,v 1.164 2006/03/28 21:25:11 jhb Exp $ * */ @@ -67,6 +67,7 @@ #include <sys/lock.h> #include <sys/malloc.h> #include <sys/mdioctl.h> +#include <sys/mount.h> #include <sys/mutex.h> #include <sys/sx.h> #include <sys/namei.h> @@ -88,7 +89,8 @@ #define MD_MODVER 1 -#define MD_SHUTDOWN 0x10000 /* Tell worker thread to terminate. */ +#define MD_SHUTDOWN 0x10000 /* Tell worker thread to terminate. */ +#define MD_EXITING 0x20000 /* Worker thread is exiting. */ #ifndef MD_NSECT #define MD_NSECT (10000 * 2) @@ -120,6 +122,8 @@ static g_fini_t g_md_fini; static g_start_t g_md_start; static g_access_t g_md_access; +static void g_md_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, + struct g_consumer *cp __unused, struct g_provider *pp); static int mdunits; static struct cdev *status_dev = 0; @@ -140,6 +144,7 @@ .fini = g_md_fini, .start = g_md_start, .access = g_md_access, + .dumpconf = g_md_dumpconf, }; DECLARE_GEOM_CLASS(g_md_class, g_md); @@ -482,12 +487,11 @@ static int mdstart_vnode(struct md_s *sc, struct bio *bp) { - int error; + int error, vfslocked; struct uio auio; struct iovec aiov; struct mount *mp; - mtx_assert(&Giant, MA_OWNED); /* * VNODE I/O * @@ -516,6 +520,7 @@ * When reading set IO_DIRECT to try to avoid double-caching * the data. When writing IO_DIRECT is not optimal. */ + vfslocked = VFS_LOCK_GIANT(sc->vnode->v_mount); if (bp->bio_cmd == BIO_READ) { vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY, curthread); error = VOP_READ(sc->vnode, &auio, IO_DIRECT, sc->cred); @@ -528,6 +533,7 @@ VOP_UNLOCK(sc->vnode, 0, curthread); vn_finished_write(mp); } + VFS_UNLOCK_GIANT(vfslocked); bp->bio_resid = auio.uio_resid; return (error); } @@ -638,35 +644,20 @@ { struct md_s *sc; struct bio *bp; - int error, hasgiant; + int error; sc = arg; mtx_lock_spin(&sched_lock); sched_prio(curthread, PRIBIO); mtx_unlock_spin(&sched_lock); - switch (sc->type) { - case MD_VNODE: - mtx_lock(&Giant); - hasgiant = 1; - break; - case MD_MALLOC: - case MD_PRELOAD: - case MD_SWAP: - default: - hasgiant = 0; - break; - } - for (;;) { + mtx_lock(&sc->queue_mtx); if (sc->flags & MD_SHUTDOWN) { - sc->procp = NULL; - wakeup(&sc->procp); - if (hasgiant) - mtx_unlock(&Giant); + sc->flags |= MD_EXITING; + mtx_unlock(&sc->queue_mtx); kthread_exit(0); } - mtx_lock(&sc->queue_mtx); bp = bioq_takefirst(&sc->bio_queue); if (!bp) { msleep(sc, &sc->queue_mtx, PRIBIO | PDROP, "mdwait", 0); @@ -864,7 +855,7 @@ { struct vattr vattr; struct nameidata nd; - int error, flags; + int error, flags, vfslocked; error = copyinstr(mdio->md_file, sc->file, sizeof(sc->file), NULL); if (error != 0) @@ -876,15 +867,17 @@ */ if ((mdio->md_options & MD_READONLY) != 0) flags &= ~FWRITE; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, sc->file, td); + NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_SYSSPACE, sc->file, td); error = vn_open(&nd, &flags, 0, -1); if (error != 0) return (error); + vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); if (nd.ni_vp->v_type != VREG || (error = VOP_GETATTR(nd.ni_vp, &vattr, td->td_ucred, td))) { VOP_UNLOCK(nd.ni_vp, 0, td); (void)vn_close(nd.ni_vp, flags, td->td_ucred, td); + VFS_UNLOCK_GIANT(vfslocked); return (error ? error : EINVAL); } VOP_UNLOCK(nd.ni_vp, 0, td); @@ -901,16 +894,18 @@ error = mdsetcred(sc, td->td_ucred); if (error != 0) { (void)vn_close(nd.ni_vp, flags, td->td_ucred, td); + VFS_UNLOCK_GIANT(vfslocked); return (error); } + VFS_UNLOCK_GIANT(vfslocked); return (0); } static int mddestroy(struct md_s *sc, struct thread *td) { + int vfslocked; - if (sc->gp) { sc->gp->softc = NULL; g_topology_lock(); @@ -919,16 +914,18 @@ sc->gp = NULL; sc->pp = NULL; } + mtx_lock(&sc->queue_mtx); sc->flags |= MD_SHUTDOWN; wakeup(sc); - while (sc->procp != NULL) - tsleep(&sc->procp, PRIBIO, "mddestroy", hz / 10); + while (!(sc->flags & MD_EXITING)) + msleep(sc->procp, &sc->queue_mtx, PRIBIO, "mddestroy", hz / 10); + mtx_unlock(&sc->queue_mtx); mtx_destroy(&sc->queue_mtx); if (sc->vnode != NULL) { - mtx_lock(&Giant); + vfslocked = VFS_LOCK_GIANT(sc->vnode->v_mount); (void)vn_close(sc->vnode, sc->flags & MD_READONLY ? FREAD : (FREAD|FWRITE), sc->cred, td); - mtx_unlock(&Giant); + VFS_UNLOCK_GIANT(vfslocked); } if (sc->cred != NULL) crfree(sc->cred); @@ -1178,6 +1175,65 @@ } static void +g_md_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, + struct g_consumer *cp __unused, struct g_provider *pp) +{ + struct md_s *mp; + char *type; + + mp = gp->softc; + if (mp == NULL) + return; + + switch (mp->type) { + case MD_MALLOC: + type = "malloc"; + break; + case MD_PRELOAD: + type = "preload"; + break; + case MD_VNODE: + type = "vnode"; + break; + case MD_SWAP: + type = "swap"; + break; + default: + type = "unknown"; + break; + } + + if (pp != NULL) { + if (indent == NULL) { + sbuf_printf(sb, " u %d", mp->unit); + sbuf_printf(sb, " s %ju", (uintmax_t) mp->sectorsize); + sbuf_printf(sb, " f %ju", (uintmax_t) mp->fwheads); + sbuf_printf(sb, " fs %ju", (uintmax_t) mp->fwsectors); + sbuf_printf(sb, " l %ju", (uintmax_t) mp->mediasize); + sbuf_printf(sb, " t %s", type); + if (mp->type == MD_VNODE && mp->vnode != NULL) + sbuf_printf(sb, " file %s", mp->file); + } else { + sbuf_printf(sb, "%s<unit>%d</unit>\n", indent, + mp->unit); + sbuf_printf(sb, "%s<sectorsize>%ju</sectorsize>\n", + indent, (uintmax_t) mp->sectorsize); + sbuf_printf(sb, "%s<fwheads>%ju</fwheads>\n", + indent, (uintmax_t) mp->fwheads); + sbuf_printf(sb, "%s<fwsectors>%ju</fwsectors>\n", + indent, (uintmax_t) mp->fwsectors); + sbuf_printf(sb, "%s<length>%ju</length>\n", + indent, (uintmax_t) mp->mediasize); + sbuf_printf(sb, "%s<type>%s</type>\n", indent, + type); + if (mp->type == MD_VNODE && mp->vnode != NULL) + sbuf_printf(sb, "%s<file>%s</file>\n", + indent, mp->file); + } + } +} + +static void g_md_fini(struct g_class *mp __unused) { ==== //depot/projects/uart/dev/mfi/mfi.c#2 (text) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi.c,v 1.1 2006/03/25 06:14:32 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi.c,v 1.3 2006/03/28 23:59:07 scottl Exp $"); #include "opt_mfi.h" @@ -250,7 +250,7 @@ sc->mfi_sgsize = sizeof(struct mfi_sg64); sc->mfi_flags |= MFI_FLAGS_SG64; } else { - sc->mfi_sgsize = sizeof(struct mfi_sg64); + sc->mfi_sgsize = sizeof(struct mfi_sg32); } frames = (sc->mfi_sgsize * sc->mfi_total_sgl + MFI_FRAME_SIZE - 1) / MFI_FRAME_SIZE + 1; @@ -911,6 +911,12 @@ struct mfi_ld *ld; device_t child; + if ((secsize == 0) || (sectors == 0)) { + device_printf(sc->mfi_dev, "Invalid capacity parameters for " + "logical disk %d\n", id); + return (EINVAL); + } + ld = malloc(sizeof(struct mfi_ld), M_MFIBUF, M_NOWAIT|M_ZERO); if (ld == NULL) { device_printf(sc->mfi_dev, "Cannot allocate ld\n"); @@ -929,7 +935,6 @@ device_set_ivars(child, ld); device_set_desc(child, "MFI Logical Disk"); - TAILQ_INSERT_TAIL(&sc->mfi_ld_tqh, ld, ld_link); mtx_unlock(&sc->mfi_io_lock); mtx_lock(&Giant); bus_generic_attach(sc->mfi_dev); @@ -1069,6 +1074,7 @@ { struct mfi_frame_header *hdr; struct mfi_command *cm; + union mfi_sgl *sgl; struct mfi_softc *sc; int i, dir; @@ -1077,17 +1083,20 @@ cm = (struct mfi_command *)arg; sc = cm->cm_sc; - hdr = (struct mfi_frame_header *)cm->cm_frame; + hdr = &cm->cm_frame->header; + sgl = cm->cm_sg; - for (i = 0; i < nsegs; i++) { - if ((cm->cm_flags & MFI_FLAGS_SG64) == 0) { - cm->cm_sg->sg32[i].addr = segs[i].ds_addr; - cm->cm_sg->sg32[i].len = segs[i].ds_len; - } else { - cm->cm_sg->sg64[i].addr = segs[i].ds_addr; - cm->cm_sg->sg64[i].len = segs[i].ds_len; - hdr->flags |= MFI_FRAME_SGL64; + if ((sc->mfi_flags & MFI_FLAGS_SG64) == 0) { + for (i = 0; i < nsegs; i++) { + sgl->sg32[i].addr = segs[i].ds_addr; + sgl->sg32[i].len = segs[i].ds_len; + } + } else { + for (i = 0; i < nsegs; i++) { + sgl->sg64[i].addr = segs[i].ds_addr; + sgl->sg64[i].len = segs[i].ds_len; } + hdr->flags |= MFI_FRAME_SGL64; } hdr->sg_count = nsegs; ==== //depot/projects/uart/dev/mfi/mfi_disk.c#2 (text) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi_disk.c,v 1.1 2006/03/25 06:14:32 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mfi/mfi_disk.c,v 1.2 2006/03/28 01:59:11 scottl Exp $"); #include "opt_mfi.h" @@ -119,6 +119,7 @@ free(sc->ld_ld, M_MFIBUF); return (EINVAL); } + TAILQ_INSERT_TAIL(&sc->ld_controller->mfi_ld_tqh, ld, ld_link); device_printf(dev, "%juMB (%ju sectors) RAID\n", sectors / (1024 * 1024 / secsize), sectors); ==== //depot/projects/uart/geom/raid3/g_raid3.c#14 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/geom/raid3/g_raid3.c,v 1.58 2006/03/25 23:30:36 pjd Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/raid3/g_raid3.c,v 1.59 2006/03/28 18:34:36 pjd Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -180,7 +180,7 @@ { struct g_raid3_zone *sz = arg; - if (sz->sz_inuse == sz->sz_max) + if (sz->sz_max > 0 && sz->sz_inuse == sz->sz_max) return (ENOMEM); sz->sz_inuse++; return (0); ==== //depot/projects/uart/i386/acpica/madt.c#5 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/i386/acpica/madt.c,v 1.22 2005/11/01 22:44:08 jkim Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/acpica/madt.c,v 1.23 2006/03/27 15:59:48 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -219,11 +219,12 @@ } /* - * For ACPI < 2.0, use the RSDT. For ACPI >= 2.0, use the XSDT. - * We map the XSDT and RSDT at page 1 in the crashdump area. - * Page 0 is used to map in the headers of candidate ACPI tables. + * For ACPI >= 2.0, use the XSDT if it is available. + * Otherwise, use the RSDT. We map the XSDT or RSDT at page 1 + * in the crashdump area. Page 0 is used to map in the + * headers of candidate ACPI tables. */ - if (rsdp->Revision >= 2) { + if (rsdp->Revision >= 2 && rsdp->XsdtPhysicalAddress != 0) { /* * AcpiOsGetRootPointer only verifies the checksum for * the version 1.0 portion of the RSDP. Version 2.0 has ==== //depot/projects/uart/i386/conf/GENERIC#13 (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.438 2006/01/21 12:38:35 marius Exp $ +# $FreeBSD: src/sys/i386/conf/GENERIC,v 1.439 2006/03/29 09:57:21 scottl Exp $ cpu I486_CPU cpu I586_CPU @@ -140,6 +140,7 @@ device aac # Adaptec FSA RAID device aacp # SCSI passthrough for aac (requires CAM) device ida # Compaq Smart RAID +device mfi # LSI MegaRAID SAS device mlx # Mylex DAC960 family device pst # Promise Supertrak SX6000 device twe # 3ware ATA RAID ==== //depot/projects/uart/i386/include/atomic.h#8 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/i386/include/atomic.h,v 1.41 2005/09/27 17:39:10 jhb Exp $ + * $FreeBSD: src/sys/i386/include/atomic.h,v 1.42 2006/03/28 14:34:48 des Exp $ */ #ifndef _MACHINE_ATOMIC_H_ #define _MACHINE_ATOMIC_H_ @@ -415,24 +415,42 @@ #define atomic_fetchadd_32 atomic_fetchadd_int /* Operations on pointers. */ -#define atomic_set_ptr atomic_set_int -#define atomic_set_acq_ptr atomic_set_acq_int -#define atomic_set_rel_ptr atomic_set_rel_int -#define atomic_clear_ptr atomic_clear_int -#define atomic_clear_acq_ptr atomic_clear_acq_int -#define atomic_clear_rel_ptr atomic_clear_rel_int -#define atomic_add_ptr atomic_add_int -#define atomic_add_acq_ptr atomic_add_acq_int -#define atomic_add_rel_ptr atomic_add_rel_int -#define atomic_subtract_ptr atomic_subtract_int -#define atomic_subtract_acq_ptr atomic_subtract_acq_int -#define atomic_subtract_rel_ptr atomic_subtract_rel_int -#define atomic_load_acq_ptr atomic_load_acq_int -#define atomic_store_rel_ptr atomic_store_rel_int -#define atomic_cmpset_ptr atomic_cmpset_int -#define atomic_cmpset_acq_ptr atomic_cmpset_acq_int -#define atomic_cmpset_rel_ptr atomic_cmpset_rel_int -#define atomic_readandclear_ptr atomic_readandclear_int +#define atomic_set_ptr(p, v) \ + atomic_set_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_set_acq_ptr(p, v) \ + atomic_set_acq_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_set_rel_ptr(p, v) \ + atomic_set_rel_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_clear_ptr(p, v) \ + atomic_clear_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_clear_acq_ptr(p, v) \ + atomic_clear_acq_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_clear_rel_ptr(p, v) \ + atomic_clear_rel_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_add_ptr(p, v) \ + atomic_add_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_add_acq_ptr(p, v) \ + atomic_add_acq_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_add_rel_ptr(p, v) \ + atomic_add_rel_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_subtract_ptr(p, v) \ + atomic_subtract_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_subtract_acq_ptr(p, v) \ + atomic_subtract_acq_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_subtract_rel_ptr(p, v) \ + atomic_subtract_rel_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_load_acq_ptr(p) \ + atomic_load_acq_int((volatile u_int *)(p)) +#define atomic_store_rel_ptr(p, v) \ + atomic_store_rel_int((volatile u_int *)(p), (v)) +#define atomic_cmpset_ptr(dst, old, new) \ + atomic_cmpset_int((volatile u_int *)(dst), (u_int)(old), (u_int)(new)) +#define atomic_cmpset_acq_ptr(dst, old, new) \ + atomic_cmpset_acq_int((volatile u_int *)(dst), (u_int)(old), (u_int)(new)) +#define atomic_cmpset_rel_ptr(dst, old, new) \ + atomic_cmpset_rel_int((volatile u_int *)(dst), (u_int)(old), (u_int)(new)) +#define atomic_readandclear_ptr(p) \ + atomic_readandclear_int((volatile u_int *)(p)) #endif /* !defined(WANT_FUNCTIONS) */ #endif /* ! _MACHINE_ATOMIC_H_ */ ==== //depot/projects/uart/kern/kern_acct.c#9 (text+ko) ==== @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_acct.c,v 1.80 2006/02/07 18:59:47 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_acct.c,v 1.81 2006/03/28 21:26:59 jhb Exp $"); #include "opt_mac.h" @@ -159,7 +159,7 @@ acct(struct thread *td, struct acct_args *uap) { struct nameidata nd; - int error, flags; + int error, flags, vfslocked; /* Make sure that the caller is root. */ error = suser(td); @@ -168,38 +168,38 @@ /* * If accounting is to be started to a file, open that file for - * appending and make sure it's a 'normal'. While we could - * conditionally acquire Giant here, we're actually interacting with - * vnodes from possibly two file systems, making the logic a bit - * complicated. For now, use Giant unconditionally. + * appending and make sure it's a 'normal'. */ - mtx_lock(&Giant); if (uap->path != NULL) { - NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_USERSPACE, + uap->path, td); flags = FWRITE | O_APPEND; error = vn_open(&nd, &flags, 0, -1); if (error) - goto done; + return (error); + vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); #ifdef MAC error = mac_check_system_acct(td->td_ucred, nd.ni_vp); if (error) { VOP_UNLOCK(nd.ni_vp, 0, td); vn_close(nd.ni_vp, flags, td->td_ucred, td); - goto done; + VFS_UNLOCK_GIANT(vfslocked); >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603292242.k2TMggdJ079138>