Received: by 2002:ac8:760c:0:b0:40f:fb00:664b with SMTP id t12csp913636qtq; Thu, 14 Sep 2023 22:10:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGG4IXnvUw705QIveEXx8i2X87jSpifJXAVDkPkrg/XDrP0wAqyThFYsfdTp4wUtrUfmNFP X-Received: by 2002:a05:6808:3af:b0:3a8:4f87:f92c with SMTP id n15-20020a05680803af00b003a84f87f92cmr700471oie.44.1694754626033; Thu, 14 Sep 2023 22:10:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694754625; cv=pass; d=google.com; s=arc-20160816; b=YB3sKYJEEwKaxfRFQonHkX169nj82AWpIZ5SF5GCifWYxPdLf524pT2U9Ok4OTbnhL fphcFDpH/sw+KqXCmT4MW7k6ii/UzUv5/+LdUNHmFkKPY+6tvDARc2Vb6D6451Hjm/RU x3MTKwFf7czfacru6dr2CkBsiC3TfjFLQ34ANajv6Iv4Uhyo+Kc6Oughcx/ewQCGz7oJ oaEoYIrPSo1JHVXJrzazn1zI3tDZoW+cXj8zyT3uDVIqPiuPoVI3Q7vSwkawReZZUc59 mU9PnOlWgniSr/zkYLuVI5EF/3xFQp6LYIkEPvGOFBdiMFrvELiAdq/s9Y1PuJAyERz1 40Ww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:content-language:references:cc:to:subject :user-agent:date:message-id:dkim-signature; bh=ylOz7uclU1zKDMBW8dkjBcZHCAXO4P85sxLIHQ4mYOM=; fh=+m+7WRVZTvuO0jiBL2LFLYNr1CKgIDdFdkEi9mliCBE=; b=lKUzs9v3MAmKT0ilB7tpCw037HonnJ0iNZilLqHmamUxBAI+z43l1rVjvOwUYmYajK 18ZcIpZ03tkSyVMZLxstHjGRaX59qIMYpvv7psLO3WM5PyDOQ0rIUfE7q/NT85FjA26t F5cdEguQT0WmQ182H1UVKlqhwNVRflAehX85+XZJZUQSIx8enILJA884XNgdGIge3rvz Kw3FWd1B06fMJzcNKUgAHahjb4xd42HXlZH0vGtDVl1udwXA5a9S9Zidln0IC2qAJFWg SYDsCsiT7k5KMxLLGcey81EMMzHdykEO6qstwktk7862zwL0BFAcatIgQ9E3vuDtbk/q bH1g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=peqm+UoY; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id cm10-20020a056a00338a00b0068e4d216325si2707786pfb.204.2023.09.14.22.10.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 22:10:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=peqm+UoY; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 21B0B83CD66C; Thu, 14 Sep 2023 13:49:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229945AbjINUsu (ORCPT + 99 others); Thu, 14 Sep 2023 16:48:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbjINUst (ORCPT ); Thu, 14 Sep 2023 16:48:49 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2050.outbound.protection.outlook.com [40.107.95.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC6632698; Thu, 14 Sep 2023 13:48:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sbul43BYOxz/PDTCrrLSTQLd9senMZ5PMCMjyUCcolZ8V5v306X7Hy3+2AWBWTglKN02BcB5ZjjI4cUgO11Qnyl6PEkPg+v/maGjIeJ0MZSrlyau094FIiCRpiUO33E52cEet1l56dYennBwZrEvXfAaKeQVaeiXUOV99rGkHZVR5eIxIg1ZvW7Uh9NebtZkc9s/RZiL5h85tmdkFvmQlZAPPm+kUiRK2H2P2jJ4iWYqOTKA9GSNHVK2xnV+eUkM8/5t1sLKbo8//mR7Rg67FwRVHKMXJJUx761dMPa55XG4M0TruZWXPW2AsElCWkvwETrpBr+uSgQ73eAOmI+u/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ylOz7uclU1zKDMBW8dkjBcZHCAXO4P85sxLIHQ4mYOM=; b=C4ysvoaI5watObiJjnRWN78VUVaQRhTDqPaEZdmll4lZLiRM3/pn3hYexkY7Fbr1ILrFKEYP50rUYQpQ1cmYJ5UNb/uua8HjPoBqxEl1BOjF4AuzPhtG4guSeH99SkmV1zPTyojQPJYillm0WTEZXBiaO7A4Bu0OO+yNCZ39Mr+6Ke+ZmmRFz1cDVuiKtRVypTm3y45qBUTmsIKf8wkTd2fJeHy8EaTHYxu92lMxyz6O8I3jwQQ4bpWLFUC+tcTw6d4HOnbYe+1uphHwplTbQenGYRebCX5gYWkZJhjWjFbmZakG3sW/j14gYmCTTv4bohvyg6nhONbtgmxYsETblA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ylOz7uclU1zKDMBW8dkjBcZHCAXO4P85sxLIHQ4mYOM=; b=peqm+UoY+RNrc0bu2RavSqywZnfPGFsU7CqXFH96PTMtEZGI254zsdaa/nzTgy6QHtDMW+/ChhFCV/ZKX1HLJux+atAm8ElzOBa6wvNkg4TPNlkm7PUWnFq45w9t/tqxjq3wYbPkdBcn0GIyxHQbHssUenmBnfdf5PDp7+GpfU0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) by PH7PR12MB6668.namprd12.prod.outlook.com (2603:10b6:510:1aa::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.31; Thu, 14 Sep 2023 20:48:42 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::d267:7b8b:844f:8bcd]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::d267:7b8b:844f:8bcd%7]) with mapi id 15.20.6792.020; Thu, 14 Sep 2023 20:48:42 +0000 Message-ID: Date: Thu, 14 Sep 2023 15:48:40 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH 1/2] KVM: SVM: Fix TSC_AUX virtualization setup To: Sean Christopherson Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, Paolo Bonzini , Borislav Petkov , Dave Hansen , Ingo Molnar , Thomas Gleixner , Babu Moger References: <8a5c1d2637475c7fb9657cdd6cb0e86f2bb3bab6.1694721045.git.thomas.lendacky@amd.com> Content-Language: en-US From: Tom Lendacky In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SN1PR12CA0044.namprd12.prod.outlook.com (2603:10b6:802:20::15) To DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR12MB5229:EE_|PH7PR12MB6668:EE_ X-MS-Office365-Filtering-Correlation-Id: f143f31e-7e96-4bf4-03ae-08dbb563faf6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yVQme40ewFTXUkgQ67zFFidy6LgYn2iYLD/a5FTdeYRvL8MWAtHglKr5v/NveRD8CShyjV62zPRSwNCy/HPRswhs3UFcTb4goI6b484gVtgeiGcjs2ts6Z3m7xPxqRQmPMb2EAgfVQfPOZ/jTn5/3MpsROOthQLbI87NGF5hWHjr6Hm1dV+Pef/ysBUAEY6Y9e5QkwgFJ9IoT8VqNWtO3QfzResy5YvvMiVhzus6xUdQMSuugAJ0K0oBKKW0hch4rLcSAN/MmDZNzeQ/v9XtSC6w+/9tTeR2HFHnLDaRXOPxbP3/rsYjyOd5tt2WYp97t3Tf5Z/A0OLfiJ7POBexY5MHtpUu2mTEdpwKiWGfyFeTOakEDZsKnEwT+kYUt5VrIUgFjYKb2tMJEjOqdX+gmc+Wcr0zWeDFbIa/wDcWDHkiHRh4u8s0nku8Szhe66KlU7ihOyaSwIU5ctr9YDe0i6zGauVXNNpwbzJm4g8ePFauNRB2+Uqh3aNvSUVvqXThXB6pSS6hv3FiBS8Y2pk9aKIcAV6V48Fd3PXXMRoOlWA9CNjR7SzufTjNjlaFcdKzp2aUd9ol5xXZVOhGRgyt12/XUMuvf0xzHsbliBt1KNy3KR4+6MEcwSw3ntRPP+BOH33Bq2hfLPHOAxDPG8Nqug== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR12MB5229.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(346002)(39860400002)(376002)(396003)(366004)(186009)(1800799009)(451199024)(8676002)(316002)(6916009)(54906003)(66946007)(36756003)(66556008)(66476007)(26005)(6506007)(6486002)(83380400001)(53546011)(86362001)(6512007)(38100700002)(2616005)(31696002)(478600001)(2906002)(31686004)(5660300002)(41300700001)(8936002)(4326008)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Zkk2K3FsTCtlTDk2RnNFRHo2Rjh6VE43Z3lwMVBLbzBNeDlYTXh3ZXdnLzVo?= =?utf-8?B?b28wWjJsMWpiRTJKbVVtZUliekJPWmlmdXFIbnBsMDU3dXQ2K3hBUCtiTk9p?= =?utf-8?B?b2Y3V3dLU3cvUlNFUUVxQXBKVUZnV1oyQVJodWJBUzRHWklrT1FFcFQ2NkJl?= =?utf-8?B?T256Qk93R0xLMUFDc0FHQTlUOFdtUWJZWmUxeUZidWtHcU5aQjZXQ2RCMkE5?= =?utf-8?B?NkxNWlExVFE1ZDA5ajJpeURkb1NvZlpGc25YWjVqSUduZnMrVElXYTJpQkc4?= =?utf-8?B?MUtCcW1LS2hDUzhkWTdHN2JyT0JKMGdKTHY2MlJBdUd6L0NKTno2SFlGWmR6?= =?utf-8?B?Zm83STFsK1hkdE5XZnp1MHFxbHhGMGkyYzhFUzQzSW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dbb563faf6 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2023 20:48:42.1186 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6/M0rvNYcDwdZIhGkRNHfKuotSobm4mUNeTRD3951Mo3g49feNMBw4CNylDvkIr03bfhlW2VlBB1gWDy6gr9Pw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6668 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 14 Sep 2023 13:49:05 -0700 (PDT) X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email On 9/14/23 15:28, Sean Christopherson wrote: > On Thu, Sep 14, 2023, Tom Lendacky wrote: >> The checks for virtualizing TSC_AUX occur during the vCPU reset processing >> path. However, at the time of initial vCPU reset processing, when the vCPU >> is first created, not all of the guest CPUID information has been set. In >> this case the RDTSCP and RDPID feature support for the guest is not in >> place and so TSC_AUX virtualization is not established. >> >> This continues for each vCPU created for the guest. On the first boot of >> an AP, vCPU reset processing is executed as a result of an APIC INIT >> event, this time with all of the guest CPUID information set, resulting >> in TSC_AUX virtualization being enabled, but only for the APs. The BSP >> always sees a TSC_AUX value of 0 which probably went unnoticed because, >> at least for Linux, the BSP TSC_AUX value is 0. >> >> Move the TSC_AUX virtualization enablement into the vcpu_after_set_cpuid() >> path to allow for proper initialization of the support after the guest >> CPUID information has been set. >> >> Fixes: 296d5a17e793 ("KVM: SEV-ES: Use V_TSC_AUX if available instead of RDTSC/MSR_TSC_AUX intercepts") >> Signed-off-by: Tom Lendacky >> --- >> arch/x86/kvm/svm/sev.c | 27 +++++++++++++++++++-------- >> arch/x86/kvm/svm/svm.c | 3 +++ >> arch/x86/kvm/svm/svm.h | 1 + >> 3 files changed, 23 insertions(+), 8 deletions(-) >> >> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c >> index b9a0a939d59f..565c9de87c6d 100644 >> --- a/arch/x86/kvm/svm/sev.c >> +++ b/arch/x86/kvm/svm/sev.c >> @@ -2962,6 +2962,25 @@ int sev_es_string_io(struct vcpu_svm *svm, int size, unsigned int port, int in) >> count, in); >> } >> >> +static void sev_es_init_vmcb_after_set_cpuid(struct vcpu_svm *svm) > > I would rather name this sev_es_after_set_cpuid() and call it directly from > svm_vcpu_after_set_cpuid(). Or I suppose bounce through sev_after_set_cpuid(), > but that seems gratuitous. There is a sev_guest() check in svm_vcpu_after_set_cpuid(), so I can move that into sev_vcpu_after_set_cpuid() and keep the separate sev_es_vcpu_after_set_cpuid(). And it looks like you would prefer to not have "vcpu" in the function name? Might be better search-wise if vcpu remains part of the name? > > AFAICT, there's no point in calling this from init_vmcb(); guest_cpuid_has() is > guaranteed to be false when called during vCPU creation and so the intercept > behavior will be correct, and even if SEV-ES called init_vmcb() from > shutdown_interception(), which it doesn't, guest_cpuid_has() wouldn't change, > i.e. the intercepts wouldn't need to be changed. Ok, I thought that's how it worked, but wasn't 100% sure. I'll move it out of the init_vmcb() path. > > init_vmcb_after_set_cpuid() is a special snowflake because it handles both SVM's > true defaults *and* guest CPUID updates. > >> +{ >> + struct kvm_vcpu *vcpu = &svm->vcpu; >> + >> + if (boot_cpu_has(X86_FEATURE_V_TSC_AUX) && >> + (guest_cpuid_has(vcpu, X86_FEATURE_RDTSCP) || >> + guest_cpuid_has(vcpu, X86_FEATURE_RDPID))) { >> + set_msr_interception(vcpu, svm->msrpm, MSR_TSC_AUX, 1, 1); > > This needs to toggled interception back on if RDTSCP and RDPID are hidden from > the guest. KVM's wonderful ABI doesn't disallow multiple calls to KVM_SET_CPUID2 > before KVM_RUN. Do you want that as a separate patch with the first patch purely addressing the current issue? Or combine them? > >> + if (guest_cpuid_has(vcpu, X86_FEATURE_RDTSCP)) >> + svm_clr_intercept(svm, INTERCEPT_RDTSCP); > > Same thing here. Will do. Thanks, Tom > >> + } >> +}