Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp164831rdb; Wed, 1 Nov 2023 22:39:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH36NzQZfUX/YCVx41TKD53nKfwKONKn8HHEH33ULiIuF5ays4RYK8Me7Dg6hLak6W8rgA+ X-Received: by 2002:a50:fa93:0:b0:533:4c15:c337 with SMTP id w19-20020a50fa93000000b005334c15c337mr15044404edr.16.1698903590721; Wed, 01 Nov 2023 22:39:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698903590; cv=pass; d=google.com; s=arc-20160816; b=Mu0+fsZ8f5QQYgmty71IHiWSj3Cyq7rGOmX8Wgq2tYu6JNZCP6nP3X8nQBU9GCJPDF oxDSFIckCCTYn6v8IbKpTtDSzbUZLMSBrjGdkD3NQK/ACDIC9tbNM9Mw1/zBhbxVh0G9 uiNjgucKJtzlqDNgvCK1HD9TFiH955CIapH21+4hj2ZDjFuzSETN81Ho3ERoGTlZCmA4 WMmbNEUWbGNr4p7nokxhP9xiyP4dBdipnKBSUBsu/CaJW1bXwqSiHG0hB5qljcT+6xqQ OvkThaTPDUHdvpasIJmhatgdiCyE6ex+OHEqKrHDojtgNmTdlBOpUzRmNIkM1mbiY93U vF7g== 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:references:cc:to:content-language:subject:reply-to :user-agent:date:message-id:dkim-signature; bh=jSBr375D73fMMePfj12ivKPHZF4zQlBak/s9sHEVSC0=; fh=tr4v0Acx58Njac3F8GRhn6Hnb3+c/LhuFjXD5pReeMw=; b=JCoFd0e6CPm9Bzq41//OrrZS7ZLA0MMzwUPG9iDjmnQg543jPYeXQnP6K9zP7r0q1l 9i7UdwB/Lg/Q8WKfgzDAlPqL21Nb0K6jMzum83HDd1gK6Jgo1b6gYu+o8iXw/fUiosvj U7wcF2lZ1kU0lqZ3hV3CY2oQMS5bIPHF29/iSOCbgt5tHPl6ThUjxrDR4D9ICBi0n1iB gQGHdFAu/XugtiYsxo+a8t42XGY9CiMb4xOYreXghvLl2I6omgOcZftUwRytevS1RUYo VYQX4sHLH8/D/62zSDiqCC731pVJzDkvAQh1GVi8VqNYirmqTAC1mCnpkQWAgyBNp+L9 W88A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=QgHhjFQZ; 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 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id da11-20020a056402176b00b0054031ef80b9si1356213edb.485.2023.11.01.22.39.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 22:39:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=QgHhjFQZ; 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 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 9E3AC81C7AA6; Wed, 1 Nov 2023 22:39:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348540AbjKBFji (ORCPT + 99 others); Thu, 2 Nov 2023 01:39:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348472AbjKBFjh (ORCPT ); Thu, 2 Nov 2023 01:39:37 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2088.outbound.protection.outlook.com [40.107.220.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D07AE112; Wed, 1 Nov 2023 22:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ina029EMEuC6CcfdUPfHeso/B6mxL6455jPAot3HXYg73a0ClQnXJ8/XjNeu8HHrvXcyGKAoM8cvwdaLvZZNqS101GztaorcmFrKUAKYQR34yvfpnYSUy7D4y9rAgIEoLyXBJJDAAON2wVKjDTxHWFP64g0ywaIkATauHNWf9V8akSMngGorCj4punk5DewkeBLV98iSMd4LpDs/I6CVyQoHnkHjVo74+4vqmvFnGnmN/ZI+r5AcMGwA4UX8T0HT+icAwbtKUoLrQYfSY/RxDy8Ay5ONT1MwnKD36KgkbaFU0YC4idIyTUV1cNv17VX4FaNyMJ2TrXtmqpbszEwVhw== 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=jSBr375D73fMMePfj12ivKPHZF4zQlBak/s9sHEVSC0=; b=XEodKjFNVhbwLrNy0x1DNqtKGHSGCosCWH2CkIThg87IPZgDTPHe5M8pHbJDDBB6NWkn6dI5TBh2/IEkmlL9GsW+nV4C04/OPJnKmQGyIB7UWnztHnji3V4vHORjbeI57qev4i9N+v8h+CDJ1ktFkYaWn1sc9daBhcc6QA4E7GEeuuFeLSYYlB826LVefjJ7JxCPsLq6a1mVVYvYaVcQJXlglrJz1EZpiuNyUsdeMw67PECJ3tPCilsugn2RODpCW5PBJ/Ar4zCQf9tuMQ+yBXa7liPzOcHIzN+9VPbkXiQ33qF8JsK3jrvXjToa69YkQxHr5rh0VCHUxpqIywyZUg== 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=jSBr375D73fMMePfj12ivKPHZF4zQlBak/s9sHEVSC0=; b=QgHhjFQZSPKY6M+tj+23lkwjiw++bttajcz94HcB/8BxI1Gkf8ezZi/6tzVfYedn8EsPyjhdSuAU8LEwpv8F9ajmqBT02zDSWQ2FR2jCrx0m3ZVeHvrOZgU4ASdsu9bdiCTMYjLv/eZ2UcX6XLgd+h0UUtz6uQhk3A71M26+XSw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DS7PR12MB6309.namprd12.prod.outlook.com (2603:10b6:8:96::19) by BL1PR12MB5972.namprd12.prod.outlook.com (2603:10b6:208:39b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.28; Thu, 2 Nov 2023 05:39:28 +0000 Received: from DS7PR12MB6309.namprd12.prod.outlook.com ([fe80::93cc:c27:4af6:b78c]) by DS7PR12MB6309.namprd12.prod.outlook.com ([fe80::93cc:c27:4af6:b78c%2]) with mapi id 15.20.6954.019; Thu, 2 Nov 2023 05:39:28 +0000 Message-ID: <0321430a-8666-4017-b791-127484c2b17e@amd.com> Date: Thu, 2 Nov 2023 11:09:16 +0530 User-Agent: Mozilla Thunderbird Reply-To: nikunj@amd.com Subject: Re: [PATCH v5 12/14] x86/kvmclock: Skip kvmclock when Secure TSC is available Content-Language: en-US To: Tom Lendacky , linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org Cc: bp@alien8.de, mingo@redhat.com, tglx@linutronix.de, dave.hansen@linux.intel.com, dionnaglaze@google.com, pgonda@google.com, seanjc@google.com, pbonzini@redhat.com References: <20231030063652.68675-1-nikunj@amd.com> <20231030063652.68675-13-nikunj@amd.com> From: "Nikunj A. Dadhania" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: PN3PR01CA0009.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:95::17) To DS7PR12MB6309.namprd12.prod.outlook.com (2603:10b6:8:96::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB6309:EE_|BL1PR12MB5972:EE_ X-MS-Office365-Filtering-Correlation-Id: 016afbda-d7e0-43be-ff3a-08dbdb661475 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zgNsFhULMoaYOjhJyo/mtXeJjzMiYqw4hLi/heTc3dzOyzU/Vi5a4ZLOtaf2KxnvM8TErJajG+dFi3GvlLBM17lC58LyyuRiZFdec+/Qge7221DG9QRRNPsc9bE09LA1lDjWZ3sIRgHAJUX+OfkRFkdDAFoVY42VoaiGacH079W/f6E8Y3fXZ9aKEyijQqGUZ2fGtc58wNFz3leAcg5ZjKjvv+Nwmiot9i3Y+qgwstvFTWAW59nQZjac8y90tekB6FBAN5RXdpxBE7ccpssOsxzr6XvFXO/krcrbWUoaTKn76crorLFEz/IukgmqVdnijkmyMPHFmujbdww3Le+eRYKYFwV8nGm5Jrt33HTkN4fvNQuGZszGnChtvIkCD9Mtx3WllX9dkHlMeZQZtaEPvaacUoFHu6YHIS+JPfz0v0rKqRhXPGwjqcC1H7Ew4jANOk3hJ2q38XuoIJTy3XcHCnQgj756Tq1Xm/nbJXVNktzLHw/IFDqJFarMhexd8+BsbiTSUPjhawP57P6UN1BZGd6fs2JV1zXfi03/Zoymh0lboGUOAIxG608015MqYiMFId0Sfdqf2HsOVk3SaRWQaR6fNGp2N/kZTUAcHieTtmZBa/RLmogU1MhjB+qHUYHdnFkHZO4YGTPUDPSFAiDCTA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB6309.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(376002)(136003)(366004)(346002)(39860400002)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(66476007)(5660300002)(31686004)(2906002)(41300700001)(478600001)(66556008)(6486002)(6512007)(6506007)(6666004)(53546011)(66946007)(966005)(7416002)(26005)(2616005)(83380400001)(3450700001)(316002)(8936002)(4326008)(8676002)(38100700002)(31696002)(36756003)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dnUyV0N6L2cxR1RldlhrWFFYMFExaGZWNFhpOENzOXozNGE3QkhZOFBoeUZ0?= =?utf-8?B?czQxMkloNkdYMm11dTYxZGwzRFFDTG9aL0pkb2JpTldNdEN0VTl1YnRtVnZ2?= =?utf-8?B?SkdVUDVmZHpsdWtSUFFhdXVQOHNraG9BanZCclg0TEc5YXJvOUtEekxIc0hm?= =?utf-8?B?TncrV0VISlRJTlRuemt0Q3RwZk1rdDFEM2c5Nzh1dWNzWm4yUGpJVW9yaFlM?= =?utf-8?B?dHJwZ3VUajhNc1orcmYvRWxOeUJmbXFhOVBWMGErUmVnR2pKaHBMYitHS282?= =?utf-8?B?TzFNVmpFd0ZsKzRXbUJjNEpDVHdjb0cwZzVvekdZcytJd0FwUUowTVh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= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 016afbda-d7e0-43be-ff3a-08dbdb661475 X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB6309.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2023 05:39:28.3001 (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: Oc0XUpf0vqeVGEGvnPbE7U+V8vAFtwBZ5DmixoN3tQcneQuCtZuz/2T8fkQWnzUTi5IAM9AujGScZrKpCKhW9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5972 X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 01 Nov 2023 22:39:48 -0700 (PDT) On 10/31/2023 2:30 AM, Tom Lendacky wrote: > On 10/30/23 01:36, Nikunj A Dadhania wrote: >> For AMD SNP guests having Secure TSC enabled, skip using the kvmclock. >> The guest kernel will fallback and use Secure TSC based clocksource. >> >> Signed-off-by: Nikunj A Dadhania >> --- >>   arch/x86/kernel/kvmclock.c | 2 +- >>   1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c >> index fb8f52149be9..779e7311fa6f 100644 >> --- a/arch/x86/kernel/kvmclock.c >> +++ b/arch/x86/kernel/kvmclock.c >> @@ -288,7 +288,7 @@ void __init kvmclock_init(void) >>   { >>       u8 flags; >>   -    if (!kvm_para_available() || !kvmclock) >> +    if (!kvm_para_available() || !kvmclock || cc_platform_has(CC_ATTR_GUEST_SECURE_TSC)) > > And is setting X86_FEATURE_TSC_RELIABLE, as Dave Hansen suggests, enough > to prevent usage of kvmclock? No that wasn't sufficient. kvmclock was always selected before SecureTSC even when X86_FEATURE_TSC_RELIABLE was selected. > > There was a discussion here: >  https://lore.kernel.org/lkml/20230808162320.27297-1-kirill.shutemov@linux.intel.com/ > > Thanks, > Tom Regards Nikunj