From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> To: Peter Zijlstra <peterz@infradead.org>, "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>, Boqun Feng <boqun.feng@gmail.com> Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>, Andy Lutomirski <luto@amacapital.net>, Dave Watson <davejwatson@fb.com>, Paul Turner <pjt@google.com>, Andrew Morton <akpm@linux-foundation.org>, Russell King <linux@arm.linux.org.uk>, Ingo Molnar <mingo@redhat.com>, "H . Peter Anvin" <hpa@zytor.com>, Andi Kleen <andi@firstfloor.org>, Chris Lameter <cl@linux.com>, Ben Maurer <bmaurer@fb.com>, Steven Rostedt <rostedt@goodmis.org>, Josh Triplett <josh@joshtriplett.org>, Linus Torvalds <torvalds@linux-foundation.org>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will.deacon@arm.com>, Michael Kerrisk <mtk.manpages@gmail.com>, Joel Fernandes <joelaf@google.com>, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>, Sergey Senozhatsky <sergey.senozhatsky@gmail.com>, Matthew Wilcox <mawilcox@microsoft.com> Subject: [RFC PATCH for 4.21 03/16] mm: Replace BUG_ON() by WARN_ON() in vm_unmap_ram() Date: Thu, 1 Nov 2018 10:58:31 +0100 [thread overview] Message-ID: <20181101095844.24462-4-mathieu.desnoyers@efficios.com> (raw) In-Reply-To: <20181101095844.24462-1-mathieu.desnoyers@efficios.com> It is encouraged to warn and return rather than use BUG_ON() when the condition can be recovered from in ways that are more graceful than halting the whole system. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Suggested-by: Steven Rostedt <rostedt@goodmis.org> CC: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> CC: Matthew Wilcox <mawilcox@microsoft.com> CC: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> CC: Peter Zijlstra <peterz@infradead.org> CC: Paul Turner <pjt@google.com> CC: Thomas Gleixner <tglx@linutronix.de> CC: Andy Lutomirski <luto@amacapital.net> CC: Andi Kleen <andi@firstfloor.org> CC: Dave Watson <davejwatson@fb.com> CC: Chris Lameter <cl@linux.com> CC: Ingo Molnar <mingo@redhat.com> CC: "H. Peter Anvin" <hpa@zytor.com> CC: Ben Maurer <bmaurer@fb.com> CC: Steven Rostedt <rostedt@goodmis.org> CC: Josh Triplett <josh@joshtriplett.org> CC: Linus Torvalds <torvalds@linux-foundation.org> CC: Andrew Morton <akpm@linux-foundation.org> CC: Russell King <linux@arm.linux.org.uk> CC: Catalin Marinas <catalin.marinas@arm.com> CC: Will Deacon <will.deacon@arm.com> CC: Michael Kerrisk <mtk.manpages@gmail.com> CC: Boqun Feng <boqun.feng@gmail.com> --- mm/vmalloc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index a728fc492557..a236bac872f0 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1123,10 +1123,11 @@ void vm_unmap_ram(const void *mem, unsigned int count) struct vmap_area *va; might_sleep(); - BUG_ON(!addr); - BUG_ON(addr < VMALLOC_START); - BUG_ON(addr > VMALLOC_END); - BUG_ON(!PAGE_ALIGNED(addr)); + if (WARN_ON(!addr) || + WARN_ON(addr < VMALLOC_START) || + WARN_ON(addr > VMALLOC_END) || + WARN_ON(!PAGE_ALIGNED(addr))) + return; if (likely(count <= VMAP_MAX_ALLOC)) { debug_check_no_locks_freed(mem, size); @@ -1135,7 +1136,8 @@ void vm_unmap_ram(const void *mem, unsigned int count) } va = find_vmap_area(addr); - BUG_ON(!va); + if (WARN_ON(!va)) + return; debug_check_no_locks_freed((void *)va->va_start, (va->va_end - va->va_start)); free_unmap_vmap_area(va); -- 2.11.0
WARNING: multiple messages have this Message-ID (diff)
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> To: Peter Zijlstra <peterz@infradead.org>, "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>, Boqun Feng <boqun.feng@gmail.com> Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>, Andy Lutomirski <luto@amacapital.net>, Dave Watson <davejwatson@fb.com>, Paul Turner <pjt@google.com>, Andrew Morton <akpm@linux-foundation.org>, Russell King <linux@arm.linux.org.uk>, Ingo Molnar <mingo@redhat.com>, "H . Peter Anvin" <hpa@zytor.com>, Andi Kleen <andi@firstfloor.org>, Chris Lameter <cl@linux.com>, Ben Maurer <bmaurer@fb.com>, Steven Rostedt <rostedt@goodmis.org>, Josh Triplett <josh@joshtriplett.org>, Linus Torvalds <torvalds@linux-foundation.org>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will.deacon@arm.com>, Michael Kerrisk <mtk.manpages@gmail.com>, Joel Fernandes <joelaf@google.com>, Mathieu Desnoyers <mathieu.desnoyers@ef> Subject: [RFC PATCH for 4.21 03/16] mm: Replace BUG_ON() by WARN_ON() in vm_unmap_ram() Date: Thu, 1 Nov 2018 10:58:31 +0100 [thread overview] Message-ID: <20181101095844.24462-4-mathieu.desnoyers@efficios.com> (raw) In-Reply-To: <20181101095844.24462-1-mathieu.desnoyers@efficios.com> It is encouraged to warn and return rather than use BUG_ON() when the condition can be recovered from in ways that are more graceful than halting the whole system. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Suggested-by: Steven Rostedt <rostedt@goodmis.org> CC: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> CC: Matthew Wilcox <mawilcox@microsoft.com> CC: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> CC: Peter Zijlstra <peterz@infradead.org> CC: Paul Turner <pjt@google.com> CC: Thomas Gleixner <tglx@linutronix.de> CC: Andy Lutomirski <luto@amacapital.net> CC: Andi Kleen <andi@firstfloor.org> CC: Dave Watson <davejwatson@fb.com> CC: Chris Lameter <cl@linux.com> CC: Ingo Molnar <mingo@redhat.com> CC: "H. Peter Anvin" <hpa@zytor.com> CC: Ben Maurer <bmaurer@fb.com> CC: Steven Rostedt <rostedt@goodmis.org> CC: Josh Triplett <josh@joshtriplett.org> CC: Linus Torvalds <torvalds@linux-foundation.org> CC: Andrew Morton <akpm@linux-foundation.org> CC: Russell King <linux@arm.linux.org.uk> CC: Catalin Marinas <catalin.marinas@arm.com> CC: Will Deacon <will.deacon@arm.com> CC: Michael Kerrisk <mtk.manpages@gmail.com> CC: Boqun Feng <boqun.feng@gmail.com> --- mm/vmalloc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index a728fc492557..a236bac872f0 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1123,10 +1123,11 @@ void vm_unmap_ram(const void *mem, unsigned int count) struct vmap_area *va; might_sleep(); - BUG_ON(!addr); - BUG_ON(addr < VMALLOC_START); - BUG_ON(addr > VMALLOC_END); - BUG_ON(!PAGE_ALIGNED(addr)); + if (WARN_ON(!addr) || + WARN_ON(addr < VMALLOC_START) || + WARN_ON(addr > VMALLOC_END) || + WARN_ON(!PAGE_ALIGNED(addr))) + return; if (likely(count <= VMAP_MAX_ALLOC)) { debug_check_no_locks_freed(mem, size); @@ -1135,7 +1136,8 @@ void vm_unmap_ram(const void *mem, unsigned int count) } va = find_vmap_area(addr); - BUG_ON(!va); + if (WARN_ON(!va)) + return; debug_check_no_locks_freed((void *)va->va_start, (va->va_end - va->va_start)); free_unmap_vmap_area(va); -- 2.11.0
next prev parent reply other threads:[~2018-11-01 9:59 UTC|newest] Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-11-01 9:58 [RFC PATCH for 4.21 00/16] rseq updates, new cpu_opv system call (v2) Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` [RFC PATCH for 4.21 01/16] rseq/selftests: Expose reference counter to coexist with glibc (v2) Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` [RFC PATCH for 4.21 02/16] rseq/selftests: Adapt number of threads to the number of detected cpus Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` mathieu.desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers [this message] 2018-11-01 9:58 ` [RFC PATCH for 4.21 03/16] mm: Replace BUG_ON() by WARN_ON() in vm_unmap_ram() Mathieu Desnoyers 2018-11-01 12:21 ` Thomas Gleixner 2018-11-01 12:21 ` Thomas Gleixner 2018-11-01 18:46 ` Steven Rostedt 2018-11-01 18:46 ` Steven Rostedt 2018-11-01 19:57 ` Mathieu Desnoyers 2018-11-01 19:57 ` Mathieu Desnoyers 2018-11-01 22:00 ` Linus Torvalds 2018-11-01 22:17 ` Mathieu Desnoyers 2018-11-01 22:17 ` Mathieu Desnoyers 2018-11-01 9:58 ` [RFC PATCH for 4.21 04/16] mm: Introduce vm_map_user_ram, vm_unmap_user_ram (v2) Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` [RFC PATCH for 4.21 05/16] mm: Provide is_vma_noncached Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` [RFC PATCH for 4.21 06/16] cpu_opv: Provide cpu_opv system call (v9) Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` [RFC PATCH for 4.21 07/16] cpu_opv: limit amount of virtual address space used by cpu_opv Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` [RFC PATCH for 4.21 08/16] x86: Wire up cpu_opv system call Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` [RFC PATCH for 4.21 09/16] powerpc: " Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` [RFC PATCH for 4.21 10/16] arm: " Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` [RFC PATCH for 4.21 11/16] cpu-opv/selftests: Provide cpu-op library Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` mathieu.desnoyers 2018-11-01 9:58 ` [RFC PATCH for 4.21 12/16] cpu-opv/selftests: Provide basic test Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` mathieu.desnoyers 2018-11-01 9:58 ` [RFC PATCH for 4.21 13/16] cpu-opv/selftests: Provide percpu_op API Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` mathieu.desnoyers 2018-11-01 9:58 ` [RFC PATCH for 4.21 14/16] cpu-opv/selftests: Provide basic percpu ops test Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` mathieu.desnoyers 2018-11-01 9:58 ` [RFC PATCH for 4.21 15/16] cpu-opv/selftests: Provide parametrized tests Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` mathieu.desnoyers 2018-11-01 9:58 ` [RFC PATCH for 4.21 16/16] cpu-opv/selftests: Provide Makefile, scripts, gitignore Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` Mathieu Desnoyers 2018-11-01 9:58 ` mathieu.desnoyers 2018-11-01 15:33 ` [RFC PATCH for 4.21 00/16] rseq updates, new cpu_opv system call (v2) Linus Torvalds
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=20181101095844.24462-4-mathieu.desnoyers@efficios.com \ --to=mathieu.desnoyers@efficios.com \ --cc=akpm@linux-foundation.org \ --cc=andi@firstfloor.org \ --cc=bmaurer@fb.com \ --cc=boqun.feng@gmail.com \ --cc=catalin.marinas@arm.com \ --cc=cl@linux.com \ --cc=davejwatson@fb.com \ --cc=hpa@zytor.com \ --cc=joelaf@google.com \ --cc=josh@joshtriplett.org \ --cc=linux-api@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux@arm.linux.org.uk \ --cc=luto@amacapital.net \ --cc=mawilcox@microsoft.com \ --cc=mingo@redhat.com \ --cc=mtk.manpages@gmail.com \ --cc=paulmck@linux.vnet.ibm.com \ --cc=peterz@infradead.org \ --cc=pjt@google.com \ --cc=rostedt@goodmis.org \ --cc=sergey.senozhatsky@gmail.com \ --cc=tglx@linutronix.de \ --cc=torvalds@linux-foundation.org \ --cc=will.deacon@arm.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.