From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6925C43B481 for ; Mon, 10 Aug 2026 22:55:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786402512; cv=none; b=rrlha1iCILtyiddblpPiFMUZ5G1ocihD+RSi+UmtBsjjB5YUpOaUu8bOfnwMFm+ol/J9qHvNLwPg8gs+RDPi+KBOQxTf7xom4SD8DJOpcGCNCXZ55apI5oB+cQY3rfRAgy4YKm725jAZy5EmbcteANSLzLHK66Y4m1ie4n7B7T8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786402512; c=relaxed/simple; bh=DBhEkQVI9NQRI1+LTosIl2HwXc4QsiNCRGdrxKptqFM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Ig86czt2pRiQ3fnrIYvimZr2GRvN/G8A57wGud4fabw2xUk/mw+4EDHvREUoYdtLbOMCd0WgRBbpnku87yi7giHv8DZ7FPS2z3oXFrIuS/Ncg9cuAmJmQvxciMz9qOBJ+vxT7+JADzST88PK9/h7uSB5pMlNvMYZGQ8bXN9NkLc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=rbnG8I8z; arc=none smtp.client-ip=209.85.215.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rbnG8I8z" Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-c860544c077so5391740a12.3 for ; Mon, 10 Aug 2026 15:55:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1786402510; x=1787007310; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:reply-to:from:to:cc:subject:date:message-id :reply-to:content-type; bh=MCnLQXakLIHuM72bNNk8nqJeDhUwND5FLiRLpavLCaA=; b=rbnG8I8z2Mnhbe5Cla7pA4L3CKaELwImMjErJmSJxvzMmIxLgjvreR5b/oLKfSFKyI P8yjqn4ng5P2sGR+qy1DnuSEikYNywkYswXbRO0LlGrAyfRP7h1uDTPNJUnB6WYfkGo4 B64Rcs/0BmNFXgEop1fK0jR/CaCAb0vyZSs1xAf8sMj8BG16XYy8odGEomqASwM462Tl PcrFMZ+HmrPayu58wJgXWL20vIwPwqRQd31w/0cMFTmM0IgZktPo4cot0Mjod3c5IUSJ WOTUEmqH5JHHn0b3dN8nEi4O3i/naIfj1T/QsHfoZHouMVSadWfyv/KU/vnxj+CXCAfQ /ZQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786402510; x=1787007310; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:reply-to:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=MCnLQXakLIHuM72bNNk8nqJeDhUwND5FLiRLpavLCaA=; b=pcKlTiL7aYHMgcq4AqZo+QQRf+sXKsT1EIbicRyBxTE4RPQMp6aUUqeokOsH0kVBdo 9zshzbYfT2tbzxVHxA0V9ghrWmVjwcVctlFi+ByFIDz/NgeXElHANhVGCQP9S3ioz/B4 vQJyPHSObOjkV9TRFRZ6vigUKw3wuOv+UPkpaa55lsBblVB/Ccw4MSsWNtKJqIqFu8I3 1srgwAKyy5aQtgpGiVWfYfAjEVOJm/wffbGk8TnxC+b67V8bVcgdAYLPyr7FlgpFcBbZ 4qCEHm4Q/T9o71p9HZtv7xAMsc325nSu8QWIhYV3LmRLlK9i7AZPygC3JyaMXPanxMH9 lYOQ== X-Forwarded-Encrypted: i=1; AHgh+Rq2YxjT8PyLrD/aaNYvM+q12q46GWczTe5Sd06X+jx9n1KVxHjKVh3Aofi11pHA622Jg0jHkmLYlJjDcw0=@vger.kernel.org X-Gm-Message-State: AOJu0YxyTBpNJZNLFdI4Lz70fZKBZgrOicqoRDlIOdLRi53Duvay8ySG BT6vV3Z7em0iTWwLignrC0wyjtKyxJhnWXUsVsVdClg3UuuIOnLJKSlSdK0jA4XmaBI6mPcUhed d9RF+9g== X-Received: from pgly34.prod.google.com ([2002:a63:1822:0:b0:c96:acc6:54d6]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:d38f:b0:3b4:8bc6:138 with SMTP id adf61e73a8af0-3cbc03b5526mr32318219637.23.1786402509474; Mon, 10 Aug 2026 15:55:09 -0700 (PDT) Reply-To: Sean Christopherson Date: Mon, 10 Aug 2026 15:54:43 -0700 In-Reply-To: <20260810225500.869288-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260810225500.869288-1-seanjc@google.com> X-Mailer: git-send-email 2.55.0.679.g6767b8d81c-goog Message-ID: <20260810225500.869288-6-seanjc@google.com> Subject: [PATCH v9 05/21] KVM: x86: Compute kvmclock base without pvclock_gtod_data From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Durrant , David Woodhouse , Dongli Zhang Content-Type: text/plain; charset="UTF-8" From: David Woodhouse get_kvmclock_base_ns() needs CLOCK_MONOTONIC_RAW + offs_boot. Compute this directly rather than reading offs_boot from the pvclock_gtod_data private copy. offs_boot only changes at suspend/resume so does not need to be atomically paired with the raw clock read. Signed-off-by: David Woodhouse Assisted-by: Kiro:claude-opus-4.6-1m Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 137a1dd2b85a..67c762b3bf28 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -930,7 +930,7 @@ static void update_pvclock_gtod(struct timekeeper *tk) static s64 get_kvmclock_base_ns(void) { /* Count up from boot time, but with the frequency of the raw clock. */ - return ktime_to_ns(ktime_add(ktime_get_raw(), pvclock_gtod_data.offs_boot)); + return ktime_to_ns(ktime_mono_to_any(ktime_get_raw(), TK_OFFS_BOOT)); } #else static s64 get_kvmclock_base_ns(void) -- 2.55.0.679.g6767b8d81c-goog