LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH] powerpc: Fix WARN_ON in decrementer_check_overflow
Date: Thu, 9 Feb 2012 14:25:02 -0800 (PST)	[thread overview]
Message-ID: <alpine.LSU.2.00.1202091411170.1263@eggly.anvils> (raw)
In-Reply-To: <1328765653.2903.59.camel@pasglop>

On Thu, 9 Feb 2012, Benjamin Herrenschmidt wrote:
> We use __get_cpu_var() which triggers a false positive warning
> in smp_processor_id() thinking interrupts are enabled (at this
> point, they are soft-enabled but hard-disabled).
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> 
> I was initially planning to fix that with a more in-depth rework
> of how we do lazy irq disabling on powerpc, but that patch is
> becoming too complex for this release so I'll apply this as a
> stop-gap and leave the full rework for -next

Okay, thanks for the update, that's equivalent to the get_cpu_var
plus put_cpu_var patch I had generally been running with successfully.

(I was not at all confident that it was a sufficient fix, and have
to say "generally" above because one time I got something that looked
like recursive calls overflowing the stack, and IIRC something "irq"
did appear in each frame of the trace.  But probably no connection,
never seen again, and I don't recall even which -rc or -next it was.)

Hugh

>  
> diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
> index 701d4ac..01e2877 100644
> --- a/arch/powerpc/kernel/irq.c
> +++ b/arch/powerpc/kernel/irq.c
> @@ -118,10 +118,14 @@ static inline notrace void set_soft_enabled(unsigned long enable)
>  static inline notrace void decrementer_check_overflow(void)
>  {
>  	u64 now = get_tb_or_rtc();
> -	u64 *next_tb = &__get_cpu_var(decrementers_next_tb);
> +	u64 *next_tb;
> +
> +	preempt_disable();
> +	next_tb = &__get_cpu_var(decrementers_next_tb);
>  
>  	if (now >= *next_tb)
>  		set_dec(1);
> +	preempt_enable();
>  }
>  
>  notrace void arch_local_irq_restore(unsigned long en)

  reply	other threads:[~2012-02-09 22:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-09  5:34 [PATCH] powerpc: Fix WARN_ON in decrementer_check_overflow Benjamin Herrenschmidt
2012-02-09 22:25 ` Hugh Dickins [this message]
2012-02-09 22:45   ` Benjamin Herrenschmidt

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=alpine.LSU.2.00.1202091411170.1263@eggly.anvils \
    --to=hughd@google.com \
    --cc=benh@kernel.crashing.org \
    --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