public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Babu Moger" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Babu Moger <babu.moger@amd.com>, Tony Luck <tony.luck@intel.com>,
	"Borislav Petkov (AMD)" <bp@alien8.de>,
	Reinette Chatre <reinette.chatre@intel.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/cache] x86/resctrl: Introduce resctrl_file_fflags_init() to initialize fflags
Date: Fri, 13 Dec 2024 21:02:44 -0000	[thread overview]
Message-ID: <173412376412.412.4974766123437056297.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20241206163148.83828-2-tony.luck@intel.com>

The following commit has been merged into the x86/cache branch of tip:

Commit-ID:     2937f9c361f7a8b230cd599e4af5264798bf4ce7
Gitweb:        https://git.kernel.org/tip/2937f9c361f7a8b230cd599e4af5264798bf4ce7
Author:        Babu Moger <babu.moger@amd.com>
AuthorDate:    Fri, 06 Dec 2024 08:31:41 -08:00
Committer:     Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Mon, 09 Dec 2024 21:37:01 +01:00

x86/resctrl: Introduce resctrl_file_fflags_init() to initialize fflags

thread_throttle_mode_init() and mbm_config_rftype_init() both initialize
fflags for resctrl files.

Adding new files will involve adding another function to initialize
the fflags. This can be simplified by adding a new function
resctrl_file_fflags_init() and passing the file name and flags
to be initialized.

Consolidate fflags initialization into resctrl_file_fflags_init() and
remove thread_throttle_mode_init() and mbm_config_rftype_init().

  [ Tony: Drop __init attribute so resctrl_file_fflags_init() can be used at
    run time. ]

Signed-off-by: Babu Moger <babu.moger@amd.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Link: https://lore.kernel.org/r/20241206163148.83828-2-tony.luck@intel.com
---
 arch/x86/kernel/cpu/resctrl/core.c     |  4 +++-
 arch/x86/kernel/cpu/resctrl/internal.h |  3 +--
 arch/x86/kernel/cpu/resctrl/monitor.c  |  6 ++++--
 arch/x86/kernel/cpu/resctrl/rdtgroup.c | 15 ++-------------
 4 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
index b681c2e..f3ee585 100644
--- a/arch/x86/kernel/cpu/resctrl/core.c
+++ b/arch/x86/kernel/cpu/resctrl/core.c
@@ -234,7 +234,9 @@ static __init bool __get_mem_config_intel(struct rdt_resource *r)
 		r->membw.throttle_mode = THREAD_THROTTLE_PER_THREAD;
 	else
 		r->membw.throttle_mode = THREAD_THROTTLE_MAX;
-	thread_throttle_mode_init();
+
+	resctrl_file_fflags_init("thread_throttle_mode",
+				 RFTYPE_CTRL_INFO | RFTYPE_RES_MB);
 
 	r->alloc_capable = true;
 
diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
index 955999a..faaff9d 100644
--- a/arch/x86/kernel/cpu/resctrl/internal.h
+++ b/arch/x86/kernel/cpu/resctrl/internal.h
@@ -647,8 +647,7 @@ void cqm_handle_limbo(struct work_struct *work);
 bool has_busy_rmid(struct rdt_mon_domain *d);
 void __check_limbo(struct rdt_mon_domain *d, bool force_free);
 void rdt_domain_reconfigure_cdp(struct rdt_resource *r);
-void __init thread_throttle_mode_init(void);
-void __init mbm_config_rftype_init(const char *config);
+void resctrl_file_fflags_init(const char *config, unsigned long fflags);
 void rdt_staged_configs_clear(void);
 bool closid_allocated(unsigned int closid);
 int resctrl_find_cleanest_closid(void);
diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
index 5fcb3d6..69bdc11 100644
--- a/arch/x86/kernel/cpu/resctrl/monitor.c
+++ b/arch/x86/kernel/cpu/resctrl/monitor.c
@@ -1224,11 +1224,13 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r)
 
 		if (rdt_cpu_has(X86_FEATURE_CQM_MBM_TOTAL)) {
 			mbm_total_event.configurable = true;
-			mbm_config_rftype_init("mbm_total_bytes_config");
+			resctrl_file_fflags_init("mbm_total_bytes_config",
+						 RFTYPE_MON_INFO | RFTYPE_RES_CACHE);
 		}
 		if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) {
 			mbm_local_event.configurable = true;
-			mbm_config_rftype_init("mbm_local_bytes_config");
+			resctrl_file_fflags_init("mbm_local_bytes_config",
+						 RFTYPE_MON_INFO | RFTYPE_RES_CACHE);
 		}
 	}
 
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index d906a1c..d333570 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -2020,24 +2020,13 @@ static struct rftype *rdtgroup_get_rftype_by_name(const char *name)
 	return NULL;
 }
 
-void __init thread_throttle_mode_init(void)
-{
-	struct rftype *rft;
-
-	rft = rdtgroup_get_rftype_by_name("thread_throttle_mode");
-	if (!rft)
-		return;
-
-	rft->fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB;
-}
-
-void __init mbm_config_rftype_init(const char *config)
+void resctrl_file_fflags_init(const char *config, unsigned long fflags)
 {
 	struct rftype *rft;
 
 	rft = rdtgroup_get_rftype_by_name(config);
 	if (rft)
-		rft->fflags = RFTYPE_MON_INFO | RFTYPE_RES_CACHE;
+		rft->fflags = fflags;
 }
 
 /**

  reply	other threads:[~2024-12-13 21:02 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-06 16:31 [PATCH v11 0/8] x86/resctrl: mba_MBps enhancement Tony Luck
2024-12-06 16:31 ` [PATCH v11 1/8] x86/resctrl: Introduce resctrl_file_fflags_init() to initialize fflags Tony Luck
2024-12-13 21:02   ` tip-bot2 for Babu Moger [this message]
2024-12-06 16:31 ` [PATCH v11 2/8] x86/resctrl: Prepare for per-CTRL_MON group mba_MBps control Tony Luck
2024-12-09 20:45   ` Borislav Petkov
2024-12-09 22:05     ` Luck, Tony
2024-12-09 22:20       ` Borislav Petkov
2024-12-09 22:35         ` Luck, Tony
2024-12-09 23:40           ` Reinette Chatre
2024-12-10  0:00             ` Luck, Tony
2024-12-10 10:13               ` Borislav Petkov
2024-12-10 18:42                 ` Reinette Chatre
2024-12-10 18:59                   ` Borislav Petkov
2024-12-13 21:02   ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-12-06 16:31 ` [PATCH v11 3/8] x86/resctrl: Modify update_mba_bw() to use per CTRL_MON group event Tony Luck
2024-12-13 21:02   ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-12-06 16:31 ` [PATCH v11 4/8] x86/resctrl: Compute memory bandwidth for all supported events Tony Luck
2024-12-13 21:02   ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-12-06 16:31 ` [PATCH v11 5/8] x86/resctrl: Make mba_sc use total bandwidth if local is not supported Tony Luck
2024-12-13 21:02   ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-12-06 16:31 ` [PATCH v11 6/8] x86/resctrl: Add "mba_MBps_event" file to CTRL_MON directories Tony Luck
2024-12-13 21:02   ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-12-06 16:31 ` [PATCH v11 7/8] x86/resctrl: Add write option to "mba_MBps_event" file Tony Luck
2024-12-13 21:02   ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-12-06 16:31 ` [PATCH v11 8/8] x86/resctrl: Document the new " Tony Luck
2024-12-13 21:02   ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-12-09 17:10 ` [PATCH v11 0/8] x86/resctrl: mba_MBps enhancement Reinette Chatre
2024-12-09 17:28   ` Borislav Petkov
2024-12-09 17:53     ` Luck, Tony
2024-12-09 17:57       ` Borislav Petkov
2024-12-09 19:15         ` Moger, Babu

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=173412376412.412.4974766123437056297.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=babu.moger@amd.com \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=tony.luck@intel.com \
    --cc=x86@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