linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: Christophe Leroy <christophe.leroy@c-s.fr>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/pseries: avoid harmless preempt warning
Date: Sat, 21 Mar 2020 16:34:39 +1000	[thread overview]
Message-ID: <1584772445.f09ly1zhoy.astroid@bobo.none> (raw)
In-Reply-To: <6b34ba18-de6b-15c5-1611-fb5c92e065f9@c-s.fr>

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

  reply	other threads:[~2020-03-21  6:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-03-26 12:06 ` Michael Ellerman

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=1584772445.f09ly1zhoy.astroid@bobo.none \
    --to=npiggin@gmail.com \
    --cc=christophe.leroy@c-s.fr \
    --cc=linuxppc-dev@lists.ozlabs.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;
as well as URLs for NNTP newsgroup(s).