Skip to contentSkip to conversation

samples/damon: fix boot time enable handling fixup merge mistakes

PATCH Applied SeongJae Park 2 participants 8 messages Sep 9, 2025

Subsystems (3)
lore
Share & tools
lore

SeongJae Park

author maintainer
#0 lore raw

cover samples/damon: fix boot time enable handling fixup merge mistakes

First three patches of the patch series "mm/damon: fix misc bugs in DAMON modules" [1] was trying to fix boot time DAMON sample modules enabling issues by avoiding starting DAMON before the module initialization phase. However, probably by a mistake during a merge, only half of the change is merged, and the part for avoiding the starting of DAMON before the module initialized is missed. So the problem is not solved. Fix those.

Note that the broken commits are merged into 6.17-rc1, but also backported to relevant stable kernels. So this series also need to be merged into the stable kernels. Hence Cc-ing stable@.

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

SeongJae Park (3):
samples/damon/wsse: avoid starting DAMON before initialization samples/damon/prcl: avoid starting DAMON before initialization samples/damon/mtier: avoid starting DAMON before initialization

 samples/damon/mtier.c | 3 +++
 samples/damon/prcl.c  | 3 +++
 samples/damon/wsse.c  | 3 +++
 3 files changed, 9 insertions(+)

base-commit: 186951910f4e44e20738d85c0421032634ddb298

Signature · 1 line
2.39.5
author maintainer
#1 lore raw

PATCH 1/3 samples/damon/wsse: avoid starting DAMON before initialization

Commit 0ed1165c3727 ("samples/damon/wsse: fix boot time enable handling") is somehow incompletely applying the origin patch [1]. It is missing the part that avoids starting DAMON before module initialization. Probably a mistake during a merge has happened. Fix it by applying the missed part again.

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

Fixes 0ed1165c3727 ("samples/damon/wsse: fix boot time enable handling")
Cc <[email protected]> # 6.17-rc1
---
 samples/damon/wsse.c | 3 +++
 1 file changed, 3 insertions(+)
