From: Greg Kroah-Hartman Date: Tue, 31 Oct 2023 11:18:56 +0000 (+0100) Subject: 6.5-stable patches X-Git-Tag: v6.1.61~29 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6f7926988a4210ddc1ad484c4bec092eb1358b58;p=thirdparty%2Fkernel%2Fstable-queue.git 6.5-stable patches added patches: mm-damon-sysfs-check-damos-regions-update-progress-from-before_terminate.patch --- diff --git a/queue-6.5/mm-damon-sysfs-check-damos-regions-update-progress-from-before_terminate.patch b/queue-6.5/mm-damon-sysfs-check-damos-regions-update-progress-from-before_terminate.patch new file mode 100644 index 00000000000..4c5c0789d85 --- /dev/null +++ b/queue-6.5/mm-damon-sysfs-check-damos-regions-update-progress-from-before_terminate.patch @@ -0,0 +1,62 @@ +From 76b7069bcc89dec33f03eb08abee165d0306b754 Mon Sep 17 00:00:00 2001 +From: SeongJae Park +Date: Sat, 7 Oct 2023 20:04:32 +0000 +Subject: mm/damon/sysfs: check DAMOS regions update progress from before_terminate() + +From: SeongJae Park + +commit 76b7069bcc89dec33f03eb08abee165d0306b754 upstream. + +DAMON_SYSFS can receive DAMOS tried regions update request while kdamond +is already out of the main loop and before_terminate callback +(damon_sysfs_before_terminate() in this case) is not yet called. And +damon_sysfs_handle_cmd() can further be finished before the callback is +invoked. Then, damon_sysfs_before_terminate() unlocks damon_sysfs_lock, +which is not locked by anyone. This happens because the callback function +assumes damon_sysfs_cmd_request_callback() should be called before it. +Check if the assumption was true before doing the unlock, to avoid this +problem. + +Link: https://lkml.kernel.org/r/20231007200432.3110-1-sj@kernel.org +Fixes: f1d13cacabe1 ("mm/damon/sysfs: implement DAMOS tried regions update command") +Signed-off-by: SeongJae Park +Cc: [6.2.x] +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + mm/damon/sysfs.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- a/mm/damon/sysfs.c ++++ b/mm/damon/sysfs.c +@@ -1202,6 +1202,8 @@ static int damon_sysfs_set_targets(struc + return 0; + } + ++static bool damon_sysfs_schemes_regions_updating; ++ + static void damon_sysfs_before_terminate(struct damon_ctx *ctx) + { + struct damon_target *t, *next; +@@ -1209,10 +1211,12 @@ static void damon_sysfs_before_terminate + + /* damon_sysfs_schemes_update_regions_stop() might not yet called */ + kdamond = damon_sysfs_cmd_request.kdamond; +- if (kdamond && damon_sysfs_cmd_request.cmd == ++ if (kdamond && (damon_sysfs_cmd_request.cmd == + DAMON_SYSFS_CMD_UPDATE_SCHEMES_TRIED_REGIONS && ++ damon_sysfs_schemes_regions_updating) && + ctx == kdamond->damon_ctx) { + damon_sysfs_schemes_update_regions_stop(ctx); ++ damon_sysfs_schemes_regions_updating = false; + mutex_unlock(&damon_sysfs_lock); + } + +@@ -1331,7 +1335,6 @@ static int damon_sysfs_commit_input(stru + static int damon_sysfs_cmd_request_callback(struct damon_ctx *c) + { + struct damon_sysfs_kdamond *kdamond; +- static bool damon_sysfs_schemes_regions_updating; + int err = 0; + + /* avoid deadlock due to concurrent state_store('off') */ diff --git a/queue-6.5/platform-x86-add-s2idle-quirk-for-more-lenovo-laptop.patch b/queue-6.5/platform-x86-add-s2idle-quirk-for-more-lenovo-laptop.patch index 9c590bbcfc8..434cd38434f 100644 --- a/queue-6.5/platform-x86-add-s2idle-quirk-for-more-lenovo-laptop.patch +++ b/queue-6.5/platform-x86-add-s2idle-quirk-for-more-lenovo-laptop.patch @@ -31,14 +31,12 @@ Link: https://lore.kernel.org/r/ZTlsyOaFucF2pWrL@localhost Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin --- - drivers/platform/x86/amd/pmc-quirks.c | 73 +++++++++++++++++++++++++++ + drivers/platform/x86/amd/pmc-quirks.c | 73 ++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) -diff --git a/drivers/platform/x86/amd/pmc-quirks.c b/drivers/platform/x86/amd/pmc-quirks.c -index ad702463a65d3..6bbffb081053e 100644 --- a/drivers/platform/x86/amd/pmc-quirks.c +++ b/drivers/platform/x86/amd/pmc-quirks.c -@@ -111,6 +111,79 @@ static const struct dmi_system_id fwbug_list[] = { +@@ -111,6 +111,79 @@ static const struct dmi_system_id fwbug_ DMI_MATCH(DMI_PRODUCT_NAME, "21A1"), } }, @@ -118,6 +116,3 @@ index ad702463a65d3..6bbffb081053e 100644 /* https://gitlab.freedesktop.org/drm/amd/-/issues/2684 */ { .ident = "HP Laptop 15s-eq2xxx", --- -2.42.0 - diff --git a/queue-6.5/series b/queue-6.5/series index 4abf3798c44..7b4624867ae 100644 --- a/queue-6.5/series +++ b/queue-6.5/series @@ -109,3 +109,4 @@ clk-sanitize-possible_parent_show-to-handle-return-value-of-of_clk_get_parent_na clk-socfpga-gate-account-for-the-divider-in-determine_rate.patch clk-stm32-fix-a-signedness-issue-in-clk_stm32_composite_determine_rate.patch platform-x86-add-s2idle-quirk-for-more-lenovo-laptop.patch +mm-damon-sysfs-check-damos-regions-update-progress-from-before_terminate.patch