lkml.org 
[lkml]   [2022]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[tip: x86/cpu] x86/mtrr: Add comment for set_mtrr_state() serialization
The following commit has been merged into the x86/cpu branch of tip:

Commit-ID: 01c97c7303580682751b5aaae043b639bdcbacb3
Gitweb: https://git.kernel.org/tip/01c97c7303580682751b5aaae043b639bdcbacb3
Author: Juergen Gross <jgross@suse.com>
AuthorDate: Tue, 04 Oct 2022 10:10:08 +02:00
Committer: Borislav Petkov <bp@suse.de>
CommitterDate: Wed, 19 Oct 2022 20:37:23 +02:00

x86/mtrr: Add comment for set_mtrr_state() serialization

Add a comment about set_mtrr_state() needing serialization.

[ bp: Touchups. ]

Suggested-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20220820092533.29420-2-jgross@suse.com
---
arch/x86/kernel/cpu/mtrr/generic.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index 5581082..c8f8951 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -684,7 +684,10 @@ static u32 deftype_lo, deftype_hi;
/**
* set_mtrr_state - Set the MTRR state for this CPU.
*
- * NOTE: The CPU must already be in a safe state for MTRR changes.
+ * NOTE: The CPU must already be in a safe state for MTRR changes, including
+ * measures that only a single CPU can be active in set_mtrr_state() in
+ * order to not be subject to races for usage of deftype_lo. This is
+ * accomplished by taking set_atomicity_lock.
* RETURNS: 0 if no changes made, else a mask indicating what was changed.
*/
static unsigned long set_mtrr_state(void)
\
 
 \ /
  Last update: 2022-10-19 20:47    [W:0.140 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site