x86: Set RDRAND usable if CPU supports RDRAND

Message ID CAMe9rOqb8mrZsv8hoUyB-z5WswncTAZJ9fBaz8Kr+NGqcuTBLg@mail.gmail.com
State Committed
Headers
Series x86: Set RDRAND usable if CPU supports RDRAND |

Commit Message

H.J. Lu Dec. 4, 2020, 1:03 p.m. UTC
  On Fri, Dec 4, 2020 at 12:12 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu via Libc-alpha:
>
> > Set RDRAND usable if CPU supports RDRAND.  Also check HAS_CPU_FEATURE
> > instead of CPU_FEATURE_USABLE for FSGSBASE, LM and XSAVES since
> > FSGSBASE/LM require kernel support and XSAVES is supervisor-mode only.
>
> I think the commit subject is misleading because the RDRAND part is a
> glibc bug fix.  Rest looks okay to me.
>
> Thanks,

I am checking the RDRAND fix as a separate patch.  I will submit a
new patch with the tst-cpu-features-supports.c fix only.

Thanks.
  

Comments

Florian Weimer Dec. 4, 2020, 1:06 p.m. UTC | #1
* H. J. Lu:

> On Fri, Dec 4, 2020 at 12:12 AM Florian Weimer <fweimer@redhat.com> wrote:
>>
>> * H. J. Lu via Libc-alpha:
>>
>> > Set RDRAND usable if CPU supports RDRAND.  Also check HAS_CPU_FEATURE
>> > instead of CPU_FEATURE_USABLE for FSGSBASE, LM and XSAVES since
>> > FSGSBASE/LM require kernel support and XSAVES is supervisor-mode only.
>>
>> I think the commit subject is misleading because the RDRAND part is a
>> glibc bug fix.  Rest looks okay to me.
>>
>> Thanks,
>
> I am checking the RDRAND fix as a separate patch.  I will submit a
> new patch with the tst-cpu-features-supports.c fix only.

Okay, thanks.  Feel free to check in both patches.

Florian
  

Patch

From eacbdebffb55aa570c53d87898fa99a9aeb5f5a1 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 3 Dec 2020 15:02:44 -0800
Subject: [PATCH] x86: Set RDRAND usable if CPU supports RDRAND

Set RDRAND usable if CPU supports RDRAND.
---
 sysdeps/x86/cpu-features.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
index f26deba38d..fe080b63b2 100644
--- a/sysdeps/x86/cpu-features.c
+++ b/sysdeps/x86/cpu-features.c
@@ -85,6 +85,7 @@  update_usable (struct cpu_features *cpu_features)
   CPU_FEATURE_SET_USABLE (cpu_features, WAITPKG);
   CPU_FEATURE_SET_USABLE (cpu_features, GFNI);
   CPU_FEATURE_SET_USABLE (cpu_features, RDPID);
+  CPU_FEATURE_SET_USABLE (cpu_features, RDRAND);
   CPU_FEATURE_SET_USABLE (cpu_features, CLDEMOTE);
   CPU_FEATURE_SET_USABLE (cpu_features, MOVDIRI);
   CPU_FEATURE_SET_USABLE (cpu_features, MOVDIR64B);
-- 
2.28.0