Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp7106501rdb; Fri, 15 Dec 2023 19:37:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IGou2nnijm+yyYNf4YaQUGciGOTBfD0ukyAeAOdLdh9Ad84Ha1fmcQprJentvZ7dbwuKnkm X-Received: by 2002:a05:620a:5587:b0:77f:3956:4aac with SMTP id vq7-20020a05620a558700b0077f39564aacmr15009267qkn.54.1702697836379; Fri, 15 Dec 2023 19:37:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702697836; cv=none; d=google.com; s=arc-20160816; b=sb4hr1o4ZSuMlT3lMtqyt2dAHMMcV/vQj+8hClLjwL+YOjqctPfWUO4RaB2VqCdwOo +u80EfN7SRgxfLTfmchepDvQcr5+ftMTu7aoces8AWzu04YkvoJdOErqySu1vjJp5y5t 8UpDfACudOePTTmnH3cPPQLHME8uIxld7QgBet9mJbYBeu6H1WDch9Xasfwr81xWpmwV QTgff5zr1nS3UQWmPtvpowZQQODJC61Rklqs+03GbeU23fdiOneSCKSfB5snqTXjfnYt jfD6zJ0qiLjJTBgTve3zlMjX/4L4Gae4HpWFEhdDEyOVsXql0JmZPidGVVD/ty7V8Cnr GhVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=/YlwF6jQl3AGWCNwHZroZiQJXLn/OA9Z6AEGkzv6HW8=; fh=vHhjxHftTECn/hRvIWNlq1eDzDsn74Roqz0kmRcPgcE=; b=g8ZBANEAFfb4uD63XxilX95+tRWE+eHnpmzfuO65ZDhG0Zyy8VhUii0zLGrcQqeIe6 VgxdgTImR9Db83o+Jj4BzQ8nZQpzVoDli9KJfULuztWsuu8HJzlmYjHEZVQDAffpoyEr BlydZei3FdtKxcjmIHALQ04KRPzpEcHYfFL7QXdZAeg9BiPgrhtoi2sSBDQwIkjnsTFc nPrj4jiZX4ePMWvGZX+4k4zSUpnu+FF/MbC/OblRCWmc/Cpc5D8Kyz8QGVRdL18XrdYG N7WsMHjMOdW9xeGHO2AALbgiV6sg8U0EuL2Zn5oKAZBhk2hxV4qQgjn0g9YV54Ukym9M BE8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=nijiqWnI; spf=pass (google.com: domain of linux-kernel+bounces-2022-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2022-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g6-20020a05620a40c600b0077f0e4ee6bcsi21106603qko.360.2023.12.15.19.37.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 19:37:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2022-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=nijiqWnI; spf=pass (google.com: domain of linux-kernel+bounces-2022-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2022-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 184EB1C20381 for ; Sat, 16 Dec 2023 03:37:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C17343AAB; Sat, 16 Dec 2023 03:33:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="nijiqWnI" X-Original-To: linux-kernel@vger.kernel.org Received: from out-175.mta0.migadu.com (out-175.mta0.migadu.com [91.218.175.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18D1D41C95 for ; Sat, 16 Dec 2023 03:33:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 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 --- 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 */ /* -- 2.43.0