This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 06/15] Add internal IFUNC call workaround


On 12/23/2012 04:02 AM, Andi Kleen wrote:
From: Andi Kleen <ak@linux.intel.com>

Avoid problems with internal hidden IFUNC calls on i386.
See http://www.sourceware.org/bugzilla/show_bug.cgi?id=14961
for more details

This patch could go in separately but please explain via email why this is needed.


This actually improves performance on x86-64 because the
call will go directly instead of through the PLT.

2012-12-22 Hongjiu Lu <hongjiu.lu@intel.com>

	* nptl/pthreadP.h (extern void __pthread_disable_asynccancel):
	* nptl/sysdeps/unix/sysv/linux/i386/i686/multiarch/Implies:
	* nptl/sysdeps/unix/sysv/linux/x86/multiarch/nptl-init.c:
	* nptl/sysdeps/unix/sysv/linux/x86_64/multiarch/Implies:

the ChangeLog entry is wrong - nptl has its own ChangeLog file and thus you do not need to add "nptl/" at the front. Also, the first and third entry contain no content about the change.


Could you resend this with proper ChangeLog and rationale, please?

Andreas

---
  nptl/pthreadP.h                                    |    2 ++
  .../unix/sysv/linux/i386/i686/multiarch/Implies    |    1 +
  .../unix/sysv/linux/x86/multiarch/nptl-init.c      |   15 +++++++++++++++
  .../unix/sysv/linux/x86_64/multiarch/Implies       |    1 +
  4 files changed, 19 insertions(+), 0 deletions(-)
  create mode 100644 nptl/sysdeps/unix/sysv/linux/i386/i686/multiarch/Implies
  create mode 100644 nptl/sysdeps/unix/sysv/linux/x86/multiarch/nptl-init.c
  create mode 100644 nptl/sysdeps/unix/sysv/linux/x86_64/multiarch/Implies

diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index fa89cbf..5cff300 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -492,7 +492,9 @@ extern void __pthread_disable_asynccancel (int oldtype)
  #if defined NOT_IN_libc && defined IS_IN_libpthread
  hidden_proto (__pthread_mutex_init)
  hidden_proto (__pthread_mutex_destroy)
+# ifndef __pthread_mutex_lock
  hidden_proto (__pthread_mutex_lock)
+# endif
  hidden_proto (__pthread_mutex_unlock)
  hidden_proto (__pthread_rwlock_rdlock)
  hidden_proto (__pthread_rwlock_wrlock)
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i686/multiarch/Implies b/nptl/sysdeps/unix/sysv/linux/i386/i686/multiarch/Implies
new file mode 100644
index 0000000..a8518c7
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i686/multiarch/Implies
@@ -0,0 +1 @@
+unix/sysv/linux/x86/multiarch
diff --git a/nptl/sysdeps/unix/sysv/linux/x86/multiarch/nptl-init.c b/nptl/sysdeps/unix/sysv/linux/x86/multiarch/nptl-init.c
new file mode 100644
index 0000000..1d52a68
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/x86/multiarch/nptl-init.c
@@ -0,0 +1,15 @@
+/* __pthread_initialize_minimal_internal () has
+
+   GL(dl_rtld_lock_recursive) = (void *) __pthread_mutex_lock;
+
+   This doesn't work with hidden IFUNC function.  See
+
+   http://www.sourceware.org/bugzilla/show_bug.cgi?id=14961
+
+   for details.  The work around is not to mark __pthread_mutex_lock
+   hidden.  It also helps x86-64 since we now use the real function
+   address at run-time, instead of its PLT entry.  */
+
+#define __pthread_mutex_lock __GI___pthread_mutex_lock
+
+#include <nptl/nptl-init.c>
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/multiarch/Implies b/nptl/sysdeps/unix/sysv/linux/x86_64/multiarch/Implies
new file mode 100644
index 0000000..a8518c7
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/multiarch/Implies
@@ -0,0 +1 @@
+unix/sysv/linux/x86/multiarch



--
 Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]