linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mm/debug: Add VM_WARN which maps to WARN()
@ 2016-05-31 11:04 Aneesh Kumar K.V
  2016-05-31 11:04 ` [PATCH 2/2] powerpc/mm: check for irq disabled() only if DEBUG_VM is enabled Aneesh Kumar K.V
  2016-06-07  6:52 ` [PATCH 1/2] mm/debug: Add VM_WARN which maps to WARN() Anshuman Khandual
  0 siblings, 2 replies; 5+ messages in thread
From: Aneesh Kumar K.V @ 2016-05-31 11:04 UTC (permalink / raw)
  To: akpm, mpe; +Cc: linux-mm, linux-kernel, Aneesh Kumar K.V

This enables us to do VM_WARN(condition, "warn message");
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 include/linux/mmdebug.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index de7be78c6f0e..451a811f48f2 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -39,6 +39,7 @@ void dump_mm(const struct mm_struct *mm);
 #define VM_WARN_ON(cond) WARN_ON(cond)
 #define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond)
 #define VM_WARN_ONCE(cond, format...) WARN_ONCE(cond, format)
+#define VM_WARN(cond, format...) WARN(cond, format)
 #else
 #define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond)
 #define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond)
@@ -47,6 +48,7 @@ void dump_mm(const struct mm_struct *mm);
 #define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond)
 #define VM_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond)
 #define VM_WARN_ONCE(cond, format...) BUILD_BUG_ON_INVALID(cond)
+#define VM_WARN(cond, format...) BUILD_BUG_ON_INVALID(cond)
 #endif
 
 #ifdef CONFIG_DEBUG_VIRTUAL
-- 
2.7.4

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

* [PATCH 2/2] powerpc/mm: check for irq disabled() only if DEBUG_VM is enabled.
  2016-05-31 11:04 [PATCH 1/2] mm/debug: Add VM_WARN which maps to WARN() Aneesh Kumar K.V
@ 2016-05-31 11:04 ` Aneesh Kumar K.V
  2016-06-07  6:54   ` Anshuman Khandual
  2016-06-07  8:36   ` Balbir Singh
  2016-06-07  6:52 ` [PATCH 1/2] mm/debug: Add VM_WARN which maps to WARN() Anshuman Khandual
  1 sibling, 2 replies; 5+ messages in thread
From: Aneesh Kumar K.V @ 2016-05-31 11:04 UTC (permalink / raw)
  To: akpm, mpe; +Cc: linux-mm, linux-kernel, Aneesh Kumar K.V

We don't need to check this always. The idea here is to capture the
wrong usage of find_linux_pte_or_hugepte and we can do that by
occasionally running with DEBUG_VM enabled.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 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..9bd87f269d6d 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(!arch_irqs_disabled(),
+		"%s called with irq enabled\n", __func__);
 	return __find_linux_pte_or_hugepte(pgdir, ea, is_thp, shift);
 }
 
-- 
2.7.4

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

* Re: [PATCH 1/2] mm/debug: Add VM_WARN which maps to WARN()
  2016-05-31 11:04 [PATCH 1/2] mm/debug: Add VM_WARN which maps to WARN() Aneesh Kumar K.V
  2016-05-31 11:04 ` [PATCH 2/2] powerpc/mm: check for irq disabled() only if DEBUG_VM is enabled Aneesh Kumar K.V
@ 2016-06-07  6:52 ` Anshuman Khandual
  1 sibling, 0 replies; 5+ messages in thread
From: Anshuman Khandual @ 2016-06-07  6:52 UTC (permalink / raw)
  To: Aneesh Kumar K.V, akpm, mpe; +Cc: linux-mm, linux-kernel

On 05/31/2016 04:34 PM, Aneesh Kumar K.V wrote:
> This enables us to do VM_WARN(condition, "warn message");
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

Reviewed-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>

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

* Re: [PATCH 2/2] powerpc/mm: check for irq disabled() only if DEBUG_VM is enabled.
  2016-05-31 11:04 ` [PATCH 2/2] powerpc/mm: check for irq disabled() only if DEBUG_VM is enabled Aneesh Kumar K.V
@ 2016-06-07  6:54   ` Anshuman Khandual
  2016-06-07  8:36   ` Balbir Singh
  1 sibling, 0 replies; 5+ messages in thread
From: Anshuman Khandual @ 2016-06-07  6:54 UTC (permalink / raw)
  To: Aneesh Kumar K.V, akpm, mpe; +Cc: linux-mm, linux-kernel

On 05/31/2016 04:34 PM, Aneesh Kumar K.V wrote:
> We don't need to check this always. The idea here is to capture the
> wrong usage of find_linux_pte_or_hugepte and we can do that by
> occasionally running with DEBUG_VM enabled.
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

Reviewed-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>

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

* Re: [PATCH 2/2] powerpc/mm: check for irq disabled() only if DEBUG_VM is enabled.
  2016-05-31 11:04 ` [PATCH 2/2] powerpc/mm: check for irq disabled() only if DEBUG_VM is enabled Aneesh Kumar K.V
  2016-06-07  6:54   ` Anshuman Khandual
@ 2016-06-07  8:36   ` Balbir Singh
  1 sibling, 0 replies; 5+ messages in thread
From: Balbir Singh @ 2016-06-07  8:36 UTC (permalink / raw)
  To: Aneesh Kumar K.V, akpm, mpe; +Cc: linux-mm, linux-kernel



On 31/05/16 21:04, Aneesh Kumar K.V wrote:
> We don't need to check this always. The idea here is to capture the
> wrong usage of find_linux_pte_or_hugepte and we can do that by
> occasionally running with DEBUG_VM enabled.
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
>  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..9bd87f269d6d 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(!arch_irqs_disabled(),
> +		"%s called with irq enabled\n", __func__);
>  	return __find_linux_pte_or_hugepte(pgdir, ea, is_thp, shift);
>  }

Agreed! Honestly, I think it should be a VM_BUG_ON() since we have a large reliance
on this elsewhere in the code.

Balbir Singh.

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

end of thread, other threads:[~2016-06-07  8:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-31 11:04 [PATCH 1/2] mm/debug: Add VM_WARN which maps to WARN() Aneesh Kumar K.V
2016-05-31 11:04 ` [PATCH 2/2] powerpc/mm: check for irq disabled() only if DEBUG_VM is enabled Aneesh Kumar K.V
2016-06-07  6:54   ` Anshuman Khandual
2016-06-07  8:36   ` Balbir Singh
2016-06-07  6:52 ` [PATCH 1/2] mm/debug: Add VM_WARN which maps to WARN() Anshuman Khandual

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