Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp168558rdb; Wed, 1 Nov 2023 22:54:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEgnbOzf9T3boMB/UcxEuYvGDt4IkBjr56aD6wxfCHbTDaG++Ap3RDCNMzAmPbSI6/DhYlk X-Received: by 2002:a05:6a00:392a:b0:68a:54e5:24e6 with SMTP id fh42-20020a056a00392a00b0068a54e524e6mr21665212pfb.8.1698904454178; Wed, 01 Nov 2023 22:54:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698904454; cv=pass; d=google.com; s=arc-20160816; b=ayZJ2uYDdNK1rMMQi3SJ/uZwsr7otnnL2zzzzsuGGRuQw/uKIj5nPIvxuMsk0VI+HW 02UF0+kWwnCDgiyFKZCaGDymlG2OCpMCTZ6eHlNohqzt+ScI7aiepAkUxBG4zTAQTgeO yHtVjsN9jCnkiDo57gBdSc81WnaYKJcZveJM+viCEw8YBZLgd0lASAA9kbvO4sTGkqJN kk8QzP7UyZyoBtHgDYjZ7DbSD75e3n5KJpUTnVG76Bfok/rFy4NfoZaN3L21u1slHicC UEYGQwsaMceSBd6cYIBKNqi5sTzly6X2cr0sQD6LPB5/OqXlAh6hAhScquaHnVh/ebmH /uDA== 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=8S6MYEKz0fmMWBxA19a/KtbeudfMu5ToMEfqLh8fRvg=; fh=6yyhg9/llbzjZjrcM45n+KrGkNlONA/y74rXX22ORRM=; b=Wajyny9GRQ7Yjv77QudvuWjtQm/2dW2IpHTugzABTSWbsQJm0i7QtAvK1BoDNjSDwN R3Cf9fkNWI+9FPQnbPYplrTIuAcKaNuLuHq47/qx1cL5vbWOkoWyQCFCd3W2+q3wx00m /FT7maaQ0pwsn4dpPJ1AUxIpsohsHbqmwn5/uN070ZWdnKWJSikzPRs6CrLsQkTketn0 Eqdhi2rgYS3LsM0rrrIbgAR8KIJDQxii5OcmyMpBno6INljRfA/6mzTZC5j5HqHIuI8N 5dPEtEEmv0voVvf1vdJCBUSdgUBfWSAeYHPC9oKWiBmk1IHmCTFLbgqH5Qp57FI005tx QPQQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ZjX6pCaa; 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:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id bn10-20020a056a02030a00b00578a98c0687si1531309pgb.99.2023.11.01.22.54.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 22:54:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ZjX6pCaa; 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:2 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 agentk.vger.email (Postfix) with ESMTP id 7F87980A7CC5; Wed, 1 Nov 2023 22:54:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232225AbjKBFx5 (ORCPT + 99 others); Thu, 2 Nov 2023 01:53:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232381AbjKBFxy (ORCPT ); Thu, 2 Nov 2023 01:53:54 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2081.outbound.protection.outlook.com [40.107.220.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C6F8128; Wed, 1 Nov 2023 22:53:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C3jk4MyS7OVXlpXb+WhHV6cyvwyBx1wF+t6Tq50OR/GJAkhv+DBv7E6jhBgPmZj+XBoH1JQnOJBO4RbMTjVvNEfhohLsqLB5WAQMXNn3Yw5fdq8Osj7qOTQzZwE9MNmKuffVCegBim9B+XQ4VqRlsT5E19JCox24k4mrifDcJxEJHjzuzp2jJv5dFycrKoLnZDF6TpNQ8mjkKdfqNG7HiqlGjq4H0rWGerE8tS5uvWXPBZkbPYXkF9BWaFe/+zR1hmFQ/tudIDNb6SkM4A7iXyK5MgTgLQ1ued31P+Fwa9yBs6+UPEfQjC88WUW/kkKrP3FiS6fPf3mza9av18K0zw== 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=8S6MYEKz0fmMWBxA19a/KtbeudfMu5ToMEfqLh8fRvg=; b=Lva2U+jdtt74H6ktpajKru8erFj8Xlpibj7OTIcVWKhoj/tlVQDulZYSiIkHHrZqNgI6SCDHpZd2w35L8keJcjNf6e72cuqEmKF9GLtsWccZlPqW+MbQZXsKDOyTKLrAITEzalRuZPzy8fiyGK77+u5CeJxFrsTA1PQqy7E1kdfuKRYgL+HYYcUwZMQmFFRIvz676MbBNViXtSBcso7uXFG9j4LtaGkx7T5TN8QclUJptYJ/FzdocfDTa0dmYlznZPaib0AcDNSnyiPcUea50lCkMY7ThTUF72SlUaYvw3qN8MbN1gs/BFeVJlsBzmYW0VUjbZ6UrHcZdzMFX4dbrg== 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=8S6MYEKz0fmMWBxA19a/KtbeudfMu5ToMEfqLh8fRvg=; b=ZjX6pCaaBYCjB5bQRmAgQIDT+BjZAd+6soQWundfmXuANqjopDMd/nzOVTc9jOnYras5YFTYp0ANmgGKWBbl1isjE5B4h5JP7P+JU0Ey1ZtCh/sMms0jpI/KZs9Cx1K/nR4sgg+X52TkB5Sd/h6g8nTXBrqRoLZVQq7tC7iSdcs= 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 PH7PR12MB5781.namprd12.prod.outlook.com (2603:10b6:510:1d0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19; Thu, 2 Nov 2023 05:53:46 +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:53:45 +0000 Message-ID: Date: Thu, 2 Nov 2023 11:23:34 +0530 User-Agent: Mozilla Thunderbird Reply-To: nikunj@amd.com Subject: Re: [PATCH v5 13/14] x86/tsc: Mark Secure TSC as reliable clocksource Content-Language: en-US To: Dave Hansen , linux-kernel@vger.kernel.org, thomas.lendacky@amd.com, x86@kernel.org, kvm@vger.kernel.org, "Kirill A. Shutemov" 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-14-nikunj@amd.com> <57d63309-51cd-4138-889d-43fbdf5ec790@intel.com> From: "Nikunj A. Dadhania" In-Reply-To: <57d63309-51cd-4138-889d-43fbdf5ec790@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: PN3PR01CA0077.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:9a::16) To DS7PR12MB6309.namprd12.prod.outlook.com (2603:10b6:8:96::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB6309:EE_|PH7PR12MB5781:EE_ X-MS-Office365-Filtering-Correlation-Id: 85fa8554-5af1-4611-9585-08dbdb681393 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gs6tgKtDx4jawT2to27Me4UHEGLZOJ9B5yXfRFlBhUmW6iUaWul2XZuhjxuSPBWg+SZKbp4Z+W8ze3RRdsnKzfbJXc6bd8q5e3SwcGLZvvKuGurV+i1EQoe1jui3uRRF4raskm3oleKF5hrTqraUrI5G0VBvhLgrj2HtgiWpbK39PgyQzy0TjJc6XLSmVBGb/vhKM/kULOCltnaccxy29vSwRar8RVlyoU+U3AbkCGCkyqiTC7XA9RPvV/mvKNNoqb+CIF6bj/FEbOjroF+mXWnRT94UV4TObd/goldlyEz4XBbm35eTqdjZVJpKjx4j0W0ESLWiXHziFlPdkgfGRIGHZcbyu22dX1D7nMMkkSJbA8YIs7lyiZLLtpI+RlPNF/6X6zxdslSg1fRaWWcGwv/toukGQr4DdKQTkC+dp2lcKhw9vDskXkfLvxP4+HbuhNzlUP97K1H2NIRBsaKUWwXsqFc/i37xAdBLKtOAXoECSILC5Ri7fcj5/Oj8WNO0WBvI47lP5hTkVl5eGVLWBPhe38qAqrksF7jExtES6hkeQ3g8dKzPgNYVVDnEvBQ1iYXOZIuFIjaLOZ++zbY9RF3yTp3inWJQuZGHo4lnXrsOURfExLG/5YzetjcKKPfq1uTVjbSiJUpdJKSHmG6DJQ== 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)(136003)(376002)(366004)(346002)(396003)(39860400002)(230922051799003)(64100799003)(186009)(1800799009)(451199024)(31696002)(31686004)(6512007)(66946007)(66476007)(966005)(53546011)(6486002)(66556008)(26005)(8676002)(83380400001)(8936002)(36756003)(4326008)(6506007)(316002)(110136005)(2616005)(478600001)(6666004)(4744005)(5660300002)(7416002)(3450700001)(2906002)(41300700001)(38100700002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?eDZkY2tvaGdIOE9udVF4cCt1U0VqV2RvS0JRMXZzT1RSalFHK0RVUnd6aGZU?= =?utf-8?B?N2FIRXNEMGRweTNWNWRqUmcvZzBWVG1aUzZCTmpXbGYweTlveVFiZHRmaWdU?= =?utf-8?B?djkxQVcyZmo2eGVJRGJFNllvS01GdTYvYUU5aVdlL05TZVRna295RzJ1OHNT?= =?utf-8?B?RzRnL1RCZGZIUzVSd1lZMTVzRXV5RUsxQk85b1kzOFVVVGZiMVFGRkgrb1NN?= =?utf-8?B?OTQwTXB1VGhsWU4w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VlHRHMz?= =?utf-8?B?d3F3T3UzVFdKQWw3UVV0ZytNNHRSdGhhbTlYQ2JDU1lKdFIwZnU4YWtXV2Rx?= =?utf-8?Q?AJqkvHvi4I6v1L930x3+I2d+i?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85fa8554-5af1-4611-9585-08dbdb681393 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:53:45.7996 (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: VrEDvplQfcJbZjs64OTyFh0/5qpuDQuSB0gqtRkOcz8ooF4+fj4Vy9R8Uma+aNLDwZudwHOFBI7yIgO4wWGiMA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5781 X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Wed, 01 Nov 2023 22:54:09 -0700 (PDT) On 10/30/2023 10:48 PM, Dave Hansen wrote: > On 10/29/23 23:36, Nikunj A Dadhania wrote: > ... >> diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c >> index 15f97c0abc9d..b0a8546d3703 100644 >> --- a/arch/x86/kernel/tsc.c >> +++ b/arch/x86/kernel/tsc.c >> @@ -1241,7 +1241,7 @@ static void __init check_system_tsc_reliable(void) >> tsc_clocksource_reliable = 1; >> } >> #endif >> - if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE)) >> + if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE) || cc_platform_has(CC_ATTR_GUEST_SECURE_TSC)) >> tsc_clocksource_reliable = 1; > > Why can't you just set X86_FEATURE_TSC_RELIABLE? Last time when I tried, I had removed my kvmclock changes and I had set the X86_FEATURE_TSC_RELIABLE similar to Kirill's patch[1], this did not select the SecureTSC. Let me try setting X86_FEATURE_TSC_RELIABLE and retaining my patch for skipping kvmclock. Regards Nikunj 1: https://lore.kernel.org/lkml/20230808162320.27297-1-kirill.shutemov@linux.intel.com/