From patchwork Mon Jun 22 13:29:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Petr Salinger X-Patchwork-Id: 31750 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5MD2QnA027008 for ; Mon, 22 Jun 2009 13:02:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751558AbZFVNCH (ORCPT ); Mon, 22 Jun 2009 09:02:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752132AbZFVNCH (ORCPT ); Mon, 22 Jun 2009 09:02:07 -0400 Received: from relay.felk.cvut.cz ([147.32.80.7]:50639 "EHLO relay.felk.cvut.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751558AbZFVNCG (ORCPT ); Mon, 22 Jun 2009 09:02:06 -0400 Received: from sci.felk.cvut.cz (sci.felk.cvut.cz [147.32.83.100]) by relay.felk.cvut.cz (8.14.3/8.14.3) with ESMTP id n5MD1xoM096427; Mon, 22 Jun 2009 15:01:59 +0200 (CEST) (envelope-from Petr.Salinger@seznam.cz) Date: Mon, 22 Jun 2009 15:29:02 +0200 (CEST) From: Petr Salinger X-X-Sender: salinger@sci.felk.cvut.cz To: linux-parisc@vger.kernel.org cc: debian-hppa@lists.debian.org Subject: Re: HPPA linux compat wrappers In-Reply-To: <119aab440906220505l26bda054r4280165627332473@mail.gmail.com> Message-ID: References: <119aab440906220505l26bda054r4280165627332473@mail.gmail.com> MIME-Version: 1.0 X-FELK-MailScanner-Information: X-MailScanner-ID: n5MD1xoM096427 X-FELK-MailScanner: Found to be clean X-FELK-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-1.913, required 5, BAYES_00 -2.60, SPF_NEUTRAL 0.69) X-FELK-MailScanner-From: petr.salinger@seznam.cz X-FELK-MailScanner-To: debian-hppa@lists.debian.org, linux-parisc@vger.kernel.org X-FELK-MailScanner-Watermark: 1246280520.13953@YbnGGoxwAkWCSsz2m+ulZQ X-Spam-Status: No Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org >> I still think there should be support for mixed ABI calls. >> See also thread http://lists.debian.org/debian-hppa/2008/09/msg00018.html > > It sounds like a good feature, but my time is restricted so I > implemented the simplest interface possible that I could prove worked. > If you have ample free time I suggest you post a version of the patch > with your enhancements. I'd be more than willing to test your patches. I have to admin I will not write the code, I only propose the idea. 1) put "__lt_compat" field in a place where originally is LT initializer. 2) create hppa specific pthread.h with just altered initializers (more zeroes) 3) At the begin of each affected function >>  if (v->__lt_compat) >>  { >>     lock_global_pt_lock(); >>     if (v->__lt_compat) >>     { >>                zero_the_same_fields_as_NPTL_but_lt_compat_field(); >>                barrier(); >>                v->__lt_compat = 0; >>     }; >>     unlock_global_pt_lock(); >>  }; This just atomically converts linuxthreads initialized variable into NPTL initialized variable. >> For the new NPTL layout the zeroing code will not be taken, >> therefore almost no overhead. >> There might be a congestion on global_pt_lock, but I do not believe, >> there are many static initilized mutexes in any real program. >> There will be no need for allocation any new structures. > > There are tons of statically initialized mutexs, gnome and gdk are > full of them as an example. Hopefully not many will try to lock global_pt_lock in the same time. Also rebuild against NPTL enabled libc-dev lowers the number of possible linuxthreads initialized variables. Petr --- sysdeps/unix/sysv/linux/hppa/nptl/bits/pthreadtypes.h +++ sysdeps/unix/sysv/linux/hppa/nptl/bits/pthreadtypes.h.compat @@ -70,6 +70,7 @@ pthread_mutex_t /* KIND must stay at this position in the structure to maintain binary compatibility. */ int __kind; + int __lt_compat; unsigned int __nusers; __extension__ union { @@ -95,10 +96,11 @@ pthread_cond_t struct { int __lock; - unsigned int __futex; + int __lt_compat; __extension__ unsigned long long int __total_seq; __extension__ unsigned long long int __wakeup_seq; __extension__ unsigned long long int __woken_seq; + unsigned int __futex; void *__mutex; unsigned int __nwaiters; unsigned int __broadcast_seq; @@ -130,6 +132,9 @@ pthread_rwlock_t struct { int __lock; + int __lt_compat; + int __hppa_pad1; + int __hppa_pad2; unsigned int __nr_readers; unsigned int __readers_wakeup; unsigned int __writer_wakeup;