From mboxrd@z Thu Jan 1 00:00:00 1970 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 94058C35274 for ; Mon, 18 Dec 2023 17:06:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2ECFA8D0007; Mon, 18 Dec 2023 12:06:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 275718D0001; Mon, 18 Dec 2023 12:06:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0EF688D0007; Mon, 18 Dec 2023 12:06:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id ECF1F8D0001 for ; Mon, 18 Dec 2023 12:06:00 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id ADEAAA132C for ; Mon, 18 Dec 2023 17:06:00 +0000 (UTC) X-FDA: 81580566480.07.FC98419 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf17.hostedemail.com (Postfix) with ESMTP id C7ECD40007 for ; Mon, 18 Dec 2023 17:05:57 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Q1lvtujs; spf=pass (imf17.hostedemail.com: domain of longman@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=longman@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702919157; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ZHVXfapFaNpskuHSl3q7oII90SEseCDPP+ervZTtQgI=; b=RRKCXCbxwNQpGApjpFrdCJduPf1aNMclVnorGvOc5ffB4HIxDCO3RjPlsbPez2VjrqxBbz 8G21DytKGbbgjU+eufv+2Qc6Evg7FCpnXbXRShvcuCa8g5IDnjVIP2bWn7ly98G4fVUrtr CDw58Rhr+xLRf6AQb+Gwq5uNLCaxgL8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702919157; a=rsa-sha256; cv=none; b=dQc8GpkgkShs5wVALi1XNpeRIgN6CRc+kcW1vQ/nKmbxGTYUD6ydkSwR+7XWWSpwDFQOci qp1jC1kbaw5FQ0kbbHARnXhvlfHWe2cInzjxkktiFfwalCFLaOriLHkQ1+5PJi0MNS6x/o RHF9HWwokTaB5hZiG4sq9Qhl2HPDA/E= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Q1lvtujs; spf=pass (imf17.hostedemail.com: domain of longman@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=longman@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702919157; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZHVXfapFaNpskuHSl3q7oII90SEseCDPP+ervZTtQgI=; b=Q1lvtujsR9Nx2rhZh1f8KpZ2X47TO0sGGSej425/1wQD3d6APiEmYfsfKkYtblVYqWskSi kNVRexgb03lkLAXFRHNMBWAAaWzX7JITz66MQ59h2lVFdzYKXVvUXkWPyCnWM40E9POBbf 9XjRTJ051ylrAV3FJL+pVp3V2e0SIAM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-686-uYJsyWyCNqG8vqZW-oOiJw-1; Mon, 18 Dec 2023 12:05:55 -0500 X-MC-Unique: uYJsyWyCNqG8vqZW-oOiJw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 53A27863E88; Mon, 18 Dec 2023 17:05:54 +0000 (UTC) Received: from [10.22.32.252] (unknown [10.22.32.252]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A88E492BF0; Mon, 18 Dec 2023 17:05:53 +0000 (UTC) Message-ID: <91824e90-0319-467c-a7a7-acda9464a542@redhat.com> Date: Mon, 18 Dec 2023 12:05:53 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 43/50] lockdep: move held_lock to lockdep_types.h Content-Language: en-US To: Kent Overstreet , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: 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, boqun.feng@gmail.com, brauner@kernel.org References: <20231216024834.3510073-1-kent.overstreet@linux.dev> <20231216033300.3553457-1-kent.overstreet@linux.dev> <20231216033300.3553457-11-kent.overstreet@linux.dev> From: Waiman Long In-Reply-To: <20231216033300.3553457-11-kent.overstreet@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Rspamd-Queue-Id: C7ECD40007 X-Rsp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j48ecWfP rnAFhztHhrySNcsmB4olCLnvTQi7+TGMkqjqjxB5Ak4gBP6oij+NUTsVrlrOn65eh/vk8WgGH7FUg2tLBcZOKCbGPsnNV0Wps6daPkOKNSRzyTCqlKAFVbn4/6YdU8PzN+Dd11oNwb/dCTsFRKuDWVKH/ngR6/T9tyDzVMYdEhelFCOQW9eF702erTmC7Qz7vBPYuCSnVS78WpRjSAm6mXm+AdWs9qg3cA1qzQZfrNaBMOMHYYk0b10LH+6AAhk3ae2tlESI6PUDMuuz58y76Pxj8iHZl3m91imkP5awhqs6IHKNHe+spw7NzvZEtPkF1HDX3p8xs27lUl4hSkiZu+qHcXA== 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: On 12/15/23 22:32, Kent Overstreet wrote: > 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 */ > > /* Acked-by: Waiman Long