From: Namhyung Kim <namhyung@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>, Will Deacon <will@kernel.org>,
Waiman Long <longman@redhat.com>,
Boqun Feng <boqun.feng@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Byungchul Park <byungchul.park@lge.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
linux-arch@vger.kernel.org, bpf@vger.kernel.org,
Radoslaw Burny <rburny@google.com>
Subject: [PATCH 3/4] locking/mutex: Pass proper call-site ip
Date: Mon, 28 Feb 2022 17:04:11 -0800 [thread overview]
Message-ID: <20220301010412.431299-4-namhyung@kernel.org> (raw)
In-Reply-To: <20220301010412.431299-1-namhyung@kernel.org>
The __mutex_lock_slowpath() and friends are declared as noinline and
_RET_IP_ returns its caller as mutex_lock which is not meaningful.
Pass the ip from mutex_lock() to have actual caller info in the trace.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
kernel/locking/mutex.c | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index 756624c14dfd..126b014098f3 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -254,7 +254,7 @@ static void __mutex_handoff(struct mutex *lock, struct task_struct *task)
* We also put the fastpath first in the kernel image, to make sure the
* branch is predicted by the CPU as default-untaken.
*/
-static void __sched __mutex_lock_slowpath(struct mutex *lock);
+static void __sched __mutex_lock_slowpath(struct mutex *lock, unsigned long ip);
/**
* mutex_lock - acquire the mutex
@@ -282,7 +282,7 @@ void __sched mutex_lock(struct mutex *lock)
might_sleep();
if (!__mutex_trylock_fast(lock))
- __mutex_lock_slowpath(lock);
+ __mutex_lock_slowpath(lock, _RET_IP_);
}
EXPORT_SYMBOL(mutex_lock);
#endif
@@ -947,10 +947,10 @@ static noinline void __sched __mutex_unlock_slowpath(struct mutex *lock, unsigne
* mutex_lock_interruptible() and mutex_trylock().
*/
static noinline int __sched
-__mutex_lock_killable_slowpath(struct mutex *lock);
+__mutex_lock_killable_slowpath(struct mutex *lock, unsigned long ip);
static noinline int __sched
-__mutex_lock_interruptible_slowpath(struct mutex *lock);
+__mutex_lock_interruptible_slowpath(struct mutex *lock, unsigned long ip);
/**
* mutex_lock_interruptible() - Acquire the mutex, interruptible by signals.
@@ -971,7 +971,7 @@ int __sched mutex_lock_interruptible(struct mutex *lock)
if (__mutex_trylock_fast(lock))
return 0;
- return __mutex_lock_interruptible_slowpath(lock);
+ return __mutex_lock_interruptible_slowpath(lock, _RET_IP_);
}
EXPORT_SYMBOL(mutex_lock_interruptible);
@@ -995,7 +995,7 @@ int __sched mutex_lock_killable(struct mutex *lock)
if (__mutex_trylock_fast(lock))
return 0;
- return __mutex_lock_killable_slowpath(lock);
+ return __mutex_lock_killable_slowpath(lock, _RET_IP_);
}
EXPORT_SYMBOL(mutex_lock_killable);
@@ -1020,36 +1020,36 @@ void __sched mutex_lock_io(struct mutex *lock)
EXPORT_SYMBOL_GPL(mutex_lock_io);
static noinline void __sched
-__mutex_lock_slowpath(struct mutex *lock)
+__mutex_lock_slowpath(struct mutex *lock, unsigned long ip)
{
- __mutex_lock(lock, TASK_UNINTERRUPTIBLE, 0, NULL, _RET_IP_);
+ __mutex_lock(lock, TASK_UNINTERRUPTIBLE, 0, NULL, ip);
}
static noinline int __sched
-__mutex_lock_killable_slowpath(struct mutex *lock)
+__mutex_lock_killable_slowpath(struct mutex *lock, unsigned long ip)
{
- return __mutex_lock(lock, TASK_KILLABLE, 0, NULL, _RET_IP_);
+ return __mutex_lock(lock, TASK_KILLABLE, 0, NULL, ip);
}
static noinline int __sched
-__mutex_lock_interruptible_slowpath(struct mutex *lock)
+__mutex_lock_interruptible_slowpath(struct mutex *lock, unsigned long ip)
{
- return __mutex_lock(lock, TASK_INTERRUPTIBLE, 0, NULL, _RET_IP_);
+ return __mutex_lock(lock, TASK_INTERRUPTIBLE, 0, NULL, ip);
}
static noinline int __sched
-__ww_mutex_lock_slowpath(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
+__ww_mutex_lock_slowpath(struct ww_mutex *lock, struct ww_acquire_ctx *ctx,
+ unsigned long ip)
{
- return __ww_mutex_lock(&lock->base, TASK_UNINTERRUPTIBLE, 0,
- _RET_IP_, ctx);
+ return __ww_mutex_lock(&lock->base, TASK_UNINTERRUPTIBLE, 0, ip, ctx);
}
static noinline int __sched
__ww_mutex_lock_interruptible_slowpath(struct ww_mutex *lock,
- struct ww_acquire_ctx *ctx)
+ struct ww_acquire_ctx *ctx,
+ unsigned long ip)
{
- return __ww_mutex_lock(&lock->base, TASK_INTERRUPTIBLE, 0,
- _RET_IP_, ctx);
+ return __ww_mutex_lock(&lock->base, TASK_INTERRUPTIBLE, 0, ip, ctx);
}
#endif
@@ -1094,7 +1094,7 @@ ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
return 0;
}
- return __ww_mutex_lock_slowpath(lock, ctx);
+ return __ww_mutex_lock_slowpath(lock, ctx, _RET_IP_);
}
EXPORT_SYMBOL(ww_mutex_lock);
@@ -1109,7 +1109,7 @@ ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
return 0;
}
- return __ww_mutex_lock_interruptible_slowpath(lock, ctx);
+ return __ww_mutex_lock_interruptible_slowpath(lock, ctx, _RET_IP_);
}
EXPORT_SYMBOL(ww_mutex_lock_interruptible);
--
2.35.1.574.g5d30c73bfb-goog
next prev parent reply other threads:[~2022-03-01 1:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-01 1:04 [RFC 0/4] locking: Add new lock contention tracepoints (v2) Namhyung Kim
2022-03-01 1:04 ` [PATCH 1/4] locking: Add lock contention tracepoints Namhyung Kim
2022-03-01 1:04 ` [PATCH 2/4] locking: Apply contention tracepoints in the slow path Namhyung Kim
2022-03-01 8:43 ` Peter Zijlstra
2022-03-01 18:03 ` Namhyung Kim
2022-03-01 9:03 ` Peter Zijlstra
2022-03-01 14:45 ` Steven Rostedt
2022-03-01 18:14 ` Namhyung Kim
2022-03-01 18:11 ` Namhyung Kim
2022-03-14 21:44 ` Namhyung Kim
2022-03-01 1:04 ` Namhyung Kim [this message]
2022-03-01 9:05 ` [PATCH 3/4] locking/mutex: Pass proper call-site ip Peter Zijlstra
2022-03-01 14:53 ` Steven Rostedt
2022-03-01 19:47 ` Peter Zijlstra
2022-03-04 7:28 ` Namhyung Kim
2022-03-01 18:25 ` Namhyung Kim
2022-03-01 1:04 ` [PATCH 4/4] locking/rwsem: " Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220301010412.431299-4-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=arnd@arndb.de \
--cc=boqun.feng@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=byungchul.park@lge.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rburny@google.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).