From: Wenyou Yang <WenYou.Yang@amd.com>
To: <alexander.deucher@amd.com>, <christian.koenig@amd.com>,
<Xinhui.Pan@amd.com>
Cc: weiyuan2@amd.com, ying.li@amd.com, amd-gfx@lists.freedesktop.org,
Wenyou Yang <WenYou.Yang@amd.com>,
kunliu13@amd.com, richardqi.liang@amd.com
Subject: [Resend PATCH v1 1/3] cpu/smt: add a notifier to notify the SMT changes
Date: Wed, 22 Mar 2023 17:16:05 +0800 [thread overview]
Message-ID: <20230322091607.1609145-2-WenYou.Yang@amd.com> (raw)
In-Reply-To: <20230322091607.1609145-1-WenYou.Yang@amd.com>
Add the notifier chain to notify the cpu SMT status changes
Signed-off-by: Wenyou Yang <WenYou.Yang@amd.com>
---
include/linux/cpu.h | 5 +++++
kernel/cpu.c | 11 ++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 314802f98b9d..9a842317fe2d 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -213,6 +213,11 @@ enum cpuhp_smt_control {
CPU_SMT_NOT_IMPLEMENTED,
};
+enum cpuhp_smt_status {
+ SMT_ENABLED,
+ SMT_DISABLED,
+};
+
#if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT)
extern enum cpuhp_smt_control cpu_smt_control;
extern void cpu_smt_disable(bool force);
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 6c0a92ca6bb5..accae0fa9868 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -89,6 +89,9 @@ static DEFINE_PER_CPU(struct cpuhp_cpu_state, cpuhp_state) = {
cpumask_t cpus_booted_once_mask;
#endif
+RAW_NOTIFIER_HEAD(smt_notifier_head);
+EXPORT_SYMBOL(smt_notifier_head);
+
#if defined(CONFIG_LOCKDEP) && defined(CONFIG_SMP)
static struct lockdep_map cpuhp_state_up_map =
STATIC_LOCKDEP_MAP_INIT("cpuhp_state-up", &cpuhp_state_up_map);
@@ -2281,8 +2284,10 @@ int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval)
*/
cpuhp_offline_cpu_device(cpu);
}
- if (!ret)
+ if (!ret) {
cpu_smt_control = ctrlval;
+ raw_notifier_call_chain(&smt_notifier_head, SMT_DISABLED, NULL);
+ }
cpu_maps_update_done();
return ret;
}
@@ -2303,7 +2308,11 @@ int cpuhp_smt_enable(void)
/* See comment in cpuhp_smt_disable() */
cpuhp_online_cpu_device(cpu);
}
+ if (!ret)
+ raw_notifier_call_chain(&smt_notifier_head, SMT_ENABLED, NULL);
+
cpu_maps_update_done();
+
return ret;
}
#endif
--
2.39.2
next prev parent reply other threads:[~2023-03-22 9:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-22 9:16 [Resend PATCH v1 0/3] send message to pmfw when SMT changes Wenyou Yang
2023-03-22 9:16 ` Wenyou Yang [this message]
2023-03-22 9:16 ` [Resend PATCH v1 2/3] drm/amd/pm: send the SMT-enable message to pmfw Wenyou Yang
2023-03-23 7:17 ` Quan, Evan
2023-03-23 7:43 ` Yang, WenYou
2023-03-23 8:29 ` Lazar, Lijo
2023-03-23 9:34 ` Yang, WenYou
2023-03-23 9:48 ` Lazar, Lijo
2023-03-22 9:16 ` [Resend PATCH v1 3/3] drm/amd/pm: vangogh: support to send SMT enable message Wenyou Yang
2023-03-23 2:21 ` Yuan, Perry
2023-03-23 9:47 ` Yang, WenYou
2023-03-24 7:04 ` Yang, WenYou
2023-03-23 7:22 ` Quan, Evan
2023-03-23 7:41 ` Yang, WenYou
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=20230322091607.1609145-2-WenYou.Yang@amd.com \
--to=wenyou.yang@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=kunliu13@amd.com \
--cc=richardqi.liang@amd.com \
--cc=weiyuan2@amd.com \
--cc=ying.li@amd.com \
/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;
as well as URLs for NNTP newsgroup(s).