public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Carlos O'Donell <carlos@redhat.com>
To: "H.J. Lu" <hjl.tools@gmail.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH] x86: Install <bits/platform/x86.h> [BZ #27958]
Date: Fri, 9 Jul 2021 16:01:44 -0400	[thread overview]
Message-ID: <83077104-ea01-0afc-5636-87e1039d463a@redhat.com> (raw)
In-Reply-To: <20210605135947.469959-1-hjl.tools@gmail.com>

On 6/5/21 9:59 AM, H.J. Lu via Libc-alpha wrote:
> Install <bits/platform/x86.h> for <sys/platform/x86.h> which includes
> <bits/platform/x86.h>.
> 
> Fixes BZ #27958.

The constants in bits/platform/x86.h are largely ABI given the behaviour
of the cpuid instruction. Likewise we do a consistent mapping between
the cpuid_array <-> usable_array without exposing internal details.

The API in sys/platform/x86.h has already been reviewed, discussed, and
exposes HAS_CPU_FEATURE(name) and CPU_FEATURE_USABLE(name).

Given that we get one more chance at review let me ask a few final questions.

(1) API prefixes in macros help developers remember names.

  Consistent prefix for APIs help developers remember.

  We use HAS_* but also CPU_* which requires the programmer remember
  two distinct naming strategies.

  Suggestion: CPU_FEATURE_PRESENT(), CPU_FEATURE_USABLE()?

  Note: We do this in the underlying name e.g. x86_cpu_*
        has_feature (could be is_present) vs. is_usable.

(2) ABI testing?

  - How are we making sure we don't accidentally break ABI?

    - Do we need any further testing?

  - Do we have a decoupled test to ensure a refactor doesn't break
    things?

    - We have tst-cpu-features-cpuinfo.c, which should cover
      comparison to the decoupled cpuinfo.

Notes:

- We will not be able to avoid in-place-update failures, in that rpm
  will do an atomic rename that unlinks the old libc.so.6 with the
  new libc.so.6 and if ld.so is not yet updated or updated first then
  a process that starts will crash. This makes it error prone to update
  the ABI in downstream minor updates.

> ---
>  sysdeps/x86/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
> index 346ec491b3..567ea54243 100644
> --- a/sysdeps/x86/Makefile
> +++ b/sysdeps/x86/Makefile
> @@ -5,7 +5,7 @@ endif
>  ifeq ($(subdir),elf)
>  sysdep_routines += get-cpuid-feature-leaf
>  sysdep-dl-routines += dl-get-cpu-features
> -sysdep_headers += sys/platform/x86.h
> +sysdep_headers += sys/platform/x86.h bits/platform/x86.h
>  
>  CFLAGS-get-cpuid-feature-leaf.o += $(no-stack-protector)
  


-- 
Cheers,
Carlos.


  reply	other threads:[~2021-07-09 20:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-05 13:59 H.J. Lu
2021-07-09 20:01 ` Carlos O'Donell [this message]
2021-07-10 17:21   ` H.J. Lu
2021-07-10 17:21 H.J. Lu
2021-07-19  2:13 ` Carlos O'Donell
2021-07-19 15:20   ` H.J. Lu

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=83077104-ea01-0afc-5636-87e1039d463a@redhat.com \
    --to=carlos@redhat.com \
    --cc=hjl.tools@gmail.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).