Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2374303pxj; Mon, 10 May 2021 01:04:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmnsT4L/Z5JF70cw6Iy7w3pQuB7KOEwD1sSzX+C+Dc2zHnn05TA5crRbC42Hts3U2u9oRd X-Received: by 2002:a05:6e02:20ce:: with SMTP id 14mr20473964ilq.102.1620633865937; Mon, 10 May 2021 01:04:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620633865; cv=none; d=google.com; s=arc-20160816; b=JbysKngIgMxtUij+xIxLP45O3epSopI7j30YFLw7FTBL+ndYwWL2kC0cCBMWaC0dUf Xsa576JesiOuu1vzL0B00nOr6zhaMAT+R/UR2fik1c6slhsL64rqK03TO0hg50u2Jo10 0pagBVHUxWpp41U2yXGGCeoBpZMDI6iW7WmDvul4ifLaTgq8/lFuDPEUOk9crm8HoIpL 0nE0Q0QoaEuly6BRpHc2WiCDrwVYraX9sfjOlX6aw12OvewwbBkbWxz1/eAKI57QAyFQ jgFLhSh/6VUd0T/Rgjf2xUVkI2Aw/Kp/qMnN7Ybsl1RXMUYAWdSQycOGsgQM0XLz6ybc Xnzg== 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=yTnjHtJM9cM9/CNRU7MdS6zqnbDhW6KdwOPWG8fu3lE=; b=sa6TjrAzSq2u9UB4c7+U7rgE81y4QBowvVVaP1cxTu1aIg1KoxrezHXcbZSc4hp6u0 jcbVo2EaFD8MKsrzEjy0bmZ3IfOexEN4vc+Y9IFWrVOHMAhqBk0HpH+I80qN8fQZ1/1x So/ebBPrTJG/ayZ+SutybVTG8MwMZdjConuVSAS2yPKH4Z49YFaYD+m53pCL93W7Gr0R qSsrJ0nUvww9TxF9BXT23qNP0xarExUyGUbQQLGsNIg23gDQjWfbBzkkBMonemw44YcK YV1yj0NZOZDSspK6pvBJfak8BoUcgjF/qaJ/NZQnDRH2YMIaZi+xaSGWIqsByfplcjrw ByXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JBBGuKUs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e5si14634295jaq.6.2021.05.10.01.04.12; Mon, 10 May 2021 01:04:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JBBGuKUs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230163AbhEJIE0 (ORCPT + 99 others); Mon, 10 May 2021 04:04:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:47558 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229852AbhEJIE0 (ORCPT ); Mon, 10 May 2021 04:04:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620633801; 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=yTnjHtJM9cM9/CNRU7MdS6zqnbDhW6KdwOPWG8fu3lE=; b=JBBGuKUsnTeq9fW1v5LjvcEC9wOeYYIOHW9eHc/Gb6Y26cz4OS8UCUT7O2HTAviGYW1DKO nCb5lrOArUFfpFJPD/SO+mLX30klzJ47wz0fU4nICoUqrQEoJkTBc0ykR6TB7h+1rRHt9c ybWRJzSC8dMlwZSW4673Tvg5HnWzlkk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-329-92GvdBxGNIm505JoPPZ2VA-1; Mon, 10 May 2021 04:03:18 -0400 X-MC-Unique: 92GvdBxGNIm505JoPPZ2VA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 49C721006C81; Mon, 10 May 2021 08:03:16 +0000 (UTC) Received: from starship (unknown [10.40.194.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id 44EFE19C45; Mon, 10 May 2021 08:03:11 +0000 (UTC) Message-ID: <666b1f0a597383bf0c838d9bfde5f07d6d0828c6.camel@redhat.com> Subject: Re: [PATCH 01/15] KVM: VMX: Do not adverise RDPID if ENABLE_RDTSCP control is unsupported From: Maxim Levitsky To: Sean Christopherson , Paolo Bonzini Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Xiaoyao Li , Reiji Watanabe Date: Mon, 10 May 2021 11:03:10 +0300 In-Reply-To: <20210504171734.1434054-2-seanjc@google.com> References: <20210504171734.1434054-1-seanjc@google.com> <20210504171734.1434054-2-seanjc@google.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.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2021-05-04 at 10:17 -0700, Sean Christopherson wrote: > Clear KVM's RDPID capability if the ENABLE_RDTSCP secondary exec control is > unsupported. Despite being enumerated in a separate CPUID flag, RDPID is > bundled under the same VMCS control as RDTSCP and will #UD in VMX non-root > if ENABLE_RDTSCP is not enabled. > > Fixes: 41cd02c6f7f6 ("kvm: x86: Expose RDPID in KVM_GET_SUPPORTED_CPUID") > Cc: stable@vger.kernel.org > Signed-off-by: Sean Christopherson > --- > arch/x86/kvm/vmx/vmx.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 10b610fc7bbc..82404ee2520e 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -7377,9 +7377,11 @@ static __init void vmx_set_cpu_caps(void) > if (!cpu_has_vmx_xsaves()) > kvm_cpu_cap_clear(X86_FEATURE_XSAVES); > > - /* CPUID 0x80000001 */ > - if (!cpu_has_vmx_rdtscp()) > + /* CPUID 0x80000001 and 0x7 (RDPID) */ > + if (!cpu_has_vmx_rdtscp()) { > kvm_cpu_cap_clear(X86_FEATURE_RDTSCP); > + kvm_cpu_cap_clear(X86_FEATURE_RDPID); > + } > > if (cpu_has_vmx_waitpkg()) > kvm_cpu_cap_check_and_set(X86_FEATURE_WAITPKG); Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky