All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: Dave Hansen <dave.hansen@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, Andy Lutomirski <luto@kernel.org>,
	 Borislav Petkov <bp@alien8.de>,
	David Hildenbrand <david@kernel.org>,
	 "H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
	 "Liam R. Howlett" <liam@infradead.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	 linux-arch@vger.kernel.org, linux-mm@kvack.org,
	Michal Hocko <mhocko@suse.com>,  Mike Rapoport <rppt@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	 Rik van Riel <riel@surriel.com>,
	Suren Baghdasaryan <surenb@google.com>,
	 Thomas Gleixner <tglx@kernel.org>,
	Vlastimil Babka <vbabka@kernel.org>,
	x86@kernel.org
Subject: Re: [PATCH] smp: Add memory barrier before many-CPU IPIs
Date: Tue, 1 Dec 2026 14:24:19 +0000	[thread overview]
Message-ID: <aw7U-b7i5dSPuHvv@gremlin> (raw)
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) <ljs@kernel.org> # mm bit

--
Cheers, Lorenzo

      reply	other threads:[~2026-12-01 14:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 22:47 [PATCH] smp: Add memory barrier before many-CPU IPIs Dave Hansen
2026-12-01 14:24 ` Lorenzo Stoakes (ARM) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aw7U-b7i5dSPuHvv@gremlin \
    --to=ljs@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=david@kernel.org \
    --cc=hpa@zytor.com \
    --cc=liam@infradead.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mhocko@suse.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=riel@surriel.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=tglx@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=vbabka@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.