From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7437 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] Use CAS instead of atomic swap to implement spinlock Date: Sun, 19 Apr 2015 14:46:05 +0200 Message-ID: <20150419124605.GO2875@port70.net> References: <1429051493-2821-1-git-send-email-amonakov@ispras.ru> <20150419002433.GL6817@brightrain.aerifal.cx> <20150419060132.GN6817@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="M38YqGLZlgb6RLPS" X-Trace: ger.gmane.org 1429447580 29682 80.91.229.3 (19 Apr 2015 12:46:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 19 Apr 2015 12:46:20 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7450-gllmg-musl=m.gmane.org@lists.openwall.com Sun Apr 19 14:46:20 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Yjoc6-0001aE-VF for gllmg-musl@m.gmane.org; Sun, 19 Apr 2015 14:46:19 +0200 Original-Received: (qmail 30426 invoked by uid 550); 19 Apr 2015 12:46:17 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 30407 invoked from network); 19 Apr 2015 12:46:17 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <20150419060132.GN6817@brightrain.aerifal.cx> User-Agent: Mutt/1.5.23 (2014-03-12) Xref: news.gmane.org gmane.linux.lib.musl.general:7437 Archived-At: --M38YqGLZlgb6RLPS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline * Rich Felker [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) --M38YqGLZlgb6RLPS Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="abi.x86_64.diff" --- 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]) --M38YqGLZlgb6RLPS--