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


Groups > linux.kernel > #1403640

Re: [RFC PATCH 03/15] Provide atomic_t functions implemented with ISO-C++11 atomics

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [RFC PATCH 03/15] Provide atomic_t functions implemented with ISO-C++11 atomics
Date 2016-05-19 13:00 +0200
Message-ID <rAtQm-73x-15@gated-at.bofh.it> (permalink)
References <rAdBU-584-21@gated-at.bofh.it> <rAbqp-3On-7@gated-at.bofh.it> <rAbqq-3On-21@gated-at.bofh.it> <rAsUh-6sS-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, May 19, 2016 at 10:52:19AM +0100, David Howells wrote:
> Peter Zijlstra <peterz@infradead.org> wrote:
> 
> > Does this generate 'sane' code for LL/SC archs? That is, a single LL/SC
> > loop and not a loop around an LL/SC cmpxchg.

> I think the code it generates should look something like:
> 
> 	test_atomic_add_unless:
> 	.L7:
> 		ldaxr	w1, [x0]		# __atomic_load_n()
> 		cmp	w1, 35			# } if (cur == unless)
> 		beq	.L4			# }     break
> 		add	w2, w1, 86		# new = cur + addend
> 		stlxr	w4, w2, [x0]
> 		cbnz	w4, .L7
> 	.L4:
> 		mov	w1, w0
> 		ret
> 
> but that requires the compiler to split up the LDAXR and STLXR instructions
> and render arbitrary code between.

Exactly.

> I suspect that might be quite a stretch.
> 
> I've opened:
> 
> 	https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71191
> 
> to cover this.

Thanks; until such time as this stretch has been made I don't see this
intrinsic stuff being much use on any of the LL/SC archs.

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


Thread

[RFC PATCH 03/15] Provide atomic_t functions implemented with  ISO-C++11 atomics David Howells <dhowells@redhat.com> - 2016-05-18 17:20 +0200
  Re: [RFC PATCH 03/15] Provide atomic_t functions implemented with  ISO-C++11 atomics Peter Zijlstra <peterz@infradead.org> - 2016-05-18 19:40 +0200
    Re: [RFC PATCH 03/15] Provide atomic_t functions implemented with  ISO-C++11 atomics David Woodhouse <dwmw2@infradead.org> - 2016-05-19 09:40 +0200
      Re: [RFC PATCH 03/15] Provide atomic_t functions implemented with  ISO-C++11 atomics Peter Zijlstra <peterz@infradead.org> - 2016-05-19 09:50 +0200
    Re: [RFC PATCH 03/15] Provide atomic_t functions implemented with ISO-C++11 atomics David Howells <dhowells@redhat.com> - 2016-05-19 12:00 +0200
      Re: [RFC PATCH 03/15] Provide atomic_t functions implemented with  ISO-C++11 atomics Peter Zijlstra <peterz@infradead.org> - 2016-05-19 13:00 +0200
        Re: [RFC PATCH 03/15] Provide atomic_t functions implemented with  ISO-C++11 atomics Peter Zijlstra <peterz@infradead.org> - 2016-05-19 13:40 +0200
        Re: [RFC PATCH 03/15] Provide atomic_t functions implemented with  ISO-C++11 atomics Peter Zijlstra <peterz@infradead.org> - 2016-05-19 13:40 +0200
        Re: [RFC PATCH 03/15] Provide atomic_t functions implemented with  ISO-C++11 atomics "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-05-19 16:30 +0200
          Re: [RFC PATCH 03/15] Provide atomic_t functions implemented with  ISO-C++11 atomics Peter Zijlstra <peterz@infradead.org> - 2016-05-19 16:50 +0200
            Re: [RFC PATCH 03/15] Provide atomic_t functions implemented with  ISO-C++11 atomics "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-05-19 17:10 +0200
              Re: [RFC PATCH 03/15] Provide atomic_t functions implemented with  ISO-C++11 atomics Michael Ellerman <mpe@ellerman.id.au> - 2016-05-20 11:40 +0200
                Re: [RFC PATCH 03/15] Provide atomic_t functions implemented with  ISO-C++11 atomics "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-05-23 20:40 +0200
  Re: [RFC PATCH 03/15] Provide atomic_t functions implemented with  ISO-C++11 atomics Peter Zijlstra <peterz@infradead.org> - 2016-05-18 19:40 +0200
  Re: [RFC PATCH 03/15] Provide atomic_t functions implemented with  ISO-C++11 atomics Peter Zijlstra <peterz@infradead.org> - 2016-05-18 19:40 +0200

csiph-web