From: sashiko-bot@kernel.org
To: "SJ Park" <sj@kernel.org>
Cc: damon@lists.linux.dev
Subject: Re: [PATCH 4/6] selftests/damon/drgn_dump_damon_status: dump probes
Date: Wed, 02 Sep 2026 14:15:46 +0000 [thread overview]
Message-ID: <20260902141546.82FED1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260902140313.85983-5-sj@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Missing dictionary mapping for DAMON_FILTER_TYPE_PGIDLE_UNSET causes a KeyError crash when dumping DAMON status.
--
commit 331c442077c25bd4d245acf2c04de56eaa44e0db
Author: SJ Park <sj@kernel.org>
selftests/damon/drgn_dump_damon_status: dump probes
This commit extends drgn_dump_damon_status.py to dump damon_ctx->probes. It is
intended to monitor in-kernel DAMON status changes when the user sets probes
via sysfs.
> diff --git a/tools/testing/selftests/damon/drgn_dump_damon_status.py b/tools/testing/selftests/damon/drgn_dump_damon_status.py
> --- a/tools/testing/selftests/damon/drgn_dump_damon_status.py
> +++ b/tools/testing/selftests/damon/drgn_dump_damon_status.py
> @@ -48,6 +48,37 @@ def attrs_to_dict(attrs):
> ['max_nr_regions', int],
> ])
>
> +def filter_to_dict(damon_filter):
> + filter_type_keyword = {
> + 0: 'anon',
> + 1: 'memcg',
> + }
> + dict_ = {
> + 'type': filter_type_keyword[int(damon_filter.type)],
[Severity: Medium]
Will filter_to_dict() crash with a KeyError if a user configures a DAMON probe
with a filter of type pgidle_unset via sysfs?
If damon_filter.type is assigned the value 2 (DAMON_FILTER_TYPE_PGIDLE_UNSET),
the filter_type_keyword dictionary does not have a mapping for it. This could
cause the Python diagnostic script to crash, preventing the user from
inspecting the internal DAMON state.
> + 'matching': bool(damon_filter.matching),
> + 'allow': bool(damon_filter.allow),
> + }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260902140313.85983-1-sj@kernel.org?part=4
next prev parent reply other threads:[~2026-09-02 14:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 14:03 [PATCH 0/6] mm/damon: add kunit and selftests for probes and probe weights SJ Park
2026-09-02 14:03 ` [PATCH 1/6] mm/damon/tests/core-kunit: test damon_commit_filter() SJ Park
2026-09-02 14:10 ` sashiko-bot
2026-09-02 14:03 ` [PATCH 2/6] mm/damon/tests/core-kunit: add damon_commit_probes() test SJ Park
2026-09-02 14:11 ` sashiko-bot
2026-09-02 14:03 ` [PATCH 3/6] selftests/damon/_damon_sysfs: implement DamonProbes SJ Park
2026-09-02 14:15 ` sashiko-bot
2026-09-02 14:03 ` [PATCH 4/6] selftests/damon/drgn_dump_damon_status: dump probes SJ Park
2026-09-02 14:15 ` sashiko-bot [this message]
2026-09-02 14:23 ` SJ Park
2026-09-02 14:03 ` [PATCH 5/6] selftests/damon/sysfs.py: extend commit assertion function for probes SJ Park
2026-09-02 14:13 ` sashiko-bot
2026-09-02 14:03 ` [PATCH 6/6] selftests/damon/sysfs.py: test damon probes SJ Park
2026-09-02 14:15 ` sashiko-bot
2026-09-02 14:25 ` [PATCH 0/6] mm/damon: add kunit and selftests for probes and probe weights SJ Park
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=20260902141546.82FED1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=damon@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sj@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