Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp300580imn; Thu, 28 Jul 2022 00:35:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sAYPWZbtexrJmHuKfm0HWErjta6OnqR9n8suy6mCVIrmPVJlOy/YYjFNbIqsH7MpUMtm6T X-Received: by 2002:a17:902:b207:b0:16d:38a:38e1 with SMTP id t7-20020a170902b20700b0016d038a38e1mr25018668plr.132.1658993710664; Thu, 28 Jul 2022 00:35:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658993710; cv=none; d=google.com; s=arc-20160816; b=nruAjPaUjokxpsHYgh5F8/Fdnybv1LzJTwi40HyQgl+ZECHMrZWE1bx4pCVXMDYD3z qnR/d0smRytBzW9/XxdRoSFAHJv5f27n/pem/n8od9CmRJj42i6salG7jBO/xHUvf8Cl 4XxVOUTczT9Ecsco3HSpltGFnQQmyaZGpMUCJPHQn/1HyskVf1bFPudUu+R4S3P9JvKG 9lQKahiluDdmhOmd/GZ8Q8NsQrUGJK339t3WTzbr30o+kVau0eRxKWdHlJk1DMPs5zwK 5dMzAZgaPpKrKO6GzWbx+yCHGFLSybDqdbMEFSrSdVp56oUQoSG69DCKvOkydWFPkuoT n/yg== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=Ux6VwMtMxHO2mepOlWLk/n9XMR06YLsuanCnSO2VUjI=; b=tdNnTH7X9sA7XwdiHCIr2qVuF7fQEG4vq6qYuBT+brCMPIMz48b95GCUUVrGkZBFGz RBanL2iBP50opZLIKgTlih3j2ujhCbAV0/F6J2+c1kms30Ryco5N7fRK9OF98SD7Yd+6 nDlre/dm/q79bwmuqIuNaW6i2m6DjQRLYMRYXQ4lNifiDjAKNGA7no8Vi8aNB7Yl0FCm cz2nWaf+026glMV63zB28YbQx4uRlW+AhnPI4j8NpMDCTUsERgrtTE+XjczBmR3rKvrP xOUOhDIpLD0Vhjsrwz9yU2p4ZJHhrevT5r6Bax05991fU5NN9JjI55r4hisUsaNtGPEZ Foyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Cy84uvf9; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-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 u186-20020a6379c3000000b003fa8e644434si366347pgc.39.2022.07.28.00.34.43; Thu, 28 Jul 2022 00:35:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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=Cy84uvf9; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-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 S233830AbiG1Hat (ORCPT + 99 others); Thu, 28 Jul 2022 03:30:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233308AbiG1Has (ORCPT ); Thu, 28 Jul 2022 03:30:48 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2B39B57234 for ; Thu, 28 Jul 2022 00:30:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658993446; 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: in-reply-to:in-reply-to:references:references; bh=Ux6VwMtMxHO2mepOlWLk/n9XMR06YLsuanCnSO2VUjI=; b=Cy84uvf9mctnvBd8B0UFUPyf7I6OJLszYFUHlBEnzKNXYI0dQT3n9KPW24nU2ZTwt0etK4 6Ez0ThLbOKlsH1aMoBJEKWeFeOuN5wODuseJ/VXgaE9e/fipWEBc6FYeTXHwPbxr/PszS/ 0m1ojePJ4X/4a8vRUSdu71HaH/mv++Q= 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-204-fvFAbU1_PgCryZqHIMMp5w-1; Thu, 28 Jul 2022 03:30:42 -0400 X-MC-Unique: fvFAbU1_PgCryZqHIMMp5w-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CC6E2185A79C; Thu, 28 Jul 2022 07:30:41 +0000 (UTC) Received: from starship (unknown [10.40.192.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 332ED492C3B; Thu, 28 Jul 2022 07:30:34 +0000 (UTC) Message-ID: Subject: Re: [PATCH v2 0/5] x86: cpuid: improve support for broken CPUID configurations 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 , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Herbert Xu , Jiri Olsa , Mark Rutland , linux-perf-users@vger.kernel.org, "open list:CRYPTO API" Date: Thu, 28 Jul 2022 10:30:33 +0300 In-Reply-To: <20220718141123.136106-1-mlevitsk@redhat.com> References: <20220718141123.136106-1-mlevitsk@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE autolearn=ham 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-crypto@vger.kernel.org On Mon, 2022-07-18 at 17:11 +0300, Maxim Levitsky wrote: > This patch series aims to harden the cpuid code against the case when > the hypervisor exposes a broken CPUID configuration to the guest, > in the form of having a feature disabled but not features that depend on it. > > This is the more generic way to fix kernel panic in aes-ni kernel driver, > which was triggered by CPUID configuration in which AVX is disabled but > not AVX2. > > https://lore.kernel.org/all/20211103145231.GA4485@gondor.apana.org.au/T/ > > This was tested by booting a guest with AVX disabled and not AVX2, > and observing that both a warning is now printed in dmesg, and > that avx2 is gone from /proc/cpuinfo. > > V2: > > I hopefully addressed all the (very good) review feedback. > > Best regards, > Maxim Levitsky > > Maxim Levitsky (5): > perf/x86/intel/lbr: use setup_clear_cpu_cap instead of clear_cpu_cap > x86/cpuid: refactor setup_clear_cpu_cap()/clear_cpu_cap() > x86/cpuid: move filter_cpuid_features to cpuid-deps.c > x86/cpuid: remove 'warn' parameter from filter_cpuid_features > x86/cpuid: check for dependencies violations in CPUID and attempt to > fix them > > arch/x86/events/intel/lbr.c | 2 +- > arch/x86/include/asm/cpufeature.h | 1 + > arch/x86/kernel/cpu/common.c | 51 +------------------- > arch/x86/kernel/cpu/cpuid-deps.c | 80 +++++++++++++++++++++++++++---- > 4 files changed, 74 insertions(+), 60 deletions(-) > > -- > 2.34.3 > > A very kind ping on these patches. Best regards, Maxim Levitsky