Skip to contentSkip to conversation

damo: support perf event configuration

RFC PATCH In review Akinobu Mita 3 participants 10 messages Jun 22 – Jun 26

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover damo: support perf event configuration

This patch set aims to make it easier to specify the perf event settings proposed for DAMON by Ravi's hardware-sampled access reports patch set [1] from the damo tool.

It consists of patches for the perf tool and the damo tool.

[1] https://lore.kernel.org/damon/[email protected]/

* perf

Akinobu Mita (1):
perf python: Add access to various members of evsel

 tools/perf/util/python.c | 50 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

* damo

Akinobu Mita (1):
damo: add --perf_event option

 src/_damo_fmt_str.py |   5 ++
 src/_damon.py        | 106 +++++++++++++++++++++++++++++++++-
 src/_damon_args.py   |  79 +++++++++++++++++++++++--
 src/_damon_sysfs.py  | 133 ++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 314 insertions(+), 9 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

RFC PATCH 1/2 perf python: Add access to various members of evsel

This change is necessary to specify the same PMU event selection as the 'perf record' -e option from DAMON's userspace tools.

For example, a Python script like the following will allow you to obtain the values to be set in the type, config, config1, and config2 members of perf_event_attr by providing a symbolic event name.

import perf

if __name__ == '__main__':

    evlist = perf.parse_events("cpu/mem-loads,ldlat=30/P")
    for evsel in evlist:
        print(f"{evsel}: type={evsel.type} config={evsel.config}",
              f"config1={evsel.config1} config2={evsel.config2}")
---
 tools/perf/util/python.c | 50 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
tools/perf/util/python.c +50 -0
index cc1019d29a5d..3f108b405ee3 100644
@@ -1241,11 +1241,60 @@ static PyMemberDef pyrf_evsel__members[] = {
 	evsel_attr_member_def(sample_type, T_ULONGLONG, "attribute sample_type."),
 	evsel_attr_member_def(read_format, T_ULONGLONG, "attribute read_format."),
 	evsel_attr_member_def(wakeup_events, T_UINT, "attribute wakeup_events."),
+	evsel_attr_member_def(config1, T_ULONGLONG, "attribute config1."),
+	evsel_attr_member_def(config2, T_ULONGLONG, "attribute config2."),
 	{ .name = NULL, },
 };
 
 static const char pyrf_evsel__doc[] = PyDoc_STR("perf event selector list object.");
 
+static PyObject *pyrf_evsel__get_freq(struct pyrf_evsel *pevsel, void *closure)
+{
+	return PyLong_FromLong(pevsel->evsel.core.attr.freq);
+}
+
+static PyObject *pyrf_evsel__get_exclude_kernel(struct pyrf_evsel *pevsel,
+						void *closure)
+{
+	return PyLong_FromLong(pevsel->evsel.core.attr.exclude_kernel);
+}
+
+static PyObject *pyrf_evsel__get_exclude_hv(struct pyrf_evsel *pevsel,
+					    void *closure)
+{
+	return PyLong_FromLong(pevsel->evsel.core.attr.exclude_hv);
+}
+
+static PyObject *pyrf_evsel__get_precise_ip(struct pyrf_evsel *pevsel,
+					    void *closure)
+{
+	return PyLong_FromLong(pevsel->evsel.core.attr.precise_ip);
+}
+
+static PyGetSetDef pyrf_evsel__getset[] = {
+	{
+		.name	= "freq",
+		.get	= (getter)pyrf_evsel__get_freq,
+		.doc	= PyDoc_STR("freq"),
+	},
+	{
+		.name	= "exclude_kernel",
+		.get	= (getter)pyrf_evsel__get_exclude_kernel,
+		.doc	= PyDoc_STR("exclude_kernel"),
+	},
+	{
+		.name	= "exclude_hv",
+		.get	= (getter)pyrf_evsel__get_exclude_hv,
+		.doc	= PyDoc_STR("exclude_hv"),
+	},
+	{
+		.name	= "precise_ip",
+		.get	= (getter)pyrf_evsel__get_precise_ip,
+		.doc	= PyDoc_STR("precise_ip"),
+	},
+	{ .name = NULL, },
+};
+
 static PyTypeObject pyrf_evsel__type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
 	.tp_name	= "perf.evsel",
