From: Hillf Danton <hdanton@sina.com>
To: Yair Podemsky <ypodemsk@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
npiggin@gmail.com, dave.hansen@linux.intel.com, will@kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
dhildenb@redhat.com, Frederic Weisbecker <fweisbec@gmail.com>
Subject: Re: [PATCH 3/3] mm/mmu_gather: send tlb_remove_table_smp_sync IPI only to CPUs in kernel mode
Date: Wed, 5 Apr 2023 08:53:07 +0800 [thread overview]
Message-ID: <20230405005307.675-1-hdanton@sina.com> (raw)
In-Reply-To: <20230404160038.GB38236@hirez.programming.kicks-ass.net>
On Tue, 4 Apr 2023 18:00:38 +0200 Peter Zijlstra <peterz@infradead.org>
> On Tue, Apr 04, 2023 at 05:12:17PM +0200, Peter Zijlstra wrote:
> > > case 2:
> > > CPU-A CPU-B
> > >
> > > modify pagetables
> > > tlb_flush (memory barrier)
> > > state == CONTEXT_USER
> > > int state = atomic_read(&ct->state);
> > > Kernel-enter:
> > > state == CONTEXT_KERNEL
> > > READ(pagetable values)
> > > if (state & CT_STATE_MASK == CONTEXT_USER)
> > >
>
> Hmm, hold up; what about memory ordering, we need a store-load ordering
> between the page-table write and the context trackng load, and a
> store-load order on the context tracking update and software page-table
> walker loads.
>
> Now, iirc page-table modification is done under pte_lock (or
> page_table_lock) and that only provides a RELEASE barrier on this end,
> which is insufficient to order against a later load.
>
> Is there anything else?
Hmm Yair could you specify what you meant by the memory barrier after tlb_flush
in the diagram above?
>
> On the state tracking side, we have ct_state_inc() which is
> atomic_add_return() which should provide full barrier and is sufficient.
next prev parent reply other threads:[~2023-04-05 0:53 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-04 13:42 [PATCH 0/3] send tlb_remove_table_smp_sync IPI only to necessary CPUs Yair Podemsky
2023-04-04 13:42 ` [PATCH 1/3] arch: Introduce ARCH_HAS_CPUMASK_BITS Yair Podemsky
2023-04-04 13:47 ` David Hildenbrand
2023-04-04 13:42 ` [PATCH 2/3] mm/mmu_gather: send tlb_remove_table_smp_sync IPI only to MM CPUs Yair Podemsky
2023-04-04 14:57 ` Peter Zijlstra
2023-04-04 13:42 ` [PATCH 3/3] mm/mmu_gather: send tlb_remove_table_smp_sync IPI only to CPUs in kernel mode Yair Podemsky
2023-04-04 14:03 ` David Hildenbrand
2023-04-04 15:12 ` Peter Zijlstra
2023-04-04 16:00 ` Peter Zijlstra
2023-04-05 0:53 ` Hillf Danton [this message]
2023-04-05 10:43 ` Frederic Weisbecker
2023-04-05 11:10 ` Frederic Weisbecker
2023-04-05 11:41 ` Peter Zijlstra
2023-04-05 12:00 ` David Hildenbrand
2023-04-05 12:05 ` Frederic Weisbecker
2023-04-05 12:31 ` Frederic Weisbecker
2023-04-05 12:45 ` Valentin Schneider
2023-04-06 13:38 ` Peter Zijlstra
2023-04-06 14:11 ` Valentin Schneider
2023-04-06 14:39 ` Peter Zijlstra
2023-04-05 19:45 ` Marcelo Tosatti
2023-04-05 19:52 ` Peter Zijlstra
2023-04-06 12:38 ` Marcelo Tosatti
2023-04-06 13:29 ` Peter Zijlstra
2023-04-06 14:04 ` Peter Zijlstra
2023-04-06 14:42 ` David Hildenbrand
2023-04-06 15:06 ` Peter Zijlstra
2023-04-06 15:02 ` Peter Zijlstra
2023-04-06 15:51 ` David Hildenbrand
2023-04-06 18:27 ` Peter Zijlstra
2023-04-19 11:30 ` David Hildenbrand
2023-04-19 11:39 ` Marcelo Tosatti
2023-04-05 19:43 ` Marcelo Tosatti
2023-04-05 19:54 ` Peter Zijlstra
2023-04-06 12:49 ` Marcelo Tosatti
2023-04-06 13:32 ` Peter Zijlstra
2023-04-19 11:01 ` Marcelo Tosatti
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=20230405005307.675-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=dave.hansen@linux.intel.com \
--cc=dhildenb@redhat.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=npiggin@gmail.com \
--cc=peterz@infradead.org \
--cc=will@kernel.org \
--cc=ypodemsk@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox