public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Re: [PATCH v3 0/4] aarch64: Allow overriding HWCAP_CPUID feature check
       [not found] <bebe9cec-5156-4bfc-9b41-6db09af69981@email.android.com>
@ 2017-05-30 16:54 ` Steve Ellcey
  2017-05-30 19:22   ` Steve Ellcey
  0 siblings, 1 reply; 7+ messages in thread
From: Steve Ellcey @ 2017-05-30 16:54 UTC (permalink / raw)
  To: siddhesh; +Cc: libc-alpha, Siddhesh Poyarekar, adhemerval.zanella

On Sat, 2017-05-27 at 07:54 +0530, siddhesh@gotplt.org wrote:
> Your test program should work provided that it is a fresh build since
> an older build will end up picking the old dl-procinfo.h and thus set
> hwcap_mask to 0.
> 
> I'm out this weekend, but I'll take a look at it on Monday.
> 
> Siddhesh

I will rerun configure and build but I think I am using the correct
(new) sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h header file and
it does have:

#define HWCAP_IMPORTANT HWCAP_CPUID

Steve Ellcey
sellcey@cavium.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 0/4] aarch64: Allow overriding HWCAP_CPUID feature check
  2017-05-30 16:54 ` [PATCH v3 0/4] aarch64: Allow overriding HWCAP_CPUID feature check Steve Ellcey
@ 2017-05-30 19:22   ` Steve Ellcey
  2017-05-30 20:23     ` Steve Ellcey
  0 siblings, 1 reply; 7+ messages in thread
From: Steve Ellcey @ 2017-05-30 19:22 UTC (permalink / raw)
  To: siddhesh; +Cc: libc-alpha, Siddhesh Poyarekar, adhemerval.zanella

Siddhesh,

I think the problem may be in dl-tunables.h.  I could not get either of
your patches that change that file (1 of 4 and 1 of 5) to apply cleanly
to this file.  1 of 4 was small, but 1 of 5 is more complex and I may
have messed it up while trying to apply it by hand.  Could you redo at
least patch 1 of 5 so it applies cleanly to top-of-tree dl-tunables.h.
Or maybe you could just send me a copy of dl-tunables.h so I can drop
it in without the patch command.

Steve Ellcey
sellcey@cavium.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 0/4] aarch64: Allow overriding HWCAP_CPUID feature check
  2017-05-30 19:22   ` Steve Ellcey
@ 2017-05-30 20:23     ` Steve Ellcey
  2017-06-01  5:29       ` Siddhesh Poyarekar
  0 siblings, 1 reply; 7+ messages in thread
From: Steve Ellcey @ 2017-05-30 20:23 UTC (permalink / raw)
  To: siddhesh; +Cc: libc-alpha, Siddhesh Poyarekar, adhemerval.zanella

On Tue, 2017-05-30 at 12:22 -0700, Steve Ellcey wrote:
> Siddhesh,
> 
> I think the problem may be in dl-tunables.h.  I could not get either
> of
> your patches that change that file (1 of 4 and 1 of 5) to apply
> cleanly
> to this file.  1 of 4 was small, but 1 of 5 is more complex and I may
> have messed it up while trying to apply it by hand.  Could you redo
> at
> least patch 1 of 5 so it applies cleanly to top-of-tree dl-
> tunables.h.
> Or maybe you could just send me a copy of dl-tunables.h so I can drop
> it in without the patch command.
> 
> Steve Ellcey
> sellcey@cavium.com

OK, I made a little progress.  If I don't set LD_HWCAP_MASK then it
seems to be treating it as 0, even though the default value is supposed
to be HWCAP_IMPORTANT which gets set to HWCAP_CPUID.  If I explicitly
set LD_HWCAP_MASK to 0x800 then I get the correct heaviour and my
program checks for CPUID.  I am not sure why the default value for
LD_HWCAP_MASK does not seem to be right.

Steve Ellcey
sellcey@cavium.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 0/4] aarch64: Allow overriding HWCAP_CPUID feature check
  2017-05-30 20:23     ` Steve Ellcey
@ 2017-06-01  5:29       ` Siddhesh Poyarekar
  2017-06-01 16:22         ` Steve Ellcey
  0 siblings, 1 reply; 7+ messages in thread
From: Siddhesh Poyarekar @ 2017-06-01  5:29 UTC (permalink / raw)
  To: sellcey; +Cc: libc-alpha, adhemerval.zanella

On Wednesday 31 May 2017 01:53 AM, Steve Ellcey wrote:
> OK, I made a little progress.  If I don't set LD_HWCAP_MASK then it
> seems to be treating it as 0, even though the default value is supposed
> to be HWCAP_IMPORTANT which gets set to HWCAP_CPUID.  If I explicitly
> set LD_HWCAP_MASK to 0x800 then I get the correct heaviour and my
> program checks for CPUID.  I am not sure why the default value for
> LD_HWCAP_MASK does not seem to be right.

I just realized what's going on; it is a bug in tunables.  The
__tunables_set_val function returns without setting the value if the
value was not set by glibc.tune.hwcap_mask or LD_HWCAP_MASK, which is
wrong.  It should return whatever is set in the tunable list.

I'll fix that and repost.

Siddhesh

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 0/4] aarch64: Allow overriding HWCAP_CPUID feature check
  2017-06-01  5:29       ` Siddhesh Poyarekar
