Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3391172imw; Mon, 18 Jul 2022 07:19:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1txQ8H8YGL/YYgrgVI/gGdEZPO4UJLxSeEJIjAGigOe+9/wRAyxaFOi1671tjlwGg0O3Ki+ X-Received: by 2002:a05:6402:2552:b0:43a:d133:b282 with SMTP id l18-20020a056402255200b0043ad133b282mr36837812edb.89.1658153940689; Mon, 18 Jul 2022 07:19:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658153940; cv=none; d=google.com; s=arc-20160816; b=AcmECRo7J28T1wUnrfLLHqlBAnCCPjU3cUbvyQuuPpf08Q94sw9BVTp2b+aN8mOxvN us+lSz26jH6PsZau+wrvOyDA5U55Q86zPI7HruyW54r4N2qVgs3HGxG3MvgkmGBhzH+8 p8vpymAfSfsQeKcMh4VDZ1saNrJL8nSxE4omzSZINiVeaEfggSt9qdQO09CdeVTVOQLU 18ppCzLjm0YJudT8gakS8k6TH5pPs6WmTgEdzyK/jABQ14uWgkaRODaaLAQCasv46V+n eusAcL699JqQy06Rx42j3KY/b9efgU3iVBrBXqPqhMhYbepsoNRHJAS++4m/1QnOW849 wPGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Vcb7EQNP7nmt18gfIk7EjblaRPAfBOgB5YIPuamopdk=; b=V5NYovxUyTNQLl9oQSf6Z22PIfZ03+2+F04Ve4EGiZsBbcZssaP584uMitryffGW5Y MV4qdfocVh+XovmFwyd+TdrarvFFb91+raziSIMMRgnjFOY4C+CkZT69Ls/e8ePF7tG3 CnGOkkusjrbBl+61M+kmVaDhjx06GZkIMdW/s1OOvZMsT+BVSw+HLbAAHseRJNtV3vPF pExhKAPBN6wSX0aTywA2Yz7theZUZFD7HyOEpoJhgE1bsxa3H4Mi7CKG4m5d3zvXWcsu MwFa867C1Ho6tEaKAPuDqBnlYCMHL5C2hdx7iPNwu049lKA0bWs+RCuh5Mx0HdSlbFJ8 NAMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P6LeF3xy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du18-20020a17090772d200b0072aef01015dsi8016426ejc.532.2022.07.18.07.18.34; Mon, 18 Jul 2022 07:19:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P6LeF3xy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235723AbiGROLi (ORCPT + 99 others); Mon, 18 Jul 2022 10:11:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235285AbiGROLh (ORCPT ); Mon, 18 Jul 2022 10:11:37 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7437F27173 for ; Mon, 18 Jul 2022 07:11:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658153495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Vcb7EQNP7nmt18gfIk7EjblaRPAfBOgB5YIPuamopdk=; b=P6LeF3xy/AR8U+qPK2zn8jA2WE0n/eL430TrlyWfryMyq9BJC5L8fvy9mJYjnikzH8PJma HSX4P+p0fJ4MH6sK4llwSdZc161JFaB9iiPFHom4R5dX1/CPMtJk4heJg0JV+2yNH+P06w SpsfjxTDRVpwO5ZMrRXgIPV5SDyp7kQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-665-HEpFr7HLMUadJh7iEE8vwg-1; Mon, 18 Jul 2022 10:11:32 -0400 X-MC-Unique: HEpFr7HLMUadJh7iEE8vwg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 43E78801231; Mon, 18 Jul 2022 14:11:30 +0000 (UTC) Received: from amdlaptop.tlv.redhat.com (dhcp-4-238.tlv.redhat.com [10.35.4.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD78B2026D64; Mon, 18 Jul 2022 14:11:24 +0000 (UTC) From: Maxim Levitsky To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Pawan Gupta , Ingo Molnar , Josh Poimboeuf , Namhyung Kim , Tony Luck , Paolo Bonzini , "H. Peter Anvin" , Arnaldo Carvalho de Melo , Thomas Gleixner , Alexander Shishkin , Tim Chen , Borislav Petkov , "David S. Miller" , Dave Hansen , "Chang S. Bae" , Jane Malalane , Kees Cook , Kan Liang , Peter Zijlstra , Maxim Levitsky , x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)), Herbert Xu , Jiri Olsa , Mark Rutland , linux-perf-users@vger.kernel.org, linux-crypto@vger.kernel.org (open list:CRYPTO API) Subject: [PATCH v2 0/5] x86: cpuid: improve support for broken CPUID configurations Date: Mon, 18 Jul 2022 17:11:18 +0300 Message-Id: <20220718141123.136106-1-mlevitsk@redhat.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch series aims to harden the cpuid code against the case when=0D the hypervisor exposes a broken CPUID configuration to the guest,=0D in the form of having a feature disabled but not features that depend on it= .=0D =0D This is the more generic way to fix kernel panic in aes-ni kernel driver,=0D which was triggered by CPUID configuration in which AVX is disabled but=0D not AVX2.=0D =0D https://lore.kernel.org/all/20211103145231.GA4485@gondor.apana.org.au/T/=0D =0D This was tested by booting a guest with AVX disabled and not AVX2,=0D and observing that both a warning is now printed in dmesg, and=0D that avx2 is gone from /proc/cpuinfo.=0D =0D V2:=0D =0D I hopefully addressed all the (very good) review feedback.=0D =0D Best regards,=0D Maxim Levitsky=0D =0D Maxim Levitsky (5):=0D perf/x86/intel/lbr: use setup_clear_cpu_cap instead of clear_cpu_cap=0D x86/cpuid: refactor setup_clear_cpu_cap()/clear_cpu_cap()=0D x86/cpuid: move filter_cpuid_features to cpuid-deps.c=0D x86/cpuid: remove 'warn' parameter from filter_cpuid_features=0D x86/cpuid: check for dependencies violations in CPUID and attempt to=0D fix them=0D =0D arch/x86/events/intel/lbr.c | 2 +-=0D arch/x86/include/asm/cpufeature.h | 1 +=0D arch/x86/kernel/cpu/common.c | 51 +-------------------=0D arch/x86/kernel/cpu/cpuid-deps.c | 80 +++++++++++++++++++++++++++----=0D 4 files changed, 74 insertions(+), 60 deletions(-)=0D =0D -- =0D 2.34.3=0D =0D