@@ -1255,6 +1304,7 @@ static PyTypeObject pyrf_evsel__type = {
 	.tp_doc		= pyrf_evsel__doc,
 	.tp_members	= pyrf_evsel__members,
 	.tp_methods	= pyrf_evsel__methods,
+	.tp_getset	= pyrf_evsel__getset,
 	.tp_init	= (initproc)pyrf_evsel__init,
 	.tp_str         = pyrf_evsel__str,
 	.tp_repr        = pyrf_evsel__str,
Signature · 1 line
2.43.0
reviewer
#2 lore raw

Re: [RFC PATCH 1/2] perf python: Add access to various members of evsel

Quoted 10 lines · Akinobu Mita

This change is necessary to specify the same PMU event selection as the 'perf record' -e option from DAMON's userspace tools.

For example, a Python script like the following will allow you to obtain the values to be set in the type, config, config1, and config2 members of perf_event_attr by providing a symbolic event name.

import perf

Quoted 7 lines

if __name__ == '__main__':

    evlist = perf.parse_events("cpu/mem-loads,ldlat=30/P")
    for evsel in evlist:
        print(f"{evsel}: type={evsel.type} config={evsel.config}",
              f"config1={evsel.config1} config2={evsel.config2}")

Thanks Akinobu! I agree we should expose more parts of the evsel through the perf python API. I refactored this area recently so that we could better support perf.data file usage (the session API). There's a long series here that is merged enough to mean these changes will need a refactor too:
https://lore.kernel.org/lkml/[email protected]/
https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/util/python.c?h=perf-tools-next#n2449

The main change I made was avoiding copying evsels in the python API, as it adds many complications, and switching to reference counting. This means the Python evsel can no longer directly access inner variables and now requires an indirection. So in:
https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/util/python.c?h=perf-tools-next#n2290

```
static PyObject *pyrf_evsel__get_attr_config(PyObject *self, void
*closure __maybe_unused)
{
struct pyrf_evsel *pevsel = (void *)self;

CHECK_INITIALIZED(pevsel->evsel, "evsel");

return PyLong_FromUnsignedLongLong(pevsel->evsel->core.attr.config);
}
```

Note how it is evsel->core rather than evsel.core as it was before.

I believe you can copy-paste the code and tweak it for config1 and config2, but I'm afraid the previous evsel_attr_member_def approach won't work.

Thanks,
Ian

Quoted 81 lines
---
 tools/perf/util/python.c | 50 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
tools/perf/util/python.c +50 -1
index cc1019d29a5d..3f108b405ee3 100644
@@ -1241,11 +1241,60 @@ static PyMemberDef pyrf_evsel__members[] = {
        evsel_attr_member_def(sample_type, T_ULONGLONG, "attribute sample_type."),
        evsel_attr_member_def(read_format, T_ULONGLONG, "attribute read_format."),
        evsel_attr_member_def(wakeup_events, T_UINT, "attribute wakeup_events."),
+       evsel_attr_member_def(config1, T_ULONGLONG, "attribute config1."),
+       evsel_attr_member_def(config2, T_ULONGLONG, "attribute config2."),
        { .name = NULL, },
 };
 
 static const char pyrf_evsel__doc[] = PyDoc_STR("perf event selector list object.");
 
+static PyObject *pyrf_evsel__get_freq(struct pyrf_evsel *pevsel, void *closure)
+{
+       return PyLong_FromLong(pevsel->evsel.core.attr.freq);
+}
+
+static PyObject *pyrf_evsel__get_exclude_kernel(struct pyrf_evsel *pevsel,
+                                               void *closure)
+{
+       return PyLong_FromLong(pevsel->evsel.core.attr.exclude_kernel);
+}
+
+static PyObject *pyrf_evsel__get_exclude_hv(struct pyrf_evsel *pevsel,
+                                           void *closure)
+{
+       return PyLong_FromLong(pevsel->evsel.core.attr.exclude_hv);
+}
+
+static PyObject *pyrf_evsel__get_precise_ip(struct pyrf_evsel *pevsel,
+                                           void *closure)
+{
+       return PyLong_FromLong(pevsel->evsel.core.attr.precise_ip);
+}
+
+static PyGetSetDef pyrf_evsel__getset[] = {
+       {
+               .name   = "freq",
+               .get    = (getter)pyrf_evsel__get_freq,
+               .doc    = PyDoc_STR("freq"),
+       },
+       {
+               .name   = "exclude_kernel",
+               .get    = (getter)pyrf_evsel__get_exclude_kernel,
+               .doc    = PyDoc_STR("exclude_kernel"),
+       },
+       {
+               .name   = "exclude_hv",
+               .get    = (getter)pyrf_evsel__get_exclude_hv,
+               .doc    = PyDoc_STR("exclude_hv"),
+       },
+       {
+               .name   = "precise_ip",
+               .get    = (getter)pyrf_evsel__get_precise_ip,
+               .doc    = PyDoc_STR("precise_ip"),
+       },
+       { .name = NULL, },
+};
+
 static PyTypeObject pyrf_evsel__type = {
        PyVarObject_HEAD_INIT(NULL, 0)
        .tp_name        = "perf.evsel",
@@ -1255,6 +1304,7 @@ static PyTypeObject pyrf_evsel__type = {
        .tp_doc         = pyrf_evsel__doc,
        .tp_members     = pyrf_evsel__members,
        .tp_methods     = pyrf_evsel__methods,
+       .tp_getset      = pyrf_evsel__getset,
        .tp_init        = (initproc)pyrf_evsel__init,
        .tp_str         = pyrf_evsel__str,
        .tp_repr        = pyrf_evsel__str,
--

2.43.0

#3 lore raw

Re: [RFC PATCH 1/2] perf python: Add access to various members of evsel

2026年6月24日(水) 3:10 Ian Rogers <[email protected]>:

Quoted 44 lines · Akinobu Mita
Quoted 10 lines

This change is necessary to specify the same PMU event selection as the 'perf record' -e option from DAMON's userspace tools.

For example, a Python script like the following will allow you to obtain the values to be set in the type, config, config1, and config2 members of perf_event_attr by providing a symbolic event name.

import perf

Quoted 7 lines

if __name__ == '__main__':

    evlist = perf.parse_events("cpu/mem-loads,ldlat=30/P")
    for evsel in evlist:
        print(f"{evsel}: type={evsel.type} config={evsel.config}",
              f"config1={evsel.config1} config2={evsel.config2}")

Thanks Akinobu! I agree we should expose more parts of the evsel through the perf python API. I refactored this area recently so that we could better support perf.data file usage (the session API). There's a long series here that is merged enough to mean these changes will need a refactor too:
https://lore.kernel.org/lkml/[email protected]/
https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/util/python.c?h=perf-tools-next#n2449

The main change I made was avoiding copying evsels in the python API, as it adds many complications, and switching to reference counting. This means the Python evsel can no longer directly access inner variables and now requires an indirection. So in:
https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/util/python.c?h=perf-tools-next#n2290

```
static PyObject *pyrf_evsel__get_attr_config(PyObject *self, void
*closure __maybe_unused)
{
struct pyrf_evsel *pevsel = (void *)self;

CHECK_INITIALIZED(pevsel->evsel, "evsel");

return PyLong_FromUnsignedLongLong(pevsel->evsel->core.attr.config);
}
```
Quoted 5 lines

Note how it is evsel->core rather than evsel.core as it was before.

I believe you can copy-paste the code and tweak it for config1 and config2, but I'm afraid the previous evsel_attr_member_def approach won't work.

Thank you for letting me know.
I think I will be able to handle it once those improvements are merged.

Quoted 84 lines

Thanks,
Ian

Quoted 81 lines
---
 tools/perf/util/python.c | 50 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
tools/perf/util/python.c +50 -1
index cc1019d29a5d..3f108b405ee3 100644
@@ -1241,11 +1241,60 @@ static PyMemberDef pyrf_evsel__members[] = {
        evsel_attr_member_def(sample_type, T_ULONGLONG, "attribute sample_type."),
        evsel_attr_member_def(read_format, T_ULONGLONG, "attribute read_format."),
        evsel_attr_member_def(wakeup_events, T_UINT, "attribute wakeup_events."),
+       evsel_attr_member_def(config1, T_ULONGLONG, "attribute config1."),
+       evsel_attr_member_def(config2, T_ULONGLONG, "attribute config2."),
        { .name = NULL, },
 };
 
 static const char pyrf_evsel__doc[] = PyDoc_STR("perf event selector list object.");
 
+static PyObject *pyrf_evsel__get_freq(struct pyrf_evsel *pevsel, void *closure)
+{
+       return PyLong_FromLong(pevsel->evsel.core.attr.freq);
+}
+
+static PyObject *pyrf_evsel__get_exclude_kernel(struct pyrf_evsel *pevsel,
+                                               void *closure)
+{
+       return PyLong_FromLong(pevsel->evsel.core.attr.exclude_kernel);
+}
+
+static PyObject *pyrf_evsel__get_exclude_hv(struct pyrf_evsel *pevsel,
+                                           void *closure)
+{
+       return PyLong_FromLong(pevsel->evsel.core.attr.exclude_hv);
+}
+
+static PyObject *pyrf_evsel__get_precise_ip(struct pyrf_evsel *pevsel,
+                                           void *closure)
+{
+       return PyLong_FromLong(pevsel->evsel.core.attr.precise_ip);
+}
+
+static PyGetSetDef pyrf_evsel__getset[] = {
+       {
+               .name   = "freq",
+               .get    = (getter)pyrf_evsel__get_freq,
+               .doc    = PyDoc_STR("freq"),
+       },
+       {
+               .name   = "exclude_kernel",
+               .get    = (getter)pyrf_evsel__get_exclude_kernel,
+               .doc    = PyDoc_STR("exclude_kernel"),
+       },
+       {
+               .name   = "exclude_hv",
+               .get    = (getter)pyrf_evsel__get_exclude_hv,
+               .doc    = PyDoc_STR("exclude_hv"),
+       },
+       {
+               .name   = "precise_ip",
+               .get    = (getter)pyrf_evsel__get_precise_ip,
+               .doc    = PyDoc_STR("precise_ip"),
+       },
+       { .name = NULL, },
+};
+
 static PyTypeObject pyrf_evsel__type = {
        PyVarObject_HEAD_INIT(NULL, 0)
        .tp_name        = "perf.evsel",
@@ -1255,6 +1304,7 @@ static PyTypeObject pyrf_evsel__type = {
        .tp_doc         = pyrf_evsel__doc,
        .tp_members     = pyrf_evsel__members,
        .tp_methods     = pyrf_evsel__methods,
+       .tp_getset      = pyrf_evsel__getset,
        .tp_init        = (initproc)pyrf_evsel__init,
        .tp_str         = pyrf_evsel__str,
        .tp_repr        = pyrf_evsel__str,
--

2.43.0

#4 lore raw

RFC PATCH 2/2 damo: add --perf_event option

In reply to Akinobu Mita

The argument for the newly added --perf_event can be the same PMU event as the 'perf record' -e option.

The appropriate PMU event can be found in the following way:

```
$ sudo perf mem record sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.030 MB perf.data (12 samples) ]
$ sudo perf evlist
cpu/mem-loads,ldlat=30/P
cpu/mem-stores/P
```

In this case, you can set up perf events by starting damo as follows:

```
$ sudo damo start \
    --perf_event "cpu/mem-loads,ldlat=30,freq=5000/P" \
    --perf_event "cpu/mem-stores,freq=5000/P" \
    ...
```

In this example, the sampling frequency is also specified by the common parameter 'freq'.

---
 src/_damo_fmt_str.py |   5 ++
 src/_damon.py        | 106 +++++++++++++++++++++++++++++++++-
 src/_damon_args.py   |  79 +++++++++++++++++++++++--
 src/_damon_sysfs.py  | 133 ++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 314 insertions(+), 9 deletions(-)
src/_damo_fmt_str.py +5 -0
index 6c51e24a..d93d5ba8 100644
@@ -257,6 +257,11 @@ def text_to_nr(txt):
         pass
     return float(new_txt)
 
+def text_to_hex(txt):
+    if type(txt) == int:
+        return txt
+    return int(txt, 16)
+
 def try_common_input(txt, min_val=0, max_val=ulong_max):
     'return success and number'
     if txt == 'min':
src/_damon.py +103 -3

149 lines not on this page · raw message

src/_damon_args.py +74 -5

131 lines not on this page · raw message

src/_damon_sysfs.py +132 -1

159 lines not on this page · raw message

Signature · 1 line
2.43.0
maintainer
#5 lore raw
In reply to Akinobu Mita

Hello Akinobu,

Quoted 3 lines · On Mon, 22 Jun 2026 22:49:31 +0900 Akinobu Mita <[email protected]> wrote:

This patch set aims to make it easier to specify the perf event settings proposed for DAMON by Ravi's hardware-sampled access reports patch set [1] from the damo tool.

Seems this patch is built on top of the per-CPU/thread/read/write monitoring patch series [1]. We made a plan [2] to use another user interface, though. The plan is, making the interface ready for page table accessed bits based monitoring by LPC'26 (milestone 1), and implementing the perf event based monitoring on top of it, by LSFMMBPF'27 (milestone 2).

So the eventual damo part change for supporting perf event based monitoring will be quite different from this series. I guess you are sharing this series not because you aiming to merge it as is right now, but just for sharing the code with other stakeholders like Ravis, not me? If I'm not wrong, I will skip this series for now, to focus on the milestone 1.

Please let me know if you want more of my feedback.

[1] https://lore.kernel.org/[email protected]
[2] https://lore.kernel.org/[email protected]/

Thanks,
SJ

[...]

#6 lore raw

2026年6月23日(火) 0:24 SeongJae Park <[email protected]>:

Quoted 15 lines

Hello Akinobu,

Quoted 3 lines · On Mon, 22 Jun 2026 22:49:31 +0900 Akinobu Mita <[email protected]> wrote:

This patch set aims to make it easier to specify the perf event settings proposed for DAMON by Ravi's hardware-sampled access reports patch set [1] from the damo tool.

Seems this patch is built on top of the per-CPU/thread/read/write monitoring patch series [1]. We made a plan [2] to use another user interface, though. The plan is, making the interface ready for page table accessed bits based monitoring by LPC'26 (milestone 1), and implementing the perf event based monitoring on top of it, by LSFMMBPF'27 (milestone 2).

Quoted 5 lines

So the eventual damo part change for supporting perf event based monitoring will be quite different from this series. I guess you are sharing this series not because you aiming to merge it as is right now, but just for sharing the code with other stakeholders like Ravis, not me? If I'm not wrong, I will skip this series for now, to focus on the milestone 1.

Since I will align with the final user interface later, please focus on the optimal interface for Milestone 1 without worrying about that.

Quoted 1 line

Please let me know if you want more of my feedback.

However, even if the interface ends up being completely different from the current one, I believe that enabling configuration via damo using symbolic event names like this would still require calling the perf python interface (import perf) from damo and modifying the perf tool itself; could you please check if that approach is acceptable?

Thank you for your continued excellent work on improving DAMON.

Quoted 8 lines

[1] https://lore.kernel.org/[email protected]
[2] https://lore.kernel.org/[email protected]/

Thanks,
SJ

[...]

maintainer
#7 lore raw
Quoted 16 lines · On Tue, 23 Jun 2026 22:29:42 +0900 Akinobu Mita <[email protected]> wrote:

2026年6月23日(火) 0:24 SeongJae Park <[email protected]>:

Quoted 15 lines

Hello Akinobu,

Quoted 3 lines · On Mon, 22 Jun 2026 22:49:31 +0900 Akinobu Mita <[email protected]> wrote:

This patch set aims to make it easier to specify the perf event settings proposed for DAMON by Ravi's hardware-sampled access reports patch set [1] from the damo tool.

Seems this patch is built on top of the per-CPU/thread/read/write monitoring patch series [1]. We made a plan [2] to use another user interface, though. The plan is, making the interface ready for page table accessed bits based monitoring by LPC'26 (milestone 1), and implementing the perf event based monitoring on top of it, by LSFMMBPF'27 (milestone 2).

Quoted 8 lines
Quoted 5 lines

So the eventual damo part change for supporting perf event based monitoring will be quite different from this series. I guess you are sharing this series not because you aiming to merge it as is right now, but just for sharing the code with other stakeholders like Ravis, not me? If I'm not wrong, I will skip this series for now, to focus on the milestone 1.

Since I will align with the final user interface later, please focus on the optimal interface for Milestone 1 without worrying about that.

Thank you, Akinobu.

Quoted 8 lines
Quoted 2 lines

Please let me know if you want more of my feedback.

However, even if the interface ends up being completely different from the current one, I believe that enabling configuration via damo using symbolic event names like this would still require calling the perf python interface (import perf) from damo and modifying the perf tool itself; could you please check if that approach is acceptable?

I'm bit concerned at having such dependencies. I'd prefer making DAMON sysfs interface uses a symbolic names and just use it from damo if possible. If that is not possible, could you share more details about why such changes are required? I'm still lazily delaying studying about perf events, so please bear in mind with me.

Quoted 2 lines

Thank you for your continued excellent work on improving DAMON.

Thank you for your grateful contributions, too!

Thanks,
SJ

[...]

#8 lore raw

2026年6月23日(火) 22:50 SeongJae Park <[email protected]>:

Quoted 39 lines · On Tue, 23 Jun 2026 22:29:42 +0900 Akinobu Mita <[email protected]> wrote:
Quoted 17 lines

2026年6月23日(火) 0:24 SeongJae Park <[email protected]>:

Quoted 15 lines

Hello Akinobu,

Quoted 3 lines · On Mon, 22 Jun 2026 22:49:31 +0900 Akinobu Mita <[email protected]> wrote:

This patch set aims to make it easier to specify the perf event settings proposed for DAMON by Ravi's hardware-sampled access reports patch set [1] from the damo tool.

Seems this patch is built on top of the per-CPU/thread/read/write monitoring patch series [1]. We made a plan [2] to use another user interface, though. The plan is, making the interface ready for page table accessed bits based monitoring by LPC'26 (milestone 1), and implementing the perf event based monitoring on top of it, by LSFMMBPF'27 (milestone 2).

Quoted 8 lines
Quoted 5 lines

So the eventual damo part change for supporting perf event based monitoring will be quite different from this series. I guess you are sharing this series not because you aiming to merge it as is right now, but just for sharing the code with other stakeholders like Ravis, not me? If I'm not wrong, I will skip this series for now, to focus on the milestone 1.

Since I will align with the final user interface later, please focus on the optimal interface for Milestone 1 without worrying about that.

Thank you, Akinobu.

Quoted 8 lines
Quoted 2 lines

Please let me know if you want more of my feedback.

However, even if the interface ends up being completely different from the current one, I believe that enabling configuration via damo using symbolic event names like this would still require calling the perf python interface (import perf) from damo and modifying the perf tool itself; could you please check if that approach is acceptable?

Quoted 5 lines

I'm bit concerned at having such dependencies. I'd prefer making DAMON sysfs interface uses a symbolic names and just use it from damo if possible. If that is not possible, could you share more details about why such changes are required? I'm still lazily delaying studying about perf events, so please bear in mind with me.

Theoretically, it might be possible to initialize perf_event_attr within the kernel based on the symbolic names of specified PMU events. However, doing so would require implementing logic to read /sys/bus/event_source/devices/<pmu>/format/*, as well as duplicating functionality within the kernel that is currently provided by the perf user-space tools.

However, if we limit processing to only the minimal format, such as pmu/config=M,config1=N,config3=K/, described in the explanation of the -e option in tools/perf/Documentation/perf-record.txt, it may be possible to minimize duplication.

Quoted 10 lines
Quoted 2 lines

Thank you for your continued excellent work on improving DAMON.

Thank you for your grateful contributions, too!

Thanks,
SJ

[...]

maintainer
#9 lore raw
Quoted 53 lines · On Fri, 26 Jun 2026 22:56:24 +0900 Akinobu Mita <[email protected]> wrote:

2026年6月23日(火) 22:50 SeongJae Park <[email protected]>:

Quoted 39 lines · On Tue, 23 Jun 2026 22:29:42 +0900 Akinobu Mita <[email protected]> wrote:
Quoted 17 lines

2026年6月23日(火) 0:24 SeongJae Park <[email protected]>:

Quoted 15 lines

Hello Akinobu,

Quoted 3 lines · On Mon, 22 Jun 2026 22:49:31 +0900 Akinobu Mita <[email protected]> wrote:

This patch set aims to make it easier to specify the perf event settings proposed for DAMON by Ravi's hardware-sampled access reports patch set [1] from the damo tool.

Seems this patch is built on top of the per-CPU/thread/read/write monitoring patch series [1]. We made a plan [2] to use another user interface, though. The plan is, making the interface ready for page table accessed bits based monitoring by LPC'26 (milestone 1), and implementing the perf event based monitoring on top of it, by LSFMMBPF'27 (milestone 2).

Quoted 8 lines
Quoted 5 lines

So the eventual damo part change for supporting perf event based monitoring will be quite different from this series. I guess you are sharing this series not because you aiming to merge it as is right now, but just for sharing the code with other stakeholders like Ravis, not me? If I'm not wrong, I will skip this series for now, to focus on the milestone 1.

Since I will align with the final user interface later, please focus on the optimal interface for Milestone 1 without worrying about that.

Thank you, Akinobu.

Quoted 8 lines
Quoted 2 lines

Please let me know if you want more of my feedback.

However, even if the interface ends up being completely different from the current one, I believe that enabling configuration via damo using symbolic event names like this would still require calling the perf python interface (import perf) from damo and modifying the perf tool itself; could you please check if that approach is acceptable?

Quoted 5 lines

I'm bit concerned at having such dependencies. I'd prefer making DAMON sysfs interface uses a symbolic names and just use it from damo if possible. If that is not possible, could you share more details about why such changes are required? I'm still lazily delaying studying about perf events, so please bear in mind with me.

Theoretically, it might be possible to initialize perf_event_attr within the kernel based on the symbolic names of specified PMU events. However, doing so would require implementing logic to read /sys/bus/event_source/devices/<pmu>/format/*, as well as duplicating functionality within the kernel that is currently provided by the perf user-space tools.

Quoted 4 lines

However, if we limit processing to only the minimal format, such as pmu/config=M,config1=N,config3=K/, described in the explanation of the -e option in tools/perf/Documentation/perf-record.txt, it may be possible to minimize duplication.

Sounds good.

I'd prefer making DAMON interface as human readable as possible, as long as it is not duplicating things too much.

I wouldn't mind adding changes that depend on perf user-space tools or libraries in 'damo' for making it even more human-readable, as long as it doesn't break the backward compatibility of 'damo', and perf developers are ok with the perf-side change. Anyway 'damo' is using 'perf' internally ;) And seems perf developers are thankfully very open minded :)

Thanks,
SJ

[...]