Received: by 2002:a05:7412:85a1:b0:e2:908c:2ebd with SMTP id n33csp63344rdh; Mon, 30 Oct 2023 14:00:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnFqUX+TpyXdurY+1s2HyuTpJJbLPsdUBLDvVBInkQ1IGBxVOs6U4FxwmNDgKN1i+0c1U+ X-Received: by 2002:a05:6a20:7da1:b0:15c:fa48:2c09 with SMTP id v33-20020a056a207da100b0015cfa482c09mr11755092pzj.15.1698699653989; Mon, 30 Oct 2023 14:00:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698699653; cv=pass; d=google.com; s=arc-20160816; b=ARAg77Lm9m5CXk2sstGD1cOjZ6HnUDDjTfdxtY6e7YuveNLi4E1MW6Ta9U+YTTrRta F3A8SF8UUKywlka2E8hsMueIoT718eGbj9h36rAEdLHEtlEo6uwoAFIcdTsW95jY3akV HquTpZGup24C3vZwOUCZySq1m0RBugEdOzBLfUH5Mx3CKNEH+/WNSfJn62gHIxqIJdlI IZmv+sOrldyyKm94FN0xOOeDTndyxAa8ox36IFGiLP5D0VvrgUQRI4IgZnsu/YSuciJX k8TRdpWdfClcoAKn5cfVtJSMzEgA3SurR1FZNFP1KCS50wEB8+RuC+bqy3DLVqnxiby7 LRoQ== 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 :user-agent:date:message-id:dkim-signature; bh=6XaneCu9562uVHNPF2RVF3dc+sQJE6EXoTrW8175XIQ=; fh=NU02LwloB+Fd/cfVcIBoNjJNLtnlo+NEvuRhjd90JOY=; b=hymyjvZKdlyyI634iaX3dGq4fPQfEgEalfSQS9NyjqthUj41Ntad0JSx21TzcWV4R7 OroEexfTXF3OrIjP1YS2CLYwuM2ophYaX2uYHkriclMRSnVMYIl7cpRHDHo1sLu4XvL+ Tfli0DVcvFKk6uvIp0Fv2VaIDiBRdIj5dUjU8+Ay47MbxfxyPt2WsGBMsljnXS2cIU0H ZfwWBM5R28lvXa75prX2hyLRsDbWvZxt9dKhUbH/KjkO5s7JX+GnL4ssEVwpM5BrHlST wEpSSVHSgrrCiLwSJnevzIN8g3lvlhObT6+LVRRQn+Iy7gr9w1Nt8ElCSoe+fOmLBhmm QQXQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=JuxqoGKb; 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:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id l133-20020a633e8b000000b005b91192c61dsi5405016pga.217.2023.10.30.14.00.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 14:00:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=JuxqoGKb; 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:5 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 groat.vger.email (Postfix) with ESMTP id C6DCA807664B; Mon, 30 Oct 2023 14:00:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229837AbjJ3VAN (ORCPT + 99 others); Mon, 30 Oct 2023 17:00:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbjJ3VAM (ORCPT ); Mon, 30 Oct 2023 17:00:12 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2070.outbound.protection.outlook.com [40.107.220.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 571C7DD; Mon, 30 Oct 2023 14:00:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PILj6hCUWUIL3b2NoRyIz79vwVcvPuiOL55xfPJ65ZjjledXQUeqakt1XqdwSkO8yQZddncPtuxW8eUdCDg0BovPJrLZN7nuLjalAxDNIOsKsPrQ1BSBF2Q6OQkhm6RtEDUoxGfRtVaBKYpskYYqg+GKpLbpX+X7OYNpVQr0fDpk4OJ98CFMoffPiqKIJ3dC8n2zerefaMkp/8nMxVOJSJORSrDwy8DioaHgN++Ic58CQLSufag+9DVkKDGv++XlK/CzIIRZ4dT5XHRMVxdORqgDEc0D9kPVuxZQTHBX2pGz6o3gsf8e+4JmST7Xy1CYYyvi15QXudZG+6zptblqJQ== 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=6XaneCu9562uVHNPF2RVF3dc+sQJE6EXoTrW8175XIQ=; b=a9eb9yHlgBuCMJHssSYEMu80fdwuVmJgt6Qwmzd73nQa0v+MU6a0DjBZTCKze4h6ByM7ePH1ZQfcuix8pkry2gBa2weFN2jtycthbi3klMcyikUicUtwEDnBC2ycgEsnj7gM1aexSQFXtEY+L85UBY1jmZrTuNrPbgT990V6xplVhcBeQH/K02ITVgotUf+/cKy9AkgXP4VcSbQNq1+1gMrFio0J8y0+V2DQkcaClTGYBGvTGIk6oC5c8uIHaVBMR+B0EmrvXjO1D9yv+ApbJ9NVA4hynBfdb4loAG6rEAxdvTu1mFit7CVqfdXtWjol+UJnwwcVZGXg5GaYIfwlDA== 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=6XaneCu9562uVHNPF2RVF3dc+sQJE6EXoTrW8175XIQ=; b=JuxqoGKbtN4O64fQyg72zWochm6xmBP0rNQA2PeejesrKHQ3ETBMUHB8oA6KdXOJTGfk/ZVw7uFQoGp2ct2f7iVeZsKI3ylDRdO/+nTZIzOoUNyqytX0p1nq95HrtTPbr212ZLNAqz9k5MLXpen32Glq/OQzIQd83Vd0ToIlOLw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BL1PR12MB5732.namprd12.prod.outlook.com (2603:10b6:208:387::17) by SA1PR12MB8162.namprd12.prod.outlook.com (2603:10b6:806:33a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.27; Mon, 30 Oct 2023 21:00:06 +0000 Received: from BL1PR12MB5732.namprd12.prod.outlook.com ([fe80::e16e:d7f1:94ad:3021]) by BL1PR12MB5732.namprd12.prod.outlook.com ([fe80::e16e:d7f1:94ad:3021%7]) with mapi id 15.20.6933.027; Mon, 30 Oct 2023 21:00:06 +0000 Message-ID: Date: Mon, 30 Oct 2023 16:00:03 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v5 12/14] x86/kvmclock: Skip kvmclock when Secure TSC is available Content-Language: en-US To: Nikunj A Dadhania , 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: Tom Lendacky In-Reply-To: <20231030063652.68675-13-nikunj@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SA9PR13CA0077.namprd13.prod.outlook.com (2603:10b6:806:23::22) To BL1PR12MB5732.namprd12.prod.outlook.com (2603:10b6:208:387::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL1PR12MB5732:EE_|SA1PR12MB8162:EE_ X-MS-Office365-Filtering-Correlation-Id: 35a7f016-64c0-4208-bcbc-08dbd98b31fe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HRZzgC/B6KMoy13vDq8kuuljqbg/ZNWKWm4lnGuJzPgx5abpoItVvITLbrxSlOXkcLkAyL3gSk2Z5wke5OHtq7/Wx8DhDvDUQuqrd+qFHNN8AHqfmVdQ2+4fxEVhYGkiikGkBEG+jIuJp7PTQel+IrIIfT5QopHcmAjCqWDjTQSUhqYJSfUy/vrR2QJtNmVF5ynBjvtM3yuTVyz5XdXquTbnkOGJRZgqC63ir0wxon3x5X/zMmmw1VDcyvD7xFCKle4K+5g+Nv5i/ZVdE/Bow0+UU2ErBIMNrI3XzMPXackdPD5/0n3rfYaoeUQmJ5TaChlQJiZZmHK0ZhP9W3yXMvGmLj1VZnLqoR4w55wsWC8mC1tgssT5TeHX/BzZ+j2LsK18E+yqRS90W70Qo6nRFks77DiXbz8x3/nf58qLe4oC1IroC1VLQv/Koqy3/GSMfdByku7ycYTGyPfAXt3JBMcwDSKCEIjP7pk9Kqjl8Td+4ULaBfLQ+yPIwhh2x1/46D+7Xv1bknjXLu2fyKSLplllflJXKvnZeRiFqPL1gyLsLdn9p5AW0X+t+ldDkWQAV3bP7dpElEvOJCbCQI5SInOzvi1aD9LIX4j+yk7+PlfVf13Afb32Y+nQxDJYD5RzafSAFIy+aL4OKENPDUNdHQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL1PR12MB5732.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(366004)(39860400002)(136003)(346002)(396003)(230922051799003)(64100799003)(186009)(1800799009)(451199024)(31686004)(6512007)(2616005)(26005)(38100700002)(31696002)(36756003)(86362001)(83380400001)(2906002)(7416002)(6486002)(478600001)(53546011)(6506007)(6666004)(66476007)(8936002)(4326008)(8676002)(316002)(966005)(66556008)(5660300002)(41300700001)(66946007)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WlNIb1UxeEsreUwzRGkvWlUvQmlNbk5LNDhZNjlGenptV3B6SjlsTm5HZXBJ?= =?utf-8?B?NVIxRzdkR3U4Q3lRQ1liYXI5Qi9Ya0F4QTkxSzlCc0NoRXAxdTR5QUF4NjdS?= =?utf-8?B?dHR5U3FFZ3FCSW9VWGVodUFIQ1M3ZDZDckFRS0pxUWFLdytVVnFVUjNueDJw?= =?utf-8?B?QmRCRS84bG5kV3VjOUdYRDVXQXlSRXlyVXl3M3NuaVU4Q2wrMWkzRE9NNGt5?= =?utf-8?B?NUdUOUhnbC9Kd0p1dTRZK0VZMXMxM05HUlhkbEhPVEE3RzUxSGh4UDBpOWZs?= =?utf-8?B?dGhldUVZQTlh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EzWEpvb0tPVnhuU2dP?= =?utf-8?Q?hpLdZAMCdXPHS75G1+/HMxK0T?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35a7f016-64c0-4208-bcbc-08dbd98b31fe X-MS-Exchange-CrossTenant-AuthSource: BL1PR12MB5732.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2023 21:00:06.7058 (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: XoD310rKuNfLigbj0yJEyyyBM9jlY6uF1R8HGc7bDEvLu56JGxxGPlmM84HbRreMyRyerGGBYh+P67ylJIUZKw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8162 X-Spam-Status: No, score=-5.8 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 groat.vger.email 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 (groat.vger.email [0.0.0.0]); Mon, 30 Oct 2023 14:00:36 -0700 (PDT) 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? There was a discussion here: https://lore.kernel.org/lkml/20230808162320.27297-1-kirill.shutemov@linux.intel.com/ Thanks, Tom > return; > > if (kvm_para_has_feature(KVM_FEATURE_CLOCKSOURCE2)) {