changeset 12797:7119a7ce586b

6893273 panic in fss_newpri() when scheduling class was changed
author Pramod Batni <Pramod.Batni@Sun.COM>
date Wed, 07 Jul 2010 02:21:35 -0700
parents 5f02bbe06309
children f6c8601080b4
files usr/src/uts/common/disp/fss.c usr/src/uts/common/disp/fx.c usr/src/uts/common/disp/ts.c
diffstat 3 files changed, 21 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/disp/fss.c	Wed Jul 07 10:09:52 2010 +0200
+++ b/usr/src/uts/common/disp/fss.c	Wed Jul 07 02:21:35 2010 -0700
@@ -20,8 +20,7 @@
  */
 
 /*
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 #include <sys/types.h>
@@ -1615,13 +1614,12 @@
 	 * process does not disappear before we set it running.
 	 */
 	mutex_enter(&cp->p_lock);
-	mutex_exit(&pidlock);
 	continuelwps(cp);
 	mutex_exit(&cp->p_lock);
 
 	mutex_enter(&pp->p_lock);
+	mutex_exit(&pidlock);
 	continuelwps(pp);
-	mutex_exit(&pp->p_lock);
 
 	thread_lock(t);
 
@@ -1645,6 +1643,11 @@
 		setfrontdq(t);
 
 	thread_unlock(t);
+	/*
+	 * Safe to drop p_lock now since it is safe to change
+	 * the scheduling class after this point.
+	 */
+	mutex_exit(&pp->p_lock);
 
 	swtch();
 }
--- a/usr/src/uts/common/disp/fx.c	Wed Jul 07 10:09:52 2010 +0200
+++ b/usr/src/uts/common/disp/fx.c	Wed Jul 07 02:21:35 2010 -0700
@@ -20,8 +20,7 @@
  */
 
 /*
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 #include <sys/types.h>
@@ -658,13 +657,12 @@
 	 * the process does not disappear before we set it running.
 	 */
 	mutex_enter(&cp->p_lock);
-	mutex_exit(&pidlock);
 	continuelwps(cp);
 	mutex_exit(&cp->p_lock);
 
 	mutex_enter(&pp->p_lock);
+	mutex_exit(&pidlock);
 	continuelwps(pp);
-	mutex_exit(&pp->p_lock);
 
 	thread_lock(t);
 	fxpp = (fxproc_t *)(t->t_cldata);
@@ -673,6 +671,11 @@
 	THREAD_TRANSITION(t);
 	fx_setrun(t);
 	thread_unlock(t);
+	/*
+	 * Safe to drop p_lock now since it is safe to change
+	 * the scheduling class after this point.
+	 */
+	mutex_exit(&pp->p_lock);
 
 	swtch();
 }
--- a/usr/src/uts/common/disp/ts.c	Wed Jul 07 10:09:52 2010 +0200
+++ b/usr/src/uts/common/disp/ts.c	Wed Jul 07 02:21:35 2010 -0700
@@ -20,8 +20,7 @@
  */
 
 /*
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
@@ -739,13 +738,12 @@
 	 * the process does not disappear before we set it running.
 	 */
 	mutex_enter(&cp->p_lock);
-	mutex_exit(&pidlock);
 	continuelwps(cp);
 	mutex_exit(&cp->p_lock);
 
 	mutex_enter(&pp->p_lock);
+	mutex_exit(&pidlock);
 	continuelwps(pp);
-	mutex_exit(&pp->p_lock);
 
 	thread_lock(t);
 	tspp = (tsproc_t *)(t->t_cldata);
@@ -759,6 +757,11 @@
 	THREAD_TRANSITION(t);
 	ts_setrun(t);
 	thread_unlock(t);
+	/*
+	 * Safe to drop p_lock now since since it is safe to change
+	 * the scheduling class after this point.
+	 */
+	mutex_exit(&pp->p_lock);
 
 	swtch();
 }