From owner-svn-src-projects@FreeBSD.ORG Tue Apr 12 04:48:37 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DEC49106566B; Tue, 12 Apr 2011 04:48:37 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C940D8FC0A; Tue, 12 Apr 2011 04:48:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3C4mbwR010104; Tue, 12 Apr 2011 04:48:37 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3C4mbne010080; Tue, 12 Apr 2011 04:48:37 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201104120448.p3C4mbne010080@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 12 Apr 2011 04:48:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220557 - in projects/altix/sys: amd64/amd64 amd64/ia32 boot/common boot/i386/boot2 boot/pc98/boot2 cam/ata cddl/compat/opensolaris/sys cddl/contrib/opensolaris/common/zfs cddl/dev/dtra... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Apr 2011 04:48:38 -0000 Author: marcel Date: Tue Apr 12 04:48:37 2011 New Revision: 220557 URL: http://svn.freebsd.org/changeset/base/220557 Log: Merge svn+ssh://svn.freebsd.org/base/head@220556 Modified: projects/altix/sys/amd64/amd64/exception.S projects/altix/sys/amd64/amd64/legacy.c projects/altix/sys/amd64/amd64/machdep.c projects/altix/sys/amd64/amd64/prof_machdep.c projects/altix/sys/amd64/amd64/sys_machdep.c projects/altix/sys/amd64/amd64/trap.c projects/altix/sys/amd64/ia32/ia32_exception.S projects/altix/sys/boot/common/module.c projects/altix/sys/boot/i386/boot2/Makefile projects/altix/sys/boot/i386/boot2/boot2.c projects/altix/sys/boot/i386/boot2/lib.h projects/altix/sys/boot/i386/boot2/sio.S projects/altix/sys/boot/pc98/boot2/Makefile projects/altix/sys/cam/ata/ata_da.c projects/altix/sys/cddl/compat/opensolaris/sys/sunddi.h projects/altix/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c projects/altix/sys/cddl/dev/dtrace/amd64/dtrace_subr.c projects/altix/sys/cddl/dev/dtrace/i386/dtrace_subr.c projects/altix/sys/cddl/dev/systrace/systrace.c projects/altix/sys/compat/linprocfs/linprocfs.c projects/altix/sys/compat/linux/linux_misc.c projects/altix/sys/compat/svr4/imgact_svr4.c projects/altix/sys/conf/options projects/altix/sys/conf/options.mips projects/altix/sys/contrib/altq/altq/altq_subr.c projects/altix/sys/ddb/db_command.c projects/altix/sys/dev/acpica/acpi.c projects/altix/sys/dev/acpica/acpi_cpu.c projects/altix/sys/dev/acpica/acpi_timer.c projects/altix/sys/dev/acpica/acpivar.h projects/altix/sys/dev/ahci/ahci.c projects/altix/sys/dev/arcmsr/arcmsr.c projects/altix/sys/dev/arcmsr/arcmsr.h projects/altix/sys/dev/ath/ah_osdep.c projects/altix/sys/dev/ath/ath_hal/ah.c projects/altix/sys/dev/ath/ath_hal/ah.h projects/altix/sys/dev/ath/ath_hal/ah_decode.h projects/altix/sys/dev/ath/ath_hal/ah_desc.h projects/altix/sys/dev/ath/ath_hal/ah_eeprom_v14.c projects/altix/sys/dev/ath/ath_hal/ah_internal.h projects/altix/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c projects/altix/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c projects/altix/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c projects/altix/sys/dev/ath/ath_hal/ar5212/ar5212_recv.c projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416.h projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416_recv.c projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c projects/altix/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c projects/altix/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c projects/altix/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c projects/altix/sys/dev/ath/if_ath.c projects/altix/sys/dev/ath/if_athvar.h projects/altix/sys/dev/bge/if_bge.c projects/altix/sys/dev/bge/if_bgereg.h projects/altix/sys/dev/bxe/if_bxe.c projects/altix/sys/dev/bxe/if_bxe.h projects/altix/sys/dev/cxgbe/t4_ioctl.h projects/altix/sys/dev/cxgbe/t4_main.c projects/altix/sys/dev/e1000/if_igb.c projects/altix/sys/dev/e1000/if_igb.h projects/altix/sys/dev/mxge/if_mxge.c projects/altix/sys/dev/mxge/mxge_lro.c projects/altix/sys/dev/ral/rt2560.c projects/altix/sys/dev/ral/rt2661.c projects/altix/sys/dev/usb/storage/umass.c projects/altix/sys/fs/fdescfs/fdesc_vfsops.c projects/altix/sys/fs/fdescfs/fdesc_vnops.c projects/altix/sys/fs/nfs/nfs_var.h projects/altix/sys/fs/nfsserver/nfs_nfsdport.c projects/altix/sys/fs/nfsserver/nfs_nfsdstate.c projects/altix/sys/i386/i386/legacy.c projects/altix/sys/i386/i386/machdep.c projects/altix/sys/i386/i386/perfmon.c projects/altix/sys/i386/i386/trap.c projects/altix/sys/i386/include/atomic.h projects/altix/sys/i386/include/cpu.h projects/altix/sys/i386/isa/prof_machdep.c projects/altix/sys/i386/linux/imgact_linux.c projects/altix/sys/kern/imgact_aout.c projects/altix/sys/kern/imgact_elf.c projects/altix/sys/kern/imgact_gzip.c projects/altix/sys/kern/kern_clock.c projects/altix/sys/kern/kern_descrip.c projects/altix/sys/kern/kern_exit.c projects/altix/sys/kern/kern_ktrace.c projects/altix/sys/kern/kern_racct.c projects/altix/sys/kern/kern_rctl.c projects/altix/sys/kern/kern_resource.c projects/altix/sys/kern/kern_sig.c projects/altix/sys/kern/kern_timeout.c projects/altix/sys/kern/sched_4bsd.c projects/altix/sys/kern/sysv_msg.c projects/altix/sys/kern/sysv_sem.c projects/altix/sys/kern/sysv_shm.c projects/altix/sys/kern/vfs_subr.c projects/altix/sys/mips/atheros/if_arge.c projects/altix/sys/mips/atheros/if_argevar.h projects/altix/sys/modules/arcnet/Makefile projects/altix/sys/modules/dtrace/dtraceall/Makefile projects/altix/sys/modules/dtrace/systrace_linux32/Makefile projects/altix/sys/modules/firewire/fwip/Makefile projects/altix/sys/net/if.c projects/altix/sys/net80211/_ieee80211.h projects/altix/sys/net80211/ieee80211_input.c projects/altix/sys/net80211/ieee80211_node.c projects/altix/sys/net80211/ieee80211_node.h projects/altix/sys/net80211/ieee80211_proto.h projects/altix/sys/netgraph/ng_hub.c projects/altix/sys/netinet/tcp_lro.c projects/altix/sys/netinet6/udp6_usrreq.c projects/altix/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c projects/altix/sys/pc98/pc98/machdep.c projects/altix/sys/sys/acl.h projects/altix/sys/sys/errno.h projects/altix/sys/sys/msg.h projects/altix/sys/sys/priv.h projects/altix/sys/sys/rctl.h projects/altix/sys/sys/sem.h projects/altix/sys/sys/shm.h projects/altix/sys/ufs/ffs/ffs_alloc.c projects/altix/sys/ufs/ffs/ffs_extern.h projects/altix/sys/ufs/ffs/ffs_softdep.c projects/altix/sys/ufs/ffs/softdep.h projects/altix/sys/vm/swap_pager.c projects/altix/sys/vm/vm_glue.c projects/altix/sys/vm/vm_map.c projects/altix/sys/vm/vm_mmap.c projects/altix/sys/vm/vm_pageout.c projects/altix/sys/vm/vm_unix.c projects/altix/sys/x86/cpufreq/est.c projects/altix/sys/x86/isa/clock.c projects/altix/sys/x86/x86/tsc.c Directory Properties: projects/altix/lib/libstand/ (props changed) projects/altix/sys/ (props changed) projects/altix/sys/amd64/include/xen/ (props changed) projects/altix/sys/boot/i386/efi/ (props changed) projects/altix/sys/boot/ia64/efi/ (props changed) projects/altix/sys/boot/ia64/ski/ (props changed) projects/altix/sys/boot/powerpc/boot1.chrp/ (props changed) projects/altix/sys/boot/powerpc/ofw/ (props changed) projects/altix/sys/cddl/contrib/opensolaris/ (props changed) projects/altix/sys/conf/ (props changed) projects/altix/sys/contrib/dev/acpica/ (props changed) projects/altix/sys/contrib/octeon-sdk/ (props changed) projects/altix/sys/contrib/pf/ (props changed) projects/altix/sys/contrib/x86emu/ (props changed) projects/altix/sys/kern/subr_busdma.c (props changed) Modified: projects/altix/sys/amd64/amd64/exception.S ============================================================================== --- projects/altix/sys/amd64/amd64/exception.S Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/amd64/amd64/exception.S Tue Apr 12 04:48:37 2011 (r220557) @@ -339,6 +339,9 @@ IDTVEC(prot) * and the new privilige level. We are still running on the old user stack * pointer. We have to juggle a few things around to find our stack etc. * swapgs gives us access to our PCPU space only. + * + * We do not support invoking this from a custom %cs or %ss (e.g. using + * entries from an LDT). */ IDTVEC(fast_syscall) swapgs @@ -379,7 +382,38 @@ IDTVEC(fast_syscall) FAKE_MCOUNT(TF_RIP(%rsp)) movq %rsp,%rdi call syscall - movq PCPU(CURPCB),%rax +1: movq PCPU(CURPCB),%rax + /* Disable interrupts before testing PCB_FULL_IRET. */ + cli + testl $PCB_FULL_IRET,PCB_FLAGS(%rax) + jnz 3f + /* Check for and handle AST's on return to userland. */ + movq PCPU(CURTHREAD),%rax + testl $TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%rax) + je 2f + sti + movq %rsp, %rdi + call ast + jmp 1b +2: /* Restore preserved registers. */ + MEXITCOUNT + movq TF_RDI(%rsp),%rdi /* bonus; preserve arg 1 */ + movq TF_RSI(%rsp),%rsi /* bonus: preserve arg 2 */ + movq TF_RDX(%rsp),%rdx /* return value 2 */ + movq TF_RAX(%rsp),%rax /* return value 1 */ + movq TF_RBX(%rsp),%rbx /* C preserved */ + movq TF_RBP(%rsp),%rbp /* C preserved */ + movq TF_R12(%rsp),%r12 /* C preserved */ + movq TF_R13(%rsp),%r13 /* C preserved */ + movq TF_R14(%rsp),%r14 /* C preserved */ + movq TF_R15(%rsp),%r15 /* C preserved */ + movq TF_RFLAGS(%rsp),%r11 /* original %rflags */ + movq TF_RIP(%rsp),%rcx /* original %rip */ + movq TF_RSP(%rsp),%r9 /* user stack pointer */ + movq %r9,%rsp /* original %rsp */ + swapgs + sysretq +3: /* Requested full context restore, use doreti for that. */ MEXITCOUNT jmp doreti @@ -628,7 +662,7 @@ doreti: doreti_ast: /* * Check for ASTs atomically with returning. Disabling CPU - * interrupts provides sufficient locking eve in the SMP case, + * interrupts provides sufficient locking even in the SMP case, * since we will be informed of any new ASTs by an IPI. */ cli @@ -649,8 +683,7 @@ doreti_ast: */ doreti_exit: MEXITCOUNT - movq PCPU(CURTHREAD),%r8 - movq TD_PCB(%r8),%r8 + movq PCPU(CURPCB),%r8 /* * Do not reload segment registers for kernel. Modified: projects/altix/sys/amd64/amd64/legacy.c ============================================================================== --- projects/altix/sys/amd64/amd64/legacy.c Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/amd64/amd64/legacy.c Tue Apr 12 04:48:37 2011 (r220557) @@ -321,7 +321,8 @@ cpu_read_ivar(device_t dev, device_t chi break; case CPU_IVAR_NOMINAL_MHZ: if (tsc_is_invariant) { - *result = (uintptr_t)(tsc_freq / 1000000); + *result = (uintptr_t)(atomic_load_acq_64(&tsc_freq) / + 1000000); break; } /* FALLTHROUGH */ Modified: projects/altix/sys/amd64/amd64/machdep.c ============================================================================== --- projects/altix/sys/amd64/amd64/machdep.c Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/amd64/amd64/machdep.c Tue Apr 12 04:48:37 2011 (r220557) @@ -546,18 +546,19 @@ int cpu_est_clockrate(int cpu_id, uint64_t *rate) { register_t reg; - uint64_t tsc1, tsc2; + uint64_t freq, tsc1, tsc2; if (pcpu_find(cpu_id) == NULL || rate == NULL) return (EINVAL); + freq = atomic_load_acq_64(&tsc_freq); /* If TSC is P-state invariant, DELAY(9) based logic fails. */ - if (tsc_is_invariant && tsc_freq != 0) + if (tsc_is_invariant && freq != 0) return (EOPNOTSUPP); /* If we're booting, trust the rate calibrated moments ago. */ - if (cold && tsc_freq != 0) { - *rate = tsc_freq; + if (cold && freq != 0) { + *rate = freq; return (0); } @@ -586,7 +587,7 @@ cpu_est_clockrate(int cpu_id, uint64_t * #endif tsc2 -= tsc1; - if (tsc_freq != 0) { + if (freq != 0) { *rate = tsc2 * 1000; return (0); } Modified: projects/altix/sys/amd64/amd64/prof_machdep.c ============================================================================== --- projects/altix/sys/amd64/amd64/prof_machdep.c Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/amd64/amd64/prof_machdep.c Tue Apr 12 04:48:37 2011 (r220557) @@ -63,9 +63,7 @@ static u_int cputime_clock_pmc_conf = I5 static int cputime_clock_pmc_init; static struct gmonparam saved_gmp; #endif -#if defined(I586_CPU) || defined(I686_CPU) static int cputime_prof_active; -#endif #endif /* GUPROF */ #ifdef __GNUCLIKE_ASM @@ -200,14 +198,12 @@ cputime() { u_int count; int delta; -#if (defined(I586_CPU) || defined(I686_CPU)) && !defined(SMP) && \ - defined(PERFMON) && defined(I586_PMC_GUPROF) +#if defined(PERFMON) && defined(I586_PMC_GUPROF) && !defined(SMP) u_quad_t event_count; #endif u_char high, low; static u_int prev_count; -#if defined(I586_CPU) || defined(I686_CPU) if (cputime_clock == CPUTIME_CLOCK_TSC) { /* * Scale the TSC a little to make cputime()'s frequency @@ -236,7 +232,6 @@ cputime() return (delta); } #endif /* PERFMON && I586_PMC_GUPROF && !SMP */ -#endif /* I586_CPU || I686_CPU */ /* * Read the current value of the 8254 timer counter 0. @@ -316,21 +311,22 @@ void startguprof(gp) struct gmonparam *gp; { + uint64_t freq; + + freq = atomic_load_acq_64(&tsc_freq); if (cputime_clock == CPUTIME_CLOCK_UNINITIALIZED) { - cputime_clock = CPUTIME_CLOCK_I8254; -#if defined(I586_CPU) || defined(I686_CPU) - if (tsc_freq != 0 && mp_ncpus == 1) + if (freq != 0 && mp_ncpus == 1) cputime_clock = CPUTIME_CLOCK_TSC; -#endif + else + cputime_clock = CPUTIME_CLOCK_I8254; } - gp->profrate = i8254_freq << CPUTIME_CLOCK_I8254_SHIFT; -#if defined(I586_CPU) || defined(I686_CPU) if (cputime_clock == CPUTIME_CLOCK_TSC) { - gp->profrate = tsc_freq >> 1; + gp->profrate = freq >> 1; cputime_prof_active = 1; - } + } else + gp->profrate = i8254_freq << CPUTIME_CLOCK_I8254_SHIFT; #if defined(PERFMON) && defined(I586_PMC_GUPROF) - else if (cputime_clock == CPUTIME_CLOCK_I586_PMC) { + if (cputime_clock == CPUTIME_CLOCK_I586_PMC) { if (perfmon_avail() && perfmon_setup(0, cputime_clock_pmc_conf) == 0) { if (perfmon_start(0) != 0) @@ -355,7 +351,6 @@ startguprof(gp) } } #endif /* PERFMON && I586_PMC_GUPROF */ -#endif /* I586_CPU || I686_CPU */ cputime_bias = 0; cputime(); } @@ -371,13 +366,10 @@ stopguprof(gp) cputime_clock_pmc_init = FALSE; } #endif -#if defined(I586_CPU) || defined(I686_CPU) if (cputime_clock == CPUTIME_CLOCK_TSC) cputime_prof_active = 0; -#endif } -#if defined(I586_CPU) || defined(I686_CPU) /* If the cpu frequency changed while profiling, report a warning. */ static void tsc_freq_changed(void *arg, const struct cf_level *level, int status) @@ -395,6 +387,5 @@ tsc_freq_changed(void *arg, const struct EVENTHANDLER_DEFINE(cpufreq_post_change, tsc_freq_changed, NULL, EVENTHANDLER_PRI_ANY); -#endif /* I586_CPU || I686_CPU */ #endif /* GUPROF */ Modified: projects/altix/sys/amd64/amd64/sys_machdep.c ============================================================================== --- projects/altix/sys/amd64/amd64/sys_machdep.c Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/amd64/amd64/sys_machdep.c Tue Apr 12 04:48:37 2011 (r220557) @@ -243,7 +243,6 @@ sysarch(td, uap) if (!error) { pcb->pcb_fsbase = i386base; td->td_frame->tf_fs = _ufssel; - set_pcb_flags(pcb, PCB_FULL_IRET); update_gdt_fsbase(td, i386base); } break; @@ -255,7 +254,6 @@ sysarch(td, uap) error = copyin(uap->parms, &i386base, sizeof(i386base)); if (!error) { pcb->pcb_gsbase = i386base; - set_pcb_flags(pcb, PCB_FULL_IRET); td->td_frame->tf_gs = _ugssel; update_gdt_gsbase(td, i386base); } Modified: projects/altix/sys/amd64/amd64/trap.c ============================================================================== --- projects/altix/sys/amd64/amd64/trap.c Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/amd64/amd64/trap.c Tue Apr 12 04:48:37 2011 (r220557) @@ -164,10 +164,12 @@ static char *trap_msg[] = { static int kdb_on_nmi = 1; SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RW, &kdb_on_nmi, 0, "Go to KDB on NMI"); +TUNABLE_INT("machdep.kdb_on_nmi", &kdb_on_nmi); #endif static int panic_on_nmi = 1; SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RW, &panic_on_nmi, 0, "Panic on NMI"); +TUNABLE_INT("machdep.panic_on_nmi", &panic_on_nmi); static int prot_fault_translation = 0; SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RW, &prot_fault_translation, 0, "Select signal to deliver on protection fault"); Modified: projects/altix/sys/amd64/ia32/ia32_exception.S ============================================================================== --- projects/altix/sys/amd64/ia32/ia32_exception.S Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/amd64/ia32/ia32_exception.S Tue Apr 12 04:48:37 2011 (r220557) @@ -46,7 +46,7 @@ IDTVEC(int0x80_syscall) subq $TF_ERR,%rsp /* skip over tf_trapno */ movq %rdi,TF_RDI(%rsp) movq PCPU(CURPCB),%rdi - movb $0,PCB_FULL_IRET(%rdi) + andl $~PCB_FULL_IRET,PCB_FLAGS(%rdi) movw %fs,TF_FS(%rsp) movw %gs,TF_GS(%rsp) movw %es,TF_ES(%rsp) Modified: projects/altix/sys/boot/common/module.c ============================================================================== --- projects/altix/sys/boot/common/module.c Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/boot/common/module.c Tue Apr 12 04:48:37 2011 (r220557) @@ -280,7 +280,7 @@ file_load(char *filename, vm_offset_t de error = EFTYPE; for (i = 0, fp = NULL; file_formats[i] && fp == NULL; i++) { - error = (file_formats[i]->l_load)(filename, loadaddr, &fp); + error = (file_formats[i]->l_load)(filename, dest, &fp); if (error == 0) { fp->f_loader = i; /* remember the loader */ *result = fp; Modified: projects/altix/sys/boot/i386/boot2/Makefile ============================================================================== --- projects/altix/sys/boot/i386/boot2/Makefile Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/boot/i386/boot2/Makefile Tue Apr 12 04:48:37 2011 (r220557) @@ -31,6 +31,7 @@ CFLAGS= -Os \ -fno-unit-at-a-time \ -mno-align-long-strings \ -mrtd \ + -mregparm=3 \ -D${BOOT2_UFS} \ -DFLAGS=${BOOT_BOOT1_FLAGS} \ -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ Modified: projects/altix/sys/boot/i386/boot2/boot2.c ============================================================================== --- projects/altix/sys/boot/i386/boot2/boot2.c Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/boot/i386/boot2/boot2.c Tue Apr 12 04:48:37 2011 (r220557) @@ -148,7 +148,7 @@ static int drvread(void *, unsigned, uns static int keyhit(unsigned); static int xputc(int); static int xgetc(int); -static int getc(int); +static inline int getc(int); static void memcpy(void *, const void *, int); static void @@ -627,6 +627,15 @@ xputc(int c) } static int +getc(int fn) +{ + v86.addr = 0x16; + v86.eax = fn << 8; + v86int(); + return fn == 0 ? v86.eax & 0xff : !V86_ZR(v86.efl); +} + +static int xgetc(int fn) { if (OPT_CHECK(RBX_NOINTR)) @@ -640,12 +649,3 @@ xgetc(int fn) return 0; } } - -static int -getc(int fn) -{ - v86.addr = 0x16; - v86.eax = fn << 8; - v86int(); - return fn == 0 ? v86.eax & 0xff : !V86_ZR(v86.efl); -} Modified: projects/altix/sys/boot/i386/boot2/lib.h ============================================================================== --- projects/altix/sys/boot/i386/boot2/lib.h Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/boot/i386/boot2/lib.h Tue Apr 12 04:48:37 2011 (r220557) @@ -17,8 +17,8 @@ * $FreeBSD$ */ -void sio_init(int); +void sio_init(int) __attribute__((regparm (3))); void sio_flush(void); -void sio_putc(int); +void sio_putc(int) __attribute__((regparm (3))); int sio_getc(void); int sio_ischar(void); Modified: projects/altix/sys/boot/i386/boot2/sio.S ============================================================================== --- projects/altix/sys/boot/i386/boot2/sio.S Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/boot/i386/boot2/sio.S Tue Apr 12 04:48:37 2011 (r220557) @@ -26,14 +26,14 @@ /* void sio_init(int div) */ -sio_init: movw $SIO_PRT+0x3,%dx # Data format reg +sio_init: pushl %eax + movw $SIO_PRT+0x3,%dx # Data format reg movb $SIO_FMT|0x80,%al # Set format outb %al,(%dx) # and DLAB - pushl %edx # Save subb $0x3,%dl # Divisor latch reg - movl 0x8(%esp),%eax # Set + popl %eax outw %ax,(%dx) # BPS - popl %edx # Restore + movw $SIO_PRT+0x3,%dx # Data format reg movb $SIO_FMT,%al # Clear outb %al,(%dx) # DLAB incl %edx # Modem control reg @@ -41,7 +41,7 @@ sio_init: movw $SIO_PRT+0x3,%dx # Data outb %al,(%dx) # DTR incl %edx # Line status reg call sio_flush - ret $0x4 + ret /* void sio_flush(void) */ @@ -52,17 +52,18 @@ sio_flush: call sio_ischar # Check for /* void sio_putc(int c) */ -sio_putc: movw $SIO_PRT+0x5,%dx # Line status reg +sio_putc: pushl %eax + movw $SIO_PRT+0x5,%dx # Line status reg xor %ecx,%ecx # Timeout movb $0x40,%ch # counter sio_putc.1: inb (%dx),%al # Transmitter testb $0x20,%al # buffer empty? loopz sio_putc.1 # No jz sio_putc.2 # If timeout - movb 0x4(%esp,1),%al # Get character + popl %eax # Get the character subb $0x5,%dl # Transmitter hold reg outb %al,(%dx) # Write character -sio_putc.2: ret $0x4 # To caller +sio_putc.2: ret # To caller /* int sio_getc(void) */ Modified: projects/altix/sys/boot/pc98/boot2/Makefile ============================================================================== --- projects/altix/sys/boot/pc98/boot2/Makefile Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/boot/pc98/boot2/Makefile Tue Apr 12 04:48:37 2011 (r220557) @@ -28,6 +28,7 @@ CFLAGS= -Os \ -fno-unit-at-a-time \ -mno-align-long-strings \ -mrtd \ + -mregparm=3 \ -D${BOOT2_UFS} \ -DFLAGS=${BOOT_BOOT1_FLAGS} \ -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ Modified: projects/altix/sys/cam/ata/ata_da.c ============================================================================== --- projects/altix/sys/cam/ata/ata_da.c Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/cam/ata/ata_da.c Tue Apr 12 04:48:37 2011 (r220557) @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_ada.h" + #include #ifdef _KERNEL @@ -66,6 +68,7 @@ __FBSDID("$FreeBSD$"); #define ATA_MAX_28BIT_LBA 268435455UL typedef enum { + ADA_STATE_WCACHE, ADA_STATE_NORMAL } ada_state; @@ -89,6 +92,7 @@ typedef enum { } ada_quirks; typedef enum { + ADA_CCB_WCACHE = 0x01, ADA_CCB_BUFFER_IO = 0x03, ADA_CCB_WAITING = 0x04, ADA_CCB_DUMP = 0x05, @@ -125,6 +129,13 @@ struct ada_softc { int outstanding_cmds; int trim_max_ranges; int trim_running; + int write_cache; +#ifdef ADA_TEST_FAILURE + int force_read_error; + int force_write_error; + int periodic_read_error; + int periodic_read_count; +#endif struct disk_params params; struct disk *disk; struct task sysctl_task; @@ -186,6 +197,10 @@ static void adashutdown(void *arg, int #define ADA_DEFAULT_SPINDOWN_SHUTDOWN 1 #endif +#ifndef ADA_DEFAULT_WRITE_CACHE +#define ADA_DEFAULT_WRITE_CACHE 1 +#endif + /* * Most platforms map firmware geometry to actual, but some don't. If * not overridden, default to nothing. @@ -198,6 +213,7 @@ static int ada_retry_count = ADA_DEFAULT static int ada_default_timeout = ADA_DEFAULT_TIMEOUT; static int ada_send_ordered = ADA_DEFAULT_SEND_ORDERED; static int ada_spindown_shutdown = ADA_DEFAULT_SPINDOWN_SHUTDOWN; +static int ada_write_cache = ADA_DEFAULT_WRITE_CACHE; SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD, 0, "CAM Direct Access Disk driver"); @@ -213,6 +229,9 @@ TUNABLE_INT("kern.cam.ada.ada_send_order SYSCTL_INT(_kern_cam_ada, OID_AUTO, spindown_shutdown, CTLFLAG_RW, &ada_spindown_shutdown, 0, "Spin down upon shutdown"); TUNABLE_INT("kern.cam.ada.spindown_shutdown", &ada_spindown_shutdown); +SYSCTL_INT(_kern_cam_ada, OID_AUTO, write_cache, CTLFLAG_RW, + &ada_write_cache, 0, "Enable disk write cache"); +TUNABLE_INT("kern.cam.ada.write_cache", &ada_write_cache); /* * ADA_ORDEREDTAG_INTERVAL determines how often, relative @@ -568,6 +587,7 @@ adaasync(void *callback_arg, u_int32_t c struct cam_path *path, void *arg) { struct cam_periph *periph; + struct ada_softc *softc; periph = (struct cam_periph *)callback_arg; switch (code) { @@ -600,6 +620,28 @@ adaasync(void *callback_arg, u_int32_t c "due to status 0x%x\n", status); break; } + case AC_SENT_BDR: + case AC_BUS_RESET: + { + struct ccb_getdev cgd; + + softc = (struct ada_softc *)periph->softc; + cam_periph_async(periph, code, path, arg); + if (ada_write_cache < 0 && softc->write_cache < 0) + break; + if (softc->state != ADA_STATE_NORMAL) + break; + xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + cgd.ccb_h.func_code = XPT_GDEV_TYPE; + xpt_action((union ccb *)&cgd); + if ((cgd.ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) == 0) + break; + softc->state = ADA_STATE_WCACHE; + cam_periph_acquire(periph); + cam_freeze_devq_arg(periph->path, + RELSIM_RELEASE_RUNLEVEL, CAM_RL_DEV + 1); + xpt_schedule(periph, CAM_PRIORITY_DEV); + } default: cam_periph_async(periph, code, path, arg); break; @@ -614,8 +656,12 @@ adasysctlinit(void *context, int pending char tmpstr[80], tmpstr2[80]; periph = (struct cam_periph *)context; - if (cam_periph_acquire(periph) != CAM_REQ_CMP) + + /* periph was held for us when this task was enqueued */ + if (periph->flags & CAM_PERIPH_INVALID) { + cam_periph_release(periph); return; + } softc = (struct ada_softc *)periph->softc; snprintf(tmpstr, sizeof(tmpstr), "CAM ADA unit %d", periph->unit_number); @@ -632,6 +678,28 @@ adasysctlinit(void *context, int pending return; } + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "write_cache", CTLFLAG_RW | CTLFLAG_MPSAFE, + &softc->write_cache, 0, "Enable disk write cache."); +#ifdef ADA_TEST_FAILURE + /* + * Add a 'door bell' sysctl which allows one to set it from userland + * and cause something bad to happen. For the moment, we only allow + * whacking the next read or write. + */ + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "force_read_error", CTLFLAG_RW | CTLFLAG_MPSAFE, + &softc->force_read_error, 0, + "Force a read error for the next N reads."); + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "force_write_error", CTLFLAG_RW | CTLFLAG_MPSAFE, + &softc->force_write_error, 0, + "Force a write error for the next N writes."); + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "periodic_read_error", CTLFLAG_RW | CTLFLAG_MPSAFE, + &softc->periodic_read_error, 0, + "Force a read error every N reads (don't set too low)."); +#endif cam_periph_release(periph); } @@ -691,7 +759,6 @@ adaregister(struct cam_periph *periph, v } if (cgd->ident_data.support.command2 & ATA_SUPPORT_CFA) softc->flags |= ADA_FLAG_CAN_CFA; - softc->state = ADA_STATE_NORMAL; periph->softc = softc; @@ -706,6 +773,10 @@ adaregister(struct cam_periph *periph, v softc->quirks = ((struct ada_quirk_entry *)match)->quirks; else softc->quirks = ADA_Q_NONE; + softc->write_cache = -1; + snprintf(announce_buf, sizeof(announce_buf), + "kern.cam.ada.%d.writa_cache", periph->unit_number); + TUNABLE_INT_FETCH(announce_buf, &softc->write_cache); bzero(&cpi, sizeof(cpi)); xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NONE); @@ -780,6 +851,14 @@ adaregister(struct cam_periph *periph, v dp->secsize, dp->heads, dp->secs_per_track, dp->cylinders); xpt_announce_periph(periph, announce_buf); + + /* + * Create our sysctl variables, now that we know + * we have successfully attached. + */ + cam_periph_acquire(periph); + taskqueue_enqueue(taskqueue_thread, &softc->sysctl_task); + /* * Add async callbacks for bus reset and * bus device reset calls. I don't bother @@ -788,7 +867,7 @@ adaregister(struct cam_periph *periph, v * them and the only alternative would be to * not attach the device on failure. */ - xpt_register_async(AC_LOST_DEVICE, + xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE, adaasync, periph, periph->path); /* @@ -800,6 +879,16 @@ adaregister(struct cam_periph *periph, v (ADA_DEFAULT_TIMEOUT * hz) / ADA_ORDEREDTAG_INTERVAL, adasendorderedtag, softc); + if ((ada_write_cache >= 0 || softc->write_cache >= 0) && + cgd->ident_data.support.command1 & ATA_SUPPORT_WRITECACHE) { + softc->state = ADA_STATE_WCACHE; + cam_periph_acquire(periph); + cam_freeze_devq_arg(periph->path, + RELSIM_RELEASE_RUNLEVEL, CAM_RL_DEV + 1); + xpt_schedule(periph, CAM_PRIORITY_DEV); + } else + softc->state = ADA_STATE_NORMAL; + return(CAM_REQ_CMP); } @@ -902,7 +991,45 @@ adastart(struct cam_periph *periph, unio { uint64_t lba = bp->bio_pblkno; uint16_t count = bp->bio_bcount / softc->params.secsize; +#ifdef ADA_TEST_FAILURE + int fail = 0; + /* + * Support the failure ioctls. If the command is a + * read, and there are pending forced read errors, or + * if a write and pending write errors, then fail this + * operation with EIO. This is useful for testing + * purposes. Also, support having every Nth read fail. + * + * This is a rather blunt tool. + */ + if (bp->bio_cmd == BIO_READ) { + if (softc->force_read_error) { + softc->force_read_error--; + fail = 1; + } + if (softc->periodic_read_error > 0) { + if (++softc->periodic_read_count >= + softc->periodic_read_error) { + softc->periodic_read_count = 0; + fail = 1; + } + } + } else { + if (softc->force_write_error) { + softc->force_write_error--; + fail = 1; + } + } + if (fail) { + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; + biodone(bp); + xpt_release_ccb(start_ccb); + adaschedule(periph); + return; + } +#endif cam_fill_ataio(ataio, ada_retry_count, adadone, @@ -1009,6 +1136,24 @@ out: adaschedule(periph); break; } + case ADA_STATE_WCACHE: + { + cam_fill_ataio(ataio, + 1, + adadone, + CAM_DIR_NONE, + 0, + NULL, + 0, + ada_default_timeout*1000); + + ata_28bit_cmd(ataio, ATA_SETFEATURES, (softc->write_cache > 0 || + (softc->write_cache < 0 && ada_write_cache)) ? + ATA_SF_ENAB_WCACHE : ATA_SF_DIS_WCACHE, 0, 0); + start_ccb->ccb_h.ccb_state = ADA_CCB_WCACHE; + xpt_action(start_ccb); + break; + } } } @@ -1097,6 +1242,36 @@ adadone(struct cam_periph *periph, union biodone(bp); break; } + case ADA_CCB_WCACHE: + { + if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (adaerror(done_ccb, 0, 0) == ERESTART) { + return; + } else if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) { + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + } + } + + softc->state = ADA_STATE_NORMAL; + /* + * Since our peripheral may be invalidated by an error + * above or an external event, we must release our CCB + * before releasing the reference on the peripheral. + * The peripheral will only go away once the last reference + * is removed, and we need it around for the CCB release + * operation. + */ + xpt_release_ccb(done_ccb); + cam_release_devq(periph->path, + RELSIM_RELEASE_RUNLEVEL, 0, CAM_RL_DEV + 1, FALSE); + adaschedule(periph); + cam_periph_release_locked(periph); + return; + } case ADA_CCB_WAITING: { /* Caller will release the CCB */ Modified: projects/altix/sys/cddl/compat/opensolaris/sys/sunddi.h ============================================================================== --- projects/altix/sys/cddl/compat/opensolaris/sys/sunddi.h Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/cddl/compat/opensolaris/sys/sunddi.h Tue Apr 12 04:48:37 2011 (r220557) @@ -37,8 +37,10 @@ #define strdup(ptr) strdup((ptr), M_SOLARIS) #define ddi_driver_major(zfs_dip) (0) -#define ddi_copyin(from, to, size, flag) (bcopy((from), (to), (size)), 0) -#define ddi_copyout(from, to, size, flag) (bcopy((from), (to), (size)), 0) +#define ddi_copyin(from, to, size, flag) \ + (copyin((from), (to), (size)), 0) +#define ddi_copyout(from, to, size, flag) \ + (copyout((from), (to), (size)), 0) int ddi_strtol(const char *str, char **nptr, int base, long *result); int ddi_strtoul(const char *str, char **nptr, int base, unsigned long *result); int ddi_strtoull(const char *str, char **nptr, int base, Modified: projects/altix/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c ============================================================================== --- projects/altix/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c Tue Apr 12 04:48:37 2011 (r220557) @@ -20,6 +20,8 @@ */ /* * Copyright 2010 Martin Matuska . All rights reserved. + * Portions Copyright 2005, 2010, Oracle and/or its affiliates. + * All rights reserved. * Use is subject to license terms. */ @@ -151,17 +153,69 @@ zfs_cmd_compat_put(zfs_cmd_t *zc, caddr_ } static int -zfs_ioctl_compat_write_nvlist_dst(zfs_cmd_t *zc, nvlist_t *nvl, size_t nvsize) +zfs_ioctl_compat_get_nvlist(uint64_t nvl, size_t size, int iflag, + nvlist_t **nvp) { - char *packed = (void *)(uintptr_t)zc->zc_nvlist_dst; - int err; + char *packed; + int error; + nvlist_t *list = NULL; + + /* + * Read in and unpack the user-supplied nvlist. + */ + if (size == 0) + return (EINVAL); + +#ifdef _KERNEL + packed = kmem_alloc(size, KM_SLEEP); + if ((error = ddi_copyin((void *)(uintptr_t)nvl, packed, size, + iflag)) != 0) { + kmem_free(packed, size); + return (error); + } +#else + packed = (void *)(uintptr_t)nvl; +#endif - err = nvlist_pack(nvl, &packed, &nvsize, - NV_ENCODE_NATIVE, 0); - if (err == 0) - zc->zc_nvlist_dst_size = nvsize; + error = nvlist_unpack(packed, size, &list, 0); - return (err); +#ifdef _KERNEL + kmem_free(packed, size); +#endif + + if (error != 0) + return (error); + + *nvp = list; + return (0); +} + +static int +zfs_ioctl_compat_put_nvlist(zfs_cmd_t *zc, nvlist_t *nvl) +{ + char *packed = NULL; + int error = 0; + size_t size; + + VERIFY(nvlist_size(nvl, &size, NV_ENCODE_NATIVE) == 0); + +#ifdef _KERNEL + packed = kmem_alloc(size, KM_SLEEP); + VERIFY(nvlist_pack(nvl, &packed, &size, NV_ENCODE_NATIVE, + KM_SLEEP) == 0); + + if (ddi_copyout(packed, + (void *)(uintptr_t)zc->zc_nvlist_dst, size, zc->zc_iflags) != 0) + error = EFAULT; + kmem_free(packed, size); +#else + packed = (void *)(uintptr_t)zc->zc_nvlist_dst; + VERIFY(nvlist_pack(nvl, &packed, &size, NV_ENCODE_NATIVE, + 0) == 0); +#endif + + zc->zc_nvlist_dst_size = size; + return (error); } static void @@ -205,17 +259,16 @@ zfs_ioctl_compat_fix_stats_nvlist(nvlist } } -static void +static int zfs_ioctl_compat_fix_stats(zfs_cmd_t *zc, const int cflag) { nvlist_t *nv, *nvp = NULL; nvpair_t *elem; - size_t nvsize; - char *packed; + int error; - if (nvlist_unpack((void *)(uintptr_t)zc->zc_nvlist_dst, - zc->zc_nvlist_dst_size, &nv, 0) != 0) - return; + if ((error = zfs_ioctl_compat_get_nvlist(zc->zc_nvlist_dst, + zc->zc_nvlist_dst_size, zc->zc_iflags, &nv)) != 0) + return (error); if (cflag == 5) { /* ZFS_IOC_POOL_STATS */ elem = NULL; @@ -227,21 +280,22 @@ zfs_ioctl_compat_fix_stats(zfs_cmd_t *zc } else zfs_ioctl_compat_fix_stats_nvlist(nv); - VERIFY(nvlist_size(nv, &nvsize, NV_ENCODE_NATIVE) == 0); - zfs_ioctl_compat_write_nvlist_dst(zc, nv, nvsize); + error = zfs_ioctl_compat_put_nvlist(zc, nv); nvlist_free(nv); + + return (error); } -static void +static int zfs_ioctl_compat_pool_get_props(zfs_cmd_t *zc) { nvlist_t *nv, *nva = NULL; - size_t nvsize; + int error; - if (nvlist_unpack((void *)(uintptr_t)zc->zc_nvlist_dst, - zc->zc_nvlist_dst_size, &nv, 0) != 0) - return; + if ((error = zfs_ioctl_compat_get_nvlist(zc->zc_nvlist_dst, + zc->zc_nvlist_dst_size, zc->zc_iflags, &nv)) != 0) + return (error); #ifdef _KERNEL if (nvlist_lookup_nvlist(nv, "allocated", &nva) == 0) { @@ -265,10 +319,11 @@ zfs_ioctl_compat_pool_get_props(zfs_cmd_ } #endif - VERIFY(nvlist_size(nv, &nvsize, NV_ENCODE_NATIVE) == 0); - zfs_ioctl_compat_write_nvlist_dst(zc, nv, nvsize); + error = zfs_ioctl_compat_put_nvlist(zc, nv); nvlist_free(nv); + + return (error); } #ifndef _KERNEL Modified: projects/altix/sys/cddl/dev/dtrace/amd64/dtrace_subr.c ============================================================================== --- projects/altix/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Tue Apr 12 04:48:37 2011 (r220557) @@ -403,7 +403,7 @@ dtrace_gethrtime_init(void *arg) * Otherwise tick->time conversion will be inaccurate, but * will preserve monotonic property of TSC. */ - tsc_f = tsc_freq; + tsc_f = atomic_load_acq_64(&tsc_freq); /* * The following line checks that nsec_scale calculated below Modified: projects/altix/sys/cddl/dev/dtrace/i386/dtrace_subr.c ============================================================================== --- projects/altix/sys/cddl/dev/dtrace/i386/dtrace_subr.c Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/cddl/dev/dtrace/i386/dtrace_subr.c Tue Apr 12 04:48:37 2011 (r220557) @@ -403,7 +403,7 @@ dtrace_gethrtime_init(void *arg) * Otherwise tick->time conversion will be inaccurate, but * will preserve monotonic property of TSC. */ - tsc_f = tsc_freq; + tsc_f = atomic_load_acq_64(&tsc_freq); /* * The following line checks that nsec_scale calculated below Modified: projects/altix/sys/cddl/dev/systrace/systrace.c ============================================================================== --- projects/altix/sys/cddl/dev/systrace/systrace.c Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/cddl/dev/systrace/systrace.c Tue Apr 12 04:48:37 2011 (r220557) @@ -64,16 +64,17 @@ #include #include #include +#define MODNAME "linux32" #elif defined(__i386__) #include #include #include #include +#define MODNAME "linux" #else #error Only i386 and amd64 are supported. #endif extern struct sysent linux_sysent[]; -#define MODNAME "linux32" #define MAXSYSCALL LINUX_SYS_MAXSYSCALL #define SYSCALLNAMES linux_syscallnames #define SYSENT linux_sysent @@ -132,7 +133,7 @@ static struct cdevsw systrace_cdevsw = { .d_version = D_VERSION, .d_open = systrace_open, #ifdef LINUX_SYSTRACE - .d_name = "linsystrace", + .d_name = "systrace_" MODNAME, #else .d_name = "systrace", #endif Modified: projects/altix/sys/compat/linprocfs/linprocfs.c ============================================================================== --- projects/altix/sys/compat/linprocfs/linprocfs.c Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/compat/linprocfs/linprocfs.c Tue Apr 12 04:48:37 2011 (r220557) @@ -221,6 +221,7 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) { int hw_model[2]; char model[128]; + uint64_t freq; size_t size; int class, fqmhz, fqkhz; int i; @@ -303,9 +304,10 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) if (cpu_feature & (1 << i)) sbuf_printf(sb, " %s", flags[i]); sbuf_cat(sb, "\n"); - if (class >= 5) { - fqmhz = (tsc_freq + 4999) / 1000000; - fqkhz = ((tsc_freq + 4999) / 10000) % 100; + freq = atomic_load_acq_64(&tsc_freq); + if (freq != 0) { + fqmhz = (freq + 4999) / 1000000; + fqkhz = ((freq + 4999) / 10000) % 100; sbuf_printf(sb, "cpu MHz\t\t: %d.%02d\n" "bogomips\t: %d.%02d\n", Modified: projects/altix/sys/compat/linux/linux_misc.c ============================================================================== --- projects/altix/sys/compat/linux/linux_misc.c Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/compat/linux/linux_misc.c Tue Apr 12 04:48:37 2011 (r220557) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -357,7 +358,9 @@ linux_uselib(struct thread *td, struct l */ PROC_LOCK(td->td_proc); if (a_out->a_text > maxtsiz || - a_out->a_data + bss_size > lim_cur(td->td_proc, RLIMIT_DATA)) { + a_out->a_data + bss_size > lim_cur(td->td_proc, RLIMIT_DATA) || + racct_set(td->td_proc, RACCT_DATA, a_out->a_data + + bss_size) != 0) { PROC_UNLOCK(td->td_proc); error = ENOMEM; goto cleanup; Modified: projects/altix/sys/compat/svr4/imgact_svr4.c ============================================================================== --- projects/altix/sys/compat/svr4/imgact_svr4.c Tue Apr 12 02:07:23 2011 (r220556) +++ projects/altix/sys/compat/svr4/imgact_svr4.c Tue Apr 12 04:48:37 2011 (r220557) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -108,7 +109,8 @@ exec_svr4_imgact(imgp) */ PROC_LOCK(imgp->proc); if (a_out->a_text > maxtsiz || - a_out->a_data + bss_size > lim_cur(imgp->proc, RLIMIT_DATA)) { + a_out->a_data + bss_size > lim_cur(imgp->proc, RLIMIT_DATA) || + racct_set(imgp->proc, RACCT_DATA, a_out->a_data + bss_size) != 0) { PROC_UNLOCK(imgp->proc); return (ENOMEM); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***