linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/pseries: avoid harmless preempt warning
@ 2020-03-20 15:24 Nicholas Piggin
  2020-03-20 15:33 ` Christophe Leroy
  2020-03-26 12:06 ` Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: Nicholas Piggin @ 2020-03-20 15:24 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/platforms/pseries/lpar.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 3c3da25b445c..e4ed5317f117 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -636,8 +636,16 @@ static const struct proc_ops vcpudispatch_stats_freq_proc_ops = {
 
 static int __init vcpudispatch_stats_procfs_init(void)
 {
-	if (!lppaca_shared_proc(get_lppaca()))
+	/*
+	 * Avoid smp_processor_id while preemptible. All CPUs should have
+	 * the same value for lppaca_shared_proc.
+	 */
+	preempt_disable();
+	if (!lppaca_shared_proc(get_lppaca())) {
+		preempt_enable();
 		return 0;
+	}
+	preempt_enable();
 
 	if (!proc_create("powerpc/vcpudispatch_stats", 0600, NULL,
 					&vcpudispatch_stats_proc_ops))
-- 
2.23.0


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

* Re: [PATCH] powerpc/pseries: avoid harmless preempt warning
  2020-03-20 15:24 [PATCH] powerpc/pseries: avoid harmless preempt warning Nicholas Piggin
@ 2020-03-20 15:33 ` Christophe Leroy
  2020-03-21  6:34   ` Nicholas Piggin
  2020-03-26 12:06 ` Michael Ellerman
  1 sibling, 1 reply; 4+ messages in thread
From: Christophe Leroy @ 2020-03-20 15:33 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev



Le 20/03/2020 à 16:24, Nicholas Piggin a écrit :
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>   arch/powerpc/platforms/pseries/lpar.c | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
> index 3c3da25b445c..e4ed5317f117 100644
> --- a/arch/powerpc/platforms/pseries/lpar.c
> +++ b/arch/powerpc/platforms/pseries/lpar.c
> @@ -636,8 +636,16 @@ static const struct proc_ops vcpudispatch_stats_freq_proc_ops = {
>   
>   static int __init vcpudispatch_stats_procfs_init(void)
>   {
> -	if (!lppaca_shared_proc(get_lppaca()))
> +	/*
> +	 * Avoid smp_processor_id while preemptible. All CPUs should have
> +	 * the same value for lppaca_shared_proc.
> +	 */
> +	preempt_disable();
> +	if (!lppaca_shared_proc(get_lppaca())) {
> +		preempt_enable();
>   		return 0;
> +	}
> +	preempt_enable();

Can we avoid the double preempt_enable() with something like:

	preempt_disable();
	is_shared = lppaca_shared_proc(get_lppaca());
	preempt_enable();
	if (!is_shared)
		return 0;


>   
>   	if (!proc_create("powerpc/vcpudispatch_stats", 0600, NULL,
>   					&vcpudispatch_stats_proc_ops))
> 

Christophe

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

* Re: [PATCH] powerpc/pseries: avoid harmless preempt warning
  2020-03-20 15:33 ` Christophe Leroy
@ 2020-03-21  6:34   ` Nicholas Piggin
  0 siblings, 0 replies; 4+ messages in thread
From: Nicholas Piggin @ 2020-03-21  6:34 UTC (permalink / raw)
  To: Christophe Leroy, linuxppc-dev

Christophe Leroy's on March 21, 2020 1:33 am:
> 
> 
> Le 20/03/2020 à 16:24, Nicholas Piggin a écrit :
>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>> ---
>>   arch/powerpc/platforms/pseries/lpar.c | 10 +++++++++-
>>   1 file changed, 9 insertions(+), 1 deletion(-)
>> 
>> diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
>> index 3c3da25b445c..e4ed5317f117 100644
>> --- a/arch/powerpc/platforms/pseries/lpar.c
>> +++ b/arch/powerpc/platforms/pseries/lpar.c
>> @@ -636,8 +636,16 @@ static const struct proc_ops vcpudispatch_stats_freq_proc_ops = {
>>   
>>   static int __init vcpudispatch_stats_procfs_init(void)
>>   {
>> -	if (!lppaca_shared_proc(get_lppaca()))
>> +	/*
>> +	 * Avoid smp_processor_id while preemptible. All CPUs should have
>> +	 * the same value for lppaca_shared_proc.
>> +	 */
>> +	preempt_disable();
>> +	if (!lppaca_shared_proc(get_lppaca())) {
>> +		preempt_enable();
>>   		return 0;
>> +	}
>> +	preempt_enable();
> 
> Can we avoid the double preempt_enable() with something like:
> 
> 	preempt_disable();
> 	is_shared = lppaca_shared_proc(get_lppaca());
> 	preempt_enable();
> 	if (!is_shared)
> 		return 0;

I don't mind too much. Same number of lines.

Thanks,
Nick

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

* Re: [PATCH] powerpc/pseries: avoid harmless preempt warning
  2020-03-20 15:24 [PATCH] powerpc/pseries: avoid harmless preempt warning Nicholas Piggin
  2020-03-20 15:33 ` Christophe Leroy
@ 2020-03-26 12:06 ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2020-03-26 12:06 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev; +Cc: Nicholas Piggin

On Fri, 2020-03-20 at 15:24:36 UTC, Nicholas Piggin wrote:
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/adde8715cf0571878d37fcb20595aad57b923bab

cheers

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

end of thread, other threads:[~2020-03-26 13:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20 15:24 [PATCH] powerpc/pseries: avoid harmless preempt warning Nicholas Piggin
2020-03-20 15:33 ` Christophe Leroy
2020-03-21  6:34   ` Nicholas Piggin
2020-03-26 12:06 ` Michael Ellerman

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