All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/mm: Use VM_WARN_ONCE() for irqs disabled check
@ 2016-06-28  6:38 Michael Ellerman
  2016-06-28 10:45 ` Aneesh Kumar K.V
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Ellerman @ 2016-06-28  6:38 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Anton Blanchard, aneesh.kumar

The check for !arch_irqs_disabled() in find_linux_pte_or_hugepte() is a
debugging aid, and needn't be enabled for production builds.

Switch it to a VM_WARN_ONCE(), which is compiled out when
CONFIG_DEBUG_VM=n.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/include/asm/pgtable.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index ee09e99097f0..651848039dc4 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -71,10 +71,8 @@ pte_t *__find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
 static inline pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
 					       bool *is_thp, unsigned *shift)
 {
-	if (!arch_irqs_disabled()) {
-		pr_info("%s called with irq enabled\n", __func__);
-		dump_stack();
-	}
+	VM_WARN_ONCE(!arch_irqs_disabled(),
+		     "find_linux_pte_or_hugepte() called with irqs enabled!\n");
 	return __find_linux_pte_or_hugepte(pgdir, ea, is_thp, shift);
 }
 
-- 
2.5.0

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

* Re: [PATCH] powerpc/mm: Use VM_WARN_ONCE() for irqs disabled check
  2016-06-28  6:38 [PATCH] powerpc/mm: Use VM_WARN_ONCE() for irqs disabled check Michael Ellerman
@ 2016-06-28 10:45 ` Aneesh Kumar K.V
  2016-06-28 11:13   ` Michael Ellerman
  0 siblings, 1 reply; 3+ messages in thread
From: Aneesh Kumar K.V @ 2016-06-28 10:45 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev; +Cc: Anton Blanchard

Michael Ellerman <mpe@ellerman.id.au> writes:

> The check for !arch_irqs_disabled() in find_linux_pte_or_hugepte() is a
> debugging aid, and needn't be enabled for production builds.
>
> Switch it to a VM_WARN_ONCE(), which is compiled out when
> CONFIG_DEBUG_VM=n.
>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
>  arch/powerpc/include/asm/pgtable.h | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
> index ee09e99097f0..651848039dc4 100644
> --- a/arch/powerpc/include/asm/pgtable.h
> +++ b/arch/powerpc/include/asm/pgtable.h
> @@ -71,10 +71,8 @@ pte_t *__find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
>  static inline pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
>  					       bool *is_thp, unsigned *shift)
>  {
> -	if (!arch_irqs_disabled()) {
> -		pr_info("%s called with irq enabled\n", __func__);
> -		dump_stack();
> -	}
> +	VM_WARN_ONCE(!arch_irqs_disabled(),
> +		     "find_linux_pte_or_hugepte() called with irqs enabled!\n");
>  	return __find_linux_pte_or_hugepte(pgdir, ea, is_thp, shift);
>  }
>


https://lkml.kernel.org/r/574de240.uG8/5OM2Lu9RY6K+%akpm@linux-foundation.orgdd

Isn't this patch already part of -mm. And why ONCE, we want to find
about all the wrong usage.

-aneesh

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

* Re: [PATCH] powerpc/mm: Use VM_WARN_ONCE() for irqs disabled check
  2016-06-28 10:45 ` Aneesh Kumar K.V
@ 2016-06-28 11:13   ` Michael Ellerman
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2016-06-28 11:13 UTC (permalink / raw)
  To: Aneesh Kumar K.V, linuxppc-dev; +Cc: Anton Blanchard

On Tue, 2016-06-28 at 16:15 +0530, Aneesh Kumar K.V wrote:
> Michael Ellerman <mpe@ellerman.id.au> writes:
> > diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
> > index ee09e99097f0..651848039dc4 100644
> > --- a/arch/powerpc/include/asm/pgtable.h
> > +++ b/arch/powerpc/include/asm/pgtable.h
> > @@ -71,10 +71,8 @@ pte_t *__find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
> >  static inline pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
> >  					       bool *is_thp, unsigned *shift)
> >  {
> > -	if (!arch_irqs_disabled()) {
> > -		pr_info("%s called with irq enabled\n", __func__);
> > -		dump_stack();
> > -	}
> > +	VM_WARN_ONCE(!arch_irqs_disabled(),
> > +		     "find_linux_pte_or_hugepte() called with irqs enabled!\n");
> >  	return __find_linux_pte_or_hugepte(pgdir, ea, is_thp, shift);
> >  }
> > 
> 
> https://lkml.kernel.org/r/574de240.uG8/5OM2Lu9RY6K+%akpm@linux-foundation.orgdd
> 
> Isn't this patch already part of -mm.

Ugh, yes. I missed that you'd already sent it.

> And why ONCE, we want to find about all the wrong usage.

Sure, but if you hit it repeatedly in a common path you're likely to kill the
box just with console spam.

But I don't mind. Ignore this version.

cheers

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

end of thread, other threads:[~2016-06-28 11:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-28  6:38 [PATCH] powerpc/mm: Use VM_WARN_ONCE() for irqs disabled check Michael Ellerman
2016-06-28 10:45 ` Aneesh Kumar K.V
2016-06-28 11:13   ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.