public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat•com>
To: Peter Zijlstra <peterz@infradead•org>
Cc: geert+renesas@glider•be, tony@atomide•com,
	linus.walleij@linaro•org, dave.hansen@linux•intel.com,
	Yair Podemsky <ypodemsk@redhat•com>,
	sebastian.reichel@collabora•com, linux-mm@kvack•org,
	hpa@zytor•com, sparclinux@vger•kernel.org,
	agordeev@linux•ibm.com, will@kernel•org, ardb@kernel•org,
	linux-arch@vger•kernel.org, linux-s390@vger•kernel.org,
	vschneid@redhat•com, arnd@arndb•de, paulmck@kernel•org,
	aneesh.kumar@linux•ibm.com, x86@kernel•org,
	linux@armlinux•org.uk, mingo@redhat•com, samitolvanen@google•com,
	borntraeger@linux•ibm.com, hca@linux•ibm.com,
	keescook@chromium•org, gor@linux•ibm.com,
	Frederic Weisbecker <frederic@kernel•org>,
	npiggin@gmail•com, rmk+kernel@armlinux•org.uk, bp@alien8•de,
	nick.hawkins@hpe•com, tglx@linutronix•de, jpoimboe@kernel•org,
	linux-arm-kernel@lists•infradead.org, alougovs@redhat•com,
	linux-kernel@vger•kernel.org, juerg.haefliger@canonical•com,
	svens@linux•ibm.com, dhildenb@redhat•com,
	akpm@linux-foundation•org, linuxppc-dev@lists•ozlabs.org,
	davem@da vemloft.net
Subject: Re: [PATCH 3/3] mm/mmu_gather: send tlb_remove_table_smp_sync IPI only to CPUs in kernel mode
Date: Thu, 6 Apr 2023 09:38:50 -0300	[thread overview]
Message-ID: <ZC69Wmqjdwk+I8kn@tpad> (raw)
In-Reply-To: <20230405195226.GB365912@hirez.programming.kicks-ass.net>

On Wed, Apr 05, 2023 at 09:52:26PM +0200, Peter Zijlstra wrote:
> On Wed, Apr 05, 2023 at 04:45:32PM -0300, Marcelo Tosatti wrote:
> > On Wed, Apr 05, 2023 at 01:10:07PM +0200, Frederic Weisbecker wrote:
> > > On Wed, Apr 05, 2023 at 12:44:04PM +0200, Frederic Weisbecker wrote:
> > > > On Tue, Apr 04, 2023 at 04:42:24PM +0300, Yair Podemsky wrote:
> > > > > +	int state = atomic_read(&ct->state);
> > > > > +	/* will return true only for cpus in kernel space */
> > > > > +	return state & CT_STATE_MASK == CONTEXT_KERNEL;
> > > > > +}
> > > > 
> > > > Also note that this doesn't stricly prevent userspace from being interrupted.
> > > > You may well observe the CPU in kernel but it may receive the IPI later after
> > > > switching to userspace.
> > > > 
> > > > We could arrange for avoiding that with marking ct->state with a pending work bit
> > > > to flush upon user entry/exit but that's a bit more overhead so I first need to
> > > > know about your expectations here, ie: can you tolerate such an occasional
> > > > interruption or not?
> > > 
> > > Bah, actually what can we do to prevent from that racy IPI? Not much I fear...
> > 
> > Use a different mechanism other than an IPI to ensure in progress
> > __get_free_pages_fast() has finished execution.
> > 
> > Isnt this codepath slow path enough that it can use
> > synchronize_rcu_expedited?
> 
> To actually hit this path you're doing something really dodgy.

Apparently khugepaged is using the same infrastructure:

$ grep tlb_remove_table khugepaged.c 
	tlb_remove_table_sync_one();
	tlb_remove_table_sync_one();

So just enabling khugepaged will hit that path.


  reply	other threads:[~2023-04-06 13:18 UTC|newest]

Thread overview: 36+ 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 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 [this message]
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=ZC69Wmqjdwk+I8kn@tpad \
    --to=mtosatti@redhat$(echo .)com \
    --cc=agordeev@linux$(echo .)ibm.com \
    --cc=akpm@linux-foundation$(echo .)org \
    --cc=alougovs@redhat$(echo .)com \
    --cc=aneesh.kumar@linux$(echo .)ibm.com \
    --cc=ardb@kernel$(echo .)org \
    --cc=arnd@arndb$(echo .)de \
    --cc=borntraeger@linux$(echo .)ibm.com \
    --cc=bp@alien8$(echo .)de \
    --cc=dave.hansen@linux$(echo .)intel.com \
    --cc=davem@da \
    --cc=dhildenb@redhat$(echo .)com \
    --cc=frederic@kernel$(echo .)org \
    --cc=geert+renesas@glider$(echo .)be \
    --cc=gor@linux$(echo .)ibm.com \
    --cc=hca@linux$(echo .)ibm.com \
    --cc=hpa@zytor$(echo .)com \
    --cc=jpoimboe@kernel$(echo .)org \
    --cc=juerg.haefliger@canonical$(echo .)com \
    --cc=keescook@chromium$(echo .)org \
    --cc=linus.walleij@linaro$(echo .)org \
    --cc=linux-arch@vger$(echo .)kernel.org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-mm@kvack$(echo .)org \
    --cc=linux-s390@vger$(echo .)kernel.org \
    --cc=linux@armlinux$(echo .)org.uk \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=mingo@redhat$(echo .)com \
    --cc=nick.hawkins@hpe$(echo .)com \
    --cc=npiggin@gmail$(echo .)com \
    --cc=paulmck@kernel$(echo .)org \
    --cc=peterz@infradead$(echo .)org \
    --cc=rmk+kernel@armlinux$(echo .)org.uk \
    --cc=samitolvanen@google$(echo .)com \
    --cc=sebastian.reichel@collabora$(echo .)com \
    --cc=sparclinux@vger$(echo .)kernel.org \
    --cc=svens@linux$(echo .)ibm.com \
    --cc=tglx@linutronix$(echo .)de \
    --cc=tony@atomide$(echo .)com \
    --cc=vschneid@redhat$(echo .)com \
    --cc=will@kernel$(echo .)org \
    --cc=x86@kernel$(echo .)org \
    --cc=ypodemsk@redhat$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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