Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3084006pxp; Tue, 8 Mar 2022 07:27:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwFoZZbwwJzKdS4j7suF8v6wX/AVyg1Z1mPmhoWUmDSmtf0B0w1t67XlL3xjIkVdwefNYcW X-Received: by 2002:a05:6a00:84b:b0:4f7:439b:64e6 with SMTP id q11-20020a056a00084b00b004f7439b64e6mr628770pfk.51.1646753228016; Tue, 08 Mar 2022 07:27:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646753228; cv=none; d=google.com; s=arc-20160816; b=Yqp9Yc0n21GnkEDJthMwuNqwYmAPd7icBZ1qI+k7KSZ/yc1ofZZFoUdDixQMZjwC3/ 524SAEweIZM8mnpA5H3/zCRhdUHm01nDLxpBEtRJoQHi2KeSl8p9dTytv/zwgDkXhYDy W1d+vEQs6hMPrTB1y4jPUptZeCT3z95zw3Y8uQWWjt76rgApppQ1D56WUGkWvP6ZBvT3 M1A6bsBtr8YXkoTsC2HDS6yI2lyeXs0MEupdCXupcBbGFUsjgfKSCCuYlWaPKAHgByRz ep0o2WoLFi2YXNhA9GWt8eDcKrievh/GTXHvSCYtcPdXMGfxQiLRuWhjVhOWtzDM/RUq LzFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=m+Wp9MKiaZfdMuHvqCbpcvkjR/bYNRpbtoP2oOY7bMU=; b=S8c2aDOfTaRfRqbMC1oFu8Li+637W2NLs/3mp1IHGLp9f7SlB5FLBJ9dnvyhBYT6Fd 2l4FZvyhbFIM+5+d32sAWjuaZvjNax6CTy33CKxTtW9QGP740lmFc+/u6LolTIEyKFSf S+3zsl/9bxZI6ERG5FGvCxYWr8hebviKOXBcJatdkbhYFpztYEvsarWE4piy/7z7k6RU Rma6u+AeGn0U1cpys5wyq14/tlZ29lhSKHBynBR1fYrHuTRKsP1NQT2w0QnejP02pJfc WPT6Wu6pxXIi5Q5Ih55Rfgw/acE0VeG0BUuLy+ylF7aiZlktdPobQ3wADx6/TUx1c1wO BFwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZviHOMu9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nt5-20020a17090b248500b001bd14e01f80si2399298pjb.110.2022.03.08.07.26.49; Tue, 08 Mar 2022 07:27:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZviHOMu9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242591AbiCHOY4 (ORCPT + 99 others); Tue, 8 Mar 2022 09:24:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230433AbiCHOYz (ORCPT ); Tue, 8 Mar 2022 09:24:55 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13E1049920; Tue, 8 Mar 2022 06:23:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646749438; x=1678285438; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=/XXipzH9LpSlloOthwoAzcFwTx0U+s0Ur50YTY714mc=; b=ZviHOMu9oZcY/LSfVmVfOz0olivD7WIjxU+Qvz2zVxPEg7AHu/7OQlDr agG82al115GE27ZXfQxqKl+pXdfT+lLTppxfVIXdoNMXATQzu5ga5G4bg zoeEetZKRYYsZPwGvNb9sFvXHKbg/7XzEhZR/fEvs3JgKXdroJIgVeDeg 5eOG/e5MqltZUYungJO2K9KGP7IwxmJR0q1HWxQ10Ss1XhDN2Vm0WKvsw 5CsnzT2AeYr+Pk4RLYhG83h+g8y+igNfU3/59wviWt2t+Jaf1a3zmRbmp PgM7V96ZARD4ke0bxYtPlFEkclBEZwlw6RCCA+JJuGseaOHz2j3F1ky5B w==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="254419987" X-IronPort-AV: E=Sophos;i="5.90,165,1643702400"; d="scan'208";a="254419987" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2022 06:23:30 -0800 X-IronPort-AV: E=Sophos;i="5.90,165,1643702400"; d="scan'208";a="553634238" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO [10.0.2.15]) ([10.252.46.193]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2022 06:23:24 -0800 Message-ID: <013b5425-2a60-e4d4-b846-444a576f2b28@intel.com> Date: Tue, 8 Mar 2022 16:23:18 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.5.0 Subject: Re: [PATCH V2 03/11] perf/x86: Add support for TSC in nanoseconds as a perf event clock Content-Language: en-US To: Peter Zijlstra Cc: Alexander Shishkin , Arnaldo Carvalho de Melo , Jiri Olsa , linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, kvm@vger.kernel.org, H Peter Anvin , Mathieu Poirier , Suzuki K Poulose , Leo Yan , jgross@suse.com, sdeep@vmware.com, pv-drivers@vmware.com, pbonzini@redhat.com, seanjc@google.com, kys@microsoft.com, sthemmin@microsoft.com, virtualization@lists.linux-foundation.org, Andrew.Cooper3@citrix.com, christopher.s.hall@intel.com References: <20220214110914.268126-1-adrian.hunter@intel.com> <20220214110914.268126-4-adrian.hunter@intel.com> <853ce127-25f0-d0fe-1d8f-0b0dd4f3ce71@intel.com> <30383f92-59cb-2875-1e1b-ff1a0eacd235@intel.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On 7.3.2022 16.42, Peter Zijlstra wrote: > On Mon, Mar 07, 2022 at 02:36:03PM +0200, Adrian Hunter wrote: > >>> diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c >>> index 4420499f7bb4..a1f179ed39bf 100644 >>> --- a/arch/x86/kernel/paravirt.c >>> +++ b/arch/x86/kernel/paravirt.c >>> @@ -145,6 +145,15 @@ DEFINE_STATIC_CALL(pv_sched_clock, native_sched_clock); >>> >>> void paravirt_set_sched_clock(u64 (*func)(void)) >>> { >>> + /* >>> + * Anything with ART on promises to have sane TSC, otherwise the whole >>> + * ART thing is useless. In order to make ART useful for guests, we >>> + * should continue to use the TSC. As such, ignore any paravirt >>> + * muckery. >>> + */ >>> + if (cpu_feature_enabled(X86_FEATURE_ART)) >> >> Does not seem to work because the feature X86_FEATURE_ART does not seem to get set. >> Possibly because detect_art() excludes anything running on a hypervisor. > > Simple enough to delete that clause I suppose. Christopher, what is > needed to make that go away? I suppose the guest needs to be aware of > the active TSC scaling parameters to make it work ? There is also not X86_FEATURE_NONSTOP_TSC nor values for art_to_tsc_denominator or art_to_tsc_numerator. Also, from the VM's point of view, TSC will jump forwards every VM-Exit / VM-Entry unless the hypervisor changes the offset every VM-Entry, which KVM does not, so it still cannot be used as a stable clocksource.