public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: caiyinyu <caiyinyu@loongson.cn>, "H.J. Lu" <hjl.tools@gmail.com>
Cc: libc-alpha@sourceware.org, goldstein.w.n@gmail.com
Subject: Re: [PATCH] x86: Fix bug about glibc.cpu.hwcaps.
Date: Tue, 07 Mar 2023 21:02:18 +0800	[thread overview]
Message-ID: <f8c8267607f42f02d06493454a03d9f564c0265a.camel@xry111.site> (raw)
In-Reply-To: <b7348af4-547c-9239-adcb-40ba94ecd5a3@loongson.cn>

On Tue, 2023-03-07 at 20:45 +0800, caiyinyu wrote:
> 
> 在 2023/3/2 下午12:22, H.J. Lu 写道:
> > On Wed, Mar 1, 2023 at 6:36 PM caiyinyu <caiyinyu@loongson.cn>
> > wrote:
> > > Recorded in [BZ #30183]:
> > > 
> > > 1. export GLIBC_TUNABLES=glibc.cpu.hwcaps=-AVX512
> > > 2. Add  _dl_printf("p -- %s\n", p); just before switch(nl) in
> > >     sysdeps/x86/cpu-tunables.c
> > > 3. compiled and run ./testrun.sh /usr/bin/ls
> > > you will get:
> > > 
> > > p -- -AVX512
> > > p -- LC_ADDRESS=en_US.UTF-8
> > > p -- LC_NUMERIC=C
> > > ...
> > > 
> > > The function, TUNABLE_CALLBACK (set_hwcaps)
> > > (tunable_val_t *valp), checks far more than it should and it
> > > should stop at end of "-AVX512".
> > > ---
> > >   sysdeps/x86/cpu-tunables.c | 6 +++---
> > >   1 file changed, 3 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/sysdeps/x86/cpu-tunables.c b/sysdeps/x86/cpu-
> > > tunables.c
> > > index d3e1367bda..772fb0c4c2 100644
> > > --- a/sysdeps/x86/cpu-tunables.c
> > > +++ b/sysdeps/x86/cpu-tunables.c
> > > @@ -107,13 +107,13 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t
> > > *valp)
> > >        NOTE: the IFUNC selection may change over time.  Please
> > > check all
> > >        multiarch implementations when experimenting.  */
> > > 
> > > -  const char *p = valp->strval;
> > > +  const char *p = valp->strval, *c;
> > >     struct cpu_features *cpu_features =
> > > &GLRO(dl_x86_cpu_features);
> > >     size_t len;
> > > 
> > >     do
> > >       {
> > > -      const char *c, *n;
> > > +      const char *n;
> > >         bool disable;
> > >         size_t nl;
> > > 
> > > @@ -283,7 +283,7 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t
> > > *valp)
> > >          }
> > >         p += len + 1;
> > >       }
> > > -  while (*p != '\0');
> > > +  while (*c != '\0');
> > >   }
> > > 
> > >   # if CET_ENABLED
> > > --
> > > 2.31.1
> > > 
> > OK.
> > 
> > Thanks.
> 
> Could you help to push this patch?

I guess you can push it yourself.  A port maintainer has write access to
the entire Git repository, just use it carefully (i. e. always get a
permission before changing other subsystems).

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

  reply	other threads:[~2023-03-07 13:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02  2:33 caiyinyu
2023-03-02  4:22 ` H.J. Lu
2023-03-07 12:45   ` caiyinyu
2023-03-07 13:02     ` Xi Ruoyao [this message]
2023-03-07 13:18       ` caiyinyu
2023-03-07 17:23         ` Noah Goldstein
2023-03-08  7:16           ` caiyinyu
2023-03-08 16:56             ` Noah Goldstein
2023-03-09  1:26               ` caiyinyu
2023-03-09  3:25                 ` Xi Ruoyao
  -- strict thread matches above, loose matches on Subject: below --
2023-03-01  3:22 caiyinyu
2023-03-01  4:19 ` Noah Goldstein
2023-03-01  9:10   ` caiyinyu
2023-03-01 16:42     ` Noah Goldstein
2023-03-01 17:33       ` H.J. Lu
2023-03-02  2:37       ` caiyinyu

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=f8c8267607f42f02d06493454a03d9f564c0265a.camel@xry111.site \
    --to=xry111@xry111.site \
    --cc=caiyinyu@loongson.cn \
    --cc=goldstein.w.n@gmail.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).