[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1643245873-15542-13-git-send-email-byungchul.park@lge.com>
Date: Thu, 27 Jan 2022 10:11:11 +0900
From: Byungchul Park <byungchul.park@....com>
To: torvalds@...ux-foundation.org, mingo@...hat.com,
linux-kernel@...r.kernel.org
Cc: peterz@...radead.org, will@...nel.org, tglx@...utronix.de,
rostedt@...dmis.org, joel@...lfernandes.org, sashal@...nel.org,
daniel.vetter@...ll.ch, chris@...is-wilson.co.uk,
duyuyang@...il.com, johannes.berg@...el.com, tj@...nel.org,
tytso@....edu, willy@...radead.org, david@...morbit.com,
amir73il@...il.com, bfields@...ldses.org,
gregkh@...uxfoundation.org, kernel-team@....com,
linux-mm@...ck.org, akpm@...ux-foundation.org, mhocko@...nel.org,
minchan@...nel.org, hannes@...xchg.org, vdavydov.dev@...il.com,
sj@...nel.org, jglisse@...hat.com, dennis@...nel.org, cl@...ux.com,
penberg@...nel.org, rientjes@...gle.com, vbabka@...e.cz,
ngupta@...are.org, linux-block@...r.kernel.org, axboe@...nel.dk,
paolo.valente@...aro.org, josef@...icpanda.com,
linux-fsdevel@...r.kernel.org, viro@...iv.linux.org.uk,
jack@...e.cz, jlayton@...nel.org, dan.j.williams@...el.com,
hch@...radead.org, djwong@...nel.org,
dri-devel@...ts.freedesktop.org, airlied@...ux.ie,
rodrigosiqueiramelo@...il.com, melissa.srw@...il.com,
hamohammed.sa@...il.com
Subject: [PATCH on v5.17-rc1 13/14] dept: Separate out SDT(Single-event Dependency Tracker) header
Now that Dept has already been applied to major synchronization
machanisms e.g. spinlock, wait_for_completion and the like, we can take
advantage of Dept by default if CONFIG_DEPT is on.
However, sometimes we need to manually tag wait/event on places where
Dept hasn't been applied. SDT(Single-event Dependency Tracker) would be
useful in that case to tag those. The usage is like:
1. Initialize dmap in the instance associated to the wait/event.
sdt_map_init(dmap);
2. Add the following just before the wait.
sdt_wait(dmap);
3. Add the following just before the event.
sdt_event(dmap);
For better reference of SDT APIs, separated the APIs from dept.h.
Signed-off-by: Byungchul Park <byungchul.park@....com>
---
include/linux/dept.h | 36 --------------------------------
include/linux/dept_sdt.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+), 36 deletions(-)
create mode 100644 include/linux/dept_sdt.h
diff --git a/include/linux/dept.h b/include/linux/dept.h
index 5a726bf..10ef7fc 100644
--- a/include/linux/dept.h
+++ b/include/linux/dept.h
@@ -504,32 +504,6 @@ struct dept_map_common {
*/
extern void dept_key_init(struct dept_key *k);
extern void dept_key_destroy(struct dept_key *k);
-
-#define DEPT_SDT_MAP_INIT(dname) { .name = #dname }
-#define DEFINE_DEPT_SDT(x) \
- struct dept_map x = DEPT_SDT_MAP_INIT(x)
-
-/*
- * SDT(Single-event Dependency Tracker) APIs
- *
- * In case that one dept_map instance maps to a single event, SDT APIs
- * can be used.
- */
-#define sdt_map_init(m) \
- do { \
- static struct dept_key __key; \
- dept_map_init(m, &__key, 0, #m); \
- } while (0)
-#define sdt_map_init_key(m, k) dept_map_init(m, k, 0, #m)
-
-#define sdt_wait(m) \
- do { \
- dept_asked_event(m); \
- dept_wait(m, 1UL, _THIS_IP_, "wait", 0); \
- } while (0)
-#define sdt_ecxt_enter(m) dept_ecxt_enter(m, 1UL, _THIS_IP_, "start", "event", 0)
-#define sdt_event(m) dept_event(m, 1UL, _THIS_IP_, "event")
-#define sdt_ecxt_exit(m) dept_ecxt_exit(m, _THIS_IP_)
#else /* !CONFIG_DEPT */
struct dept_task { };
struct dept_key { };
@@ -563,15 +537,5 @@ struct dept_map_common {
#define dept_asked_event_split_map(me, mc) do { } while (0)
#define dept_key_init(k) do { (void)(k); } while (0)
#define dept_key_destroy(k) do { (void)(k); } while (0)
-
-#define DEPT_SDT_MAP_INIT(dname)
-#define DEFINE_DEPT_SDT(x)
-
-#define sdt_map_init(m) do { } while (0)
-#define sdt_map_init_key(m, k) do { (void)(k); } while (0)
-#define sdt_wait(m) do { } while (0)
-#define sdt_ecxt_enter(m) do { } while (0)
-#define sdt_event(m) do { } while (0)
-#define sdt_ecxt_exit(m) do { } while (0)
#endif
#endif /* __LINUX_DEPT_H */
diff --git a/include/linux/dept_sdt.h b/include/linux/dept_sdt.h
new file mode 100644
index 0000000..32a4a9e
--- /dev/null
+++ b/include/linux/dept_sdt.h
@@ -0,0 +1,53 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Dept Single-event Dependency Tracker
+ *
+ * Started by Byungchul Park <max.byungchul.park@...il.com>:
+ *
+ * Copyright (c) 2020 LG Electronics, Inc., Byungchul Park
+ */
+
+#ifndef __LINUX_DEPT_SDT_H
+#define __LINUX_DEPT_SDT_H
+
+#ifdef CONFIG_DEPT
+
+#include <linux/dept.h>
+
+#define DEPT_SDT_MAP_INIT(dname) { .name = #dname }
+#define DEFINE_DEPT_SDT(x) \
+ struct dept_map x = DEPT_SDT_MAP_INIT(x)
+
+/*
+ * SDT(Single-event Dependency Tracker) APIs
+ *
+ * In case that one dept_map instance maps to a single event, SDT APIs
+ * can be used.
+ */
+#define sdt_map_init(m) \
+ do { \
+ static struct dept_key __key; \
+ dept_map_init(m, &__key, 0, #m); \
+ } while (0)
+#define sdt_map_init_key(m, k) dept_map_init(m, k, 0, #m)
+
+#define sdt_wait(m) \
+ do { \
+ dept_asked_event(m); \
+ dept_wait(m, 1UL, _THIS_IP_, "wait", 0); \
+ } while (0)
+#define sdt_ecxt_enter(m) dept_ecxt_enter(m, 1UL, _THIS_IP_, "start", "event", 0)
+#define sdt_event(m) dept_event(m, 1UL, _THIS_IP_, "event")
+#define sdt_ecxt_exit(m) dept_ecxt_exit(m, _THIS_IP_)
+#else /* !CONFIG_DEPT */
+#define DEPT_SDT_MAP_INIT(dname)
+#define DEFINE_DEPT_SDT(x)
+
+#define sdt_map_init(m) do { } while (0)
+#define sdt_map_init_key(m, k) do { (void)(k); } while (0)
+#define sdt_wait(m) do { } while (0)
+#define sdt_ecxt_enter(m) do { } while (0)
+#define sdt_event(m) do { } while (0)
+#define sdt_ecxt_exit(m) do { } while (0)
+#endif
+#endif /* __LINUX_DEPT_SDT_H */
--
1.9.1
Powered by blists - more mailing lists