All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Cc: Noam Camus <noamc@ezchip.com>, Andi Kleen <andi@firstfloor.org>,
	Alexey Brodkin <Alexey.Brodkin@synopsys.com>,
	Gilad Ben Yossef <giladb@ezchip.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-perf-users@vger.kernel.org"
	<linux-perf-users@vger.kernel.org>,
	"dvhart@linux.intel.com" <dvhart@linux.intel.com>,
	"dsahern@gmail.com" <dsahern@gmail.com>,
	"acme@redhat.com" <acme@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [RFC] perf: fix building for ARCv1
Date: Tue, 20 Oct 2015 12:11:33 +0200	[thread overview]
Message-ID: <20151020101133.GA17308@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <C2D7FE5348E1B147BCA15975FBA23075F44CB43D@IN01WEMBXA.internal.synopsys.com>

On Tue, Oct 20, 2015 at 08:00:46AM +0000, Vineet Gupta wrote:
> On Monday 19 October 2015 03:22 PM, Peter Zijlstra wrote:
> > On Mon, Oct 19, 2015 at 09:46:35AM +0000, Vineet Gupta wrote:
> >> On ARC we could use the atomic EXchange to implement a user space only binary
> >> semaphore - these atomic ops will be small duration so it is OK to spin wait for a
> >> little bit. That's how the old pthread library worked for ARC w/o any atomic support.
> > That has the obvious problem of lock-holder-preemption and the horrible
> > performance issues that result from that.
> >
> > I think the syscall at least has deterministic behaviour, whereas that
> > userspace spin loop has this abysmal worst case thing.
> 
> I don't have issue with adding the syscall per-se. But that comes with it's own
> headaches of ABI change - more importantly it requires several things to match,
> libc, kernel...  It would be easier if change was confined to say perf.

OTOH fixing all those would get you a 'sane' system :-)

> Can we use existing syscall(s) - again this is what our good old pthread library
> code did.
> 
> static void __pthread_acquire(int * spinlock)
> {
>   int cnt = 0;
>   struct timespec tm;
> 
>   READ_MEMORY_BARRIER();
> 
>   while (testandset(spinlock)) {   <---- atomic EXchange
>     if (cnt < 50) {
>       sched_yield();
>       cnt++;
>     } else {
>       tm.tv_sec = 0;
>       tm.tv_nsec = 2000001;
>       nanosleep(&tm, ((void *)0));
>       cnt = 0;
>     }
>   }

*shudder* that is quite horrible.

This means all your 'atomics' are broken for anything SCHED_FIFO and the
like. You simply _cannot_ run a realtime system.

(also, for ACQUIRE you want the READ_MEMORY_BARRIER() _after_ the
test-and-set control dependency.)

But its your arch..

  reply	other threads:[~2015-10-20 10:11 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1445088959-3058-1-git-send-email-abrodkin@synopsys.com>
2015-10-17 14:19 ` [RFC] perf: fix building for ARCv1 Vineet Gupta
2015-10-18 11:15   ` Alexey Brodkin
2015-10-18 11:15     ` Alexey Brodkin
2015-10-18 23:14     ` Andi Kleen
2015-10-18 23:14       ` Andi Kleen
2015-10-19  4:58       ` Vineet Gupta
2015-10-19  5:49         ` Andi Kleen
2015-10-19  5:49           ` Andi Kleen
2015-10-19  9:28           ` Vineet Gupta
2015-10-19  9:35             ` Peter Zijlstra
2015-10-19  9:46               ` Vineet Gupta
2015-10-19  9:51                 ` Peter Zijlstra
2015-10-19 10:04                   ` Vineet Gupta
2015-10-20  8:00                   ` Vineet Gupta
2015-10-20 10:11                     ` Peter Zijlstra [this message]
2015-10-20 10:45                       ` Vineet Gupta
2015-10-29 15:58                         ` Alexey Brodkin
2015-10-29 15:58                           ` Alexey Brodkin
2015-10-29 15:58                           ` Alexey Brodkin
2015-10-30  6:19                           ` Vineet Gupta
2015-10-30  6:19                             ` Vineet Gupta
2016-02-03 16:20                             ` Alexey Brodkin
2016-02-03 16:20                               ` Alexey Brodkin
     [not found]                             ` <1454516455.2811.4.camel__10775.5710989752$1454516490$gmane$org@synopsys.com>
2016-02-04  4:13                               ` Vineet Gupta
2016-02-04  4:13                                 ` Vineet Gupta
2016-02-04  4:13                                 ` Vineet Gupta
2016-02-05 11:18                                 ` Noam Camus
2016-02-05 11:18                                   ` Noam Camus
2016-02-05 16:10                                   ` acme
2016-02-05 16:10                                     ` acme
2016-02-10  3:09                                     ` Vineet Gupta
2016-02-10  3:09                                       ` Vineet Gupta
2016-10-18 18:58               ` Vineet Gupta
2016-10-18 18:58                 ` Vineet Gupta
2016-10-24 16:17                 ` [PATCH-v2] ARC: syscall for userspace cmpxchg assist Vineet Gupta
2016-10-24 16:17                   ` Vineet Gupta
2016-11-04 20:16                   ` Vineet Gupta
2016-11-04 20:16                     ` Vineet Gupta
2016-11-07 18:50                     ` [PATCH] ARC: tweak semantics of " Vineet Gupta
2016-11-07 18:50                       ` Vineet Gupta
2015-10-30  6:21 ` [RFC] perf: fix building for ARCv1 Vineet Gupta
2015-10-30  6:21   ` Vineet Gupta

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=20151020101133.GA17308@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=Alexey.Brodkin@synopsys.com \
    --cc=Vineet.Gupta1@synopsys.com \
    --cc=acme@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=dsahern@gmail.com \
    --cc=dvhart@linux.intel.com \
    --cc=giladb@ezchip.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=noamc@ezchip.com \
    --cc=tglx@linutronix.de \
    /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.