From patchwork Mon May 6 23:50:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Cross X-Patchwork-Id: 2529111 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id D488F3FD85 for ; Mon, 6 May 2013 23:55:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758272Ab3EFXzk (ORCPT ); Mon, 6 May 2013 19:55:40 -0400 Received: from mail-gg0-f201.google.com ([209.85.161.201]:56711 "EHLO mail-gg0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932364Ab3EFXu3 (ORCPT ); Mon, 6 May 2013 19:50:29 -0400 Received: by mail-gg0-f201.google.com with SMTP id k25so425004ggl.4 for ; Mon, 06 May 2013 16:50:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=ppVx5TWKC6zmohGRdhNEh4PK+FxsDG+2qtn5wNFj534=; b=po2Lhq/qR7rdbaQjSOa2Xplpn/AJGro8yDIOJ/Fo42OLdncJBJ6LjPFQcX2BJ1GaY7 AkDWa8Jx63KHXtK3bVNOZXjZ2CVQqvmhq2vVyXgrA+Lu6TcjDpPrGEMDgIVV18zfMf4y 6Merb17PFP9/NfYbR+SR02XRW2ql2IdWzdhT6+/5hkbMe5/sv4RDSItMCpmUOcvkOyKh vCL8eS7nXJ7xadKIEJRmcDSqxwOTyUK9Xs3X4Re+WRhvbPlxDlNecb5B6XSmxioOSIo5 ArqQeMnA5QMCUSiX/DNKf88zEHzJemMZ8EQCP38gLbq7/hlw+tQPBa1S2pB1QAqvsRMP gJyA== X-Received: by 10.236.70.170 with SMTP id p30mr18121345yhd.5.1367884227398; Mon, 06 May 2013 16:50:27 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id h2si1210474yhj.2.2013.05.06.16.50.27 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Mon, 06 May 2013 16:50:27 -0700 (PDT) Received: from walnut.mtv.corp.google.com (walnut.mtv.corp.google.com [172.18.105.48]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 22B465A4005; Mon, 6 May 2013 16:50:27 -0700 (PDT) Received: by walnut.mtv.corp.google.com (Postfix, from userid 99897) id D5C5C16078C; Mon, 6 May 2013 16:50:26 -0700 (PDT) From: Colin Cross To: linux-kernel@vger.kernel.org Cc: Pavel Machek , "Rafael J. Wysocki" , Peter Zijlstra , Ingo Molnar , Andrew Morton , Mandeep Singh Baines , Colin Cross , Oleg Nesterov , linux-nfs@vger.kernel.org, linux-pm@vger.kernel.org, netdev@vger.kernel.org, Linus Torvalds , Tejun Heo , Paul Walmsley , Al Viro , "Eric W. Biederman" , David Howells Subject: [PATCH v3 03/16] lockdep: remove task argument from debug_check_no_locks_held Date: Mon, 6 May 2013 16:50:08 -0700 Message-Id: <1367884221-20462-4-git-send-email-ccross@android.com> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1367884221-20462-1-git-send-email-ccross@android.com> References: <1367884221-20462-1-git-send-email-ccross@android.com> X-Gm-Message-State: ALoCoQmOhevAcFrGCexc0oTF8pxFSwZpiIj2TV3HjYs6dowwTXupTweOtEgUxROD6XwBx3qwj8ozkAkX4Ll6jn0poEBMXw9BCcaNENCpsFoL4fUHTSdj04yC6iw+s32Rf49SFLq8i0AfoigNSJ0CswGhtHx+50FxxHL8x9EsVxCqDHsKcCrZVebX/Zb42VLG/KiQ6+RWqU2e Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The only existing caller to debug_check_no_locks_held calls it with 'current' as the task, and the freezer needs to call debug_check_no_locks_held but doesn't already have a current task pointer, so remove the argument. It is already assuming that the current task is relevant by dumping the current stack trace as part of the warning. This was originally part of 6aa9707099c (lockdep: check that no locks held at freeze time) which was reverted in dbf520a9d7d4. Original-author: Mandeep Singh Baines Signed-off-by: Colin Cross Acked-by: Pavel Machek --- include/linux/debug_locks.h | 4 ++-- kernel/exit.c | 2 +- kernel/lockdep.c | 17 ++++++++--------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h index 3bd46f7..a975de1 100644 --- a/include/linux/debug_locks.h +++ b/include/linux/debug_locks.h @@ -51,7 +51,7 @@ struct task_struct; extern void debug_show_all_locks(void); extern void debug_show_held_locks(struct task_struct *task); extern void debug_check_no_locks_freed(const void *from, unsigned long len); -extern void debug_check_no_locks_held(struct task_struct *task); +extern void debug_check_no_locks_held(void); #else static inline void debug_show_all_locks(void) { @@ -67,7 +67,7 @@ debug_check_no_locks_freed(const void *from, unsigned long len) } static inline void -debug_check_no_locks_held(struct task_struct *task) +debug_check_no_locks_held(void) { } #endif diff --git a/kernel/exit.c b/kernel/exit.c index 60bc027..51e485c 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -835,7 +835,7 @@ void do_exit(long code) /* * Make sure we are holding no locks: */ - debug_check_no_locks_held(tsk); + debug_check_no_locks_held(); /* * We can do this unlocked here. The futex code uses this flag * just to verify whether the pi state cleanup has been done diff --git a/kernel/lockdep.c b/kernel/lockdep.c index 8a0efac..259db20 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c @@ -4088,7 +4088,7 @@ void debug_check_no_locks_freed(const void *mem_from, unsigned long mem_len) } EXPORT_SYMBOL_GPL(debug_check_no_locks_freed); -static void print_held_locks_bug(struct task_struct *curr) +static void print_held_locks_bug(void) { if (!debug_locks_off()) return; @@ -4097,22 +4097,21 @@ static void print_held_locks_bug(struct task_struct *curr) printk("\n"); printk("=====================================\n"); - printk("[ BUG: lock held at task exit time! ]\n"); + printk("[ BUG: %s/%d still has locks held! ]\n", + current->comm, task_pid_nr(current)); print_kernel_ident(); printk("-------------------------------------\n"); - printk("%s/%d is exiting with locks still held!\n", - curr->comm, task_pid_nr(curr)); - lockdep_print_held_locks(curr); - + lockdep_print_held_locks(current); printk("\nstack backtrace:\n"); dump_stack(); } -void debug_check_no_locks_held(struct task_struct *task) +void debug_check_no_locks_held(void) { - if (unlikely(task->lockdep_depth > 0)) - print_held_locks_bug(task); + if (unlikely(current->lockdep_depth > 0)) + print_held_locks_bug(); } +EXPORT_SYMBOL_GPL(debug_check_no_locks_held); void debug_show_all_locks(void) {