@ 2017-06-01 16:22         ` Steve Ellcey
  0 siblings, 0 replies; 7+ messages in thread
From: Steve Ellcey @ 2017-06-01 16:22 UTC (permalink / raw)
  To: siddhesh; +Cc: libc-alpha, adhemerval.zanella

On Thu, 2017-06-01 at 10:59 +0530, Siddhesh Poyarekar wrote:
> 
> I just realized what's going on; it is a bug in tunables.  The
> __tunables_set_val function returns without setting the value if the
> value was not set by glibc.tune.hwcap_mask or LD_HWCAP_MASK, which is
> wrong.  It should return whatever is set in the tunable list.
> 
> I'll fix that and repost.
> 
> Siddhesh

Excellent, I find this functionality very useful so I look forward to
having it in glibc.

Steve Ellcey
sellcey@cavium.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 0/4] aarch64: Allow overriding HWCAP_CPUID feature check
  2017-05-25 20:27 Siddhesh Poyarekar
@ 2017-05-26 20:13 ` Steve Ellcey
  0 siblings, 0 replies; 7+ messages in thread
From: Steve Ellcey @ 2017-05-26 20:13 UTC (permalink / raw)
  To: Siddhesh Poyarekar, libc-alpha; +Cc: adhemerval.zanella

On Fri, 2017-05-26 at 01:55 +0530, Siddhesh Poyarekar wrote:
> 
> I have not reposted the earlier 1/5, 2/5 and 4/5 since they have been acked.
> I'll push them in together with all these patches since it did not make sense to
> put them in isolation.
> 
> Tested on x86_64 and aarch64.

Siddhesh, does this mean that if I apply these four patches plus
patches 1, 2, and 4 from the earlier set (https://sourceware.org/ml/lib
c-alpha/2017-05/msg00570.html) then I should get the override
functionality?

I have applied those patches, the earlier patch 1 of 5 did not apply
cleanly but I think I fixed that by hand correctly and I had to fix up
the documentation problem that was mentioned in the email but the
override is not working correctly for me (or I am misunderstanding
things).

I wrote a small program to call __libc_ifunc_impl_list and see what
memcpy versions were available on thunderx.  I see both versions but
the usable flag is 0 for the thunderx version on my thunderx machine
even if I do not set HWCAP_MASK to anything.  When I build the library
with out --enable-tunable, then I get a usable flag of 1 for both
versions of memcpy which is what I would expect.  Are there any other
patches I need?

Steve Ellcey
sellcey@cavium.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 0/4] aarch64: Allow overriding HWCAP_CPUID feature check
@ 2017-05-25 20:27 Siddhesh Poyarekar
  2017-05-26 20:13 ` Steve Ellcey
  0 siblings, 1 reply; 7+ messages in thread
From: Siddhesh Poyarekar @ 2017-05-25 20:27 UTC (permalink / raw)
  To: libc-alpha; +Cc: adhemerval.zanella

Hi,

Here is another take at the remaining patches to allow overriding HWCAP_CPUID
feature check.  Changes from the previous version:

 - Added convenience macro to get dl_hwcap_mask
 - Disable reading LD_HWCAP_MASK in static binaries when tunables are disabled
 - Enable reading LD_HWCAP_MASK in static binaries when tunables are enabled
 - Fix x86 exponential behaviour with ld_hwcap_mask set to a high value on
   static binaries
 - Add patch to write hwcap strings to LD_SHOW_AUXV and for ldconfig

I have not reposted the earlier 1/5, 2/5 and 4/5 since they have been acked.
I'll push them in together with all these patches since it did not make sense to
put them in isolation.

Tested on x86_64 and aarch64.


Siddhesh Poyarekar (4):
  tunables: Use glibc.tune.hwcap_mask tunable instead of _dl_hwcap_mask
  aarch64: Allow overriding HWCAP_CPUID feature check using HWCAP_MASK
  Make LD_HWCAP_MASK usable for static binaries
  aarch64: Add hwcap string routines

 elf/dl-cache.c                                 |  5 +-
 elf/dl-hwcaps.c                                | 11 +++-
 elf/dl-hwcaps.h                                | 30 +++++++++
 elf/dl-support.c                               |  2 +
 elf/dl-tunables.h                              |  2 +
 elf/rtld.c                                     |  4 ++
 sysdeps/generic/ldsodefs.h                     |  2 +
 sysdeps/sparc/sparc32/dl-machine.h             |  6 +-
 sysdeps/unix/sysv/linux/aarch64/cpu-features.c | 10 +--
 sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c  | 15 +++++
 sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h  | 86 ++++++++++++++++++++++++++
 sysdeps/x86/cpu-features.c                     | 10 +--
 12 files changed, 170 insertions(+), 13 deletions(-)
 create mode 100644 elf/dl-hwcaps.h
 create mode 100644 sysdeps/unix/sysv/linux/aarch64/dl-procinfo.h

-- 
2.7.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-06-01 16:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bebe9cec-5156-4bfc-9b41-6db09af69981@email.android.com>
2017-05-30 16:54 ` [PATCH v3 0/4] aarch64: Allow overriding HWCAP_CPUID feature check Steve Ellcey
2017-05-30 19:22   ` Steve Ellcey
2017-05-30 20:23     ` Steve Ellcey
2017-06-01  5:29       ` Siddhesh Poyarekar
2017-06-01 16:22         ` Steve Ellcey
2017-05-25 20:27 Siddhesh Poyarekar
2017-05-26 20:13 ` Steve Ellcey

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 read-only IMAP folder(s) and NNTP newsgroup(s).