From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by sourceware.org (Postfix) with ESMTPS id C55AF3834E2A for ; Fri, 9 Dec 2022 22:53:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C55AF3834E2A 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-oi1-x230.google.com with SMTP id r11so5827627oie.13 for ; Fri, 09 Dec 2022 14:53:14 -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=+3tY3zxS4DdPTth5W3GxfEQRh/xQL+Vix+ClMHcaM48=; b=JW3DMxvxfvwdEzM98HfBsYvMCDr5yzRMHBF233tDOGrJFk5P/XyhrRp93YLY64dnGp ixx9CQWj9A95VZIkhoCneDHLebxzltIO+6uv37g+tkhGX+KxvdOisJMMc564iHi6O7Zi BfXW/+zBEshJ9GGW781PdlvKlLQ+N3JvnGaQ3pWvJ/i5HENFdPGkPPzMU2KqF5ueblaa ZEda050VXuzEr5uEz1MpDdoRoJ8Sy4hHXa5S7i+DPk+Wc6YBW2P8WA9SWTPWCd1estw7 0Wbzfho8vZ1eeaWSVIOgYBQPfSjZH2SO3Llo4eCzN2wFwDI4LrpSAQZ3x14bSLv8Meip sRoA== 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=+3tY3zxS4DdPTth5W3GxfEQRh/xQL+Vix+ClMHcaM48=; b=2L8GoLXE88rD5eEP8D9VujOf0bKsVbsHedG5fUZKP4RzSZUpjM9llrkWRm/84G5Yut ZJRGhH6PTa8PWtjiDDT569gxm/So/AGybF+oK1QAU/+EA2fm7rhinSHoTlEJ5NlGNPi6 F7E7xDX0U9N7OQhG1nz627dNw69k6BxhfqQWguESEAObN5I97Gwjf9sGyFG8AEoipybN DNVsaUTAHnznd+VNKr7mxUAgBnCw05mr6D/UhwAFCIMEXSExAPG+2r599RxUrLMKRjan hfE7/8Om5Tr1H5VDND69UsF7hO0nNQRj87JOxr/vQqUemAHmZ6ZrrF69ayvulMwMnvKL VERg== X-Gm-Message-State: ANoB5plrQYNpQvRVWfrO/PJvRlUmFFYE6nBfwuEm23bE35kImt3K7JTl r5fTNiumQn7+8TVNcNyLqRK/RA6Cc+GfFuhUNqo= X-Google-Smtp-Source: AA0mqf5q8CyjfQnvjz23ifhZgic1y92YdZytzm9YCG0kjOGRuXJHMmrmMeIIR28hoRlCiAFPHSuVf0NljL3m8oAvo4k= X-Received: by 2002:a05:6808:22a0:b0:35b:c6c4:7a33 with SMTP id bo32-20020a05680822a000b0035bc6c47a33mr20156648oib.266.1670626394070; Fri, 09 Dec 2022 14:53:14 -0800 (PST) MIME-Version: 1.0 References: <4789070.31r3eYUQgx@linux-e202.suse.de> In-Reply-To: From: "H.J. Lu" Date: Fri, 9 Dec 2022 14:52:37 -0800 Message-ID: Subject: Re: [PATCH] x86: include OSXSAVE in x86-64-v3 level To: Noah Goldstein Cc: Fabian Vogt , libc-alpha@sourceware.org, aurelien@aurel32.net Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3023.2 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 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. > Skipping the extra check seems prone to bugs like BZ #29611. -- H.J.