linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/intel_rdt: use __this_cpu_read in pseudo_lock_fn()
@ 2021-07-23  2:33 Hui Su
  2021-07-27 18:56 ` Reinette Chatre
  0 siblings, 1 reply; 4+ messages in thread
From: Hui Su @ 2021-07-23  2:33 UTC (permalink / raw)
  To: fenghua.yu, reinette.chatre, tglx, mingo, bp, x86, hpa, linux-kernel
  Cc: Hui Su

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

Signed-off-by: Hui Su <suhui@zeku.com>
---
 arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c
index 2207916cae65..f0cc0a89333b 100644
--- a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c
+++ b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c
@@ -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;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/intel_rdt: use __this_cpu_read in pseudo_lock_fn()
  2021-07-23  2:33 [PATCH] x86/intel_rdt: use __this_cpu_read in pseudo_lock_fn() Hui Su
@ 2021-07-27 18:56 ` Reinette Chatre
  2021-07-30  8:22   ` 回复: " 苏辉(Robert Su)
  0 siblings, 1 reply; 4+ messages in thread
From: Reinette Chatre @ 2021-07-27 18:56 UTC (permalink / raw)
  To: Hui Su, fenghua.yu, tglx, mingo, bp, x86, hpa, linux-kernel

Hi,

On 7/22/2021 7:33 PM, Hui Su wrote:
> 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.

> 
> Signed-off-by: Hui Su <suhui@zeku.com>
> ---
>   arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c
> index 2207916cae65..f0cc0a89333b 100644
> --- a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c
> +++ b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c
> @@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* 回复: [PATCH] x86/intel_rdt: use __this_cpu_read in pseudo_lock_fn()
  2021-07-27 18:56 ` Reinette Chatre
@ 2021-07-30  8:22   ` 苏辉(Robert Su)
  2021-07-30 14:47     ` Reinette Chatre
  0 siblings, 1 reply; 4+ messages in thread
From: 苏辉(Robert Su) @ 2021-07-30  8:22 UTC (permalink / raw)
  To: Reinette Chatre, fenghua.yu, tglx, mingo, bp, x86, hpa, linux-kernel

Hi, Reinette:

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

________________________________________
发件人: Reinette Chatre <reinette.chatre@intel.com>
发送时间: 2021年7月28日 2:56
收件人: 苏辉(Robert Su); fenghua.yu@intel.com; tglx@linutronix.de; mingo@redhat.com; bp@alien8.de; x86@kernel.org; hpa@zytor.com; linux-kernel@vger.kernel.org
主题: Re: [PATCH] x86/intel_rdt: use __this_cpu_read in pseudo_lock_fn()

Hi,

On 7/22/2021 7:33 PM, Hui Su wrote:
> 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.

>
> Signed-off-by: Hui Su <suhui@zeku.com>
> ---
>   arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c
> index 2207916cae65..f0cc0a89333b 100644
> --- a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c
> +++ b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c
> @@ -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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 回复: [PATCH] x86/intel_rdt: use __this_cpu_read in pseudo_lock_fn()
  2021-07-30  8:22   ` 回复: " 苏辉(Robert Su)
@ 2021-07-30 14:47     ` Reinette Chatre
  0 siblings, 0 replies; 4+ messages in thread
From: Reinette Chatre @ 2021-07-30 14:47 UTC (permalink / raw)
  To: 苏辉(Robert Su),
	fenghua.yu, tglx, mingo, bp, x86, hpa, linux-kernel

Hi,

On 7/30/2021 1:22 AM, 苏辉(Robert Su) wrote:
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-30 14:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-23  2:33 [PATCH] x86/intel_rdt: use __this_cpu_read in pseudo_lock_fn() Hui Su
2021-07-27 18:56 ` Reinette Chatre
2021-07-30  8:22   ` 回复: " 苏辉(Robert Su)
2021-07-30 14:47     ` Reinette Chatre

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).