public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: DJ Delorie <dj@redhat.com>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: tunables vs osxsave vs checkpointing vs _dl_runtime_resolve
Date: Thu, 18 Mar 2021 21:16:27 -0700	[thread overview]
Message-ID: <CAMe9rOoNBoWHoYnkyQgQVOF0oSHTBE08xT5gT30Fhaq7BF5YSA@mail.gmail.com> (raw)
In-Reply-To: <xnlfajn749.fsf@rhel8.vm>

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

On Thu, Mar 18, 2021 at 8:40 PM DJ Delorie <dj@redhat.com> wrote:
>
>
> But...
>
> (gdb) set env GLIBC_TUNABLES=glibc.cpu.hwcaps=-OSXSAVE
> (gdb) r
> The program being debugged has been started already.
> Start it from the beginning? (y or n) y
> Starting program: /home/dj/criu-test
>
> Breakpoint 2, _dl_runtime_resolve_xsavec () at ../sysdeps/x86_64/dl-trampoline.h:67
> 67              _CET_ENDBR
>

Try this.

-- 
H.J.

[-- Attachment #2: cpu-features.diff --]
[-- Type: text/x-patch, Size: 2447 bytes --]

diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
index d7248cbb45..6262b03cd4 100644
--- a/sysdeps/x86/cpu-features.c
+++ b/sysdeps/x86/cpu-features.c
@@ -40,7 +40,7 @@ extern void TUNABLE_CALLBACK (set_x86_shstk) (tunable_val_t *)
 #endif
 
 static void
-update_usable (struct cpu_features *cpu_features)
+copy_usable (struct cpu_features *cpu_features)
 {
   /* Copy the cpuid bits to usable bits for CPU featuress whose usability
      in user space can be detected without additonal OS support.  */
@@ -98,9 +98,13 @@ update_usable (struct cpu_features *cpu_features)
   CPU_FEATURE_SET_USABLE (cpu_features, FSRS);
   CPU_FEATURE_SET_USABLE (cpu_features, FSRCS);
   CPU_FEATURE_SET_USABLE (cpu_features, PTWRITE);
+}
 
+static void
+update_usable (struct cpu_features *cpu_features)
+{
   /* Can we call xgetbv?  */
-  if (CPU_FEATURES_CPU_P (cpu_features, OSXSAVE))
+  if (CPU_FEATURE_USABLE_P (cpu_features, OSXSAVE))
     {
       unsigned int xcrlow;
       unsigned int xcrhigh;
@@ -420,8 +424,6 @@ init_cpu_features (struct cpu_features *cpu_features)
 
       get_extended_indices (cpu_features);
 
-      update_usable (cpu_features);
-
       if (family == 0x06)
 	{
 	  model += extended_model;
@@ -547,8 +549,6 @@ init_cpu_features (struct cpu_features *cpu_features)
 
       get_extended_indices (cpu_features);
 
-      update_usable (cpu_features);
-
       ecx = cpu_features->features[CPUID_INDEX_1].cpuid.ecx;
 
       if (CPU_FEATURE_USABLE_P (cpu_features, AVX))
@@ -586,8 +586,6 @@ init_cpu_features (struct cpu_features *cpu_features)
 
       get_extended_indices (cpu_features);
 
-      update_usable (cpu_features);
-
       model += extended_model;
       if (family == 0x6)
         {
@@ -630,7 +628,6 @@ init_cpu_features (struct cpu_features *cpu_features)
     {
       kind = arch_kind_other;
       get_common_indices (cpu_features, NULL, NULL, NULL, NULL);
-      update_usable (cpu_features);
     }
 
   /* Support i586 if CX8 is available.  */
@@ -652,6 +649,8 @@ no_cpuid:
 
   dl_init_cacheinfo (cpu_features);
 
+  copy_usable (cpu_features);
+
 #if HAVE_TUNABLES
   TUNABLE_GET (hwcaps, tunable_val_t *, TUNABLE_CALLBACK (set_hwcaps));
 #elif defined SHARED
@@ -661,6 +660,8 @@ no_cpuid:
   GLRO(dl_hwcap_mask) = HWCAP_IMPORTANT;
 #endif
 
+  update_usable (cpu_features);
+
 #ifdef __x86_64__
   GLRO(dl_hwcap) = HWCAP_X86_64;
   if (cpu_features->basic.kind == arch_kind_intel)

  reply	other threads:[~2021-03-19  4:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 17:18 DJ Delorie
2021-03-18 17:29 ` H.J. Lu
2021-03-18 17:45   ` DJ Delorie
2021-03-18 20:39     ` H.J. Lu
2021-03-19  3:40       ` DJ Delorie
2021-03-19  4:16         ` H.J. Lu [this message]
2021-03-19  4:35           ` DJ Delorie
2021-03-18 17:32 ` Florian Weimer
2021-03-18 17:47   ` DJ Delorie
2021-03-18 17:57     ` Florian Weimer
2021-03-18 18:19       ` DJ Delorie
2021-03-19 16:43 ` Szabolcs Nagy
2021-03-19 21:12   ` DJ Delorie

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=CAMe9rOoNBoWHoYnkyQgQVOF0oSHTBE08xT5gT30Fhaq7BF5YSA@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=dj@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /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.
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).