Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2289564rdb; Tue, 3 Oct 2023 17:10:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEBdhgdsoYZQN7lzg2x11veyrvSynPd3owpihWN5Zxh5mYpWLoOrC3F/bzGM/u16c8G5LLt X-Received: by 2002:a17:902:aa48:b0:1c0:bcbc:d5d with SMTP id c8-20020a170902aa4800b001c0bcbc0d5dmr1013176plr.61.1696378235175; Tue, 03 Oct 2023 17:10:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696378235; cv=none; d=google.com; s=arc-20160816; b=hTnA07dnyEDsnPhmV3Zim18hYZ7pkq9aLgYtng9jXeY3f9piMlhWz7A2q+iX6v2xPL hCkvvzmcLpRnzRRtdCe6LVunmMuz4+FW5c4CzVhIZMzeIJzEzzUlODV3c1aOtWR2ZeA9 YXwzz1o2cRIiyhW+sPF1OMHtEc3CxXQDzAATOBZMtLa/5TRrafHdLkjO+gmuRCUm/eLi 4QQI6VnKTi6GYYmGkpZZmhtAN6bmO4nIRRy1o6VXJeAsoIvbG1t2Lf3mPTtoZ0pWdhms P2rUinzc2cgyv2FgfEp/JTwuG7HpBL2itE8XjvsN4biahG4i70bMqMZWepMBcMfLj/uF 2I/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=AxAlV3CAuuyZC8A6b6U3UPYaMBOXggU9rKrWo9R2t80=; fh=kEwGWtJQc59vbmlm12aVprPFZ9WpoqRDDmJESEnXeTY=; b=odi/NcZQbHsSl6CG7TKNKIsS2zvYh1iwi9Po+LkXYmW3QCRdJLjmcXBb0qs5ucEjlr 5NOmgdBgUv2kveRUbHcDxfSTNe+KUctaVAYKYd75/PpM3l0ieVTYxn1p+Z5NC12fhDRj gWGyGJnx5aAKujky63xV3tedcvQlzNpwuSddh7TiQIuUgjc15KAW5qLKwDIjEjBvIDCK FLGTksaohaltDgt9ssvdoID6/9IK3Y5Au+6C+462j4j1w6Pzz/7WsSQsnaiJbWdfnf4R FJ7PQlL4+r5PXjXUAciiZcUa77igQ2893ieo6FU8snwqqtdDZSDU7SA6QLZNQDHomuAV 6eDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=dOuaV6NO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id q2-20020a170902e30200b001c724cd1125si2321335plc.203.2023.10.03.17.10.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 17:10:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=dOuaV6NO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 3FCCA8317EAC; Tue, 3 Oct 2023 17:10:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238557AbjJDAKd (ORCPT + 99 others); Tue, 3 Oct 2023 20:10:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232203AbjJDAKc (ORCPT ); Tue, 3 Oct 2023 20:10:32 -0400 Received: from mail-oa1-x4a.google.com (mail-oa1-x4a.google.com [IPv6:2001:4860:4864:20::4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17BE0B0 for ; Tue, 3 Oct 2023 17:10:26 -0700 (PDT) Received: by mail-oa1-x4a.google.com with SMTP id 586e51a60fabf-1dd8e6a7a86so2141323fac.1 for ; Tue, 03 Oct 2023 17:10:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696378224; x=1696983024; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=AxAlV3CAuuyZC8A6b6U3UPYaMBOXggU9rKrWo9R2t80=; b=dOuaV6NOYFe9DFhhwcwCJnrNqatX/th6EyZ5U7cv+vtHDNB4rOfBh1YFadnYTKnGFG qWUfxid36MgMmX/vFfaNPy6ZFEfCmtMVF878iygROZ5g3IcH/cBpcCtsrLfUABz7bYXs se3hZtFOuDUXM8gNHl+yGDVNNr6zo/JZrj0DFJIGxpYBgaU+nVz5woul7UqWAdTlKEP7 psWlTicyyEheUVofrHRwUm4pp+F+2gKMnGrNfUiGrmEpyYDONSikeENaN77Gp17VqQ0b GfWMHNJ1vCVK8nW+3PFmNtzR50L4hNVgRgzJKOcJaPwkuunrRIMgaLNVnUhfgXlNr1FU CAQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696378224; x=1696983024; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AxAlV3CAuuyZC8A6b6U3UPYaMBOXggU9rKrWo9R2t80=; b=bW+E84LXJ/amA8O+LDBCE82XgWmiqzoIgr3CWiv/nGV1TyCucga5JXTsgDwG85xeFF II1jKsTrwqe1JMtOJ2dGJumpJW68S3jtdbjwCXBh+pHw9CdeH2gYUOEwVdTcETgGDm65 tpLUChHbxE8EaL4DkeMJ+cKlWT9YLpXFLjqdGHc0fz6Ohj45XN6kOKOUNdDEeXKtSRXE aaCqEd7KFhzeixuGeHsRYvXRVc4j3ztwJ1szufcoQdSoLaeS1h677iZYYzBlbG4ncqhd 3j1draAiYZ4HkDltZ8E+FpDLEP6qRhOhyOcaneZbh7F6/ZMG+4PqbfcZ8itIbGGo1wXJ AlkQ== X-Gm-Message-State: AOJu0YyFCm6WuE0ccTg+fTt0NB11XwOIhADVQ28bNDK+UeY3d2DdvUKh tMn1l4IB6IfNMGn+vYHG5yqXzoD2zhk= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6870:3a28:b0:1e1:2ebc:b63a with SMTP id du40-20020a0568703a2800b001e12ebcb63amr407181oab.2.1696378224685; Tue, 03 Oct 2023 17:10:24 -0700 (PDT) Date: Tue, 3 Oct 2023 17:10:22 -0700 In-Reply-To: <96ceb6a6e9c380d329e8cd556ad13a2fcd554882.camel@infradead.org> Mime-Version: 1.0 References: <20230926230649.67852-1-dongli.zhang@oracle.com> <377d9706-cc10-dfb8-5326-96c83c47338d@oracle.com> <36f3dbb1-61d7-e90a-02cf-9f151a1a3d35@oracle.com> <884aa233ef46d5209b2d1c92ce992f50a76bd656.camel@infradead.org> <52a3cea2084482fc67e35a0bf37453f84dcd6297.camel@infradead.org> <96ceb6a6e9c380d329e8cd556ad13a2fcd554882.camel@infradead.org> Message-ID: Subject: Re: [PATCH RFC 1/1] KVM: x86: add param to update master clock periodically From: Sean Christopherson To: David Woodhouse Cc: Dongli Zhang , Joe Jin , x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, pbonzini@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 03 Oct 2023 17:10:34 -0700 (PDT) On Tue, Oct 03, 2023, David Woodhouse wrote: > On Mon, 2023-10-02 at 17:53 -0700, Sean Christopherson wrote: > > > > This is *very* lightly tested, as in it compiles and doesn't explode, but that's > > about all I've tested. > > I don't think it's working, if I understand what it's supposed to be > doing. ... > When I run xen_shinfo_test, the kvmclock still drifts from the > "monotonic_raw" I get from kvm_get_time_and_clockread(), even with your > patch. It "works", in that it does what I intended it to do. What I missed, and what's obvious in hindsight, is that the timekeeping code doesn't *just* update what KVM uses as the "base" when there "big events" like suspend/resume, the timekeeping code updates the base clock on every tick. My hack only smoothed away the delta, it didn't address the time that had gotten moved into the base. I though the base would be stable if the host was in a steady state, but see above...