lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 28 Jan 2020 10:01:58 +0100
From:   <sjpark@...zon.com>
To:     <akpm@...ux-foundation.org>
CC:     SeongJae Park <sjpark@...zon.de>, <sj38.park@...il.com>,
        <acme@...nel.org>, <amit@...nel.org>, <brendan.d.gregg@...il.com>,
        <corbet@....net>, <dwmw@...zon.com>, <mgorman@...e.de>,
        <rostedt@...dmis.org>, <kirill@...temov.name>,
        <brendanhiggins@...gle.com>, <colin.king@...onical.com>,
        <minchan@...nel.org>, <vdavydov.dev@...il.com>,
        <vdavydov@...allels.com>, <linux-mm@...ck.org>,
        <linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH v2 9/9] mm/damon: Add a tracepoint for result buffer writing

From: SeongJae Park <sjpark@...zon.de>

This commit adds a tracepoint for DAMON's result buffer writing.  It is
called for each writing of the DAMON results and print the result data.
Therefore, it would be used to easily integrated with other tracepoint
supporting tracers such as perf.

Signed-off-by: SeongJae Park <sjpark@...zon.de>
---
 MAINTAINERS                  |  1 +
 include/trace/events/damon.h | 32 ++++++++++++++++++++++++++++++++
 mm/damon.c                   |  4 ++++
 3 files changed, 37 insertions(+)
 create mode 100644 include/trace/events/damon.h

diff --git a/MAINTAINERS b/MAINTAINERS
index cb091bee16c7..b912c659833d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4619,6 +4619,7 @@ F:	mm/damon.c
 F:	mm/damon-test.h
 F:	tools/damon/*
 F:	Documentation/admin-guide/mm/data_access_monitor.rst
+F:	include/trace/events/damon.h
 
 DAVICOM FAST ETHERNET (DMFE) NETWORK DRIVER
 L:	netdev@...r.kernel.org
diff --git a/include/trace/events/damon.h b/include/trace/events/damon.h
new file mode 100644
index 000000000000..fb33993620ce
--- /dev/null
+++ b/include/trace/events/damon.h
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM damon
+
+#if !defined(_TRACE_DAMON_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_DAMON_H
+
+#include <linux/types.h>
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(damon_write_rbuf,
+
+	TP_PROTO(void *buf, const ssize_t sz),
+
+	TP_ARGS(buf, sz),
+
+	TP_STRUCT__entry(
+		__dynamic_array(char, buf, sz)
+	),
+
+	TP_fast_assign(
+		memcpy(__get_dynamic_array(buf), buf, sz);
+	),
+
+	TP_printk("dat=%s", __print_hex(__get_dynamic_array(buf),
+			__get_dynamic_array_len(buf)))
+);
+
+#endif /* _TRACE_DAMON_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
diff --git a/mm/damon.c b/mm/damon.c
index f21968f079f0..6a0d560d38e7 100644
--- a/mm/damon.c
+++ b/mm/damon.c
@@ -9,6 +9,8 @@
 
 #define pr_fmt(fmt) "damon: " fmt
 
+#define CREATE_TRACE_POINTS
+
 #include <linux/debugfs.h>
 #include <linux/delay.h>
 #include <linux/kthread.h>
@@ -19,6 +21,7 @@
 #include <linux/sched/mm.h>
 #include <linux/sched/task.h>
 #include <linux/slab.h>
+#include <trace/events/damon.h>
 
 #define damon_get_task_struct(t) \
 	(get_pid_task(find_vpid(t->pid), PIDTYPE_PID))
@@ -587,6 +590,7 @@ static void damon_write_rbuf(void *data, ssize_t size)
 		damon_flush_rbuffer();
 
 	memcpy(&damon_rbuf[damon_rbuf_offset], data, size);
+	trace_damon_write_rbuf(data, size);
 	damon_rbuf_offset += size;
 }
 
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