public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Cc: "linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"Vineet.Gupta1@synopsys.com" <Vineet.Gupta1@synopsys.com>,
	"linux-snps-arc@lists.infradead.org"
	<linux-snps-arc@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: arc_usr_cmpxchg and preemption
Date: Fri, 16 Mar 2018 08:55:08 +0100	[thread overview]
Message-ID: <20180316075508.GY4043@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <1521140611.6358.29.camel@synopsys.com>

On Thu, Mar 15, 2018 at 07:03:32PM +0000, Alexey Brodkin wrote:
> > I think there's a bunch of architectures that are in the same boat.
> > m68k, arm, mips was mentioned. Sure, the moment an arch has hardware
> > support you don't need the syscall anymore.
> 
> Here's a brief analysis:
> ARM:  Looks like they got rid of that stuff in v4.4, see
>       commit db695c0509d6 ("ARM: remove user cmpxchg syscall").

Oh shiny, that's why I couldn't find it. I had distinct memories of them
having one though.

> M68K: That's even uglier implementation which is really asking for
>       a facelift, look at sys_atomic_cmpxchg_32() here:
>       https://elixir.bootlin.com/linux/latest/source/arch/m68k/kernel/sys_m68k.c#L461

Yes, I found that code, it's something special allright.

> MIPS: They do it via special sysmips syscall which among other things
>       might handle MIPS_ATOMIC_SET with mips_atomic_set()
> 
> I don't immediately see if there're others but really I'm not sure if it even worth trying to
> clean-up all that since efforts might be spent pointlessly.
> 
> > I was just thinking it would be good to have a common implementation (if
> > possible) rather than 4-5 different copies of basically the same thing.
> 
> From above I would conclude that only M68K might benefit from new
> library implementation. BTW M68K uses a bit different ABI compared to
> ARC for that syscall so it will be really atomic_cmpxchg_32()
> libfunction called from those syscalls, but now I think that's exactly
> what you meant initially, correct?

Right. In any case, I won't insist, but if it's very little effort, it
might well be worth getting rid of that m68k magic.

WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz@infradead.org>
To: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Cc: "Vineet.Gupta1@synopsys.com" <Vineet.Gupta1@synopsys.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"linux-snps-arc@lists.infradead.org"
	<linux-snps-arc@lists.infradead.org>
Subject: Re: arc_usr_cmpxchg and preemption
Date: Fri, 16 Mar 2018 08:55:08 +0100	[thread overview]
Message-ID: <20180316075508.GY4043@hirez.programming.kicks-ass.net> (raw)
Message-ID: <20180316075508.d7XCoFqLNRW25WwRI3xSSBITAImQonymV8SUfAdGo1c@z> (raw)
In-Reply-To: <1521140611.6358.29.camel@synopsys.com>

On Thu, Mar 15, 2018 at 07:03:32PM +0000, Alexey Brodkin wrote:
> > I think there's a bunch of architectures that are in the same boat.
> > m68k, arm, mips was mentioned. Sure, the moment an arch has hardware
> > support you don't need the syscall anymore.
> 
> Here's a brief analysis:
> ARM:  Looks like they got rid of that stuff in v4.4, see
>       commit db695c0509d6 ("ARM: remove user cmpxchg syscall").

Oh shiny, that's why I couldn't find it. I had distinct memories of them
having one though.

> M68K: That's even uglier implementation which is really asking for
>       a facelift, look at sys_atomic_cmpxchg_32() here:
>       https://elixir.bootlin.com/linux/latest/source/arch/m68k/kernel/sys_m68k.c#L461

Yes, I found that code, it's something special allright.

> MIPS: They do it via special sysmips syscall which among other things
>       might handle MIPS_ATOMIC_SET with mips_atomic_set()
> 
> I don't immediately see if there're others but really I'm not sure if it even worth trying to
> clean-up all that since efforts might be spent pointlessly.
> 
> > I was just thinking it would be good to have a common implementation (if
> > possible) rather than 4-5 different copies of basically the same thing.
> 
> From above I would conclude that only M68K might benefit from new
> library implementation. BTW M68K uses a bit different ABI compared to
> ARC for that syscall so it will be really atomic_cmpxchg_32()
> libfunction called from those syscalls, but now I think that's exactly
> what you meant initially, correct?

Right. In any case, I won't insist, but if it's very little effort, it
might well be worth getting rid of that m68k magic.

  parent reply	other threads:[~2018-03-16  7:55 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1521045375.11552.27.camel@synopsys.com>
2018-03-14 16:58 ` arc_usr_cmpxchg and preemption Vineet Gupta
2018-03-14 16:58   ` Vineet Gupta
2018-03-14 17:53   ` Peter Zijlstra
2018-03-14 17:53     ` Peter Zijlstra
2018-03-14 18:20     ` Peter Zijlstra
2018-03-14 18:20       ` Peter Zijlstra
2018-03-14 20:38     ` Alexey Brodkin
2018-03-14 20:38       ` Alexey Brodkin
2018-03-14 20:55       ` Vineet Gupta
2018-03-14 20:55         ` Vineet Gupta
2018-03-15  8:18       ` Peter Zijlstra
2018-03-15  8:18         ` Peter Zijlstra
2018-03-15  9:12         ` Alexey Brodkin
2018-03-15  9:12           ` Alexey Brodkin
2018-03-15 11:28           ` Peter Zijlstra
2018-03-15 11:28             ` Peter Zijlstra
2018-03-15 19:03             ` Alexey Brodkin
2018-03-15 19:03               ` Alexey Brodkin
2018-03-16  7:55               ` Peter Zijlstra [this message]
2018-03-16  7:55                 ` Peter Zijlstra
2018-03-16 18:12               ` Max Filippov
2018-03-16 18:12                 ` Max Filippov
2018-03-16 17:33     ` Alexey Brodkin
2018-03-16 17:33       ` Alexey Brodkin
2018-03-16 17:54       ` Vineet Gupta
2018-03-16 17:54         ` Vineet Gupta
2018-03-16 17:58         ` Peter Zijlstra
2018-03-16 17:58           ` Peter Zijlstra

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=20180316075508.GY4043@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=Alexey.Brodkin@synopsys.com \
    --cc=Vineet.Gupta1@synopsys.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.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