From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by sourceware.org (Postfix) with ESMTPS id A82053858C78 for ; Wed, 1 Mar 2023 04:19:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A82053858C78 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x536.google.com with SMTP id d30so48828670eda.4 for ; Tue, 28 Feb 2023 20:19:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=C7EeFcdKXZV+PhDQXQXumgvNRucRsFBXYFl9VarESF8=; b=bUYr1PA1uo2AHQLcBQjatZQ854ctrGueVUlVc44l2V5DnXmd3yhf4aTkzu70PypSZx nDdzniu9eprcQXPx48tinKxGqA9BpPOJDxY1VmGAyrpVm4PDZC9pABZy/YPjkOfrsdax UzYsXFp0j7bn4X4/0zMbehKovK+8ERKbnuBUVu98zo5rRZAf0+vcrtJsbmcEm56t6+o2 VwwIj/nKRc6qKZCXqROwy3Jhf76PKOb9G2eInBqPrKI1K6EIACeZ/gnyzB3njjWAwiUa ZUBel6rn9EDpoodUlnkmzyQSyVg2A4sbqTZUfuYnNYVwd6rWLNNCQlDqBzQwUvWjUzZq EtUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C7EeFcdKXZV+PhDQXQXumgvNRucRsFBXYFl9VarESF8=; b=aUHkgFic1y3/RPLUhOpwrqTfh8yLgoYut4IJWdKEROH9tlQjMaOeVAltXPmpmd0tM8 TRTqGgJC3sQyx7pCxuiYbNwZKoEASXBOE4FWaJFn2GZo6mDIVWvr+Oj2SC9zacgP4Hsp t+BcbKaKHcRMgHFPtHrIr2JXEyvQqOuB5jNdXVuN+FlPN8aRlkVDXvPkZ2WFm1Gc2oi+ z+cK9kIN/lLgf2mNwiSqROQpn6thCcKTvkzgb0cHuifpBeimJ3VUDTIVw+gTvT5p4C35 0t40XP3y+ZLzAXGi3sLCa2XWkA9bg5Ey8J8TaaUj+DycPRhzuO2lcxjNHtKNBBhkzT72 IHZw== X-Gm-Message-State: AO0yUKUTKPqKtV9OXNFSQ3KgXJYJonbPYvBxsUHGijBTT/ZzEYXXaKGI P/srj8MtpE3eJ7/nO1UEDAV0BV4hnqTdSQMEG5Q= X-Google-Smtp-Source: AK7set8xXsHcub2F++2HF5V/K3W2QguYelK+Z5+HGXkXF1+9n1IhHmT9XPK3R02q571BNa+cXKFe82yDXB2uScthwpM= X-Received: by 2002:a50:ce15:0:b0:4af:69e2:52f9 with SMTP id y21-20020a50ce15000000b004af69e252f9mr3100851edi.6.1677644354893; Tue, 28 Feb 2023 20:19:14 -0800 (PST) MIME-Version: 1.0 References: <20230301032238.566874-1-caiyinyu@loongson.cn> In-Reply-To: <20230301032238.566874-1-caiyinyu@loongson.cn> From: Noah Goldstein Date: Tue, 28 Feb 2023 22:19:03 -0600 Message-ID: Subject: Re: [PATCH] x86: Fix bug about glibc.cpu.hwcaps. To: caiyinyu Cc: libc-alpha@sourceware.org, adhemerval.zanella@linaro.org, hjl.tools@gmail.com, carlos@redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, Feb 28, 2023 at 9:22=E2=80=AFPM caiyinyu wro= te: > > 1. export GLIBC_TUNABLES=3Dglibc.cpu.hwcaps=3D-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=3Den_US.UTF-8 > p -- LC_NUMERIC=3DC > ... > > 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 =3D valp->strval; > + const char *p =3D valp->strval, *c; > struct cpu_features *cpu_features =3D &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 +=3D len + 1; > } > - while (*p !=3D '\0'); > + while (*c !=3D '\0'); > } > > # if CET_ENABLED > -- > 2.31.1 > Can you make a bugzilla for this?