Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1723534

Re: [PATCH v2] membarrier: provide register sync core cmd

From Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] membarrier: provide register sync core cmd
Date 2017-08-30 19:40 +0200
Message-ID <ukf86-2PE-25@gated-at.bofh.it> (permalink)
References <ujcOZ-4mU-1@gated-at.bofh.it> <ujeH7-5GI-1@gated-at.bofh.it> <ujiB3-8J-5@gated-at.bofh.it> <uk3qh-44H-1@gated-at.bofh.it> <ukctz-16f-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


----- On Aug 30, 2017, at 10:46 AM, Paul E. McKenney paulmck@linux.vnet.ibm.com wrote:

> On Tue, Aug 29, 2017 at 10:01:56PM -0700, Andy Lutomirski wrote:
>> > On Aug 27, 2017, at 8:05 PM, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> > wrote:
>> >
>> > ----- On Aug 27, 2017, at 3:53 PM, Andy Lutomirski luto@amacapital.net wrote:
>> >
>> >>> On Aug 27, 2017, at 1:50 PM, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> >>> wrote:
>> >>>
>> >>> Add a new MEMBARRIER_CMD_REGISTER_SYNC_CORE command to the membarrier
>> >>> system call. It allows processes to register their intent to have their
>> >>> threads issue core serializing barriers in addition to memory barriers
>> >>> whenever a membarrier command is performed.
>> >>>
>> >>
>> >> Why is this stateful?  That is, why not just have a new membarrier command to
>> >> sync every thread's icache?
>> >
>> > If we'd do it on every CPU icache, it would be as trivial as you say. The
>> > concern here is sending IPIs only to CPUs running threads that belong to the
>> > same process, so we don't disturb unrelated processes.
>> >
>> > If we could just grab each CPU's runqueue lock, it would be fairly simple
>> > to do. But we want to avoid hitting each runqueue with exclusive atomic
>> > access associated with grabbing the lock. (cache-line bouncing)
>> 
>> Hmm.  Are there really arches where there is no clean implementation
>> without this hacker?  It seems rather unfortunate that munmap() can be
>> done efficiently but this barrier can't be.
>> 
>> At the very least, could there be a register command *and* a special
>> sync command?  I dislike the idea that the sync command does something
>> different depending on some other state.  Even better (IMO) would be a
>> design where you ask for an isync and, if the arch can do it
>> efficiently (x86), you get an efficient isync and, if the arch can't
>> (arm64?) you take all the rq locks?
> 
> In some cases I suspect that IPIs might be required.  Regardless of
> that, we might well need to provide a way for architectures to do
> special things.
> 
> But I must defer to Mathieu on this.

Yes, I think you are both correct. It's better to expose a new command
for code sync, so architectures have more freedom in how they choose to
implement it.

Thanks,

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] membarrier: provide register sync core cmd Mathieu Desnoyers <mathieu.desnoyers@efficios.com> - 2017-08-27 23:00 +0200
  Re: [PATCH v2] membarrier: provide register sync core cmd Andy Lutomirski <luto@amacapital.net> - 2017-08-28 01:00 +0200
    Re: [PATCH v2] membarrier: provide register sync core cmd Mathieu Desnoyers <mathieu.desnoyers@efficios.com> - 2017-08-28 05:10 +0200
      Re: [PATCH v2] membarrier: provide register sync core cmd Andy Lutomirski <luto@amacapital.net> - 2017-08-30 07:10 +0200
        Re: [PATCH v2] membarrier: provide register sync core cmd "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-08-30 16:50 +0200
          Re: [PATCH v2] membarrier: provide register sync core cmd Mathieu Desnoyers <mathieu.desnoyers@efficios.com> - 2017-08-30 19:40 +0200
      Re: [PATCH v2] membarrier: provide register sync core cmd Will Deacon <will.deacon@arm.com> - 2017-08-31 19:10 +0200
  Re: [PATCH v2] membarrier: provide register sync core cmd Boqun Feng <boqun.feng@gmail.com> - 2017-08-30 06:10 +0200
    Re: [PATCH v2] membarrier: provide register sync core cmd Mathieu Desnoyers <mathieu.desnoyers@efficios.com> - 2017-08-30 19:30 +0200

csiph-web