From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Deegan Subject: Re: [PATCH 1 of 6] x86/mm: Print stack trace on a an mm-locks deadlock panic Date: Wed, 18 Apr 2012 16:55:24 +0100 Message-ID: <20120418155524.GO7013@ocelot.phlegethon.org> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="LpQ9ahxlCli8rRTG" Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andres Lagar-Cavilla Cc: andres@gridcentric.ca, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org --LpQ9ahxlCli8rRTG Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline At 12:22 -0400 on 13 Apr (1334319739), Andres Lagar-Cavilla wrote: > xen/arch/x86/mm/mm-locks.h | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > > > Signed-off-by: Andres Lagar-Cavilla Good idea, but 'WARN(); panic();' is a bit ugly. How about the attached two patches instead? The second one fixes what I think must be a typo, unless I'm forgetting something subtle. Tim. --LpQ9ahxlCli8rRTG Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: attachment; filename=backtrace # HG changeset patch # User Tim Deegan # Date 1334763793 -3600 # Node ID 33978b6482d058887c00454aff078476cef4155d # Parent 7c777cb8f705411b77c551f34ba88bdc09e38ab8 x86/mm: BUG() rather than panic() on mm lock order violations That gives us a backtrace showing where the bad lock happens. Reported-by: Andres Lagar-Cavilla Signed-off-by: Tim Deegan diff -r 7c777cb8f705 xen/arch/x86/mm/mm-locks.h --- a/xen/arch/x86/mm/mm-locks.h Wed Apr 18 16:49:55 2012 +0100 +++ b/xen/arch/x86/mm/mm-locks.h Wed Apr 18 16:50:45 2012 +0100 @@ -50,8 +50,11 @@ static inline int mm_locked_by_me(mm_loc #define __check_lock_level(l) \ do { \ if ( unlikely(__get_lock_level()) > (l) ) \ - panic("mm locking order violation: %i > %i\n", \ - __get_lock_level(), (l)); \ + { \ + printk("mm locking order violation: %i > %i\n", \ + __get_lock_level(), (l)); \ + BUG(); \ + } \ } while(0) #define __set_lock_level(l) \ --LpQ9ahxlCli8rRTG Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: attachment; filename=parens # HG changeset patch # Parent 87eb032bda77ade8cd75b530a97ea50170becb0b x86/mm: fix parens in mm lock level check Signed-off-by: Tim Deegan diff -r 87eb032bda77 xen/arch/x86/mm/mm-locks.h --- a/xen/arch/x86/mm/mm-locks.h Wed Apr 18 16:43:13 2012 +0100 +++ b/xen/arch/x86/mm/mm-locks.h Wed Apr 18 16:50:49 2012 +0100 @@ -49,7 +49,7 @@ static inline int mm_locked_by_me(mm_loc * where the offending locks are declared. */ #define __check_lock_level(l) \ do { \ - if ( unlikely(__get_lock_level()) > (l) ) \ + if ( unlikely(__get_lock_level() > (l)) ) \ { \ printk("mm locking order violation: %i > %i\n", \ __get_lock_level(), (l)); \ --LpQ9ahxlCli8rRTG Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --LpQ9ahxlCli8rRTG--