PERFORCE change 57493 for review
John Baldwin
jhb at FreeBSD.org
Fri Jul 16 14:13:12 PDT 2004
http://perforce.freebsd.org/chv.cgi?CH=57493
Change 57493 by jhb at jhb_slimer on 2004/07/16 21:12:15
IFC @57490. Loop back TDF -> TDP fixes.
Affected files ...
.. //depot/projects/smpng/sys/compat/ia32/ia32_sysvec.c#10 integrate
.. //depot/projects/smpng/sys/kern/kern_kse.c#4 integrate
.. //depot/projects/smpng/sys/kern/kern_sig.c#93 integrate
.. //depot/projects/smpng/sys/kern/kern_switch.c#39 integrate
.. //depot/projects/smpng/sys/kern/kern_synch.c#74 integrate
.. //depot/projects/smpng/sys/kern/kern_thread.c#61 integrate
.. //depot/projects/smpng/sys/kern/sched_4bsd.c#30 integrate
.. //depot/projects/smpng/sys/kern/sched_ule.c#35 integrate
.. //depot/projects/smpng/sys/kern/subr_prof.c#26 integrate
.. //depot/projects/smpng/sys/kern/subr_trap.c#67 integrate
.. //depot/projects/smpng/sys/sys/proc.h#120 integrate
.. //depot/projects/smpng/sys/sys/resourcevar.h#20 integrate
Differences ...
==== //depot/projects/smpng/sys/compat/ia32/ia32_sysvec.c#10 (text+ko) ====
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ia32/ia32_sysvec.c,v 1.17 2004/03/21 01:22:24 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ia32/ia32_sysvec.c,v 1.18 2004/07/16 20:53:00 obrien Exp $");
#include "opt_compat.h"
@@ -150,7 +150,7 @@
NULL,
"/usr/libexec/ld-elf.so.1",
&ia32_freebsd_sysvec,
- "/usr/libexec/ld-elf32.so.1",
+ "/libexec/ld-elf32.so.1",
};
SYSINIT(oia32, SI_SUB_EXEC, SI_ORDER_ANY,
==== //depot/projects/smpng/sys/kern/kern_kse.c#4 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_kse.c,v 1.184 2004/07/13 07:33:40 davidxu Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_kse.c,v 1.185 2004/07/16 21:04:55 jhb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -838,8 +838,9 @@
return (0);
if (user) {
/* Current always do via ast() */
+ td->td_pflags |= TDP_USTATCLOCK;
mtx_lock_spin(&sched_lock);
- td->td_flags |= (TDF_USTATCLOCK|TDF_ASTPENDING);
+ td->td_flags |= TDF_ASTPENDING;
mtx_unlock_spin(&sched_lock);
td->td_uuticks++;
} else if (td->td_mailbox != NULL)
@@ -1129,11 +1130,9 @@
* is returning from interrupt, charge thread's
* userland time for UTS.
*/
- if (td->td_flags & TDF_USTATCLOCK) {
+ if (td->td_pflags & TDP_USTATCLOCK) {
thread_update_usr_ticks(td, 1);
- mtx_lock_spin(&sched_lock);
- td->td_flags &= ~TDF_USTATCLOCK;
- mtx_unlock_spin(&sched_lock);
+ td->td_pflags &= ~TDP_USTATCLOCK;
}
/*
==== //depot/projects/smpng/sys/kern/kern_sig.c#93 (text+ko) ====
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_sig.c,v 1.284 2004/07/13 07:20:10 davidxu Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_sig.c,v 1.285 2004/07/16 21:00:50 jhb Exp $");
#include "opt_compat.h"
#include "opt_ktrace.h"
@@ -219,9 +219,7 @@
mtx_unlock_spin(&sched_lock);
}
if ((p->p_flag & P_SA) && !(p->p_flag & P_SIGEVENT)) {
- if (SIGSETEQ(saved, p->p_siglist))
- return;
- else {
+ if (!SIGSETEQ(saved, p->p_siglist)) {
/* pending set changed */
p->p_flag |= P_SIGEVENT;
wakeup(&p->p_siglist);
@@ -1647,9 +1645,7 @@
saved = p->p_siglist;
do_tdsignal(td, sig, target);
if ((p->p_flag & P_SA) && !(p->p_flag & P_SIGEVENT)) {
- if (SIGSETEQ(saved, p->p_siglist))
- return;
- else {
+ if (!SIGSETEQ(saved, p->p_siglist)) {
/* pending set changed */
p->p_flag |= P_SIGEVENT;
wakeup(&p->p_siglist);
==== //depot/projects/smpng/sys/kern/kern_switch.c#39 (text+ko) ====
@@ -86,7 +86,7 @@
***/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_switch.c,v 1.70 2004/07/10 21:36:01 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_switch.c,v 1.71 2004/07/16 21:04:55 jhb Exp $");
#include "opt_full_preemption.h"
@@ -451,7 +451,8 @@
("critical_exit: td_critnest == 0"));
if (td->td_critnest == 1) {
#ifdef PREEMPTION
- if (td->td_flags & TDF_OWEPREEMPT) {
+ mtx_assert(&sched_lock, MA_NOTOWNED);
+ if (td->td_pflags & TDP_OWEPREEMPT) {
mtx_lock_spin(&sched_lock);
mi_switch(SW_INVOL, NULL);
mtx_unlock_spin(&sched_lock);
@@ -485,7 +486,9 @@
* The new thread should not preempt the current thread if any of the
* following conditions are true:
*
- * - The current thread has a higher (numerically lower) priority.
+ * - The current thread has a higher (numerically lower) or
+ * equivalent priority. Note that this prevents curthread from
+ * trying to preempt to itself.
* - It is too early in the boot for context switches (cold is set).
* - The current thread has an inhibitor set or is in the process of
* exiting. In this case, the current thread is about to switch
@@ -515,7 +518,7 @@
if (ctd->td_critnest > 1) {
CTR1(KTR_PROC, "maybe_preempt: in critical section %d",
ctd->td_critnest);
- ctd->td_flags |= TDF_OWEPREEMPT;
+ ctd->td_pflags |= TDP_OWEPREEMPT;
return (0);
}
==== //depot/projects/smpng/sys/kern/kern_synch.c#74 (text+ko) ====
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_synch.c,v 1.253 2004/07/10 21:36:01 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_synch.c,v 1.254 2004/07/16 21:04:55 jhb Exp $");
#include "opt_ktrace.h"
@@ -297,11 +297,12 @@
mtx_assert(&Giant, MA_NOTOWNED);
#endif
KASSERT(td->td_critnest == 1 || (td->td_critnest == 2 &&
- (td->td_flags & TDF_OWEPREEMPT) != 0 && (flags & SW_INVOL) != 0 &&
+ (td->td_pflags & TDP_OWEPREEMPT) != 0 && (flags & SW_INVOL) != 0 &&
newtd == NULL),
("mi_switch: switch in a critical section"));
KASSERT((flags & (SW_INVOL | SW_VOL)) != 0,
("mi_switch: switch must be voluntary or involuntary"));
+ KASSERT(newtd != curthread, ("mi_switch: preempting back to ourself"));
if (flags & SW_VOL)
p->p_stats->p_ru.ru_nvcsw++;
==== //depot/projects/smpng/sys/kern/kern_thread.c#61 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_thread.c,v 1.187 2004/07/13 07:20:09 davidxu Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_thread.c,v 1.188 2004/07/16 21:01:52 jhb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1066,7 +1066,7 @@
mtx_assert(&sched_lock, MA_OWNED);
PROC_LOCK_ASSERT(p, MA_OWNED);
if (!P_SHOULDSTOP(p)) {
- while (( td = TAILQ_FIRST(&p->p_suspended))) {
+ while ((td = TAILQ_FIRST(&p->p_suspended))) {
thread_unsuspend_one(td);
}
} else if ((P_SHOULDSTOP(p) == P_STOPPED_SINGLE) &&
==== //depot/projects/smpng/sys/kern/sched_4bsd.c#30 (text+ko) ====
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.44 2004/07/13 20:49:13 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.45 2004/07/16 21:04:55 jhb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -654,7 +654,8 @@
sched_tdcnt++;
td->td_lastcpu = td->td_oncpu;
td->td_last_kse = ke;
- td->td_flags &= ~(TDF_NEEDRESCHED | TDF_OWEPREEMPT);
+ td->td_flags &= ~TDF_NEEDRESCHED;
+ td->td_pflags &= ~TDP_OWEPREEMPT;
td->td_oncpu = NOCPU;
/*
* At the last moment, if this thread is still marked RUNNING,
==== //depot/projects/smpng/sys/kern/sched_ule.c#35 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.115 2004/07/10 21:38:22 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.116 2004/07/16 21:04:55 jhb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1138,7 +1138,8 @@
td->td_last_kse = ke;
td->td_lastcpu = td->td_oncpu;
td->td_oncpu = NOCPU;
- td->td_flags &= ~(TDF_NEEDRESCHED | TDF_OWEPREEMPT);
+ td->td_flags &= ~TDF_NEEDRESCHED;
+ td->td_pflags &= ~TDP_OWEPREEMPT;
/*
* If the KSE has been assigned it may be in the process of switching
==== //depot/projects/smpng/sys/kern/subr_prof.c#26 (text+ko) ====
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/subr_prof.c,v 1.73 2004/07/02 03:50:47 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/subr_prof.c,v 1.74 2004/07/16 21:04:55 jhb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -481,10 +481,11 @@
addr = prof->pr_base + i;
mtx_unlock_spin(&sched_lock);
if ((v = fuswintr(addr)) == -1 || suswintr(addr, v + ticks) == -1) {
- prof->pr_addr = pc;
- prof->pr_ticks = ticks;
+ td->td_profil_addr = pc;
+ td->td_profil_ticks = ticks;
+ td->td_pflags |= TDP_OWEUPC;
mtx_lock_spin(&sched_lock);
- td->td_flags |= TDF_OWEUPC | TDF_ASTPENDING;
+ td->td_flags |= TDF_ASTPENDING;
mtx_unlock_spin(&sched_lock);
}
}
==== //depot/projects/smpng/sys/kern/subr_trap.c#67 (text+ko) ====
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/subr_trap.c,v 1.268 2004/07/02 19:09:49 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/subr_trap.c,v 1.269 2004/07/16 21:04:55 jhb Exp $");
#include "opt_ktrace.h"
#include "opt_mac.h"
@@ -178,7 +178,7 @@
p->p_sflag &= ~PS_MACPEND;
#endif
td->td_flags &= ~(TDF_ASTPENDING | TDF_NEEDSIGCHK |
- TDF_NEEDRESCHED | TDF_OWEUPC | TDF_INTERRUPT);
+ TDF_NEEDRESCHED | TDF_INTERRUPT);
cnt.v_soft++;
mtx_unlock_spin(&sched_lock);
/*
@@ -191,10 +191,10 @@
if (td->td_ucred != p->p_ucred)
cred_update_thread(td);
- if (flags & TDF_OWEUPC && p->p_flag & P_PROFIL) {
- addupc_task(td, p->p_stats->p_prof.pr_addr,
- p->p_stats->p_prof.pr_ticks);
- p->p_stats->p_prof.pr_ticks = 0;
+ if (td->td_pflags & TDP_OWEUPC && p->p_flag & P_PROFIL) {
+ addupc_task(td, td->td_profil_addr, td->td_profil_ticks);
+ td->td_profil_ticks = 0;
+ td->td_pflags &= ~TDP_OWEUPC;
}
if (sflag & PS_ALRMPEND) {
PROC_LOCK(p);
==== //depot/projects/smpng/sys/sys/proc.h#120 (text+ko) ====
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* @(#)proc.h 8.15 (Berkeley) 5/19/95
- * $FreeBSD: src/sys/sys/proc.h,v 1.386 2004/07/13 07:20:09 davidxu Exp $
+ * $FreeBSD: src/sys/sys/proc.h,v 1.387 2004/07/16 21:04:55 jhb Exp $
*/
#ifndef _SYS_PROC_H_
@@ -304,6 +304,9 @@
stack_t td_sigstk; /* (k) Stack ptr and on-stack flag. */
int td_kflags; /* (c) Flags for KSE threading. */
int td_xsig; /* (c) Signal for ptrace */
+ u_long td_profil_addr; /* (k) Temporary addr until AST. */
+ u_int td_profil_ticks; /* (k) Temporary ticks until AST. */
+
#define td_endzero td_base_pri
/* Copied during fork1() or thread_sched_upcall(). */
@@ -346,12 +349,9 @@
#define TDF_IDLETD 0x000020 /* This is one of the per-CPU idle threads. */
#define TDF_SELECT 0x000040 /* Selecting; wakeup/waiting danger. */
#define TDF_TSNOBLOCK 0x000100 /* Don't block on a turnstile due to race. */
-#define TDF_OWEPREEMPT 0x000200 /* Thread has a pending preemption. */
#define TDF_ASTPENDING 0x000800 /* Thread has some asynchronous events. */
#define TDF_TIMOFAIL 0x001000 /* Timeout from sleep after we were awake. */
#define TDF_INTERRUPT 0x002000 /* Thread is marked as interrupted. */
-#define TDF_USTATCLOCK 0x004000 /* Finish user statclock hit at next AST. */
-#define TDF_OWEUPC 0x008000 /* Owe thread an addupc() call at next AST. */
#define TDF_NEEDRESCHED 0x010000 /* Thread needs to yield. */
#define TDF_NEEDSIGCHK 0x020000 /* Thread may need signal delivery. */
#define TDF_XSIG 0x040000 /* Thread is exchanging signal under traced */
@@ -368,6 +368,9 @@
#define TDP_ALTSTACK 0x0020 /* Have alternate signal stack. */
#define TDP_DEADLKTREAT 0x0040 /* Lock aquisition - deadlock treatment. */
#define TDP_SA 0x0080 /* A scheduler activation based thread. */
+#define TDP_OWEPREEMPT 0x0100 /* Thread has a pending preemption. */
+#define TDP_OWEUPC 0x0200 /* Owe thread an addupc() call at next AST. */
+#define TDP_USTATCLOCK 0x0400 /* Finish user statclock hit at next AST. */
#define TDI_SUSPENDED 0x0001 /* On suspension queue. */
#define TDI_SLEEPING 0x0002 /* Actually asleep! (tricky). */
==== //depot/projects/smpng/sys/sys/resourcevar.h#20 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)resourcevar.h 8.4 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/sys/resourcevar.h,v 1.42 2004/07/02 03:50:48 jhb Exp $
+ * $FreeBSD: src/sys/sys/resourcevar.h,v 1.43 2004/07/16 21:04:55 jhb Exp $
*/
#ifndef _SYS_RESOURCEVAR_H_
@@ -63,8 +63,6 @@
u_long pr_size; /* (c + j) Buffer size. */
u_long pr_off; /* (c + j) PC offset. */
u_long pr_scale; /* (c + j) PC scaling. */
- u_long pr_addr; /* (k) Temporary addr until AST. */
- u_int pr_ticks; /* (k) Temporary ticks until AST. */
} p_prof;
#define pstat_endcopy p_start
struct timeval p_start; /* (b) Starting time. */
More information about the p4-projects
mailing list