Mercurial > illumos > illumos-gate
changeset 3677:b34b45f03271
6479756 dtrace can cause "panic send mondo timeout"
author | sudheer |
---|---|
date | Sun, 18 Feb 2007 22:59:58 -0800 |
parents | 4975133d76f2 |
children | c532e9896e3d |
files | usr/src/uts/common/dtrace/dtrace.c usr/src/uts/common/sys/dtrace_impl.h usr/src/uts/intel/dtrace/Makefile usr/src/uts/intel/dtrace/dtrace_asm.s usr/src/uts/intel/dtrace/dtrace_isa.c usr/src/uts/sparc/dtrace/Makefile usr/src/uts/sparc/dtrace/dtrace_asm.s |
diffstat | 7 files changed, 135 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/dtrace/dtrace.c Sun Feb 18 22:37:35 2007 -0800 +++ b/usr/src/uts/common/dtrace/dtrace.c Sun Feb 18 22:59:58 2007 -0800 @@ -20,7 +20,7 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -2959,7 +2959,7 @@ if (subr == DIF_SUBR_COPYIN) { DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); - dtrace_copyin(tupregs[0].dttk_value, dest, size); + dtrace_copyin(tupregs[0].dttk_value, dest, size, flags); DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); } @@ -2984,7 +2984,7 @@ } DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); - dtrace_copyin(tupregs[0].dttk_value, dest, size); + dtrace_copyin(tupregs[0].dttk_value, dest, size, flags); DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); break; } @@ -3008,7 +3008,7 @@ } DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); - dtrace_copyinstr(tupregs[0].dttk_value, dest, size); + dtrace_copyinstr(tupregs[0].dttk_value, dest, size, flags); DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); ((char *)dest)[size - 1] = '\0'; @@ -3108,7 +3108,7 @@ dtrace_priv_proc_control(state) && !dtrace_istoxic(kaddr, size)) { DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); - dtrace_copyout(kaddr, uaddr, size); + dtrace_copyout(kaddr, uaddr, size, flags); DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); } break; @@ -3123,7 +3123,7 @@ dtrace_priv_proc_control(state) && !dtrace_istoxic(kaddr, size)) { DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); - dtrace_copyoutstr(kaddr, uaddr, size); + dtrace_copyoutstr(kaddr, uaddr, size, flags); DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT); } break;
--- a/usr/src/uts/common/sys/dtrace_impl.h Sun Feb 18 22:37:35 2007 -0800 +++ b/usr/src/uts/common/sys/dtrace_impl.h Sun Feb 18 22:59:58 2007 -0800 @@ -20,7 +20,7 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1239,10 +1239,11 @@ extern uintptr_t dtrace_caller(int); extern uint32_t dtrace_cas32(uint32_t *, uint32_t, uint32_t); extern void *dtrace_casptr(void *, void *, void *); -extern void dtrace_copyin(uintptr_t, uintptr_t, size_t); -extern void dtrace_copyinstr(uintptr_t, uintptr_t, size_t); -extern void dtrace_copyout(uintptr_t, uintptr_t, size_t); -extern void dtrace_copyoutstr(uintptr_t, uintptr_t, size_t); +extern void dtrace_copyin(uintptr_t, uintptr_t, size_t, volatile uint16_t *); +extern void dtrace_copyinstr(uintptr_t, uintptr_t, size_t, volatile uint16_t *); +extern void dtrace_copyout(uintptr_t, uintptr_t, size_t, volatile uint16_t *); +extern void dtrace_copyoutstr(uintptr_t, uintptr_t, size_t, + volatile uint16_t *); extern void dtrace_getpcstack(pc_t *, int, int, uint32_t *); extern ulong_t dtrace_getreg(struct regs *, uint_t); extern int dtrace_getstackdepth(int); @@ -1267,7 +1268,7 @@ extern uint_t dtrace_getfprs(void); #else extern void dtrace_copy(uintptr_t, uintptr_t, size_t); -extern void dtrace_copystr(uintptr_t, uintptr_t, size_t); +extern void dtrace_copystr(uintptr_t, uintptr_t, size_t, volatile uint16_t *); #endif /*
--- a/usr/src/uts/intel/dtrace/Makefile Sun Feb 18 22:37:35 2007 -0800 +++ b/usr/src/uts/intel/dtrace/Makefile Sun Feb 18 22:59:58 2007 -0800 @@ -19,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" @@ -49,6 +49,9 @@ ALL_TARGET = $(BINARY) $(SRC_CONFILE) LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) +AS_INC_PATH += -I$(DSF_DIR)/$(OBJS_DIR) + +ASSYM_H = $(DSF_DIR)/$(OBJS_DIR)/assym.h .KEEP_STATE: @@ -68,4 +71,12 @@ install: $(INSTALL_DEPS) +$(BINARY): $(ASSYM_H) + +# +# Rule to generate assym.h +# +$(ASSYM_H): FRC + @cd $(DSF_DIR); $(MAKE) all.targ + include $(UTSBASE)/intel/Makefile.targ
--- a/usr/src/uts/intel/dtrace/dtrace_asm.s Sun Feb 18 22:37:35 2007 -0800 +++ b/usr/src/uts/intel/dtrace/dtrace_asm.s Sun Feb 18 22:59:58 2007 -0800 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,6 +30,8 @@ #if defined(lint) #include <sys/dtrace_impl.h> +#else +#include "assym.h" #endif #if defined(lint) || defined(__lint) @@ -193,7 +194,8 @@ /*ARGSUSED*/ void -dtrace_copystr(uintptr_t uaddr, uintptr_t kaddr, size_t size) +dtrace_copystr(uintptr_t uaddr, uintptr_t kaddr, size_t size, + volatile uint16_t *flags) {} #else @@ -211,10 +213,15 @@ addq $1, %rsi /* increment destination pointer */ subq $1, %rdx /* decrement remaining count */ cmpb $0, %al - je 1f + je 2f + testq $0xfff, %rdx /* test if count is 4k-aligned */ + jnz 1f /* if not, continue with copying */ + testq $CPU_DTRACE_BADADDR, (%rcx) /* load and test dtrace flags */ + jnz 2f +1: cmpq $0, %rdx jne 0b -1: +2: leave ret @@ -239,11 +246,17 @@ incl %edx / Increment destination pointer decl %ecx / Decrement remaining count cmpb $0, %al - je 1f + je 2f + testl $0xfff, %ecx / Check if count is 4k-aligned + jnz 1f + movl 20(%ebp), %eax / load flags pointer + testl $CPU_DTRACE_BADADDR, (%eax) / load and test dtrace flags + jnz 2f +1: cmpl $0, %ecx jne 0b -1: +2: popl %ebx movl %ebp, %esp popl %ebp
--- a/usr/src/uts/intel/dtrace/dtrace_isa.c Sun Feb 18 22:37:35 2007 -0800 +++ b/usr/src/uts/intel/dtrace/dtrace_isa.c Sun Feb 18 22:59:58 2007 -0800 @@ -642,32 +642,38 @@ return (1); } +/*ARGSUSED*/ void -dtrace_copyin(uintptr_t uaddr, uintptr_t kaddr, size_t size) +dtrace_copyin(uintptr_t uaddr, uintptr_t kaddr, size_t size, + volatile uint16_t *flags) { if (dtrace_copycheck(uaddr, kaddr, size)) dtrace_copy(uaddr, kaddr, size); } +/*ARGSUSED*/ void -dtrace_copyout(uintptr_t kaddr, uintptr_t uaddr, size_t size) +dtrace_copyout(uintptr_t kaddr, uintptr_t uaddr, size_t size, + volatile uint16_t *flags) { if (dtrace_copycheck(uaddr, kaddr, size)) dtrace_copy(kaddr, uaddr, size); } void -dtrace_copyinstr(uintptr_t uaddr, uintptr_t kaddr, size_t size) +dtrace_copyinstr(uintptr_t uaddr, uintptr_t kaddr, size_t size, + volatile uint16_t *flags) { if (dtrace_copycheck(uaddr, kaddr, size)) - dtrace_copystr(uaddr, kaddr, size); + dtrace_copystr(uaddr, kaddr, size, flags); } void -dtrace_copyoutstr(uintptr_t kaddr, uintptr_t uaddr, size_t size) +dtrace_copyoutstr(uintptr_t kaddr, uintptr_t uaddr, size_t size, + volatile uint16_t *flags) { if (dtrace_copycheck(uaddr, kaddr, size)) - dtrace_copystr(kaddr, uaddr, size); + dtrace_copystr(kaddr, uaddr, size, flags); } uint8_t
--- a/usr/src/uts/sparc/dtrace/Makefile Sun Feb 18 22:37:35 2007 -0800 +++ b/usr/src/uts/sparc/dtrace/Makefile Sun Feb 18 22:59:58 2007 -0800 @@ -19,13 +19,14 @@ # CDDL HEADER END # # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" UTSBASE = ../.. +PLATFORM = sun4u MODULE = dtrace OBJECTS = $(DTRACE_OBJS:%=$(OBJS_DIR)/%) LINTS = $(DTRACE_OBJS:%.o=$(LINTS_DIR)/%.ln) @@ -34,6 +35,11 @@ include $(UTSBASE)/sparc/Makefile.sparc +# +# Redefine DSF_DIR +# +DSF_DIR = $(UTSBASE)/$(PLATFORM)/genassym + ALL_TARGET = $(BINARY) $(SRC_CONFILE) LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) @@ -49,6 +55,9 @@ AS_CPPFLAGS += $(DTRACE_INC_64) ASFLAGS += $(DTRACE_XAS_$(CLASS)) +AS_INC_PATH += -I$(DSF_DIR)/$(OBJS_DIR) + +ASSYM_H = $(DSF_DIR)/$(OBJS_DIR)/assym.h # # For now, disable these lint checks; maintainers should endeavor @@ -80,4 +89,12 @@ install: $(INSTALL_DEPS) +$(BINARY): $(ASSYM_H) + +# +# Rule to generate assym.h +# +$(ASSYM_H): FRC + @cd $(DSF_DIR); $(MAKE) all.targ + include $(UTSBASE)/sparc/Makefile.targ
--- a/usr/src/uts/sparc/dtrace/dtrace_asm.s Sun Feb 18 22:37:35 2007 -0800 +++ b/usr/src/uts/sparc/dtrace/dtrace_asm.s Sun Feb 18 22:59:58 2007 -0800 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -33,6 +32,7 @@ #include <sys/privregs.h> #include <sys/fsr.h> #include <sys/asi.h> +#include "assym.h" #endif #if defined(lint) || defined(__lint) @@ -317,23 +317,32 @@ /*ARGSUSED*/ void -dtrace_copyin(uintptr_t uaddr, uintptr_t kaddr, size_t size) +dtrace_copyin(uintptr_t uaddr, uintptr_t kaddr, size_t size, + volatile uint16_t *flags) {} #else ENTRY(dtrace_copyin) tst %o2 - bz 1f + bz 2f clr %g1 lduba [%o0 + %g1]ASI_USER, %g2 0: + ! check for an error if the count is 4k-aligned + andcc %g1, 0xfff, %g0 + bnz,pt %icc, 1f stub %g2, [%o1 + %g1] + lduh [%o3], %g3 + andcc %g3, CPU_DTRACE_BADADDR, %g0 + bnz,pn %icc, 2f + nop +1: inc %g1 cmp %g1, %o2 bl,a 0b lduba [%o0 + %g1]ASI_USER, %g2 -1: +2: retl nop @@ -345,25 +354,35 @@ /*ARGSUSED*/ void -dtrace_copyinstr(uintptr_t uaddr, uintptr_t kaddr, size_t size) +dtrace_copyinstr(uintptr_t uaddr, uintptr_t kaddr, size_t size, + volatile uint16_t *flags) {} #else ENTRY(dtrace_copyinstr) tst %o2 - bz 1f + bz 2f clr %g1 lduba [%o0 + %g1]ASI_USER, %g2 0: stub %g2, [%o1 + %g1] ! Store byte + + ! check for an error if the count is 4k-aligned + andcc %g1, 0xfff, %g0 + bnz,pt %icc, 1f + inc %g1 + lduh [%o3], %g3 + andcc %g3, CPU_DTRACE_BADADDR, %g0 + bnz,pn %icc, 2f + nop +1: cmp %g2, 0 ! Was that '\0'? - be 1f ! If so, we're done - inc %g1 ! Increment offset + be 2f ! If so, we're done cmp %g1, %o2 ! Compare to limit bl,a 0b ! If less, take another lap lduba [%o0 + %g1]ASI_USER, %g2 ! delay: load user byte -1: +2: retl nop @@ -375,23 +394,32 @@ /*ARGSUSED*/ void -dtrace_copyout(uintptr_t kaddr, uintptr_t uaddr, size_t size) +dtrace_copyout(uintptr_t kaddr, uintptr_t uaddr, size_t size, + volatile uint16_t *flags) {} #else ENTRY(dtrace_copyout) tst %o2 - bz 1f + bz 2f clr %g1 ldub [%o0 + %g1], %g2 0: + ! check for an error if the count is 4k-aligned + andcc %g1, 0xfff, %g0 + bnz,pt %icc, 1f stba %g2, [%o1 + %g1]ASI_USER + lduh [%o3], %g3 + andcc %g3, CPU_DTRACE_BADADDR, %g0 + bnz,pn %icc, 2f + nop +1: inc %g1 cmp %g1, %o2 bl,a 0b ldub [%o0 + %g1], %g2 -1: +2: retl nop SET_SIZE(dtrace_copyout) @@ -402,25 +430,35 @@ /*ARGSUSED*/ void -dtrace_copyoutstr(uintptr_t kaddr, uintptr_t uaddr, size_t size) +dtrace_copyoutstr(uintptr_t kaddr, uintptr_t uaddr, size_t size, + volatile uint16_t *flags) {} #else ENTRY(dtrace_copyoutstr) tst %o2 - bz 1f + bz 2f clr %g1 ldub [%o0 + %g1], %g2 0: stba %g2, [%o1 + %g1]ASI_USER + + ! check for an error if the count is 4k-aligned + andcc %g1, 0xfff, %g0 + bnz,pt %icc, 1f + inc %g1 + lduh [%o3], %g3 + andcc %g3, CPU_DTRACE_BADADDR, %g0 + bnz,pn %icc, 2f + nop +1: cmp %g2, 0 - be 1f - inc %g1 + be 2f cmp %g1, %o2 bl,a 0b ldub [%o0 + %g1], %g2 -1: +2: retl nop SET_SIZE(dtrace_copyoutstr)