linux-parisc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Helge Deller <deller@gmx.de>,
	John David Anglin <dave.anglin@bell.net>,
	linux-parisc@vger.kernel.org
Subject: Re: [PATCH] parisc: use per-pagetable spinlock
Date: Sun, 7 Apr 2019 13:23:55 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LRH.2.02.1904071319480.29323@file01.intranet.prod.int.rdu2.redhat.com> (raw)
In-Reply-To: <1554605295.5053.17.camel@HansenPartnership.com>



On Sat, 6 Apr 2019, James Bottomley wrote:

> On Sat, 2019-04-06 at 22:15 +0200, Helge Deller wrote:
> > On 06.04.19 21:49, James Bottomley wrote:
> > > On Sat, 2019-04-06 at 15:36 -0400, Mikulas Patocka wrote:
> > > > Parisc uses a global spinlock to protect pagetable updates in the
> > > > TLB
> > > > fault handlers. When multiple cores are taking TLB faults
> > > > simultaneously, the cache line containing the spinlock becomes a
> > > > bottleneck.
> > > 
> > > You can't do this.  As the comment in cache.c says: the lock is to
> > > protect the merced bus, which runs between the CPUs on some
> > > systems.
> > > That means it must be a single, global lock.  Of course, on systems
> > > without a merced bus, we don't need the lock at all, so runtime
> > > patching might be usable to fix that case.
> > 
> > Is there a way to detect if a system has the Merced bus?
> > 
> > See arch/parisc/include/asm/tlbflush.h too:
> > /* This is for the serialisation of PxTLB broadcasts.  At least on
> > the
> >  * N class systems, only one PxTLB inter processor broadcast can be
> >  * active at any one time on the Merced bus.  This tlb purge
> >  * synchronisation is fairly lightweight and harmless so we activate
> >  * it on all systems not just the N class.
> > 
> > 30% speed improvement by Mikulas patches don't seem lightweight...
> 
> Well, that's because when it was originally conceived the patch was
> only about purging.  It never actually involved the TLB insertion hot
> path.  It turns out the entanglement occurred here:
> 
> commit 01ab60570427caa24b9debc369e452e86cd9beb4
> Author: John David Anglin <dave.anglin@bell.net>
> Date:   Wed Jul 1 17:18:37 2015 -0400
> 
>     parisc: Fix some PTE/TLB race conditions and optimize
> __flush_tlb_range based on timing results
>  
> 
> Which is when the dbit lock got replaced by the tlb purge lock.  I have
> some vague memories about why we needed the dbit lock which I'll try to
> make more coherent.
> 
> James

Before this patch, it used pa_dbit_lock for modifying pagetables and 
pa_tlb_lock for flushing.

So it still suffered the performance penalty with shared pa_dbit_lock.

Perhaps the proper thing would be to use global pa_tlb_lock for flushing 
and per-process tlb lock for pagetable updates.

Mikulas

  reply	other threads:[~2019-04-07 17:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-06 19:36 [PATCH] parisc: use per-pagetable spinlock Mikulas Patocka
2019-04-06 19:49 ` James Bottomley
2019-04-06 20:13   ` Mikulas Patocka
2019-04-06 20:32     ` James Bottomley
2019-04-06 20:40       ` Mikulas Patocka
2019-04-06 21:28         ` James Bottomley
2019-04-07 17:07           ` Mikulas Patocka
2019-04-10 15:05         ` John David Anglin
2019-04-10 16:09           ` Mikulas Patocka
     [not found]             ` <e81cc4d8-0da9-454b-6102-c89bb5cdd0b0@bell.net>
2019-04-11 13:18               ` John David Anglin
2019-04-06 20:15   ` Helge Deller
2019-04-07  2:48     ` James Bottomley
2019-04-07 17:23       ` Mikulas Patocka [this message]
2019-04-07 17:42         ` James Bottomley
2019-04-10 19:10   ` John David Anglin
2019-04-10 19:27     ` John David Anglin
2019-04-13 16:23       ` Helge Deller
2019-04-13 17:57         ` John David Anglin

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=alpine.LRH.2.02.1904071319480.29323@file01.intranet.prod.int.rdu2.redhat.com \
    --to=mpatocka@redhat.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=dave.anglin@bell.net \
    --cc=deller@gmx.de \
    --cc=linux-parisc@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).