Skip to contentSkip to conversation

x86/intel_rdt: use __this_cpu_read in pseudo_lock_fn()

PATCH In review Hui Su 2 participants 4 messages Jul 23, 2021 – Jul 30, 2021

Subsystems (2)
lore
Share & tools
lore

Hui Su

author
#0 lore raw

PATCH 1/1 x86/intel_rdt: use __this_cpu_read in pseudo_lock_fn()

The code is executed with interrupts disabled,
so it's safe to use __this_cpu_read().

---
 arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +2 -2
index 2207916cae65..f0cc0a89333b 100644
@@ -464,8 +464,8 @@ static int pseudo_lock_fn(void *_rdtgrp)
 	 * cache.
 	 */
 	__wrmsr(MSR_MISC_FEATURE_CONTROL, prefetch_disable_bits, 0x0);
-	closid_p = this_cpu_read(pqr_state.cur_closid);
-	rmid_p = this_cpu_read(pqr_state.cur_rmid);
+	closid_p = __this_cpu_read(pqr_state.cur_closid);
+	rmid_p = __this_cpu_read(pqr_state.cur_rmid);
 	mem_r = plr->kmem;
 	size = plr->size;
 	line_size = plr->line_size;
Signature · 1 line
2.30.2
maintainer
#1 lore raw

Hi,

Quoted 2 lines · Hui Su

The code is executed with interrupts disabled,
so it's safe to use __this_cpu_read().

True ... but could you please elaborate what the issue is with using this_cpu_read()? It too is safe to use when interrupts are disabled.

Quoted 12 lines
---
  arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +0 -0
index 2207916cae65..f0cc0a89333b 100644

arch/x86/kernel/cpu/resctrl/pseudo_lock.c static int pseudo_lock_fn(void *_rdtgrp) · line 471

Quoted 10 lines
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +2 -2
@@ -464,8 +464,8 @@ static int pseudo_lock_fn(void *_rdtgrp)
  	 * cache.
  	 */
  	__wrmsr(MSR_MISC_FEATURE_CONTROL, prefetch_disable_bits, 0x0);
-	closid_p = this_cpu_read(pqr_state.cur_closid);
-	rmid_p = this_cpu_read(pqr_state.cur_rmid);
+	closid_p = __this_cpu_read(pqr_state.cur_closid);
+	rmid_p = __this_cpu_read(pqr_state.cur_rmid);
  	mem_r = plr->kmem;
  	size = plr->size;
  	line_size = plr->line_size;

Reinette

#2 lore raw

Hi, Reinette:

There is no issue here, i just think it's better to use __this_cpu_read when
interrupt disabled.

________________________________________
发件人: Reinette Chatre <[email protected]>
发送时间: 2021年7月28日 2:56
收件人: 苏辉(Robert Su); [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected] 主题: Re: [PATCH] x86/intel_rdt: use __this_cpu_read in pseudo_lock_fn()

Hi,

Quoted 2 lines · Hui Su

The code is executed with interrupts disabled,
so it's safe to use __this_cpu_read().

True ... but could you please elaborate what the issue is with using this_cpu_read()? It too is safe to use when interrupts are disabled.

Quoted 12 lines
---
  arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +0 -0
index 2207916cae65..f0cc0a89333b 100644

arch/x86/kernel/cpu/resctrl/pseudo_lock.c static int pseudo_lock_fn(void *_rdtgrp) · line 471

Quoted 10 lines
arch/x86/kernel/cpu/resctrl/pseudo_lock.c +2 -2
@@ -464,8 +464,8 @@ static int pseudo_lock_fn(void *_rdtgrp)
       * cache.
       */
      __wrmsr(MSR_MISC_FEATURE_CONTROL, prefetch_disable_bits, 0x0);
-     closid_p = this_cpu_read(pqr_state.cur_closid);
-     rmid_p = this_cpu_read(pqr_state.cur_rmid);
+     closid_p = __this_cpu_read(pqr_state.cur_closid);
+     rmid_p = __this_cpu_read(pqr_state.cur_rmid);
      mem_r = plr->kmem;
      size = plr->size;
      line_size = plr->line_size;

Reinette

maintainer
#3 lore raw

Hi,

Quoted 4 lines · 苏辉(Robert Su)

Hi, Reinette:

There is no issue here, i just think it's better to use __this_cpu_read when
interrupt disabled.

ok, could you please elaborate why it is better? I do not see a problem with the change - I would just like to understand the motivation for it.

Thank you

Reinette