From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 671E22FFFB2 for ; Wed, 10 Dec 2025 16:18:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765383509; cv=none; b=fl30QefRQceaCuSvtk5nvJd6caPOsQhuOrRoKpSsILIQ4U1ojk9Q2baF3Lj2XpQyE3OxN1STiNn0WtSSxpyuaWeYA5PXD/wwUVmVjlNERxF1T3OXaEnY1FcgQOILablczPuL+D7SmRB8AsM4wrpLHykZECEu+qB7GSgaKgjkw2A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765383509; c=relaxed/simple; bh=8fukvFVHvNsSJut9kyMPtVjty3xkgDR42FqSOIyq0Vs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mB+gD7v3IZSVIeXZTTx12yWSvtjp9FeAmd22vS6ToL0kAlsukozsd5CQPKsKXhPRAaWiY1W7GUN6YLLhNZcEBt6owpkJJ/nIkMXoWeX1HKxu26Z3lR4CfWDwSQ6xE0yHwZHT2lXO6dYjjpESFwzIpSXzqQXpF820S/BahkiFtZs= 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=O2W+DHu+; arc=none smtp.client-ip=209.85.128.42 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="O2W+DHu+" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-477b91680f8so77529005e9.0 for ; Wed, 10 Dec 2025 08:18:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1765383506; x=1765988306; darn=lists.linux.dev; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=5R7EEgKhSIj0MssK61oG5hvlzLQojw/c9iQ7wtMJnfU=; b=O2W+DHu+AKoFzR7Hspv8YXhmVmVa4LDRe455nXs87Kw/CN8Wf21xFZEX6wuMlsN/jq NPq80hGe6snK1gSppavQHN6N79kv8SE26UO4y5rEu3nx0Eko4z6sKABBqUwKzvI2epiD D+ra446/Uiqd0ULFpjoVwYcEV4OYAatuuxByYIP32U+GNftbCpUlzgRCb5FegyG+C7ag lGhgCp1cSuwP2fC703YLjX4qBEA1kkFCZ+m9ij9w+UFM80TCyCHiZpQUPSzqDaMVkRHM c1ZkTP91UfPKaMqtZGQ7mWHxoP80x6SoUv8Z/O6pfwA2C4wJZ06l1DAXp3z+DLUXhypq IkOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765383506; x=1765988306; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=5R7EEgKhSIj0MssK61oG5hvlzLQojw/c9iQ7wtMJnfU=; b=JwdWw4kcDuFvR1vBoDOJ1dPtdAsbtZj+/pdk3Ksv8qA9bzjIFCNbSMFiJWssfn1xjI /YooeN8TxlzTy9MUc1qopzIB4ktdCmc1Ee+1ANnJtbcIU2ZYtwsEu5NjCHMSwnlRNhyz MGTGLayJUzTChpOhY4ZqGwQZ7eav+nTQlxITt9wlp4uM4UTGZjQznkjK2yiojGyBYlaJ 4DQolMeuYbi6V5sGKP/oDClzFlq9lhHPU/XsMKRGVVTkVA8W5rCm3o3mLkczY4Gd7sda CyklcHAAWkng+ZLwiY7UmByej1z+IEEyNs8FenJN42yCl5PmC+tXVhyxZnPfZqcdKboU LxJg== X-Forwarded-Encrypted: i=1; AJvYcCVPLHtNPoTnfx23UNkwDP32MWzVTcWBXLwFmKPKoZCnFzoJaQFfNg2EK/h9yDH7vf+t/VV1@lists.linux.dev X-Gm-Message-State: AOJu0YybmBxWmZOm4+S4tNQtDLmyYgywBGKsOkfsTRMPoQ397YAn08ng j2mDVJXDkgU5MwFhy3tCRxirTaTnkHDqkt/DUiHvkIU9pVT9XGcInvSAB+oCR35Hrw== X-Gm-Gg: ASbGncuMZSbbw/zd8358SytoQHqzYsxBbBgloQQqTn8L62nZejXLcXa/dXen/yvjetO Wasucp5PvVECvgor9Hvqmp8KFBoc0P7zb+X5bbgvtKLpbA5zKeLozb/afQHlljdI0ptvyB+jpQ1 rC+mS81MXoMEJZW3+OJtVum7lqiPGvwY4z5Mfsjemg95AlnRb3XecO/vaVnKKz459DMI2o+UFw4 au1Xqs+Kyl4iTW7b9hEKGRYojnSFdWDpmQHsUp2oPWWaRs8MGi3ZQybFOaYtHc6OfnBAnq0Y2CD kSD4jiPNmzbn3p3RUiO/u//syS/n6VHaW5rMnWJ0zBD/secAsNyG+fQtuDHhbv2STNfEcPAwlAW LJO+LKLRSonRsBgH0D8yR1LIy/CBMcU9h4F21+EtB+3EXfo5Sdks86KFLEg0R5sfOD2H2F/y3lI GE0V/vRYFMNQ8nZRt9sXkOJOzF4mUILCilrSd5dylfOQwhSsA= X-Google-Smtp-Source: AGHT+IE5gG+0fezF5tzXHFusF2dBV52zxvrbxnDDqwGYfilnFo0IcpTyJU4lWfuQsZFtfQAM3eL7LQ== X-Received: by 2002:a05:600c:687:b0:46e:59bd:f7d3 with SMTP id 5b1f17b1804b1-47a83cc5528mr15763325e9.20.1765383505415; Wed, 10 Dec 2025 08:18:25 -0800 (PST) Received: from elver.google.com ([2a00:79e0:2834:9:edfc:ec3:194e:c3b3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47a7d3a75a3sm45109085e9.6.2025.12.10.08.18.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Dec 2025 08:18:24 -0800 (PST) Date: Wed, 10 Dec 2025 17:18:16 +0100 From: Marco Elver To: Peter Zijlstra , Boqun Feng , Ingo Molnar , Will Deacon , Linus Torvalds Cc: "David S. Miller" , Luc Van Oostenryck , Chris Li , "Paul E. McKenney" , Alexander Potapenko , Arnd Bergmann , Bart Van Assche , 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 Subject: Re: [PATCH v4 00/35] Compiler-Based Context- and Locking-Analysis Message-ID: References: <20251120145835.3833031-2-elver@google.com> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251120145835.3833031-2-elver@google.com> User-Agent: Mutt/2.2.13 (2024-03-09) All, On Thu, Nov 20, 2025 at 03:49PM +0100, Marco Elver wrote: > Context Analysis is a language extension, which enables statically > checking that required contexts are active (or inactive) by acquiring > and releasing user-definable "context guards". An obvious application is > lock-safety checking for the kernel's various synchronization primitives > (each of which represents a "context guard"), and checking that locking > rules are not violated. [...] > A Clang version that supports `-Wthread-safety-pointer` and the new > alias-analysis of context-guard pointers is required (from this version > onwards): > > https://github.com/llvm/llvm-project/commit/7ccb5c08f0685d4787f12c3224a72f0650c5865e > > The minimum required release version will be Clang 22. > > This series is also available at this Git tree: > > https://git.kernel.org/pub/scm/linux/kernel/git/melver/linux.git/log/?h=ctx-analysis/dev [...] I realize that I sent this series at the end of the last release cycle, and now we're in the merge window, along with LPC going on -- so it wasn't the best timing (however, it might be something to discuss at LPC, too :-) .. I'm attending virtually, however :-/). How to proceed? I'll be preparing a rebased and retested version of all this when v6.19-rc1 is out. One outstanding recommendation from Linus was to investigate compile-times, but as-is, it's unclear there's any notable overhead per brief investigation: https://lore.kernel.org/all/aR-plHrWDMqRRlcI@elver.google.com/ >From what I can tell most of this has to go through the locking tree, given the potential for conflict there. However, it is possible to split this up as follows: Batch 1: > compiler_types: Move lock checking attributes to > compiler-context-analysis.h > compiler-context-analysis: Add infrastructure for Context Analysis > with Clang > compiler-context-analysis: Add test stub > Documentation: Add documentation for Compiler-Based Context Analysis > checkpatch: Warn about context_unsafe() without comment > cleanup: Basic compatibility with context analysis > lockdep: Annotate lockdep assertions for context analysis > locking/rwlock, spinlock: Support Clang's context analysis > compiler-context-analysis: Change __cond_acquires to take return value > locking/mutex: Support Clang's context analysis > locking/seqlock: Support Clang's context analysis > bit_spinlock: Include missing > bit_spinlock: Support Clang's context analysis > rcu: Support Clang's context analysis > srcu: Support Clang's context analysis > kref: Add context-analysis annotations > locking/rwsem: Support Clang's context analysis > locking/local_lock: Include missing headers > locking/local_lock: Support Clang's context analysis > locking/ww_mutex: Support Clang's context analysis > debugfs: Make debugfs_cancellation a context guard struct > compiler-context-analysis: Remove Sparse support > compiler-context-analysis: Remove __cond_lock() function-like helper > compiler-context-analysis: Introduce header suppressions > compiler: Let data_race() imply disabled context analysis > MAINTAINERS: Add entry for Context Analysis Batch 2: Everything below this can wait for the initial support in mainline, at which point subsystem maintainers can pick them up if deemed appropriate. > kfence: Enable context analysis > kcov: Enable context analysis > kcsan: Enable context analysis > stackdepot: Enable context analysis > rhashtable: Enable context analysis > printk: Move locking annotation to printk.c > security/tomoyo: Enable context analysis > crypto: Enable context analysis > sched: Enable context analysis for core.c and fair.c Thanks, -- Marco