mm/debug: Add VM_WARN which maps to WARN()
Subsystems (3)
PATCH 1/2 mm/debug: Add VM_WARN which maps to WARN()
This enables us to do VM_WARN(condition, "warn message");
--- include/linux/mmdebug.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/mmdebug.h +2 -0
@@ -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
Signature · 7 lines
2.7.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 2/2 powerpc/mm: check for irq disabled() only if DEBUG_VM is enabled.
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.
--- arch/powerpc/include/asm/pgtable.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/pgtable.h +2 -4
@@ -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); }
Signature · 7 lines
2.7.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/2] powerpc/mm: check for irq disabled() only if DEBUG_VM is enabled.
Quoted 5 lines · 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_hugepteand we can do that by occasionally running withDEBUG_VMenabled.Signed-off-by Aneesh Kumar K.V <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/2] powerpc/mm: check for irq disabled() only if DEBUG_VM is enabled.
In reply to Aneesh Kumar K.VQuoted 15 lines · 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_hugepteand we can do that by occasionally running withDEBUG_VMenabled.Signed-off-by Aneesh Kumar K.V <[email protected]>--- arch/powerpc/include/asm/pgtable.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)arch/powerpc/include/asm/pgtable.h +0
-0@@ -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,
arch/powerpc/include/asm/pgtable.h pte_t *__find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, · line 77
Quoted 10 lines
arch/powerpc/include/asm/pgtable.h +2
-4bool *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.
Quoted 2 lines · Aneesh Kumar K.V
This enables us to do
VM_WARN(condition, "warn message");Signed-off-by Aneesh Kumar K.V <[email protected]>