From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796135067; b=sEtJFsezYNXNHtIgmr9iwnxj+Q39YIKA+Vv3EW3+Edn2MVC2ZrmGhXy9kWVIavcJ3DD5 NLnTyj3uRknzm6oXgPPjejh4UB6ESMU1thtLl/yEg6HyXs8B08fBT4Sq5coqQ6yqzZGlZ 84tThTQaFf2KVwrt2LJ79yuL1TXX6NwbZnCd30oKlNUDky884EK2BmMkePkIEq3C7UyDI D3DbtNhn99qveHHtiYLKzFM6bwEoVBrOxyqS5pNUeoP9vcQ+5KSSpr8WGZ+NX104edsZF afJOyEt85RX1akNQpXKUfbissWorKxc45G9n4TMkaydilK5Wzoqrv3Wdd8DiE5G0Ibg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796135067; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=OrRHyJzXcn93uHJF+ZCSd1ELVmST5cqUnhpj1vmH2+M=; b=EFO6mc/ldqLPpPps4OgmE1fB2Yi9iWBhx4CFJ7W4lupKZhGzdmT9KnRpu6xG1qDoCBys pTz4yXBI1vJgT5gisfzADN0NYDJCS1gR48M+lLy9IdiXgOAeFjpA/a9fEhwuFdLwPuiCo AGrr/gGY+UfzoZCLw7B0jV2dn/dnGLTI6LEohbu6ZIiydH1YD6rFp970kIjGTfFukA0Jv QhMqEXWC1ROo1FNoPoI7ekQ78NB9KQ0V2wEW1mEZomNfxzEt9zGIjsckAyjynUhw1+Oxl RQjdAD0/j7DG3KYyYHuTEKMxd/0fXevtBc9YTkYslaAuMDxgK2o+YmXa0VNdwmVmn1g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VcnyuYa+; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FCEE606A31A; Tue, 1 Dec 2026 14:24:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VcnyuYa+ Received: by smtp.kernel.org (Postfix) with ESMTPSA id B07B91F000C1; Tue, 1 Dec 2026 14:24:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796135067; bh=OrRHyJzXcn93uHJF+ZCSd1ELVmST5cqUnhpj1vmH2+M=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=VcnyuYa+PkRYqm0JtizHslne2nw/bIk96pLEJiNFeGSX3Ljl2uy29euYvYSXm8lN4 iiGuHTc4xJ/l/roXNe9A8Ag43gHvJF/eEAAz97WHNR1kvZw7X2etgmoQ7D/184jJ5D /8txpHuvbNBXwuLVpUEnH05EBOReR/Z/5gkjDNVGvlBc/jvKNQT4V38YBiP9QJjl8o qXwS71snSnfVlUy3v/UXsWGTDM0oXDvMKcFRUEF/dVXOxKoWipDxzbIgel7xDiFq9/ zVT0WwAE6KVj1bbOZ5tG4C23SrBXTb9i8Wu3IjvDqj7Wn3vYbVdm2676uK7UHS63hz y4H6h5B1fDe/A== Date: Tue, 1 Dec 2026 14:24:19 +0000 From: "Lorenzo Stoakes (ARM)" To: Dave Hansen Cc: linux-kernel@vger.kernel.org, Andy Lutomirski , Borislav Petkov , David Hildenbrand , "H. Peter Anvin" , Ingo Molnar , "Liam R. Howlett" , Linus Torvalds , linux-arch@vger.kernel.org, linux-mm@kvack.org, Michal Hocko , Mike Rapoport , Peter Zijlstra , Rik van Riel , Suren Baghdasaryan , Thomas Gleixner , Vlastimil Babka , x86@kernel.org Subject: Re: [PATCH] smp: Add memory barrier before many-CPU IPIs Message-ID: References: <20261120224758.04F70CD8@davehans-spike.ostc.intel.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261120224758.04F70CD8@davehans-spike.ostc.intel.com> On Fri, Nov 20, 2026 at 02:47:58PM -0800, Dave Hansen wrote: > diff -puN include/linux/mm_types.h~ipi-mb2-generic include/linux/mm_types.h (Not sure what all this ~xxx stuff is not seen it before? Some quirk of git-format-patch or such?) > --- a/include/linux/mm_types.h~ipi-mb2-generic 2026-11-20 11:28:32.779744056 -0800 > +++ b/include/linux/mm_types.h 2026-11-20 11:28:32.785744556 -0800 > @@ -1514,7 +1514,19 @@ static inline void mm_init_cpumask(struc > cpumask_clear((struct cpumask *)cpu_bitmap); > } > > -/* Future-safe accessor for struct mm_struct's cpu_vm_mask. */ > +/* > + * mm_cpumask() - CPUs that may hold state derived from @mm (TLB entries, > + * cached per-mm context). Code that updates per-mm state and then notifies > + * the CPUs in the mask relies on: > + * > + * - A CPU sets its bit, then a full barrier, then reads that state or > + * loads @mm's page tables. Slight grammar tweaks (should read as 'relies on ...'): - A CPU setting its bit, then taking a full barrier, then reading that state or loading @mm's page tables. > + * - The updater has a full barrier between the update and reading the > + * mask. on_each_cpu_mask() and smp_call_function_many() provide it; > + * open-coded mask tests (e.g. "only this CPU?") must do it themselves. I think this can be tweaked for clarity as well as grammar fixed: - The updater taking a full barrier between the update and reading the mask. Some functions (e.g. on_each_cpu_mask() and smp_call_function_many()) do this for you, open-coded mask tests (e.g. only-this-CPU) must do this manually. > + * - An architecture that clears bits must revalidate that state when the > + * CPU sets its bit again. Similarly: - An architecture that clears bits revalidating that state when the CPU sets its bit again. > + */ > static inline cpumask_t *mm_cpumask(struct mm_struct *mm) > { > return (struct cpumask *)&mm->flexible_array; FWIW though adding a comment here is nice so with the tweaks: Reviewed-by: Lorenzo Stoakes (ARM) # mm bit -- Cheers, Lorenzo