Page MenuHomeFreeBSD

D43450.diff
No OneTemporary

D43450.diff

diff --git a/sys/kern/kern_condvar.c b/sys/kern/kern_condvar.c
--- a/sys/kern/kern_condvar.c
+++ b/sys/kern/kern_condvar.c
@@ -43,8 +43,9 @@
#include <sys/sleepqueue.h>
#include <sys/resourcevar.h>
#ifdef KTRACE
-#include <sys/uio.h>
#include <sys/ktrace.h>
+#include <sys/uio.h>
+#include <sys/user.h>
#endif
/*
@@ -107,24 +108,32 @@
_cv_wait(struct cv *cvp, struct lock_object *lock)
{
WITNESS_SAVE_DECL(lock_witness);
+#ifdef KTRACE
+ char wmesg[WMESGLEN + 1];
+#endif
struct lock_class *class;
struct thread *td;
uintptr_t lock_state;
td = curthread;
- lock_state = 0;
-#ifdef KTRACE
- if (KTRPOINT(td, KTR_CSW))
- ktrcsw(1, 0, cv_wmesg(cvp));
-#endif
CV_ASSERT(cvp, lock, td);
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, lock,
"Waiting on \"%s\"", cvp->cv_description);
- class = LOCK_CLASS(lock);
if (SCHEDULER_STOPPED_TD(td))
return;
+#ifdef KTRACE
+ if (KTRPOINT(td, KTR_CSW)) {
+ strlcpy(wmesg, cv_wmesg(cvp), sizeof(wmesg));
+ ktrcsw(1, 0, wmesg);
+ } else {
+ wmesg[0] = '\0';
+ }
+#endif
+
+ class = LOCK_CLASS(lock);
+ lock_state = 0;
sleepq_lock(cvp);
CV_WAITERS_INC(cvp);
@@ -145,7 +154,7 @@
#ifdef KTRACE
if (KTRPOINT(td, KTR_CSW))
- ktrcsw(0, 0, cv_wmesg(cvp));
+ ktrcsw(0, 0, wmesg);
#endif
PICKUP_GIANT();
if (lock != &Giant.lock_object) {
@@ -161,14 +170,13 @@
void
_cv_wait_unlock(struct cv *cvp, struct lock_object *lock)
{
+#ifdef KTRACE
+ char wmesg[WMESGLEN + 1];
+#endif
struct lock_class *class;
struct thread *td;
td = curthread;
-#ifdef KTRACE
- if (KTRPOINT(td, KTR_CSW))
- ktrcsw(1, 0, cv_wmesg(cvp));
-#endif
CV_ASSERT(cvp, lock, td);
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, lock,
"Waiting on \"%s\"", cvp->cv_description);
@@ -181,6 +189,15 @@
return;
}
+#ifdef KTRACE
+ if (KTRPOINT(td, KTR_CSW)) {
+ strlcpy(wmesg, cv_wmesg(cvp), sizeof(wmesg));
+ ktrcsw(1, 0, wmesg);
+ } else {
+ wmesg[0] = '\0';
+ }
+#endif
+
sleepq_lock(cvp);
CV_WAITERS_INC(cvp);
@@ -196,7 +213,7 @@
#ifdef KTRACE
if (KTRPOINT(td, KTR_CSW))
- ktrcsw(0, 0, cv_wmesg(cvp));
+ ktrcsw(0, 0, wmesg);
#endif
PICKUP_GIANT();
}
@@ -211,25 +228,33 @@
_cv_wait_sig(struct cv *cvp, struct lock_object *lock)
{
WITNESS_SAVE_DECL(lock_witness);
+#ifdef KTRACE
+ char wmesg[WMESGLEN + 1];
+#endif
struct lock_class *class;
struct thread *td;
uintptr_t lock_state;
int rval;
td = curthread;
- lock_state = 0;
-#ifdef KTRACE
- if (KTRPOINT(td, KTR_CSW))
- ktrcsw(1, 0, cv_wmesg(cvp));
-#endif
CV_ASSERT(cvp, lock, td);
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, lock,
"Waiting on \"%s\"", cvp->cv_description);
- class = LOCK_CLASS(lock);
if (SCHEDULER_STOPPED_TD(td))
return (0);
+#ifdef KTRACE
+ if (KTRPOINT(td, KTR_CSW)) {
+ strlcpy(wmesg, cv_wmesg(cvp), sizeof(wmesg));
+ ktrcsw(1, 0, wmesg);
+ } else {
+ wmesg[0] = '\0';
+ }
+#endif
+
+ class = LOCK_CLASS(lock);
+ lock_state = 0;
sleepq_lock(cvp);
CV_WAITERS_INC(cvp);
@@ -251,7 +276,7 @@
#ifdef KTRACE
if (KTRPOINT(td, KTR_CSW))
- ktrcsw(0, 0, cv_wmesg(cvp));
+ ktrcsw(0, 0, wmesg);
#endif
PICKUP_GIANT();
if (lock != &Giant.lock_object) {
@@ -272,24 +297,32 @@
sbintime_t pr, int flags)
{
WITNESS_SAVE_DECL(lock_witness);
+#ifdef KTRACE
+ char wmesg[WMESGLEN + 1];
+#endif
struct lock_class *class;
struct thread *td;
int lock_state, rval;
td = curthread;
- lock_state = 0;
-#ifdef KTRACE
- if (KTRPOINT(td, KTR_CSW))
- ktrcsw(1, 0, cv_wmesg(cvp));
-#endif
CV_ASSERT(cvp, lock, td);
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, lock,
"Waiting on \"%s\"", cvp->cv_description);
- class = LOCK_CLASS(lock);
if (SCHEDULER_STOPPED_TD(td))
return (0);
+#ifdef KTRACE
+ if (KTRPOINT(td, KTR_CSW)) {
+ strlcpy(wmesg, cv_wmesg(cvp), sizeof(wmesg));
+ ktrcsw(1, 0, wmesg);
+ } else {
+ wmesg[0] = '\0';
+ }
+#endif
+
+ class = LOCK_CLASS(lock);
+ lock_state = 0;
sleepq_lock(cvp);
CV_WAITERS_INC(cvp);
@@ -311,7 +344,7 @@
#ifdef KTRACE
if (KTRPOINT(td, KTR_CSW))
- ktrcsw(0, 0, cv_wmesg(cvp));
+ ktrcsw(0, 0, wmesg);
#endif
PICKUP_GIANT();
if (lock != &Giant.lock_object) {
@@ -334,24 +367,32 @@
sbintime_t sbt, sbintime_t pr, int flags)
{
WITNESS_SAVE_DECL(lock_witness);
+#ifdef KTRACE
+ char wmesg[WMESGLEN + 1];
+#endif
struct lock_class *class;
struct thread *td;
int lock_state, rval;
td = curthread;
- lock_state = 0;
-#ifdef KTRACE
- if (KTRPOINT(td, KTR_CSW))
- ktrcsw(1, 0, cv_wmesg(cvp));
-#endif
CV_ASSERT(cvp, lock, td);
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, lock,
"Waiting on \"%s\"", cvp->cv_description);
- class = LOCK_CLASS(lock);
if (SCHEDULER_STOPPED_TD(td))
return (0);
+#ifdef KTRACE
+ if (KTRPOINT(td, KTR_CSW)) {
+ strlcpy(wmesg, cv_wmesg(cvp), sizeof(wmesg));
+ ktrcsw(1, 0, wmesg);
+ } else {
+ wmesg[0] = '\0';
+ }
+#endif
+
+ class = LOCK_CLASS(lock);
+ lock_state = 0;
sleepq_lock(cvp);
CV_WAITERS_INC(cvp);
@@ -374,7 +415,7 @@
#ifdef KTRACE
if (KTRPOINT(td, KTR_CSW))
- ktrcsw(0, 0, cv_wmesg(cvp));
+ ktrcsw(0, 0, wmesg);
#endif
PICKUP_GIANT();
if (lock != &Giant.lock_object) {

File Metadata

Mime Type
text/plain
Expires
Sat, Jan 11, 3:42 AM (18 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15749698
Default Alt Text
D43450.diff (5 KB)

Event Timeline