mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: musl@lists.openwall.com
Subject: Re: [PATCH] Use CAS instead of atomic swap to implement spinlock
Date: Sun, 19 Apr 2015 14:46:05 +0200	[thread overview]
Message-ID: <20150419124605.GO2875@port70.net> (raw)
In-Reply-To: <20150419060132.GN6817@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 981 bytes --]

* Rich Felker <dalias@libc.org> [2015-04-19 02:01:32 -0400]:
> On Sun, Apr 19, 2015 at 08:50:18AM +0300, Alexander Monakov wrote:
> > On Sat, 18 Apr 2015, Rich Felker wrote:
> > > 
> > > while (*(volatile int *)s || a_cas(s, 0, 1)) a_spin();
> > 
> > I think so, Yes.  Is the cast required, or is it possible to change the
> > pthread_spinlock_t typedef to 'volatile int'?
> 
> For C++ ABI purposes, I think switching to volatile int would be a
> different type. :(
> 
> I wouldn't really be opposed to changing it for C and just having the
> ABI-compat type used when __cplusplus is defined. We already do that
> for pthread_t.
> 

btw pthread_spinlock_t is volatile int in glibc,
i didnt catch this abi diff earlier because it only matters when used
as a pointer

now changed my abi checks for all type T to do

 void x_T(T x, T* ptr, size(*y)[sizeof(T)], align(*z)[__alignof__(T)]){}

but i found no other case with qualifier differences
(updated x86_64 abi diffs are attached)

[-- Attachment #2: abi.x86_64.diff --]
[-- Type: text/x-diff, Size: 4079 bytes --]

--- abi.x86_64.glibc
+++ abi.x86_64.musl
@@ -2 +2 @@
-x_CODE(_code, _code*, size (*) [16], align (*) [8])
+x_CODE(CODE, CODE*, size (*) [16], align (*) [8])
@@ -69 +69 @@
-x___jmp_buf(long*, long (*) [8], size (*) [64], align (*) [8])
+x___jmp_buf(unsigned long*, unsigned long (*) [8], size (*) [64], align (*) [8])
@@ -97 +97 @@
-x_cmsghdr(cmsghdr, cmsghdr*, size (*) [16], align (*) [8])
+x_cmsghdr(cmsghdr, cmsghdr*, size (*) [16], align (*) [4])
@@ -100 +100 @@
-x_crypt_data(crypt_data, crypt_data*, size (*) [131232], align (*) [8])
+x_crypt_data(crypt_data, crypt_data*, size (*) [260], align (*) [4])
@@ -121,2 +121,2 @@
-x_ether_header(ether_header, ether_header*, size (*) [14], align (*) [1])
-x_ethhdr(ethhdr, ethhdr*, size (*) [14], align (*) [1])
+x_ether_header(ether_header, ether_header*, size (*) [14], align (*) [2])
+x_ethhdr(ethhdr, ethhdr*, size (*) [14], align (*) [2])
@@ -127 +127 @@
-x_fd_mask(long, long*, size (*) [8], align (*) [8])
+x_fd_mask(unsigned long, unsigned long*, size (*) [8], align (*) [8])
@@ -135 +135 @@
-x_fpregset_t(_libc_fpstate*, _libc_fpstate**, size (*) [8], align (*) [8])
+x_fpregset_t(_fpstate*, _fpstate**, size (*) [8], align (*) [8])
@@ -180,2 +180,2 @@
-x_int_fast16_t(long, long*, size (*) [8], align (*) [8])
-x_int_fast32_t(long, long*, size (*) [8], align (*) [8])
+x_int_fast16_t(int, int*, size (*) [4], align (*) [4])
+x_int_fast32_t(int, int*, size (*) [4], align (*) [4])
@@ -218 +218 @@
-x_lastlog(lastlog, lastlog*, size (*) [292], align (*) [4])
+x_lastlog(lastlog, lastlog*, size (*) [296], align (*) [8])
@@ -281 +281 @@
-x_ntptimeval(ntptimeval, ntptimeval*, size (*) [72], align (*) [8])
+x_ntptimeval(ntptimeval, ntptimeval*, size (*) [32], align (*) [8])
@@ -307,2 +307,2 @@
-x_pthread_rwlockattr_t(pthread_rwlockattr_t, pthread_rwlockattr_t*, size (*) [8], align (*) [8])
-x_pthread_spinlock_t(int, int volatile*, size (*) [4], align (*) [4])
+x_pthread_rwlockattr_t(pthread_rwlockattr_t, pthread_rwlockattr_t*, size (*) [8], align (*) [4])
+x_pthread_spinlock_t(int, int*, size (*) [4], align (*) [4])
@@ -312 +312 @@
-x_quad_t(long, long*, size (*) [8], align (*) [8])
+x_quad_t(long long, long long*, size (*) [8], align (*) [8])
@@ -317,2 +317,2 @@
-x_regmatch_t(regmatch_t, regmatch_t*, size (*) [8], align (*) [4])
-x_regoff_t(int, int*, size (*) [4], align (*) [4])
+x_regmatch_t(regmatch_t, regmatch_t*, size (*) [16], align (*) [8])
+x_regoff_t(long, long*, size (*) [8], align (*) [8])
@@ -321 +321 @@
-x_rlim_t(unsigned long, unsigned long*, size (*) [8], align (*) [8])
+x_rlim_t(unsigned long long, unsigned long long*, size (*) [8], align (*) [8])
@@ -327 +327 @@
-x_rusage(rusage, rusage*, size (*) [144], align (*) [8])
+x_rusage(rusage, rusage*, size (*) [272], align (*) [8])
@@ -329,2 +329,2 @@
-x_sched_param(sched_param, sched_param*, size (*) [4], align (*) [4])
-x_sem_t(sem_t, sem_t*, size (*) [32], align (*) [8])
+x_sched_param(sched_param, sched_param*, size (*) [48], align (*) [8])
+x_sem_t(sem_t, sem_t*, size (*) [32], align (*) [4])
@@ -383 +383 @@
-x_sysinfo(sysinfo, sysinfo*, size (*) [112], align (*) [8])
+x_sysinfo(sysinfo, sysinfo*, size (*) [368], align (*) [8])
@@ -385 +385 @@
-x_tcp_info(tcp_info, tcp_info*, size (*) [104], align (*) [4])
+x_tcp_info(tcp_info, tcp_info*, size (*) [120], align (*) [8])
@@ -389 +389 @@
-x_tftphdr(tftphdr, tftphdr*, size (*) [5], align (*) [1])
+x_tftphdr(tftphdr, tftphdr*, size (*) [6], align (*) [2])
@@ -407 +407 @@
-x_u_quad_t(unsigned long, unsigned long*, size (*) [8], align (*) [8])
+x_u_quad_t(unsigned long long, unsigned long long*, size (*) [8], align (*) [8])
@@ -418,2 +418,2 @@
-x_uint_fast16_t(unsigned long, unsigned long*, size (*) [8], align (*) [8])
-x_uint_fast32_t(unsigned long, unsigned long*, size (*) [8], align (*) [8])
+x_uint_fast16_t(unsigned int, unsigned int*, size (*) [4], align (*) [4])
+x_uint_fast32_t(unsigned int, unsigned int*, size (*) [4], align (*) [4])
@@ -435 +435 @@
-x_utmpx(utmpx, utmpx*, size (*) [384], align (*) [4])
+x_utmpx(utmpx, utmpx*, size (*) [400], align (*) [8])

      reply	other threads:[~2015-04-19 12:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-14 22:44 Alexander Monakov
2015-04-14 23:16 ` Rich Felker
2015-04-15  6:29   ` Concerns about dlclose() behaviour Brad Conroy
2015-04-15  7:17     ` Rich Felker
2015-04-19  0:24 ` [PATCH] Use CAS instead of atomic swap to implement spinlock Rich Felker
2015-04-19  5:50   ` Alexander Monakov
2015-04-19  6:01     ` Rich Felker
2015-04-19 12:46       ` Szabolcs Nagy [this message]

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=20150419124605.GO2875@port70.net \
    --to=nsz@port70.net \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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).