From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x332.google.com (mail-ot1-x332.google.com [IPv6:2607:f8b0:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id EBB77385223B for ; Wed, 14 Dec 2022 16:12:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EBB77385223B 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-ot1-x332.google.com with SMTP id x44-20020a05683040ac00b006707c74330eso2000631ott.10 for ; Wed, 14 Dec 2022 08:12:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=j9/M4DU4dTF3hQ/IBAZS5a5Zemq2apNzCYCzagqZrbU=; b=N+suxtPZbGlqb+8F48lhIve2WQjmJvX+nKUL7HuT4chPoq/bGcRiSpK5VTqDav0f+N HwtW89b93M/RYpq5nfN1n6g5hISGt+BPCiUSBb6Qa115Z7iuCM76iFnAhCoobhK5dMFX 4nk46PZu5QpVzw26bWHiaRC3G/hNYjkZ6bvGu3XJ76fp1kSmAJqfiaPeKojD9/OCV3ww rFRiDCRX/JTS2bcDkkRuYmPFoLFHMTYy9EiMGfexPseBm+/CDvNtiqPD+r5rfmwJqsN6 AvVDNgy0RcMmUfIS+HdCEOruF/szFTnoxImdDc7L83/YfsPzrmwxxiH91kpg4Bs4JrT1 ZTUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=j9/M4DU4dTF3hQ/IBAZS5a5Zemq2apNzCYCzagqZrbU=; b=oomPK37LSxwPqbelcktOPPazA+dufl5rLnOdu2apmvW0yujupOZ+8ObrXearKzxeYm NfR7FuER3xr3S43RYPdRbYg1zTpK7Q8vY3Sbjta9zLRK3YpTYtphoXcI6Wy6cL9PEAu7 G3LzqkDSxoLWLMszPedXI+eHKGwQT7ygIfpi77uL7xZe05XzKiEWf7vbzBByz2OX5YwD BDv/Il2LsiU5n6Z8np4HZsulx4YGj+E1Jmeoa5cU6A778qtGbJ9I2IbutjWbmVKiGgeY P3ODiiTJw+WQot2dyrqmO/n1A55RwE4ZcU9z+2l83KoTAdnf5QKH2DKVUTvQUDHh77+p lubg== X-Gm-Message-State: ANoB5pl3T2X7HltSY3L00jny7H+wJexO1b5Lc3cXVkep/thMHkswmwmn B+DUkMyYknaQJDUtVL33atB7HpF4hAlmlJkDHOw= X-Google-Smtp-Source: AA0mqf4gn9q8ZsrQITFezMjG9tO/ORrU7XtlvESxUcsAKY0ebHH7PGQjuQsyGGAZaUzo8rLAZ48+fRDRuzOPheVDZMk= X-Received: by 2002:a9d:12e5:0:b0:66e:b992:749f with SMTP id g92-20020a9d12e5000000b0066eb992749fmr9937883otg.52.1671034333836; Wed, 14 Dec 2022 08:12:13 -0800 (PST) MIME-Version: 1.0 References: <4789070.31r3eYUQgx@linux-e202.suse.de> <4794883.31r3eYUQgx@linux-e202.suse.de> In-Reply-To: <4794883.31r3eYUQgx@linux-e202.suse.de> From: "H.J. Lu" Date: Wed, 14 Dec 2022 08:11:37 -0800 Message-ID: Subject: Re: [PATCH] x86: include OSXSAVE in x86-64-v3 level To: Fabian Vogt Cc: libc-alpha@sourceware.org, Noah Goldstein , aurelien@aurel32.net Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3023.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 Wed, Dec 14, 2022 at 7:23 AM Fabian Vogt wrote: > > Am Freitag, 9. Dezember 2022, 23:52:37 CET schrieb H.J. Lu: > > On Fri, Dec 9, 2022 at 1:09 PM Noah Goldstein wrote: > > > > > > On Fri, Dec 9, 2022 at 12:26 PM H.J. Lu via Libc-alpha > > > wrote: > > > > > > > > On Fri, Dec 9, 2022 at 2:36 AM Fabian Vogt wrote: > > > > > > > > > > For some reason the initial x86-64-v3 detection code was missing checks for > > > > > BMI, BMI2 and OSXSAVE, which are all required for that level to be met. > > > > > BMI and BMI2 got added recently, but OSXSAVE was still missing. Add it. > > > > > > > > > > Signed-off-by: Fabian Vogt > > > > > --- > > > > > sysdeps/x86/get-isa-level.h | 3 ++- > > > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > > > > > diff --git a/sysdeps/x86/get-isa-level.h b/sysdeps/x86/get-isa-level.h > > > > > index 5b4dd5f062..d62bf92cde 100644 > > > > > --- a/sysdeps/x86/get-isa-level.h > > > > > +++ b/sysdeps/x86/get-isa-level.h > > > > > @@ -52,7 +52,8 @@ get_isa_level (const struct cpu_features *cpu_features) > > > > > && CPU_FEATURE_USABLE_P (cpu_features, F16C) > > > > > && CPU_FEATURE_USABLE_P (cpu_features, FMA) > > > > > && CPU_FEATURE_USABLE_P (cpu_features, LZCNT) > > > > > - && CPU_FEATURE_USABLE_P (cpu_features, MOVBE)) > > > > > + && CPU_FEATURE_USABLE_P (cpu_features, MOVBE) > > > > > + && CPU_FEATURE_USABLE_P (cpu_features, OSXSAVE)) > > > > > > > > If OSXSAVE isn't usable, all AVX/AVX512 features shouldn't be usable. > > > > Am I missing something? > > > > > > Seems like better to err on side of caution here. > > > > We will have serious issues in many places if we don't get it correctly. > > CPU_FEATURE_USABLE_P is set according to the states supported > > by OSXSAVE. Checking OSXSAVE isn't needed here. > > I see, you explicitly unset some flags if OSXSAVE is not available. > In that case the patch is indeed a noop, but also won't hurt. What about > adding a comment instead? Sure. Please submit a patch. > > > > Skipping the extra check seems prone to bugs like BZ #29611. > > -- H.J.