Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1833224pxp; Mon, 7 Mar 2022 03:25:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6Uy6ts23+PRgbyDiv3743lmIfg2YrNIQALb9/MYFawEXK7IfDdX9WjhtRgU/YN7hTUHjt X-Received: by 2002:a17:906:7316:b0:6d7:16be:b584 with SMTP id di22-20020a170906731600b006d716beb584mr8696487ejc.759.1646652355906; Mon, 07 Mar 2022 03:25:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646652355; cv=none; d=google.com; s=arc-20160816; b=ewAjEShxfYvPjjk72iScz0LyBe3s50axmsnmwSs1mGmaak5gWCLl5mQ/rSM5+/ZPki /swzsWOJIfrMYgrb+BrT6qDJFEZk5qhy09Jg5u7bRGH9jq+Cptxgj9OCngPD7k0R7onq 9CFNpHdHq/EOlYzAFEXlT+k4ivQZ1z1WaFfzo5LVSdDRhaZURLTya4GC8bRUBDl7+sMe ZMfeAJlDjxMNRjhlmkCz8mVK5IsCyO9nbtnP0rvQ36UEa+1NDD3eGMXbnvgYJlb9U4p3 VHNXK2djFzG9fzjsMtptLDf/8U5APWzk/B2lbEZV1xqBD8p1ttu70Bo1G7cMEi1iljeu Oh2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=F33OJew4f+X9EGyrX9UFDzNmD+8SJD5GlTnGdBvVako=; b=wud8IrKQtAjtLafptU8hRj7UfD84FHIS+RH7EvQjsovji4G+W0dMF/V9VxUyQpy42J 5Gw5m4YN98tQnsFcWAmj09CGjMCbMAcmRxpnBKqNW0wYrmzKZQN5t+vlykf9w1ZsZPap cFVBrz/lUV+xtCyijdo06ipv4Ynp0HuMbM/+4s0jzF9y2S/BzBYBY+AfGWuKGuEemGdn tRcPJHGZPWrUR67i1ees609Xz9PD9aFSI79JgXsK3j1rbAocNKoGDNqDo1ZJN47uN5cV mW/sOsCAUrWCFQrjT7yKu6Vhta7lmEqEddydU3pGPDiw2jBVJ5dyCV2/9zj9JofGHJGl Jvqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=l29VVU0v; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w21-20020a170906d21500b006cfea10904esi7314486ejz.813.2022.03.07.03.25.33; Mon, 07 Mar 2022 03:25:55 -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=@infradead.org header.s=casper.20170209 header.b=l29VVU0v; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233390AbiCGKYz (ORCPT + 99 others); Mon, 7 Mar 2022 05:24:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241202AbiCGKBq (ORCPT ); Mon, 7 Mar 2022 05:01:46 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE53171C9F; Mon, 7 Mar 2022 01:51:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=F33OJew4f+X9EGyrX9UFDzNmD+8SJD5GlTnGdBvVako=; b=l29VVU0vNjudQfmRlD//2Ai5r4 Rb+GvW9iJclOfRU4GCvEkvP37BglXQGkWNdbR9UtqNDH7Bd7uNMQTzk6GQO/3RrgBAK92YJPN+Gxz hmdhnmemQGbjdAakq68Sl3xDp2W7oSx7yoYDF+U55QRcn1hqpaDZX/h1Zyw3Sv7rLP/+rdGyTBYZA irmfqZgm8l2HmkKiZZ31K7VhEMil+fheol+qvc06hlmbEo4d8FiIGMLtmGd3lA47z7T/HYJz48Sge QILp/zYvt2fLhpl9YQcEH7SYyGRpLEYHP4sDoMdMnAg5VRIOhIN4hykzWAtmP/fB3VicXW0j1V6fh ioJsNaJw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRA16-00F53J-8g; Mon, 07 Mar 2022 09:51:00 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 513993002BE; Mon, 7 Mar 2022 10:50:57 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id EC3C92BA7BE19; Mon, 7 Mar 2022 10:50:56 +0100 (CET) Date: Mon, 7 Mar 2022 10:50:56 +0100 From: Peter Zijlstra To: Adrian Hunter 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 Subject: Re: [PATCH V2 03/11] perf/x86: Add support for TSC in nanoseconds as a perf event clock Message-ID: References: <20220214110914.268126-1-adrian.hunter@intel.com> <20220214110914.268126-4-adrian.hunter@intel.com> <853ce127-25f0-d0fe-1d8f-0b0dd4f3ce71@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <853ce127-25f0-d0fe-1d8f-0b0dd4f3ce71@intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 Fri, Mar 04, 2022 at 08:27:45PM +0200, Adrian Hunter wrote: > On 04/03/2022 15:41, Peter Zijlstra wrote: > > On Mon, Feb 14, 2022 at 01:09:06PM +0200, Adrian Hunter wrote: > >> Currently, when Intel PT is used within a VM guest, it is not possible to > >> make use of TSC because perf clock is subject to paravirtualization. > > > > Yeah, so how much of that still makes sense, or ever did? AFAIK the > > whole pv_clock thing is utter crazy. Should we not fix that instead? > > Presumably pv_clock must work with different host operating systems. > Similarly, KVM must work with different guest operating systems. > Perhaps I'm wrong, but I imagine re-engineering time virtualization > might be a pretty big deal, far exceeding the scope of these patches. I think not; on both counts. That is, I don't think it's going to be hard, and even it if were, it would still be the right thing to do. We're not going to add interface just to work around a known broken piece of crap just because we don't want to fix it. So I'm thinking we should do the below and simply ignore any paravirt sched clock offered when there's ART on. --- 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)) + return; + static_call_update(pv_sched_clock, func); }