From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (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 77ACC30F92E for ; Thu, 22 Jan 2026 06:25:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769063161; cv=none; b=BDg0IKZjBqXKplTe9E4Ka5N8002wn2oT7X6tDh5bwwSEet0C3LeE7H7zOTJfdkrSzJAKfK0PoEJjeTjU6EyfcHfH2uXxy5DgAiBN/pjuonrINUp0ueOh61TpgER+BBVxrFehP+drUfhCTybKjLewCBLabmnwcmjJwZVDZUqdo0A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769063161; c=relaxed/simple; bh=W/TDQoiTUd7cx8+7Aorg7n9lcONZAlWF7ZwnZemjTD0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=r8O61ugZfsYPMbG3a1Vhp+h2m7ztxp12BRovKQ2UhNpozc5Zs1EJmbzbpWY6zX7tjTjB2+xCOAUAoMUsWfvVhWDlad/iT6x1uorhzpqqbqPGl17sV6Dm4y53jywwTuZmG2jUOCnRosONHqZMiMKUfovX5Zc8XGqyqza5iiP16zY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id 0389B227AA8; Thu, 22 Jan 2026 07:25:55 +0100 (CET) Date: Thu, 22 Jan 2026 07:25:54 +0100 From: Christoph Hellwig To: Steven Rostedt Cc: Peter Zijlstra , Christoph Hellwig , Marco Elver , Ingo Molnar , Thomas Gleixner , Will Deacon , Boqun Feng , Waiman Long , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Bart Van Assche Subject: Re: [PATCH tip/locking/core] compiler-context-analysis: Support immediate acquisition after initialization Message-ID: <20260122062554.GA24403@lst.de> References: <20260115005231.1211866-1-elver@google.com> <20260115213311.GG830755@noisy.programming.kicks-ass.net> <20260116150750.GG831050@noisy.programming.kicks-ass.net> <20260116151043.GA18805@lst.de> <20260116152016.GI831050@noisy.programming.kicks-ass.net> <20260116152741.GA19823@lst.de> <20260116154754.GN830755@noisy.programming.kicks-ass.net> <20260121202427.099c36ab@gandalf.local.home> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260121202427.099c36ab@gandalf.local.home> User-Agent: Mutt/1.5.17 (2007-11-01) On Wed, Jan 21, 2026 at 08:24:27PM -0500, Steven Rostedt wrote: > I haven't seen all the other approaches, but would a macro be able to hide > it with some kind of obfuscation from the compiler? > > > GUARD_INIT(obj->state, INIT_STATE); > > which would be something like a WRITE_ONCE() macro. I'm not sure what > tooling there is to disable checks for a small bit of code like this. Well, you don't really want WRITE_ONCE for every field, but basically a barrier. And initializing the lock seems like a very logical place for such a barrier. So we'd probably need to pair it with a some kind of 'start initializing fields' that starts the context, and the init then ends it.