From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C8FB2459DD for ; Fri, 19 Dec 2025 21:49:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766180955; cv=none; b=ohgMs4e838P0CetxU5HVnWHRsyEj9a6qBEO1LG7mz0HJvh/ULQkWDCArJjeKtjObl9RvcfUCqLCmQR/l7p5WHR+Rwemb26Tp2XaZsYxTMiF9QxXoXwmTI+rGQW4XcQmTquv28aVgGzsNeo9T5AmFV61uekLjuOv4SnAqsI7fb4k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766180955; c=relaxed/simple; bh=k9J0WFzlkYtCk1RXVJs8ICS2UcS46vYMNi/KF0RXH0A=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=bvBokYU+kZouiA+4tmreSrB9scDkj8m5wcdt4v+hmIila6/HJF0tJ4DffK8wT8pXqTN8SJ34rg67GT4/bcJ8KttMUD5dfFlXnaF7quyRvY8LWM9Eb+6nnQZCp1nzDRirfNbHsGzBTyTwFqvEx9GwGhlpc/yUaTZYxTyN9iLQ5+M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=wxzxqX9N; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="wxzxqX9N" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-7bab7c997eeso2553081b3a.0 for ; Fri, 19 Dec 2025 13:49:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1766180952; x=1766785752; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=NzDuEDjTM8ZWLDMfL/9YFXqkNSYfSWOUAvfjFgQokA0=; b=wxzxqX9NTO+ux5QSAcxOM6N4IFypnQhbKmPscGrkLhB0JOtlA75xFwJBn3T/ndKGFF dGu73fTDFG1w7J7q09Rt2RIg0RiPTxdyLZAi9Yo7VnX4CCGDbs+Al8VT5I+bWlMi2RSa 2FbFx4vLCJK8j0nAmNQv4ZuhoB8LqGTKjzRN5XBCWHSTJLbQiVTuCIkipaAoML/6gSY1 JVw//ZcP0nWpjLQ/CeXnGTPTOumpHJ4dU8U8gMyF3aTjQe321HLJGcUCIclL0o8h2+BZ 7p+xcyKOMxVFgvpAYQBtWCVrv8RzLkh0A5kz4oHK0cAt/eZmsHmkQgBgG6tbS+FLp400 uL7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766180952; x=1766785752; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NzDuEDjTM8ZWLDMfL/9YFXqkNSYfSWOUAvfjFgQokA0=; b=amvm9yZY9EL7lO5OJK1I0L78XrMbMx0zcZ7yHI9huoPSDWisnZZgEYdoqgGOg4p6n0 6IRGgABP+Mhc/QhWI9kEHXEbi8+0zmjZbs60x3CvwG8MYf4N4MGkmCHAhz2rVh5fFvqJ b+o2gP1nnAa0pM8/XO/kwz7mRQFLMywGNCyeZbdfjjHj7+37oNmC6G0ZMsQcxncjc9wE kRq8Jp1wsti1DH18Y5DZgEvFo9L5d6yCDd6oKD2Nz8vRXb8HEhXPHsxBQu4lid9Y8+jh oY5RMhveyl2gFK8HVdSogPPAwFY6pJ5iZ3tUrMfRVvGdxccQGd6Prr6+/t5srN5/tUZi VwPA== X-Forwarded-Encrypted: i=1; AJvYcCXXANXsslc04vjuN6MTVJFLSNwEz4j+vlOTckxJhXicsmPlUX2La1jEh7kSq2i29lgwRJJgs3Ucxj6fezg=@vger.kernel.org X-Gm-Message-State: AOJu0Yw/wf43EbV4moiAqJXK5UW20lKvF2pquXK8QjtldZDfcw1jH2Hk Qgvzm64lkfXyTpJWn4OxCRYNG6afDjuAkRkPgBII6Q2Xr9GfplK3rmsBS7Pdj1cXeEeX0oHixNx V6D+1kLB0B5UVhxKy0MbrQLiyFiWZdIfJMTgl8nyt X-Gm-Gg: AY/fxX5pVsseZfgEUUinqivXQ5Ty4KYs0Kl9A58ZR11wCYpp2G0pco3S8ujXenHHFZS fpPWi6x5ihPkyMNrcAw2xr1BpDI3l1amVUUupRcnotZD/iJ4F6JS9jXrBstmrQhwtgWDQXy/1s+ El+HfIw4P/J+vz2pjI/XKke0DrKO3+B2oHbRX2Zvt5tyse1cbHwJHyG9N47eoNn2DUx1rAIBp/V Rrk0W53rCNW23nGcpZgoHgu8skHODc5BVryVBbhoHV+Tv8AkHYfeWMXs+xob9oMSRaUwfBbrUYO eK+nVEczJNEMpierKv4z0TzBpQM= X-Google-Smtp-Source: AGHT+IH1wb+RKJ6da97DpXPpqA5MRT8qx5b7FDx5k2pjduqaEcwfYWMMGR5Rn4FLqe1i8Vtg4dzqeBXKvhP326Y4ZH8= X-Received: by 2002:a05:7022:213:b0:11a:4016:44a5 with SMTP id a92af1059eb24-121722de1e1mr5781198c88.24.1766180951816; Fri, 19 Dec 2025 13:49:11 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20251219154418.3592607-1-elver@google.com> <20251219154418.3592607-9-elver@google.com> <17723ae6-9611-4731-905c-60dab9fb7102@acm.org> <0088cc8c-b395-4659-854f-a6cc5df626ed@gmail.com> In-Reply-To: <0088cc8c-b395-4659-854f-a6cc5df626ed@gmail.com> From: Marco Elver Date: Fri, 19 Dec 2025 22:48:35 +0100 X-Gm-Features: AQt7F2rGv_yg31bAGJRVSa1c9k6UbjL-L12dGmORxx_mEF1TxDypAURYmp5bQlk Message-ID: Subject: Re: [PATCH v5 08/36] locking/rwlock, spinlock: Support Clang's context analysis To: Bart Van Assche Cc: Peter Zijlstra , Boqun Feng , Ingo Molnar , Will Deacon , "David S. Miller" , Luc Van Oostenryck , Chris Li , "Paul E. McKenney" , Alexander Potapenko , Arnd Bergmann , Christoph Hellwig , Dmitry Vyukov , Eric Dumazet , Frederic Weisbecker , Greg Kroah-Hartman , Herbert Xu , Ian Rogers , Jann Horn , Joel Fernandes , Johannes Berg , Jonathan Corbet , Josh Triplett , Justin Stitt , Kees Cook , Kentaro Takeda , Lukas Bulwahn , Mark Rutland , Mathieu Desnoyers , Miguel Ojeda , Nathan Chancellor , Neeraj Upadhyay , Nick Desaulniers , Steven Rostedt , Tetsuo Handa , Thomas Gleixner , Thomas Graf , Uladzislau Rezki , Waiman Long , kasan-dev@googlegroups.com, linux-crypto@vger.kernel.org, linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, linux-sparse@vger.kernel.org, linux-wireless@vger.kernel.org, llvm@lists.linux.dev, rcu@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Fri, 19 Dec 2025 at 22:34, Bart Van Assche wrote: > > On 12/19/25 2:02 PM, Marco Elver wrote: > > On Fri, 19 Dec 2025 at 21:26, Bart Van Assche wrote: > >> On 12/19/25 7:39 AM, Marco Elver wrote: > >>> - extern void do_raw_read_lock(rwlock_t *lock) __acquires(lock); > >>> + extern void do_raw_read_lock(rwlock_t *lock) __acquires_shared(lock); > >> > >> Given the "one change per patch" rule, shouldn't the annotation fixes > >> for rwlock operations be moved into a separate patch? > >> > >>> -typedef struct { > >>> +context_lock_struct(rwlock) { > >>> arch_rwlock_t raw_lock; > >>> #ifdef CONFIG_DEBUG_SPINLOCK > >>> unsigned int magic, owner_cpu; > >>> @@ -31,7 +31,8 @@ typedef struct { > >>> #ifdef CONFIG_DEBUG_LOCK_ALLOC > >>> struct lockdep_map dep_map; > >>> #endif > >>> -} rwlock_t; > >>> +}; > >>> +typedef struct rwlock rwlock_t; > >> > >> This change introduces a new globally visible "struct rwlock". Although > >> I haven't found any existing "struct rwlock" definitions, maybe it's a > >> good idea to use a more unique name instead. > > > > This doesn't actually introduce a new globally visible "struct > > rwlock", it's already the case before. > > An inlined struct definition in a typedef is available by its struct > > name, so this is not introducing a new name > > (https://godbolt.org/z/Y1jf66e1M). > > Please take another look. The godbolt example follows the pattern > "typedef struct name { ... } name_t;". The "name" part is missing from > the rwlock_t definition. This is why I wrote that the above code > introduces a new global struct name. You're right. My point only applies to "typedef struct spinlock ..."