From patchwork Sat Dec 16 03:32:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 13495437 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C9C6C4332F for ; Sat, 16 Dec 2023 03:33:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3183A8D015B; Fri, 15 Dec 2023 22:33:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2CDE58D0153; Fri, 15 Dec 2023 22:33:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 120F78D015B; Fri, 15 Dec 2023 22:33:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id F09838D0153 for ; Fri, 15 Dec 2023 22:33:41 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D38821C181F for ; Sat, 16 Dec 2023 03:33:41 +0000 (UTC) X-FDA: 81571261842.14.673B9F7 Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [91.218.175.178]) by imf26.hostedemail.com (Postfix) with ESMTP id E4F5914000E for ; Sat, 16 Dec 2023 03:33:39 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=nijiqWnI; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf26.hostedemail.com: domain of kent.overstreet@linux.dev designates 91.218.175.178 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702697620; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/YlwF6jQl3AGWCNwHZroZiQJXLn/OA9Z6AEGkzv6HW8=; b=Qm6EuEJ8Lclns9RHIpxyAOyMLGyZiXKyF3Y0l4ctJFp5MBNTp8So1/Ym5Rn9t3nPgdjO4E QUNtxqpjD+PFsANR4ZXcfRdPqgqxXBK/Vd60c16r5j8YdPIHModw/9htplYVw3H6Set09I obifO1hND1VsFaQmvR2qTfy5dkiIWig= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=nijiqWnI; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf26.hostedemail.com: domain of kent.overstreet@linux.dev designates 91.218.175.178 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702697620; a=rsa-sha256; cv=none; b=dPQ14JoANE4pFt8WniJmGO4AroXSEugPdvRBk/bEpdKEldrnC+NQNkKMi1PiZHsbzR9sH0 lEbkjEnL5A1ZSob478PYYoc6dSeTd9V+CD3rZFTlo6yfgpUUmcF5wbtgvRArD9PDvPhggD WBy4VgFa3qLw0FOWMqPF5lOzSuNuivo= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1702697618; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/YlwF6jQl3AGWCNwHZroZiQJXLn/OA9Z6AEGkzv6HW8=; b=nijiqWnIMhK8D4E+Dsg3ln2Q7UPgn+yu9KR+e2JPEspKys0O6hVGLCnxi5pkYic8E9OCiG pGy+l2s15DaXeItKJ/if34iFAE3tHB6uBAO2eH431kKPbX4YcuQTfdhzqtTSV1ZoEFY5I6 gbtEG/7AyCymx8o2Dy6NxS+GuSnt7YU= From: Kent Overstreet To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: Kent Overstreet , tglx@linutronix.de, x86@kernel.org, tj@kernel.org, peterz@infradead.org, mathieu.desnoyers@efficios.com, paulmck@kernel.org, keescook@chromium.org, dave.hansen@linux.intel.com, mingo@redhat.com, will@kernel.org, longman@redhat.com, boqun.feng@gmail.com, brauner@kernel.org Subject: [PATCH 43/50] lockdep: move held_lock to lockdep_types.h Date: Fri, 15 Dec 2023 22:32:49 -0500 Message-ID: <20231216033300.3553457-11-kent.overstreet@linux.dev> In-Reply-To: <20231216033300.3553457-1-kent.overstreet@linux.dev> References: <20231216024834.3510073-1-kent.overstreet@linux.dev> <20231216033300.3553457-1-kent.overstreet@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: E4F5914000E X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: hij3gtiubyijr3ae4k4pab6qz7kco1dq X-HE-Tag: 1702697619-194506 X-HE-Meta: U2FsdGVkX1/vxl4JjAqc51fzsmOHrLg0rU2jzMYyyftJNsF2P49JwBfum8fv328hDtZyaPDbW8tOaWJixgPTGMgdIdtFtmp7um7F9pkTxcQ8vEnnfMUSSRFGvtvBh0n25cEFgw4LjByUlCRn271dM+mFEdSDGAtOpf1OhLOXIuPk4FYYKyGP0Tp60VLFtMdhOzmTr3kj0lcfFVo8fhMkgrQCFXol1yrSesvYvGxdlPc0CoYHnRb3XMWmJqKkpfZuBlN92ITmC8F1qC1DPVkVLA52Rqz2NtUhj+4YGdsbD7kaLNop5H+uWJbnlnWAU0j5tcEnjLcLuBLNjQ85aaVfalpQZ0jTGZP5LGRkJPK5r/N2mSaWym0g+gMni2JKMea452blN4B6laDYE0LhSuFWRT3hiwuCZyc/5oiKnSon1kVMOUhcEWSANtVDS20sWkLaSnU217AIaYu9XSMh0pfgFVWm4bbYpq4zQcZB8vdSz/m84u6Fi/53J8MUTrKlT5MyQEC9xU/iFv5nmyVicxzzYX7VofkuuuMjWq/7QFqmbwWSMqLlVcmdEo6wgi6G8xesm2sij64u6UO62fGOY//CXYjpzMI+TxXyhBxJ3GeGtVyp+0zB3ms2aZxOff51uu8HbHdEBYNVWr8gk/Z8z7bw0gyEasAG4wpiFMcHpy9+1mtV0p8RPcoFdZC4OteoBupqGkyHPDddJVcAvborW86JoM2J+pUmsFDjQBBTvNUlalUEZpPGDv0S3bQJ1yXRrBonHlElTg1MnTPfwNBxLBrnXJR60zvOuuSV1NGMYakcUADJODL6hIK3DsuHr3bjnZgeYQGWlZWXE3TMqM65TrGfZN+w5sX6W9cFfeBJX+Yj9GTiSGHV/VAHdymVgbWe44da8aYRXGxpCWpghTZAwl3imfH9WtzIG5JrX1M3u8ZcPaTLNb+VYnMC9clbm+8A9TdqYV5TK39ZvNe1PBuwIbY cO/TCA9J /gW/SV4lZoO9gB6SMCiQBsJ8dI3SYdFHEudgNhbKry76qY6xMj/WQcsudrK0JJQH9mVjm8neCn34+mEeczAkT5R6HPvZFXahhm5xOdBpZhwzUwecGA6C40W9hDEuv3VCYHGR/v8E/OQblNNA+7EL/a+hyfo+4NVOmlgqUSRpotpoyKj44YflYyHxFh8ZTIW09Xj0RgQtqyDNhIT4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: held_lock is embedded in task_struct, and we don't want sched.h pulling in all of lockdep.h Signed-off-by: Kent Overstreet Acked-by: Waiman Long --- include/linux/lockdep.h | 57 ----------------------------------- include/linux/lockdep_types.h | 57 +++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index dc2844b071c2..08b0d1d9d78b 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h @@ -82,63 +82,6 @@ struct lock_chain { u64 chain_key; }; -#define MAX_LOCKDEP_KEYS_BITS 13 -#define MAX_LOCKDEP_KEYS (1UL << MAX_LOCKDEP_KEYS_BITS) -#define INITIAL_CHAIN_KEY -1 - -struct held_lock { - /* - * One-way hash of the dependency chain up to this point. We - * hash the hashes step by step as the dependency chain grows. - * - * We use it for dependency-caching and we skip detection - * passes and dependency-updates if there is a cache-hit, so - * it is absolutely critical for 100% coverage of the validator - * to have a unique key value for every unique dependency path - * that can occur in the system, to make a unique hash value - * as likely as possible - hence the 64-bit width. - * - * The task struct holds the current hash value (initialized - * with zero), here we store the previous hash value: - */ - u64 prev_chain_key; - unsigned long acquire_ip; - struct lockdep_map *instance; - struct lockdep_map *nest_lock; -#ifdef CONFIG_LOCK_STAT - u64 waittime_stamp; - u64 holdtime_stamp; -#endif - /* - * class_idx is zero-indexed; it points to the element in - * lock_classes this held lock instance belongs to. class_idx is in - * the range from 0 to (MAX_LOCKDEP_KEYS-1) inclusive. - */ - unsigned int class_idx:MAX_LOCKDEP_KEYS_BITS; - /* - * The lock-stack is unified in that the lock chains of interrupt - * contexts nest ontop of process context chains, but we 'separate' - * the hashes by starting with 0 if we cross into an interrupt - * context, and we also keep do not add cross-context lock - * dependencies - the lock usage graph walking covers that area - * anyway, and we'd just unnecessarily increase the number of - * dependencies otherwise. [Note: hardirq and softirq contexts - * are separated from each other too.] - * - * The following field is used to detect when we cross into an - * interrupt context: - */ - unsigned int irq_context:2; /* bit 0 - soft, bit 1 - hard */ - unsigned int trylock:1; /* 16 bits */ - - unsigned int read:2; /* see lock_acquire() comment */ - unsigned int check:1; /* see lock_acquire() comment */ - unsigned int hardirqs_off:1; - unsigned int sync:1; - unsigned int references:11; /* 32 bits */ - unsigned int pin_count; -}; - /* * Initialization, self-test and debugging-output methods: */ diff --git a/include/linux/lockdep_types.h b/include/linux/lockdep_types.h index 2ebc323d345a..9c533c8d701e 100644 --- a/include/linux/lockdep_types.h +++ b/include/linux/lockdep_types.h @@ -198,6 +198,63 @@ struct lockdep_map { struct pin_cookie { unsigned int val; }; +#define MAX_LOCKDEP_KEYS_BITS 13 +#define MAX_LOCKDEP_KEYS (1UL << MAX_LOCKDEP_KEYS_BITS) +#define INITIAL_CHAIN_KEY -1 + +struct held_lock { + /* + * One-way hash of the dependency chain up to this point. We + * hash the hashes step by step as the dependency chain grows. + * + * We use it for dependency-caching and we skip detection + * passes and dependency-updates if there is a cache-hit, so + * it is absolutely critical for 100% coverage of the validator + * to have a unique key value for every unique dependency path + * that can occur in the system, to make a unique hash value + * as likely as possible - hence the 64-bit width. + * + * The task struct holds the current hash value (initialized + * with zero), here we store the previous hash value: + */ + u64 prev_chain_key; + unsigned long acquire_ip; + struct lockdep_map *instance; + struct lockdep_map *nest_lock; +#ifdef CONFIG_LOCK_STAT + u64 waittime_stamp; + u64 holdtime_stamp; +#endif + /* + * class_idx is zero-indexed; it points to the element in + * lock_classes this held lock instance belongs to. class_idx is in + * the range from 0 to (MAX_LOCKDEP_KEYS-1) inclusive. + */ + unsigned int class_idx:MAX_LOCKDEP_KEYS_BITS; + /* + * The lock-stack is unified in that the lock chains of interrupt + * contexts nest ontop of process context chains, but we 'separate' + * the hashes by starting with 0 if we cross into an interrupt + * context, and we also keep do not add cross-context lock + * dependencies - the lock usage graph walking covers that area + * anyway, and we'd just unnecessarily increase the number of + * dependencies otherwise. [Note: hardirq and softirq contexts + * are separated from each other too.] + * + * The following field is used to detect when we cross into an + * interrupt context: + */ + unsigned int irq_context:2; /* bit 0 - soft, bit 1 - hard */ + unsigned int trylock:1; /* 16 bits */ + + unsigned int read:2; /* see lock_acquire() comment */ + unsigned int check:1; /* see lock_acquire() comment */ + unsigned int hardirqs_off:1; + unsigned int sync:1; + unsigned int references:11; /* 32 bits */ + unsigned int pin_count; +}; + #else /* !CONFIG_LOCKDEP */ /*