svn commit: r212733 - in user/nwhitehorn/ps3: amd64/amd64
amd64/conf amd64/include arm/arm arm/xscale/ixp425
boot/sparc64/boot1 boot/zfs cddl/boot/zfs
cddl/compat/opensolaris/sys cddl/contrib/opens...
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Thu Sep 16 13:49:11 UTC 2010
Author: nwhitehorn
Date: Thu Sep 16 13:49:10 2010
New Revision: 212733
URL: http://svn.freebsd.org/changeset/base/212733
Log:
IFC @ r212732
This pulls in recent timer and SLB changes.
Added:
user/nwhitehorn/ps3/conf/ldscript.mips.64.cfe
- copied unchanged from r212732, head/sys/conf/ldscript.mips.64.cfe
user/nwhitehorn/ps3/dev/mps/
- copied from r212732, head/sys/dev/mps/
user/nwhitehorn/ps3/mips/conf/SWARM64
- copied unchanged from r212732, head/sys/mips/conf/SWARM64
user/nwhitehorn/ps3/mips/conf/SWARM64_SMP
- copied unchanged from r212732, head/sys/mips/conf/SWARM64_SMP
user/nwhitehorn/ps3/mips/conf/SWARM_COMMON
- copied unchanged from r212732, head/sys/mips/conf/SWARM_COMMON
user/nwhitehorn/ps3/modules/mps/
- copied from r212732, head/sys/modules/mps/
Deleted:
user/nwhitehorn/ps3/mips/mips/psraccess.S
Modified:
user/nwhitehorn/ps3/amd64/amd64/legacy.c
user/nwhitehorn/ps3/amd64/amd64/machdep.c
user/nwhitehorn/ps3/amd64/amd64/mp_machdep.c
user/nwhitehorn/ps3/amd64/amd64/nexus.c
user/nwhitehorn/ps3/amd64/conf/GENERIC
user/nwhitehorn/ps3/amd64/include/apicvar.h
user/nwhitehorn/ps3/arm/arm/nexus.c
user/nwhitehorn/ps3/arm/arm/pmap.c
user/nwhitehorn/ps3/arm/xscale/ixp425/ixp425.c
user/nwhitehorn/ps3/boot/sparc64/boot1/boot1.c
user/nwhitehorn/ps3/boot/zfs/zfsimpl.c
user/nwhitehorn/ps3/cddl/boot/zfs/zfsimpl.h
user/nwhitehorn/ps3/cddl/compat/opensolaris/sys/vnode.h
user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ctldir.h
user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c
user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c
user/nwhitehorn/ps3/compat/linprocfs/linprocfs.c
user/nwhitehorn/ps3/compat/linux/linux_ioctl.c
user/nwhitehorn/ps3/conf/Makefile.mips
user/nwhitehorn/ps3/conf/files
user/nwhitehorn/ps3/conf/files.mips
user/nwhitehorn/ps3/conf/files.powerpc
user/nwhitehorn/ps3/conf/kern.mk
user/nwhitehorn/ps3/conf/kern.pre.mk
user/nwhitehorn/ps3/conf/kmod.mk
user/nwhitehorn/ps3/contrib/pf/net/pf.c
user/nwhitehorn/ps3/dev/aac/aac.c
user/nwhitehorn/ps3/dev/aac/aacreg.h
user/nwhitehorn/ps3/dev/aac/aacvar.h
user/nwhitehorn/ps3/dev/acpi_support/acpi_hp.c
user/nwhitehorn/ps3/dev/acpi_support/acpi_wmi.c
user/nwhitehorn/ps3/dev/acpica/acpi.c
user/nwhitehorn/ps3/dev/acpica/acpi_cpu.c
user/nwhitehorn/ps3/dev/acpica/acpi_hpet.c
user/nwhitehorn/ps3/dev/ahci/ahci.c
user/nwhitehorn/ps3/dev/atkbdc/atkbdc_isa.c
user/nwhitehorn/ps3/dev/cxgb/common/cxgb_t3_hw.c
user/nwhitehorn/ps3/dev/cxgb/cxgb_sge.c
user/nwhitehorn/ps3/dev/fb/vesa.c
user/nwhitehorn/ps3/dev/firewire/firewire.c
user/nwhitehorn/ps3/dev/firewire/fwohci_pci.c
user/nwhitehorn/ps3/dev/gem/if_gem.c
user/nwhitehorn/ps3/dev/gem/if_gem_pci.c
user/nwhitehorn/ps3/dev/gem/if_gem_sbus.c
user/nwhitehorn/ps3/dev/iicbus/iicbus.c
user/nwhitehorn/ps3/dev/led/led.c
user/nwhitehorn/ps3/dev/malo/if_malo_pci.c
user/nwhitehorn/ps3/dev/msk/if_msk.c
user/nwhitehorn/ps3/dev/mvs/mvs.c
user/nwhitehorn/ps3/dev/mwl/if_mwl_pci.c
user/nwhitehorn/ps3/dev/ofw/ofw_fdt.c
user/nwhitehorn/ps3/dev/ofw/ofw_if.m
user/nwhitehorn/ps3/dev/ofw/ofw_iicbus.c
user/nwhitehorn/ps3/dev/ofw/ofw_standard.c
user/nwhitehorn/ps3/dev/ofw/openfirm.c
user/nwhitehorn/ps3/dev/pci/pcireg.h
user/nwhitehorn/ps3/dev/ppbus/ppbconf.c
user/nwhitehorn/ps3/dev/siba/siba.c
user/nwhitehorn/ps3/dev/siis/siis.c
user/nwhitehorn/ps3/dev/spibus/spibus.c
user/nwhitehorn/ps3/dev/usb/usb_busdma.c
user/nwhitehorn/ps3/fs/devfs/devfs.h
user/nwhitehorn/ps3/fs/devfs/devfs_devs.c
user/nwhitehorn/ps3/fs/devfs/devfs_vnops.c
user/nwhitehorn/ps3/fs/nfs/nfsdport.h
user/nwhitehorn/ps3/fs/nfsclient/nfs_clvnops.c
user/nwhitehorn/ps3/fs/nfsserver/nfs_nfsdstate.c
user/nwhitehorn/ps3/fs/tmpfs/tmpfs_vnops.c
user/nwhitehorn/ps3/geom/eli/g_eli_ctl.c
user/nwhitehorn/ps3/geom/mirror/g_mirror_ctl.c
user/nwhitehorn/ps3/geom/part/g_part.c
user/nwhitehorn/ps3/i386/i386/legacy.c
user/nwhitehorn/ps3/i386/i386/machdep.c
user/nwhitehorn/ps3/i386/i386/mp_machdep.c
user/nwhitehorn/ps3/i386/i386/nexus.c
user/nwhitehorn/ps3/i386/include/apicvar.h
user/nwhitehorn/ps3/ia64/ia64/nexus.c
user/nwhitehorn/ps3/isa/isa_common.c
user/nwhitehorn/ps3/kern/bus_if.m
user/nwhitehorn/ps3/kern/kern_clock.c
user/nwhitehorn/ps3/kern/kern_clocksource.c
user/nwhitehorn/ps3/kern/kern_et.c
user/nwhitehorn/ps3/kern/kern_jail.c
user/nwhitehorn/ps3/kern/kern_sig.c
user/nwhitehorn/ps3/kern/kern_tc.c
user/nwhitehorn/ps3/kern/kern_timeout.c
user/nwhitehorn/ps3/kern/sched_4bsd.c
user/nwhitehorn/ps3/kern/sched_ule.c
user/nwhitehorn/ps3/kern/subr_bus.c
user/nwhitehorn/ps3/kern/subr_lock.c
user/nwhitehorn/ps3/kern/subr_sbuf.c
user/nwhitehorn/ps3/kern/subr_sleepqueue.c
user/nwhitehorn/ps3/kern/subr_witness.c
user/nwhitehorn/ps3/kern/vfs_mount.c
user/nwhitehorn/ps3/kern/vfs_subr.c
user/nwhitehorn/ps3/mips/adm5120/obio.c
user/nwhitehorn/ps3/mips/alchemy/obio.c
user/nwhitehorn/ps3/mips/atheros/apb.c
user/nwhitehorn/ps3/mips/cavium/octeon_mp.c
user/nwhitehorn/ps3/mips/conf/MALTA64
user/nwhitehorn/ps3/mips/conf/OCTEON1
user/nwhitehorn/ps3/mips/conf/SWARM
user/nwhitehorn/ps3/mips/conf/SWARM_SMP
user/nwhitehorn/ps3/mips/idt/obio.c
user/nwhitehorn/ps3/mips/include/cpufunc.h
user/nwhitehorn/ps3/mips/include/md_var.h
user/nwhitehorn/ps3/mips/include/smp.h
user/nwhitehorn/ps3/mips/mips/machdep.c
user/nwhitehorn/ps3/mips/mips/mainbus.c
user/nwhitehorn/ps3/mips/mips/mp_machdep.c
user/nwhitehorn/ps3/mips/mips/nexus.c
user/nwhitehorn/ps3/mips/mips/pmap.c
user/nwhitehorn/ps3/mips/mips/trap.c
user/nwhitehorn/ps3/mips/rmi/dev/nlge/if_nlge.c
user/nwhitehorn/ps3/mips/rmi/dev/xlr/rge.c
user/nwhitehorn/ps3/mips/rmi/iodi.c
user/nwhitehorn/ps3/mips/rmi/msgring.h
user/nwhitehorn/ps3/mips/rmi/rmi_mips_exts.h
user/nwhitehorn/ps3/mips/rmi/xlr_machdep.c
user/nwhitehorn/ps3/mips/rmi/xlr_pci.c
user/nwhitehorn/ps3/mips/sibyte/sb_machdep.c
user/nwhitehorn/ps3/mips/sibyte/sb_zbbus.c
user/nwhitehorn/ps3/modules/Makefile
user/nwhitehorn/ps3/modules/crypto/Makefile
user/nwhitehorn/ps3/modules/gem/Makefile
user/nwhitehorn/ps3/modules/opensolaris/Makefile
user/nwhitehorn/ps3/modules/scc/Makefile
user/nwhitehorn/ps3/modules/sound/sound/Makefile
user/nwhitehorn/ps3/modules/zfs/Makefile
user/nwhitehorn/ps3/net/if.c
user/nwhitehorn/ps3/netinet/raw_ip.c
user/nwhitehorn/ps3/netinet/sctp_asconf.c
user/nwhitehorn/ps3/netinet/sctp_asconf.h
user/nwhitehorn/ps3/netinet/sctp_bsd_addr.c
user/nwhitehorn/ps3/netinet/sctp_cc_functions.c
user/nwhitehorn/ps3/netinet/sctp_indata.c
user/nwhitehorn/ps3/netinet/sctp_input.c
user/nwhitehorn/ps3/netinet/sctp_output.c
user/nwhitehorn/ps3/netinet/sctp_output.h
user/nwhitehorn/ps3/netinet/sctp_pcb.c
user/nwhitehorn/ps3/netinet/sctp_sysctl.c
user/nwhitehorn/ps3/netinet/sctp_timer.c
user/nwhitehorn/ps3/netinet/sctp_usrreq.c
user/nwhitehorn/ps3/netinet/sctputil.c
user/nwhitehorn/ps3/netinet/tcp.h
user/nwhitehorn/ps3/netinet6/sctp6_usrreq.c
user/nwhitehorn/ps3/nfsclient/nfs.h
user/nwhitehorn/ps3/nfsclient/nfs_nfsiod.c
user/nwhitehorn/ps3/nfsclient/nfs_subs.c
user/nwhitehorn/ps3/pc98/pc98/canbus.c
user/nwhitehorn/ps3/pc98/pc98/machdep.c
user/nwhitehorn/ps3/powerpc/aim/clock.c
user/nwhitehorn/ps3/powerpc/aim/copyinout.c
user/nwhitehorn/ps3/powerpc/aim/interrupt.c
user/nwhitehorn/ps3/powerpc/aim/machdep.c
user/nwhitehorn/ps3/powerpc/aim/mmu_oea.c
user/nwhitehorn/ps3/powerpc/aim/mmu_oea64.c
user/nwhitehorn/ps3/powerpc/aim/nexus.c
user/nwhitehorn/ps3/powerpc/aim/slb.c
user/nwhitehorn/ps3/powerpc/aim/trap.c
user/nwhitehorn/ps3/powerpc/aim/trap_subr64.S
user/nwhitehorn/ps3/powerpc/booke/clock.c
user/nwhitehorn/ps3/powerpc/booke/interrupt.c
user/nwhitehorn/ps3/powerpc/booke/platform_bare.c
user/nwhitehorn/ps3/powerpc/booke/pmap.c
user/nwhitehorn/ps3/powerpc/include/intr_machdep.h
user/nwhitehorn/ps3/powerpc/include/md_var.h
user/nwhitehorn/ps3/powerpc/include/mmuvar.h
user/nwhitehorn/ps3/powerpc/include/pcb.h
user/nwhitehorn/ps3/powerpc/include/pcpu.h
user/nwhitehorn/ps3/powerpc/include/pmap.h
user/nwhitehorn/ps3/powerpc/include/smp.h
user/nwhitehorn/ps3/powerpc/include/sr.h
user/nwhitehorn/ps3/powerpc/ofw/ofw_real.c
user/nwhitehorn/ps3/powerpc/powermac/ata_kauai.c
user/nwhitehorn/ps3/powerpc/powermac/kiic.c
user/nwhitehorn/ps3/powerpc/powerpc/cpu.c
user/nwhitehorn/ps3/powerpc/powerpc/exec_machdep.c
user/nwhitehorn/ps3/powerpc/powerpc/intr_machdep.c
user/nwhitehorn/ps3/powerpc/powerpc/mp_machdep.c
user/nwhitehorn/ps3/powerpc/ps3/mmu_ps3.c
user/nwhitehorn/ps3/security/audit/audit_bsm_klib.c
user/nwhitehorn/ps3/sparc64/include/asm.h
user/nwhitehorn/ps3/sparc64/include/intr_machdep.h
user/nwhitehorn/ps3/sparc64/include/md_var.h
user/nwhitehorn/ps3/sparc64/include/smp.h
user/nwhitehorn/ps3/sparc64/pci/schizo.c
user/nwhitehorn/ps3/sparc64/sparc64/bus_machdep.c
user/nwhitehorn/ps3/sparc64/sparc64/intr_machdep.c
user/nwhitehorn/ps3/sparc64/sparc64/iommu.c
user/nwhitehorn/ps3/sparc64/sparc64/machdep.c
user/nwhitehorn/ps3/sparc64/sparc64/mp_machdep.c
user/nwhitehorn/ps3/sparc64/sparc64/nexus.c
user/nwhitehorn/ps3/sparc64/sparc64/support.S
user/nwhitehorn/ps3/sparc64/sparc64/vm_machdep.c
user/nwhitehorn/ps3/sun4v/include/intr_machdep.h
user/nwhitehorn/ps3/sun4v/include/smp.h
user/nwhitehorn/ps3/sun4v/sun4v/bus_machdep.c
user/nwhitehorn/ps3/sun4v/sun4v/hviommu.c
user/nwhitehorn/ps3/sun4v/sun4v/intr_machdep.c
user/nwhitehorn/ps3/sun4v/sun4v/mp_machdep.c
user/nwhitehorn/ps3/sun4v/sun4v/nexus.c
user/nwhitehorn/ps3/sun4v/sun4v/vnex.c
user/nwhitehorn/ps3/sys/bus.h
user/nwhitehorn/ps3/sys/callout.h
user/nwhitehorn/ps3/sys/elf_common.h
user/nwhitehorn/ps3/sys/lock.h
user/nwhitehorn/ps3/sys/mount.h
user/nwhitehorn/ps3/sys/param.h
user/nwhitehorn/ps3/sys/pcpu.h
user/nwhitehorn/ps3/sys/sbuf.h
user/nwhitehorn/ps3/sys/sched.h
user/nwhitehorn/ps3/sys/systm.h
user/nwhitehorn/ps3/sys/timeet.h
user/nwhitehorn/ps3/sys/timetc.h
user/nwhitehorn/ps3/ufs/ffs/ffs_softdep.c
user/nwhitehorn/ps3/ufs/ffs/fs.h
user/nwhitehorn/ps3/ufs/ffs/softdep.h
user/nwhitehorn/ps3/x86/cpufreq/est.c
user/nwhitehorn/ps3/x86/x86/local_apic.c
Directory Properties:
user/nwhitehorn/ps3/ (props changed)
user/nwhitehorn/ps3/amd64/include/xen/ (props changed)
user/nwhitehorn/ps3/boot/powerpc/ps3/ (props changed)
user/nwhitehorn/ps3/cddl/contrib/opensolaris/ (props changed)
user/nwhitehorn/ps3/contrib/dev/acpica/ (props changed)
user/nwhitehorn/ps3/contrib/pf/ (props changed)
user/nwhitehorn/ps3/contrib/x86emu/ (props changed)
user/nwhitehorn/ps3/dev/xen/xenpci/ (props changed)
user/nwhitehorn/ps3/powerpc/ps3/ (props changed)
Modified: user/nwhitehorn/ps3/amd64/amd64/legacy.c
==============================================================================
--- user/nwhitehorn/ps3/amd64/amd64/legacy.c Thu Sep 16 12:39:50 2010 (r212732)
+++ user/nwhitehorn/ps3/amd64/amd64/legacy.c Thu Sep 16 13:49:10 2010 (r212733)
@@ -60,7 +60,7 @@ struct legacy_device {
static int legacy_probe(device_t);
static int legacy_attach(device_t);
static int legacy_print_child(device_t, device_t);
-static device_t legacy_add_child(device_t bus, int order, const char *name,
+static device_t legacy_add_child(device_t bus, u_int order, const char *name,
int unit);
static int legacy_read_ivar(device_t, device_t, int, uintptr_t *);
static int legacy_write_ivar(device_t, device_t, int, uintptr_t);
@@ -149,7 +149,7 @@ legacy_print_child(device_t bus, device_
}
static device_t
-legacy_add_child(device_t bus, int order, const char *name, int unit)
+legacy_add_child(device_t bus, u_int order, const char *name, int unit)
{
device_t child;
struct legacy_device *atdev;
@@ -213,7 +213,7 @@ legacy_write_ivar(device_t dev, device_t
static void cpu_identify(driver_t *driver, device_t parent);
static int cpu_read_ivar(device_t dev, device_t child, int index,
uintptr_t *result);
-static device_t cpu_add_child(device_t bus, int order, const char *name,
+static device_t cpu_add_child(device_t bus, u_int order, const char *name,
int unit);
static struct resource_list *cpu_get_rlist(device_t dev, device_t child);
@@ -277,7 +277,7 @@ cpu_identify(driver_t *driver, device_t
}
static device_t
-cpu_add_child(device_t bus, int order, const char *name, int unit)
+cpu_add_child(device_t bus, u_int order, const char *name, int unit)
{
struct cpu_device *cd;
device_t child;
Modified: user/nwhitehorn/ps3/amd64/amd64/machdep.c
==============================================================================
--- user/nwhitehorn/ps3/amd64/amd64/machdep.c Thu Sep 16 12:39:50 2010 (r212732)
+++ user/nwhitehorn/ps3/amd64/amd64/machdep.c Thu Sep 16 13:49:10 2010 (r212733)
@@ -585,59 +585,89 @@ cpu_halt(void)
}
void (*cpu_idle_hook)(void) = NULL; /* ACPI idle hook. */
+static int cpu_ident_amdc1e = 0; /* AMD C1E supported. */
+static int idle_mwait = 1; /* Use MONITOR/MWAIT for short idle. */
+TUNABLE_INT("machdep.idle_mwait", &idle_mwait);
+SYSCTL_INT(_machdep, OID_AUTO, idle_mwait, CTLFLAG_RW, &idle_mwait,
+ 0, "Use MONITOR/MWAIT for short idle");
+
+#define STATE_RUNNING 0x0
+#define STATE_MWAIT 0x1
+#define STATE_SLEEPING 0x2
static void
-cpu_idle_hlt(int busy)
+cpu_idle_acpi(int busy)
{
- /*
- * we must absolutely guarentee that hlt is the next instruction
- * after sti or we introduce a timing window.
- */
+ int *state;
+
+ state = (int *)PCPU_PTR(monitorbuf);
+ *state = STATE_SLEEPING;
disable_intr();
- if (sched_runnable())
+ if (sched_runnable())
enable_intr();
+ else if (cpu_idle_hook)
+ cpu_idle_hook();
else
__asm __volatile("sti; hlt");
+ *state = STATE_RUNNING;
}
static void
-cpu_idle_acpi(int busy)
+cpu_idle_hlt(int busy)
{
+ int *state;
+
+ state = (int *)PCPU_PTR(monitorbuf);
+ *state = STATE_SLEEPING;
+ /*
+ * We must absolutely guarentee that hlt is the next instruction
+ * after sti or we introduce a timing window.
+ */
disable_intr();
- if (sched_runnable())
+ if (sched_runnable())
enable_intr();
- else if (cpu_idle_hook)
- cpu_idle_hook();
else
__asm __volatile("sti; hlt");
+ *state = STATE_RUNNING;
}
-static int cpu_ident_amdc1e = 0;
+/*
+ * MWAIT cpu power states. Lower 4 bits are sub-states.
+ */
+#define MWAIT_C0 0xf0
+#define MWAIT_C1 0x00
+#define MWAIT_C2 0x10
+#define MWAIT_C3 0x20
+#define MWAIT_C4 0x30
-static int
-cpu_probe_amdc1e(void)
+static void
+cpu_idle_mwait(int busy)
{
- int i;
+ int *state;
- /*
- * Forget it, if we're not using local APIC timer.
- */
- if (resource_disabled("apic", 0) ||
- (resource_int_value("apic", 0, "clock", &i) == 0 && i == 0))
- return (0);
-
- /*
- * Detect the presence of C1E capability mostly on latest
- * dual-cores (or future) k8 family.
- */
- if (cpu_vendor_id == CPU_VENDOR_AMD &&
- (cpu_id & 0x00000f00) == 0x00000f00 &&
- (cpu_id & 0x0fff0000) >= 0x00040000) {
- cpu_ident_amdc1e = 1;
- return (1);
+ state = (int *)PCPU_PTR(monitorbuf);
+ *state = STATE_MWAIT;
+ if (!sched_runnable()) {
+ cpu_monitor(state, 0, 0);
+ if (*state == STATE_MWAIT)
+ cpu_mwait(0, MWAIT_C1);
}
+ *state = STATE_RUNNING;
+}
- return (0);
+static void
+cpu_idle_spin(int busy)
+{
+ int *state;
+ int i;
+
+ state = (int *)PCPU_PTR(monitorbuf);
+ *state = STATE_RUNNING;
+ for (i = 0; i < 1000; i++) {
+ if (sched_runnable())
+ return;
+ cpu_spinwait();
+ }
}
/*
@@ -655,110 +685,83 @@ cpu_probe_amdc1e(void)
#define AMDK8_CMPHALT (AMDK8_SMIONCMPHALT | AMDK8_C1EONCMPHALT)
static void
-cpu_idle_amdc1e(int busy)
+cpu_probe_amdc1e(void)
{
- disable_intr();
- if (sched_runnable())
- enable_intr();
- else {
- uint64_t msr;
-
- msr = rdmsr(MSR_AMDK8_IPM);
- if (msr & AMDK8_CMPHALT)
- wrmsr(MSR_AMDK8_IPM, msr & ~AMDK8_CMPHALT);
-
- if (cpu_idle_hook)
- cpu_idle_hook();
- else
- __asm __volatile("sti; hlt");
+ /*
+ * Detect the presence of C1E capability mostly on latest
+ * dual-cores (or future) k8 family.
+ */
+ if (cpu_vendor_id == CPU_VENDOR_AMD &&
+ (cpu_id & 0x00000f00) == 0x00000f00 &&
+ (cpu_id & 0x0fff0000) >= 0x00040000) {
+ cpu_ident_amdc1e = 1;
}
}
-static void
-cpu_idle_spin(int busy)
-{
- return;
-}
-
void (*cpu_idle_fn)(int) = cpu_idle_acpi;
void
cpu_idle(int busy)
{
+ uint64_t msr;
+
+ CTR2(KTR_SPARE2, "cpu_idle(%d) at %d",
+ busy, curcpu);
#ifdef SMP
if (mp_grab_cpu_hlt())
return;
#endif
- cpu_idle_fn(busy);
-}
-
-/*
- * mwait cpu power states. Lower 4 bits are sub-states.
- */
-#define MWAIT_C0 0xf0
-#define MWAIT_C1 0x00
-#define MWAIT_C2 0x10
-#define MWAIT_C3 0x20
-#define MWAIT_C4 0x30
-
-#define MWAIT_DISABLED 0x0
-#define MWAIT_WOKEN 0x1
-#define MWAIT_WAITING 0x2
+ /* If we are busy - try to use fast methods. */
+ if (busy) {
+ if ((cpu_feature2 & CPUID2_MON) && idle_mwait) {
+ cpu_idle_mwait(busy);
+ goto out;
+ }
+ }
-static void
-cpu_idle_mwait(int busy)
-{
- int *mwait;
+ /* If we have time - switch timers into idle mode. */
+ if (!busy) {
+ critical_enter();
+ cpu_idleclock();
+ }
- mwait = (int *)PCPU_PTR(monitorbuf);
- *mwait = MWAIT_WAITING;
- if (sched_runnable())
- return;
- cpu_monitor(mwait, 0, 0);
- if (*mwait == MWAIT_WAITING)
- cpu_mwait(0, MWAIT_C1);
-}
+ /* Apply AMD APIC timer C1E workaround. */
+ if (cpu_ident_amdc1e && cpu_disable_deep_sleep) {
+ msr = rdmsr(MSR_AMDK8_IPM);
+ if (msr & AMDK8_CMPHALT)
+ wrmsr(MSR_AMDK8_IPM, msr & ~AMDK8_CMPHALT);
+ }
-static void
-cpu_idle_mwait_hlt(int busy)
-{
- int *mwait;
+ /* Call main idle method. */
+ cpu_idle_fn(busy);
- mwait = (int *)PCPU_PTR(monitorbuf);
- if (busy == 0) {
- *mwait = MWAIT_DISABLED;
- cpu_idle_hlt(busy);
- return;
- }
- *mwait = MWAIT_WAITING;
- if (sched_runnable())
- return;
- cpu_monitor(mwait, 0, 0);
- if (*mwait == MWAIT_WAITING)
- cpu_mwait(0, MWAIT_C1);
+ /* Switch timers mack into active mode. */
+ if (!busy) {
+ cpu_activeclock();
+ critical_exit();
+ }
+out:
+ CTR2(KTR_SPARE2, "cpu_idle(%d) at %d done",
+ busy, curcpu);
}
int
cpu_idle_wakeup(int cpu)
{
struct pcpu *pcpu;
- int *mwait;
+ int *state;
- if (cpu_idle_fn == cpu_idle_spin)
- return (1);
- if (cpu_idle_fn != cpu_idle_mwait && cpu_idle_fn != cpu_idle_mwait_hlt)
- return (0);
pcpu = pcpu_find(cpu);
- mwait = (int *)pcpu->pc_monitorbuf;
+ state = (int *)pcpu->pc_monitorbuf;
/*
* This doesn't need to be atomic since missing the race will
* simply result in unnecessary IPIs.
*/
- if (cpu_idle_fn == cpu_idle_mwait_hlt && *mwait == MWAIT_DISABLED)
+ if (*state == STATE_SLEEPING)
return (0);
- *mwait = MWAIT_WOKEN;
-
+ if (*state == STATE_MWAIT)
+ *state = STATE_RUNNING;
return (1);
}
@@ -771,8 +774,6 @@ struct {
} idle_tbl[] = {
{ cpu_idle_spin, "spin" },
{ cpu_idle_mwait, "mwait" },
- { cpu_idle_mwait_hlt, "mwait_hlt" },
- { cpu_idle_amdc1e, "amdc1e" },
{ cpu_idle_hlt, "hlt" },
{ cpu_idle_acpi, "acpi" },
{ NULL, NULL }
@@ -791,8 +792,8 @@ idle_sysctl_available(SYSCTL_HANDLER_ARG
if (strstr(idle_tbl[i].id_name, "mwait") &&
(cpu_feature2 & CPUID2_MON) == 0)
continue;
- if (strcmp(idle_tbl[i].id_name, "amdc1e") == 0 &&
- cpu_ident_amdc1e == 0)
+ if (strcmp(idle_tbl[i].id_name, "acpi") == 0 &&
+ cpu_idle_hook == NULL)
continue;
p += sprintf(p, "%s, ", idle_tbl[i].id_name);
}
@@ -801,6 +802,9 @@ idle_sysctl_available(SYSCTL_HANDLER_ARG
return (error);
}
+SYSCTL_PROC(_machdep, OID_AUTO, idle_available, CTLTYPE_STRING | CTLFLAG_RD,
+ 0, 0, idle_sysctl_available, "A", "list of available idle functions");
+
static int
idle_sysctl(SYSCTL_HANDLER_ARGS)
{
@@ -824,8 +828,8 @@ idle_sysctl(SYSCTL_HANDLER_ARGS)
if (strstr(idle_tbl[i].id_name, "mwait") &&
(cpu_feature2 & CPUID2_MON) == 0)
continue;
- if (strcmp(idle_tbl[i].id_name, "amdc1e") == 0 &&
- cpu_ident_amdc1e == 0)
+ if (strcmp(idle_tbl[i].id_name, "acpi") == 0 &&
+ cpu_idle_hook == NULL)
continue;
if (strcmp(idle_tbl[i].id_name, buf))
continue;
@@ -835,9 +839,6 @@ idle_sysctl(SYSCTL_HANDLER_ARGS)
return (EINVAL);
}
-SYSCTL_PROC(_machdep, OID_AUTO, idle_available, CTLTYPE_STRING | CTLFLAG_RD,
- 0, 0, idle_sysctl_available, "A", "list of available idle functions");
-
SYSCTL_PROC(_machdep, OID_AUTO, idle, CTLTYPE_STRING | CTLFLAG_RW, 0, 0,
idle_sysctl, "A", "currently selected idle function");
@@ -1743,8 +1744,7 @@ hammer_time(u_int64_t modulep, u_int64_t
}
#endif
- if (cpu_probe_amdc1e())
- cpu_idle_fn = cpu_idle_amdc1e;
+ cpu_probe_amdc1e();
/* Location of kernel stack for locore */
return ((u_int64_t)thread0.td_pcb);
Modified: user/nwhitehorn/ps3/amd64/amd64/mp_machdep.c
==============================================================================
--- user/nwhitehorn/ps3/amd64/amd64/mp_machdep.c Thu Sep 16 12:39:50 2010 (r212732)
+++ user/nwhitehorn/ps3/amd64/amd64/mp_machdep.c Thu Sep 16 13:49:10 2010 (r212733)
@@ -118,7 +118,6 @@ u_long *ipi_invlcache_counts[MAXCPU];
u_long *ipi_rendezvous_counts[MAXCPU];
u_long *ipi_lazypmap_counts[MAXCPU];
static u_long *ipi_hardclock_counts[MAXCPU];
-static u_long *ipi_statclock_counts[MAXCPU];
#endif
extern inthand_t IDTVEC(fast_syscall), IDTVEC(fast_syscall32);
@@ -1196,16 +1195,22 @@ smp_masked_invlpg_range(cpumask_t mask,
void
ipi_bitmap_handler(struct trapframe frame)
{
+ struct trapframe *oldframe;
+ struct thread *td;
int cpu = PCPU_GET(cpuid);
u_int ipi_bitmap;
+ critical_enter();
+ td = curthread;
+ td->td_intr_nesting_level++;
+ oldframe = td->td_intr_frame;
+ td->td_intr_frame = &frame;
ipi_bitmap = atomic_readandclear_int(&cpu_ipi_pending[cpu]);
-
if (ipi_bitmap & (1 << IPI_PREEMPT)) {
#ifdef COUNT_IPIS
(*ipi_preempt_counts[cpu])++;
#endif
- sched_preempt(curthread);
+ sched_preempt(td);
}
if (ipi_bitmap & (1 << IPI_AST)) {
#ifdef COUNT_IPIS
@@ -1217,14 +1222,11 @@ ipi_bitmap_handler(struct trapframe fram
#ifdef COUNT_IPIS
(*ipi_hardclock_counts[cpu])++;
#endif
- hardclockintr(&frame);
- }
- if (ipi_bitmap & (1 << IPI_STATCLOCK)) {
-#ifdef COUNT_IPIS
- (*ipi_statclock_counts[cpu])++;
-#endif
- statclockintr(&frame);
+ hardclockintr();
}
+ td->td_intr_frame = oldframe;
+ td->td_intr_nesting_level--;
+ critical_exit();
}
/*
@@ -1579,8 +1581,6 @@ mp_ipi_intrcnt(void *dummy)
intrcnt_add(buf, &ipi_lazypmap_counts[i]);
snprintf(buf, sizeof(buf), "cpu%d:hardclock", i);
intrcnt_add(buf, &ipi_hardclock_counts[i]);
- snprintf(buf, sizeof(buf), "cpu%d:statclock", i);
- intrcnt_add(buf, &ipi_statclock_counts[i]);
}
}
SYSINIT(mp_ipi_intrcnt, SI_SUB_INTR, SI_ORDER_MIDDLE, mp_ipi_intrcnt, NULL);
Modified: user/nwhitehorn/ps3/amd64/amd64/nexus.c
==============================================================================
--- user/nwhitehorn/ps3/amd64/amd64/nexus.c Thu Sep 16 12:39:50 2010 (r212732)
+++ user/nwhitehorn/ps3/amd64/amd64/nexus.c Thu Sep 16 13:49:10 2010 (r212733)
@@ -83,7 +83,7 @@ static int nexus_probe(device_t);
static int nexus_attach(device_t);
static int nexus_print_all_resources(device_t dev);
static int nexus_print_child(device_t, device_t);
-static device_t nexus_add_child(device_t bus, int order, const char *name,
+static device_t nexus_add_child(device_t bus, u_int order, const char *name,
int unit);
static struct resource *nexus_alloc_resource(device_t, device_t, int, int *,
u_long, u_long, u_long, u_int);
@@ -293,7 +293,7 @@ nexus_print_child(device_t bus, device_t
}
static device_t
-nexus_add_child(device_t bus, int order, const char *name, int unit)
+nexus_add_child(device_t bus, u_int order, const char *name, int unit)
{
device_t child;
struct nexus_device *ndev;
Modified: user/nwhitehorn/ps3/amd64/conf/GENERIC
==============================================================================
--- user/nwhitehorn/ps3/amd64/conf/GENERIC Thu Sep 16 12:39:50 2010 (r212732)
+++ user/nwhitehorn/ps3/amd64/conf/GENERIC Thu Sep 16 13:49:10 2010 (r212733)
@@ -112,6 +112,7 @@ device hptiop # Highpoint RocketRaid 3
device isp # Qlogic family
#device ispfw # Firmware for QLogic HBAs- normally a module
device mpt # LSI-Logic MPT-Fusion
+device mps # LSI-Logic MPT-Fusion 2
#device ncr # NCR/Symbios Logic
device sym # NCR/Symbios Logic (newer chipsets + those of `ncr')
device trm # Tekram DC395U/UW/F DC315U adapters
Modified: user/nwhitehorn/ps3/amd64/include/apicvar.h
==============================================================================
--- user/nwhitehorn/ps3/amd64/include/apicvar.h Thu Sep 16 12:39:50 2010 (r212732)
+++ user/nwhitehorn/ps3/amd64/include/apicvar.h Thu Sep 16 13:49:10 2010 (r212733)
@@ -123,8 +123,7 @@
#define IPI_AST 0 /* Generate software trap. */
#define IPI_PREEMPT 1
#define IPI_HARDCLOCK 2
-#define IPI_STATCLOCK 3
-#define IPI_BITMAP_LAST IPI_STATCLOCK
+#define IPI_BITMAP_LAST IPI_HARDCLOCK
#define IPI_IS_BITMAPED(x) ((x) <= IPI_BITMAP_LAST)
#define IPI_STOP (APIC_IPI_INTS + 7) /* Stop CPU until restarted. */
Modified: user/nwhitehorn/ps3/arm/arm/nexus.c
==============================================================================
--- user/nwhitehorn/ps3/arm/arm/nexus.c Thu Sep 16 12:39:50 2010 (r212732)
+++ user/nwhitehorn/ps3/arm/arm/nexus.c Thu Sep 16 13:49:10 2010 (r212733)
@@ -74,7 +74,7 @@ static struct rman mem_rman;
static int nexus_probe(device_t);
static int nexus_attach(device_t);
static int nexus_print_child(device_t, device_t);
-static device_t nexus_add_child(device_t, int, const char *, int);
+static device_t nexus_add_child(device_t, u_int, const char *, int);
static struct resource *nexus_alloc_resource(device_t, device_t, int, int *,
u_long, u_long, u_long, u_int);
static int nexus_activate_resource(device_t, device_t, int, int,
@@ -166,7 +166,7 @@ nexus_print_child(device_t bus, device_t
}
static device_t
-nexus_add_child(device_t bus, int order, const char *name, int unit)
+nexus_add_child(device_t bus, u_int order, const char *name, int unit)
{
device_t child;
struct nexus_device *ndev;
Modified: user/nwhitehorn/ps3/arm/arm/pmap.c
==============================================================================
--- user/nwhitehorn/ps3/arm/arm/pmap.c Thu Sep 16 12:39:50 2010 (r212732)
+++ user/nwhitehorn/ps3/arm/arm/pmap.c Thu Sep 16 13:49:10 2010 (r212733)
@@ -3158,8 +3158,6 @@ pmap_remove_all(vm_page_t m)
*ptep = 0;
PTE_SYNC_CURRENT(pv->pv_pmap, ptep);
pmap_free_l2_bucket(pv->pv_pmap, l2b, 1);
- if (pv->pv_flags & PVF_WIRED)
- pv->pv_pmap->pm_stats.wired_count--;
pv->pv_pmap->pm_stats.resident_count--;
flags |= pv->pv_flags;
}
Modified: user/nwhitehorn/ps3/arm/xscale/ixp425/ixp425.c
==============================================================================
--- user/nwhitehorn/ps3/arm/xscale/ixp425/ixp425.c Thu Sep 16 12:39:50 2010 (r212732)
+++ user/nwhitehorn/ps3/arm/xscale/ixp425/ixp425.c Thu Sep 16 13:49:10 2010 (r212733)
@@ -369,7 +369,7 @@ ixp425_hinted_child(device_t bus, const
}
static device_t
-ixp425_add_child(device_t dev, int order, const char *name, int unit)
+ixp425_add_child(device_t dev, u_int order, const char *name, int unit)
{
device_t child;
struct ixp425_ivar *ivar;
Modified: user/nwhitehorn/ps3/boot/sparc64/boot1/boot1.c
==============================================================================
--- user/nwhitehorn/ps3/boot/sparc64/boot1/boot1.c Thu Sep 16 12:39:50 2010 (r212732)
+++ user/nwhitehorn/ps3/boot/sparc64/boot1/boot1.c Thu Sep 16 13:49:10 2010 (r212733)
@@ -26,9 +26,7 @@ __FBSDID("$FreeBSD$");
#define _PATH_LOADER "/boot/loader"
#define _PATH_KERNEL "/boot/kernel/kernel"
-#define BSIZEMAX 16384
-
-typedef int putc_func_t(int c, void *arg);
+typedef int putc_func_t(char c, void *arg);
typedef int32_t ofwh_t;
struct sp_data {
@@ -44,11 +42,6 @@ static char bootargs[128];
static ofwh_t bootdev;
-static struct fs fs;
-static ino_t inomap;
-static char blkbuf[BSIZEMAX];
-static unsigned int fsblks;
-
static uint32_t fs_off;
int main(int ac, char **av);
@@ -66,14 +59,13 @@ static int mount(const char *device);
static void panic(const char *fmt, ...) __dead2;
static int printf(const char *fmt, ...);
-static int putchar(int c, void *arg);
+static int putchar(char c, void *arg);
static int vprintf(const char *fmt, va_list ap);
static int vsnprintf(char *str, size_t sz, const char *fmt, va_list ap);
static int __printf(const char *fmt, putc_func_t *putc, void *arg, va_list ap);
-static int __putc(int c, void *arg);
static int __puts(const char *s, putc_func_t *putc, void *arg);
-static int __sputc(int c, void *arg);
+static int __sputc(char c, void *arg);
static char *__uitoa(char *buf, u_int val, int base);
static char *__ultoa(char *buf, u_long val, int base);
@@ -83,19 +75,18 @@ static char *__ultoa(char *buf, u_long v
typedef u_int64_t ofwcell_t;
typedef u_int32_t u_ofwh_t;
typedef int (*ofwfp_t)(ofwcell_t []);
-ofwfp_t ofw; /* the prom Open Firmware entry */
+static ofwfp_t ofw; /* the PROM Open Firmware entry */
void ofw_init(int, int, int, int, ofwfp_t);
-ofwh_t ofw_finddevice(const char *);
-ofwh_t ofw_open(const char *);
-int ofw_getprop(ofwh_t, const char *, void *, size_t);
-int ofw_read(ofwh_t, void *, size_t);
-int ofw_write(ofwh_t, const void *, size_t);
-int ofw_seek(ofwh_t, u_int64_t);
-void ofw_exit(void) __dead2;
+static ofwh_t ofw_finddevice(const char *);
+static ofwh_t ofw_open(const char *);
+static int ofw_getprop(ofwh_t, const char *, void *, size_t);
+static int ofw_read(ofwh_t, void *, size_t);
+static int ofw_write(ofwh_t, const void *, size_t);
+static int ofw_seek(ofwh_t, u_int64_t);
+static void ofw_exit(void) __dead2;
-ofwh_t bootdevh;
-ofwh_t stdinh, stdouth;
+static ofwh_t stdinh, stdouth;
/*
* This has to stay here, as the PROM seems to ignore the
@@ -138,7 +129,7 @@ ofw_init(int d, int d1, int d2, int d3,
exit(main(ac, av));
}
-ofwh_t
+static ofwh_t
ofw_finddevice(const char *name)
{
ofwcell_t args[] = {
@@ -156,7 +147,7 @@ ofw_finddevice(const char *name)
return (args[4]);
}
-int
+static int
ofw_getprop(ofwh_t ofwh, const char *name, void *buf, size_t len)
{
ofwcell_t args[] = {
@@ -178,7 +169,7 @@ ofw_getprop(ofwh_t ofwh, const char *nam
return (0);
}
-ofwh_t
+static ofwh_t
ofw_open(const char *path)
{
ofwcell_t args[] = {
@@ -196,7 +187,7 @@ ofw_open(const char *path)
return (args[4]);
}
-int
+static int
ofw_close(ofwh_t devh)
{
ofwcell_t args[] = {
@@ -213,12 +204,12 @@ ofw_close(ofwh_t devh)
return (0);
}
-int
+static int
ofw_read(ofwh_t devh, void *buf, size_t len)
{
ofwcell_t args[] = {
(ofwcell_t)"read",
- 4,
+ 3,
1,
(u_ofwh_t)devh,
(ofwcell_t)buf,
@@ -233,7 +224,7 @@ ofw_read(ofwh_t devh, void *buf, size_t
return (0);
}
-int
+static int
ofw_write(ofwh_t devh, const void *buf, size_t len)
{
ofwcell_t args[] = {
@@ -253,12 +244,12 @@ ofw_write(ofwh_t devh, const void *buf,
return (0);
}
-int
+static int
ofw_seek(ofwh_t devh, u_int64_t off)
{
ofwcell_t args[] = {
(ofwcell_t)"seek",
- 4,
+ 3,
1,
(u_ofwh_t)devh,
off >> 32,
@@ -273,7 +264,7 @@ ofw_seek(ofwh_t devh, u_int64_t off)
return (0);
}
-void
+static void
ofw_exit(void)
{
ofwcell_t args[3];
@@ -299,6 +290,7 @@ bcopy(const void *src, void *dst, size_t
static void
memcpy(void *dst, const void *src, size_t len)
{
+
bcopy(src, dst, len);
}
@@ -314,6 +306,7 @@ bzero(void *b, size_t len)
static int
strcmp(const char *s1, const char *s2)
{
+
for (; *s1 == *s2 && *s1; s1++, s2++)
;
return ((u_char)*s1 - (u_char)*s2);
@@ -431,6 +424,7 @@ load(const char *fname)
static int
dskread(void *buf, u_int64_t lba, int nblk)
{
+
/*
* The Open Firmware should open the correct partition for us.
* That means, if we read from offset zero on an open instance handle,
@@ -468,7 +462,7 @@ printf(const char *fmt, ...)
}
static int
-putchar(int c, void *arg)
+putchar(char c, void *arg)
{
char buf;
@@ -614,7 +608,7 @@ reswitch: c = *fmt++;
}
static int
-__sputc(int c, void *arg)
+__sputc(char c, void *arg)
{
struct sp_data *sp;
Modified: user/nwhitehorn/ps3/boot/zfs/zfsimpl.c
==============================================================================
--- user/nwhitehorn/ps3/boot/zfs/zfsimpl.c Thu Sep 16 12:39:50 2010 (r212732)
+++ user/nwhitehorn/ps3/boot/zfs/zfsimpl.c Thu Sep 16 13:49:10 2010 (r212733)
@@ -376,6 +376,27 @@ vdev_mirror_read(vdev_t *vdev, const blk
return (rc);
}
+static int
+vdev_replacing_read(vdev_t *vdev, const blkptr_t *bp, void *buf,
+ off_t offset, size_t bytes)
+{
+ vdev_t *kid;
+
+ /*
+ * Here we should have two kids:
+ * First one which is the one we are replacing and we can trust
+ * only this one to have valid data, but it might not be present.
+ * Second one is that one we are replacing with. It is most likely
+ * healthy, but we can't trust it has needed data, so we won't use it.
+ */
+ kid = STAILQ_FIRST(&vdev->v_children);
+ if (kid == NULL)
+ return (EIO);
+ if (kid->v_state != VDEV_STATE_HEALTHY)
+ return (EIO);
+ return (kid->v_read(kid, bp, buf, offset, bytes));
+}
+
static vdev_t *
vdev_find(uint64_t guid)
{
@@ -416,7 +437,7 @@ vdev_init_from_nvlist(const unsigned cha
vdev_t *vdev, *kid;
const unsigned char *kids;
int nkids, i, is_new;
- uint64_t is_offline, is_faulted, is_degraded, is_removed;
+ uint64_t is_offline, is_faulted, is_degraded, is_removed, isnt_present;
if (nvlist_find(nvlist, ZPOOL_CONFIG_GUID,
DATA_TYPE_UINT64, 0, &guid)
@@ -430,12 +451,13 @@ vdev_init_from_nvlist(const unsigned cha
if (strcmp(type, VDEV_TYPE_MIRROR)
&& strcmp(type, VDEV_TYPE_DISK)
- && strcmp(type, VDEV_TYPE_RAIDZ)) {
+ && strcmp(type, VDEV_TYPE_RAIDZ)
+ && strcmp(type, VDEV_TYPE_REPLACING)) {
printf("ZFS: can only boot from disk, mirror or raidz vdevs\n");
return (EIO);
}
- is_offline = is_removed = is_faulted = is_degraded = 0;
+ is_offline = is_removed = is_faulted = is_degraded = isnt_present = 0;
nvlist_find(nvlist, ZPOOL_CONFIG_OFFLINE, DATA_TYPE_UINT64, 0,
&is_offline);
@@ -445,6 +467,8 @@ vdev_init_from_nvlist(const unsigned cha
&is_faulted);
nvlist_find(nvlist, ZPOOL_CONFIG_DEGRADED, DATA_TYPE_UINT64, 0,
&is_degraded);
+ nvlist_find(nvlist, ZPOOL_CONFIG_NOT_PRESENT, DATA_TYPE_UINT64, 0,
+ &isnt_present);
vdev = vdev_find(guid);
if (!vdev) {
@@ -454,6 +478,8 @@ vdev_init_from_nvlist(const unsigned cha
vdev = vdev_create(guid, vdev_mirror_read);
else if (!strcmp(type, VDEV_TYPE_RAIDZ))
vdev = vdev_create(guid, vdev_raidz_read);
+ else if (!strcmp(type, VDEV_TYPE_REPLACING))
+ vdev = vdev_create(guid, vdev_replacing_read);
else
vdev = vdev_create(guid, vdev_disk_read);
@@ -488,7 +514,16 @@ vdev_init_from_nvlist(const unsigned cha
vdev->v_name = strdup(type);
}
}
+ } else {
+ is_new = 0;
+ }
+ if (is_new || is_newer) {
+ /*
+ * This is either new vdev or we've already seen this vdev,
+ * but from an older vdev label, so let's refresh its state
+ * from the newer label.
+ */
if (is_offline)
vdev->v_state = VDEV_STATE_OFFLINE;
else if (is_removed)
@@ -497,28 +532,10 @@ vdev_init_from_nvlist(const unsigned cha
vdev->v_state = VDEV_STATE_FAULTED;
else if (is_degraded)
vdev->v_state = VDEV_STATE_DEGRADED;
+ else if (isnt_present)
+ vdev->v_state = VDEV_STATE_CANT_OPEN;
else
vdev->v_state = VDEV_STATE_HEALTHY;
- } else {
- is_new = 0;
-
- if (is_newer) {
- /*
- * We've already seen this vdev, but from an older
- * vdev label, so let's refresh its state from the
- * newer label.
- */
- if (is_offline)
- vdev->v_state = VDEV_STATE_OFFLINE;
- else if (is_removed)
- vdev->v_state = VDEV_STATE_REMOVED;
- else if (is_faulted)
- vdev->v_state = VDEV_STATE_FAULTED;
- else if (is_degraded)
- vdev->v_state = VDEV_STATE_DEGRADED;
- else
- vdev->v_state = VDEV_STATE_HEALTHY;
- }
}
rc = nvlist_find(nvlist, ZPOOL_CONFIG_CHILDREN,
@@ -754,6 +771,7 @@ vdev_probe(vdev_phys_read_t *read, void
uint64_t val;
uint64_t guid;
uint64_t pool_txg, pool_guid;
+ uint64_t is_log;
const char *pool_name;
const unsigned char *vdevs;
int i, rc, is_newer;
@@ -830,6 +848,12 @@ vdev_probe(vdev_phys_read_t *read, void
return (EIO);
}
+ is_log = 0;
+ (void) nvlist_find(nvlist, ZPOOL_CONFIG_IS_LOG, DATA_TYPE_UINT64, 0,
+ &is_log);
+ if (is_log)
+ return (EIO);
+
/*
* Create the pool if this is the first time we've seen it.
*/
Modified: user/nwhitehorn/ps3/cddl/boot/zfs/zfsimpl.h
==============================================================================
--- user/nwhitehorn/ps3/cddl/boot/zfs/zfsimpl.h Thu Sep 16 12:39:50 2010 (r212732)
+++ user/nwhitehorn/ps3/cddl/boot/zfs/zfsimpl.h Thu Sep 16 13:49:10 2010 (r212733)
@@ -546,6 +546,7 @@ typedef enum {
#define ZPOOL_CONFIG_NPARITY "nparity"
#define ZPOOL_CONFIG_HOSTID "hostid"
#define ZPOOL_CONFIG_HOSTNAME "hostname"
+#define ZPOOL_CONFIG_IS_LOG "is_log"
#define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */
/*
Modified: user/nwhitehorn/ps3/cddl/compat/opensolaris/sys/vnode.h
==============================================================================
--- user/nwhitehorn/ps3/cddl/compat/opensolaris/sys/vnode.h Thu Sep 16 12:39:50 2010 (r212732)
+++ user/nwhitehorn/ps3/cddl/compat/opensolaris/sys/vnode.h Thu Sep 16 13:49:10 2010 (r212733)
@@ -69,11 +69,14 @@ vn_is_readonly(vnode_t *vp)
#define vn_vfsunlock(vp) do { } while (0)
#define vn_ismntpt(vp) ((vp)->v_type == VDIR && (vp)->v_mountedhere != NULL)
#define vn_mountedvfs(vp) ((vp)->v_mountedhere)
-#define vn_has_cached_data(vp) ((vp)->v_object != NULL && (vp)->v_object->resident_page_count > 0)
+#define vn_has_cached_data(vp) \
+ ((vp)->v_object != NULL && ((vp)->v_object->resident_page_count > 0 \
+ || (vp)->v_object->cache != NULL))
#define vn_exists(vp) do { } while (0)
#define vn_invalid(vp) do { } while (0)
#define vn_renamepath(tdvp, svp, tnm, lentnm) do { } while (0)
#define vn_free(vp) do { } while (0)
+#define vn_matchops(vp, vops) ((vp)->v_op == &(vops))
#define VN_HOLD(v) vref(v)
#define VN_RELE(v) vrele(v)
Modified: user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
==============================================================================
--- user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Thu Sep 16 12:39:50 2010 (r212732)
+++ user/nwhitehorn/ps3/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Thu Sep 16 13:49:10 2010 (r212733)
@@ -460,11 +460,13 @@ fasttrap_fork(proc_t *p, proc_t *cp)
/*
* dtrace_helpers_duplicate() allocates memory.
*/
+ _PHOLD(cp);
PROC_UNLOCK(p);
PROC_UNLOCK(cp);
dtrace_helpers_duplicate(p, cp);
PROC_LOCK(cp);
PROC_LOCK(p);
+ _PRELE(cp);
}
/*
* This check is purposely here instead of in kern_fork.c because,
@@ -494,6 +496,8 @@ fasttrap_fork(proc_t *p, proc_t *cp)
mtx_lock_spin(&cp->p_slock);
sprlock_proc(cp);
mtx_unlock_spin(&cp->p_slock);
+#else
+ _PHOLD(cp);
#endif
/*
@@ -527,6 +531,8 @@ fasttrap_fork(proc_t *p, proc_t *cp)
#if defined(sun)
mutex_enter(&cp->p_lock);
sprunlock(cp);
+#else
+ _PRELE(cp);
#endif
}
@@ -542,6 +548,7 @@ fasttrap_exec_exit(proc_t *p)
ASSERT(p == curproc);
#endif
PROC_LOCK_ASSERT(p, MA_OWNED);
+ _PHOLD(p);
PROC_UNLOCK(p);
/*
@@ -554,6 +561,7 @@ fasttrap_exec_exit(proc_t *p)
dtrace_helpers_destroy(p);
#endif
PROC_LOCK(p);
+ _PRELE(p);
}
@@ -693,8 +701,6 @@ again:
*/
#if defined(sun)
ASSERT(p->p_proc_flag & P_PR_LOCK);
-#else
- PROC_LOCK_ASSERT(p, MA_OWNED);
#endif
p->p_dtrace_count++;
@@ -887,8 +893,6 @@ fasttrap_tracepoint_disable(proc_t *p, f
*/
#if defined(sun)
ASSERT(p->p_proc_flag & P_PR_LOCK);
-#else
- PROC_LOCK_ASSERT(p, MA_OWNED);
#endif
p->p_dtrace_count--;
}
@@ -1042,9 +1046,14 @@ fasttrap_pid_enable(void *arg, dtrace_id
* the chance to execute the trap instruction we're about to place
* in their process's text.
*/
+#ifdef __FreeBSD__
+ /*
+ * pfind() returns a locked process.
+ */
+ _PHOLD(p);
PROC_UNLOCK(p);
+#endif
fasttrap_enable_callbacks();
- PROC_LOCK(p);
/*
* Enable all the tracepoints and add this probe's id to each
@@ -1075,7 +1084,7 @@ fasttrap_pid_enable(void *arg, dtrace_id
mutex_enter(&p->p_lock);
sprunlock(p);
#else
- PROC_UNLOCK(p);
+ PRELE(p);
#endif
/*
@@ -1090,7 +1099,7 @@ fasttrap_pid_enable(void *arg, dtrace_id
mutex_enter(&p->p_lock);
sprunlock(p);
#else
- PROC_UNLOCK(p);
+ PRELE(p);
#endif
probe->ftp_enabled = 1;
@@ -1119,6 +1128,10 @@ fasttrap_pid_disable(void *arg, dtrace_i
mutex_exit(&provider->ftp_mtx);
return;
}
+#ifdef __FreeBSD__
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-user
mailing list