{"id":819328,"url":"http://patchwork.ozlabs.org/api/patches/819328/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/patch/20170927214220.41216-5-gvaradar@cisco.com/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170927214220.41216-5-gvaradar@cisco.com>","list_archive_url":null,"date":"2017-09-27T21:42:20","name":"[4/4] lockdep: make MAX_LOCK_DEPTH configurable from Kconfig","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"e9ef2cd981187c000b221e9fd297dcde774053b0","submitter":{"id":46073,"url":"http://patchwork.ozlabs.org/api/people/46073/?format=json","name":"Govindarajulu Varadarajan","email":"gvaradar@cisco.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/20170927214220.41216-5-gvaradar@cisco.com/mbox/","series":[{"id":5455,"url":"http://patchwork.ozlabs.org/api/series/5455/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=5455","date":"2017-09-27T21:42:16","name":"pci aer: fix deadlock in do_recovery","version":1,"mbox":"http://patchwork.ozlabs.org/series/5455/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/819328/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/819328/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linux-pci-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-pci-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=cisco.com header.i=@cisco.com\n\theader.b=\"Rma0nFWG\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y2Wlw3twCz9t67\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 28 Sep 2017 07:53:16 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752011AbdI0Vwe (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tWed, 27 Sep 2017 17:52:34 -0400","from alln-iport-1.cisco.com ([173.37.142.88]:63407 \"EHLO\n\talln-iport-1.cisco.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751905AbdI0Vwb (ORCPT\n\t<rfc822; linux-pci@vger.kernel.org>); Wed, 27 Sep 2017 17:52:31 -0400","from alln-core-6.cisco.com ([173.36.13.139])\n\tby alln-iport-1.cisco.com with ESMTP/TLS/DHE-RSA-AES256-SHA;\n\t27 Sep 2017 21:43:11 +0000","from a6.cisco.com (arch-kvm-vm.cisco.com [10.193.184.6])\n\t(authenticated bits=0)\n\tby alln-core-6.cisco.com (8.14.5/8.14.5) with ESMTP id v8RLgpwi021066\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);\n\tWed, 27 Sep 2017 21:43:11 GMT"],"X-Greylist":"delayed 559 seconds by postgrey-1.27 at vger.kernel.org;\n\tWed, 27 Sep 2017 17:52:31 EDT","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n\td=cisco.com; i=@cisco.com; l=4444; q=dns/txt; s=iport;\n\tt=1506549151; x=1507758751;\n\th=from:to:cc:subject:date:message-id:in-reply-to: references;\n\tbh=tfVY4rUOCeyl75po42v2wD8IzGefw0uQs+LVG9LAy6w=;\n\tb=Rma0nFWGcKXq6ixQTwXce6/yVuS1GMdI+ptdV6urznZ/Dtix6epDAeHV\n\tn2IcHvTSbd0Er041ABt5aBPjGrV8pA/vpUCpFzjEsclobdkv8QB12W7kX\n\tbAEedn61ms4LcBNcLEARfWR4rNA1HIX6KM3qQcAb2X1OvgsBSDLkyT/Rw Y=;","X-IronPort-AV":"E=Sophos;i=\"5.42,446,1500940800\"; d=\"scan'208\";a=\"9604015\"","From":"Govindarajulu Varadarajan <gvaradar@cisco.com>","To":"benve@cisco.com, bhelgaas@google.com, linux-pci@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org, jlbec@evilplan.org, hch@lst.de,\n\tmingo@redhat.com, peterz@infradead.org","Cc":"Govindarajulu Varadarajan <gvaradar@cisco.com>","Subject":"[PATCH 4/4] lockdep: make MAX_LOCK_DEPTH configurable from Kconfig","Date":"Wed, 27 Sep 2017 14:42:20 -0700","Message-Id":"<20170927214220.41216-5-gvaradar@cisco.com>","X-Mailer":"git-send-email 2.14.1","In-Reply-To":"<20170927214220.41216-1-gvaradar@cisco.com>","References":"<20170927214220.41216-1-gvaradar@cisco.com>","X-Authenticated-User":"gvaradar@cisco.com","Sender":"linux-pci-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-pci.vger.kernel.org>","X-Mailing-List":"linux-pci@vger.kernel.org"},"content":"Make MAX_LOCK_DEPTH configurable. It is set to 48 right now. Number of\nVFs under a PCI pf bus can exceed 48 and this disables lockdep.\n\nlockdep currently allows max of 63 held_locks.\n\nSigned-off-by: Govindarajulu Varadarajan <gvaradar@cisco.com>\n---\n fs/configfs/inode.c      |  2 +-\n include/linux/sched.h    |  3 +--\n kernel/locking/lockdep.c | 13 +++++++------\n lib/Kconfig.debug        | 10 ++++++++++\n 4 files changed, 19 insertions(+), 9 deletions(-)","diff":"diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c\nindex ad718e5e37bb..a1e2a7ce69d0 100644\n--- a/fs/configfs/inode.c\n+++ b/fs/configfs/inode.c\n@@ -41,7 +41,7 @@\n #include \"configfs_internal.h\"\n \n #ifdef CONFIG_LOCKDEP\n-static struct lock_class_key default_group_class[MAX_LOCK_DEPTH];\n+static struct lock_class_key default_group_class[CONFIG_MAX_LOCK_DEPTH];\n #endif\n \n static const struct address_space_operations configfs_aops = {\ndiff --git a/include/linux/sched.h b/include/linux/sched.h\nindex 92fb8dd5a9e4..9a81eec702be 100644\n--- a/include/linux/sched.h\n+++ b/include/linux/sched.h\n@@ -841,11 +841,10 @@ struct task_struct {\n #endif\n \n #ifdef CONFIG_LOCKDEP\n-# define MAX_LOCK_DEPTH\t\t\t48UL\n \tu64\t\t\t\tcurr_chain_key;\n \tint\t\t\t\tlockdep_depth;\n \tunsigned int\t\t\tlockdep_recursion;\n-\tstruct held_lock\t\theld_locks[MAX_LOCK_DEPTH];\n+\tstruct held_lock\t\theld_locks[CONFIG_MAX_LOCK_DEPTH];\n #endif\n \n #ifdef CONFIG_LOCKDEP_CROSSRELEASE\ndiff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c\nindex 44c8d0d17170..22a4a338616d 100644\n--- a/kernel/locking/lockdep.c\n+++ b/kernel/locking/lockdep.c\n@@ -3404,7 +3404,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,\n \t/*\n \t * Ran out of static storage for our per-task lock stack again have we?\n \t */\n-\tif (DEBUG_LOCKS_WARN_ON(depth >= MAX_LOCK_DEPTH))\n+\tif (DEBUG_LOCKS_WARN_ON(depth >= CONFIG_MAX_LOCK_DEPTH))\n \t\treturn 0;\n \n \tclass_idx = class - lock_classes + 1;\n@@ -3513,11 +3513,11 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,\n \tif (unlikely(!debug_locks))\n \t\treturn 0;\n #endif\n-\tif (unlikely(curr->lockdep_depth >= MAX_LOCK_DEPTH)) {\n+\tif (unlikely(curr->lockdep_depth >= CONFIG_MAX_LOCK_DEPTH)) {\n \t\tdebug_locks_off();\n \t\tprint_lockdep_off(\"BUG: MAX_LOCK_DEPTH too low!\");\n \t\tprintk(KERN_DEBUG \"depth: %i  max: %lu!\\n\",\n-\t\t       curr->lockdep_depth, MAX_LOCK_DEPTH);\n+\t\t       curr->lockdep_depth, CONFIG_MAX_LOCK_DEPTH);\n \n \t\tlockdep_print_held_locks(current);\n \t\tdebug_show_all_locks();\n@@ -4276,7 +4276,8 @@ void lockdep_reset(void)\n \tcurrent->curr_chain_key = 0;\n \tcurrent->lockdep_depth = 0;\n \tcurrent->lockdep_recursion = 0;\n-\tmemset(current->held_locks, 0, MAX_LOCK_DEPTH*sizeof(struct held_lock));\n+\tmemset(current->held_locks, 0,\n+\t       CONFIG_MAX_LOCK_DEPTH * sizeof(struct held_lock));\n \tnr_hardirq_chains = 0;\n \tnr_softirq_chains = 0;\n \tnr_process_chains = 0;\n@@ -4421,7 +4422,7 @@ void __init lockdep_info(void)\n \tprintk(\"Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar\\n\");\n \n \tprintk(\"... MAX_LOCKDEP_SUBCLASSES:  %lu\\n\", MAX_LOCKDEP_SUBCLASSES);\n-\tprintk(\"... MAX_LOCK_DEPTH:          %lu\\n\", MAX_LOCK_DEPTH);\n+\tprintk(\"... MAX_LOCK_DEPTH:          %lu\\n\", CONFIG_MAX_LOCK_DEPTH);\n \tprintk(\"... MAX_LOCKDEP_KEYS:        %lu\\n\", MAX_LOCKDEP_KEYS);\n \tprintk(\"... CLASSHASH_SIZE:          %lu\\n\", CLASSHASH_SIZE);\n \tprintk(\"... MAX_LOCKDEP_ENTRIES:     %lu\\n\", MAX_LOCKDEP_ENTRIES);\n@@ -4441,7 +4442,7 @@ void __init lockdep_info(void)\n \t\t);\n \n \tprintk(\" per task-struct memory footprint: %lu bytes\\n\",\n-\t\tsizeof(struct held_lock) * MAX_LOCK_DEPTH);\n+\t\tsizeof(struct held_lock) * CONFIG_MAX_LOCK_DEPTH);\n }\n \n static void\ndiff --git a/lib/Kconfig.debug b/lib/Kconfig.debug\nindex 2689b7c50c52..60bc084315a6 100644\n--- a/lib/Kconfig.debug\n+++ b/lib/Kconfig.debug\n@@ -1187,6 +1187,16 @@ config DEBUG_LOCKDEP\n \t  additional runtime checks to debug itself, at the price\n \t  of more runtime overhead.\n \n+config MAX_LOCK_DEPTH\n+\tint \"Maximum held_locks depth\"\n+\tdepends on DEBUG_LOCKDEP\n+\tdefault 48\n+\trange 1 63\n+\thelp\n+\t  This is maximum held_lock depth in task_struct for debugging.\n+\t  Increment if you think a task can hold more than default(48) locks.\n+\t  If unsure, set to default value, 48.\n+\n config DEBUG_ATOMIC_SLEEP\n \tbool \"Sleep inside atomic section checking\"\n \tselect PREEMPT_COUNT\n","prefixes":["4/4"]}