samples/damon/wsse.c +3 -0
index da052023b099..21eaf15f987d 100644
@@ -118,6 +118,9 @@ static int damon_sample_wsse_enable_store(
 		return 0;
 
 	if (enabled) {
+		if (!init_called)
+			return 0;
+
 		err = damon_sample_wsse_start();
 		if (err)
 			enabled = false;
Signature · 1 line
2.39.5
author maintainer
#2 lore raw

PATCH 2/3 samples/damon/prcl: avoid starting DAMON before initialization

In reply to SeongJae Park

Commit 2780505ec2b4 ("samples/damon/prcl: fix boot time enable crash") is somehow incompletely applying the origin patch [1]. It is missing the part that avoids starting DAMON before module initialization. Probably a mistake during a merge has happened. Fix it by applying the missed part again.

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

Fixes 2780505ec2b4 ("samples/damon/prcl: fix boot time enable crash")
Cc <[email protected]> # 6.17-rc1
---
 samples/damon/prcl.c | 3 +++
 1 file changed, 3 insertions(+)
samples/damon/prcl.c +3 -0
index 1b839c06a612..0226652f94d5 100644
@@ -137,6 +137,9 @@ static int damon_sample_prcl_enable_store(
 	if (enabled == is_enabled)
 		return 0;
 
+	if (!init_called)
+		return 0;
+
 	if (enabled) {
 		err = damon_sample_prcl_start();
 		if (err)
Signature · 1 line
2.39.5
author maintainer
#3 lore raw

PATCH 3/3 samples/damon/mtier: avoid starting DAMON before initialization

In reply to SeongJae Park

Commit 964314344eab ("samples/damon/mtier: support boot time enable setup") is somehow incompletely applying the origin patch [1]. It is missing the part that avoids starting DAMON before module initialization. Probably a mistake during a merge has happened. Fix it by applying the missed part again.

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

Fixes 964314344eab ("samples/damon/mtier: support boot time enable setup")
Cc <[email protected]> # 6.17-rc1
---
 samples/damon/mtier.c | 3 +++
 1 file changed, 3 insertions(+)
samples/damon/mtier.c +3 -0
index 7ebd352138e4..beaf36657dea 100644
@@ -208,6 +208,9 @@ static int damon_sample_mtier_enable_store(
 	if (enabled == is_enabled)
 		return 0;
 
+	if (!init_called)
+		return 0;
+
 	if (enabled) {
 		err = damon_sample_mtier_start();
 		if (err)
Signature · 1 line
2.39.5
maintainer
#4 lore raw
In reply to SeongJae Park
Quoted 11 lines · On Mon, 8 Sep 2025 19:22:35 -0700 SeongJae Park <[email protected]> wrote:

First three patches of the patch series "mm/damon: fix misc bugs in DAMON modules" [1] was trying to fix boot time DAMON sample modules enabling issues by avoiding starting DAMON before the module initialization phase. However, probably by a mistake during a merge, only half of the change is merged, and the part for avoiding the starting of DAMON before the module initialized is missed. So the problem is not solved. Fix those.

Note that the broken commits are merged into 6.17-rc1, but also backported to relevant stable kernels. So this series also need to be merged into the stable kernels. Hence Cc-ing stable@.

That's unfortunate, but the about doesn't actually tell us what this series does.

Quoted 1 line

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

Presumably it's in there somewhere?

author maintainer
#5 lore raw
Quoted 10 lines · On Mon, 8 Sep 2025 19:35:48 -0700 Andrew Morton <[email protected]>…
Quoted 8 lines · On Mon, 8 Sep 2025 19:22:35 -0700 SeongJae Park <[email protected]> wrote:

First three patches of the patch series "mm/damon: fix misc bugs in DAMON modules" [1] was trying to fix boot time DAMON sample modules enabling issues by avoiding starting DAMON before the module initialization phase. However, probably by a mistake during a merge, only half of the change is merged, and the part for avoiding the starting of DAMON before the module initialized is missed. So the problem is not solved. Fix those.

Quoted 6 lines
Quoted 3 lines

Note that the broken commits are merged into 6.17-rc1, but also backported to relevant stable kernels. So this series also need to be merged into the stable kernels. Hence Cc-ing stable@.

That's unfortunate, but the about doesn't actually tell us what this series does.

Good point. The issue is that the sample modules can crash if those are enabled at boot time before DAMON is initialized, via kernel command line.

Would you prefer me sending another version of this patch series with an elaborated cover letter?

Quoted 4 lines
Quoted 2 lines

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

Presumably it's in there somewhere?

You're right. Both the cover letter and the individual fix patches (first three of the series) describes the issue and origin broken commit.

Please let me know if there is anything I can help for this patch series from my side :)

Thanks,
SJ

maintainer
#6 lore raw
Quoted 4 lines · On Mon, 8 Sep 2025 20:51:41 -0700 SeongJae Park <[email protected]> wrote:
Quoted 4 lines
Quoted 3 lines

Note that the broken commits are merged into 6.17-rc1, but also backported to relevant stable kernels. So this series also need to be merged into the stable kernels. Hence Cc-ing stable@.

Quoted 8 lines
Quoted 2 lines

That's unfortunate, but the about doesn't actually tell us what this series does.

Good point. The issue is that the sample modules can crash if those are enabled at boot time before DAMON is initialized, via kernel command line.

Would you prefer me sending another version of this patch series with an elaborated cover letter?

Please just send out the appropriate words and I'll paste it in.

author maintainer
#7 lore raw
Quoted 9 lines · On Mon, 8 Sep 2025 21:18:45 -0700 Andrew Morton <[email protected]>…
Quoted 7 lines · On Mon, 8 Sep 2025 20:51:41 -0700 SeongJae Park <[email protected]> wrote:
Quoted 6 lines
Quoted 3 lines

Note that the broken commits are merged into 6.17-rc1, but also backported to relevant stable kernels. So this series also need to be merged into the stable kernels. Hence Cc-ing stable@.

That's unfortunate, but the about doesn't actually tell us what this series does.

Quoted 7 lines
Quoted 5 lines

Good point. The issue is that the sample modules can crash if those are enabled at boot time before DAMON is initialized, via kernel command line.

Would you prefer me sending another version of this patch series with an elaborated cover letter?

Please just send out the appropriate words and I'll paste it in.

Thank you for the guidance, Andrew. How about below?

"""
First three patches of the patch series "mm/damon: fix misc bugs in DAMON modules" [1] was trying to fix boot time DAMON sample modules enabling issues. The issues are the modules can crash if those are enabled before DAMON is enabled, like using boot time parameter options. The three patches were fixing the issues by avoiding starting DAMON before the module initialization phase.

However, probably by a mistake during a merge, only half of the change is merged, and the part for avoiding the starting of DAMON before the module initialized is missed. So the problem is not solved and thus the modules can still crash if enabled before DAMON is initialized. Fix those by applying the unmerged parts again.

Note that the broken commits are merged into 6.17-rc1, but also backported to relevant stable kernels. So this series also needs to be merged into the stable kernels. Hence Cc-ing stable@.
"""

Thanks,
SJ