From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) (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 B0E3A39EF2B for ; Tue, 4 Aug 2026 23:38:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785886700; cv=none; b=ED5RPvqh9Z06ALHxRr9pCcYvwIuVSp78CXHin9LWbvfUmaVZ8oA2CWuqmWv51GioFm3If7iuf3hsifRKqiNOQj4sveDgmCRw21MjN1W3cr+zNrvrIbhBlCgXxRngLskdy+mcYYvMQ5IQCR9s7D5D85ycO2cmiIfD0Mp1RW6arwc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785886700; c=relaxed/simple; bh=7nykWB6HWQWBtzXDzLlBfOGF8GccFcz3uG03qRHgn6o=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=NvJU2osb9CJ5kmDS8jDYoJrM6BKRmnKgRUEVl3FKxgOA3xP5YTK8pyHXJI7WXhFLvBnnHQn2VI2X4f+k6FEj8RbyIy8v6qVlMq8/o1pVEZU/mC++K/mx8ybHMT4RaDM9wJzYW2mqMA+WxHeHfuH+3LFTAYNdkm8uKEKAVcXVCnE= 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=tWRJ/czV; arc=none smtp.client-ip=209.85.210.200 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="tWRJ/czV" Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-84e1da97175so468938b3a.0 for ; Tue, 04 Aug 2026 16:38:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1785886698; x=1786491498; darn=vger.kernel.org; h=content-transfer-encoding:content-type:cc:to:from:subject :message-id:references:mime-version:in-reply-to:date:from:to:cc :subject:date:message-id:reply-to:content-type; bh=MCQeULnuxyizouUVujp9ZRZMwHTWkFpcMFYeBXRE7J4=; b=tWRJ/czVIciPcCnKqFPzTC2zDIy7WTK03oJtlTjFhoiOqM5WI30VD/kecpcTM8u4f8 V8ACH55V+Ou+T7MzlXw9ZJ9zbdZbLzhlo4XRs0EOIgzsKnAIK4gFsPVHMwY5RLR4kDM4 vr2/rg9NtBqTTCByHQUAY3qWiwop5cjT12oKQVAsvql11/kQp0lRFmZfxLOPG7sdFpSB o7JNa5ADEq7AoiSp5k50CUD/GcE3aG1CsALrXs9mc5uoRX9R2g1JtLOQqHGhTvQwVeL/ SCmtUIq5hqLGzO9y5nk4n3C3/xXPkX5l2r5GWdqRAANnCXUHTk4GftatoOGU8+AJltHK EbWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785886698; x=1786491498; h=content-transfer-encoding:content-type: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 :content-type; bh=MCQeULnuxyizouUVujp9ZRZMwHTWkFpcMFYeBXRE7J4=; b=GZuWpzpYxl0AkkmCWjefx8xAFlYwyq8NpslFIfqYbJshJV8WF5wNGhKyxp3C3xhiQL J8hyTYNX1W5YmUtynUzykTbAAOZMK3OiQHbh9Ynh7ou4XigNm782udMibp8M8kae6O0g o8HLXuhsJRtAZVrHrcQNoigdgEzjnYy0D+6Fdoyo7Z5i+O+Q20PLvoFmAq7th9VFb37B +36N3oSDTOT3fx9WtJou2PQiTzw61FEfrX1HV7PAVXAkfYH/GGTY5AntV3cf2R/VzzHT 69v2gm8S0rTjGr2Dr4HHyxatfnJ73caziB6Gfy1iBoPYoW6PMIHB0ylUwGIZQvNPWNj5 ZjXQ== X-Forwarded-Encrypted: i=1; AHgh+RpAloeP+Iyvng6A7jqLg/7IMhuPmmjTpK3YR95EwHgIvzYVxndHNTSjbpHrqsHbTzQ6sUK3jS58nFKdYsU=@vger.kernel.org X-Gm-Message-State: AOJu0YxVtwJoelqMtN1Ws/1+z+dyl7Xgdg3TZAABcRf0pLGqr0PTi3Gm /JBeJGeRQGsQaWHD+gg28G0kJX5aSa2CsGXjAjHl9DVuzIJzz2p8/tVNRsAaEFSqvXHLIK0bbWW OcxEhBg== X-Received: from pgig16.prod.google.com ([2002:a63:f410:0:b0:c92:11a5:bbce]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:3a15:b0:84a:60a4:2651 with SMTP id d2e1a72fcca58-84f2dfc53efmr1961102b3a.6.1785886697620; Tue, 04 Aug 2026 16:38:17 -0700 (PDT) Date: Tue, 4 Aug 2026 16:38:17 -0700 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260728144954.355376-1-dwmw2@infradead.org> <20260728144954.355376-32-dwmw2@infradead.org> Message-ID: Subject: Re: [PATCH v7 31/36] KVM: x86: Add KVM_[GS]ET_CLOCK_GUEST for accurate KVM clock migration From: Sean Christopherson To: David Woodhouse Cc: Paolo Bonzini , Jonathan Corbet , Shuah Khan , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Vitaly Kuznetsov , Juergen Gross , Boris Ostrovsky , Paul Durrant , Jonathan Cameron , Sascha Bischoff , Marc Zyngier , Joey Gouly , Jack Allister , Dongli Zhang , joe.jin@oracle.com, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Sat, Aug 01, 2026, David Woodhouse wrote: > On Fri, 2026-07-31 at 16:24 -0700, Sean Christopherson wrote: > >=20 > > > + /* > > > + * Allow for a discrepancy of 1 kHz either way between the TSC > > > + * frequency used to generate the user's pvclock and the current > > > + * host's measured frequency, since they may not precisely match. > > > + */ > > > + if (user_tsc_hz < curr_tsc_hz - 1000 || > > > + =C2=A0=C2=A0=C2=A0 user_tsc_hz > curr_tsc_hz + 1000) { > >=20 > > I don't follow, why is KVM restricting what frequency userspace can set= ? >=20 > Userspace actually sets the frequency with KVM_SET_TSC_KHZ. What KVM is > insisting upon here is that the input to KVM_SET_CLOCK_GUEST is > *consistent* with the guest's TSC frequency (within a little slop > caused by different host TSCs). Why does KVM care though? I know some people hate that KVM's uAPI is permi= ssive to a fault, but trying to "help" userspace often ends badly for everyone. = E.g. what happens if userspace does KVM_SET_TSC_KHZ after KVM_SET_CLOCK_GUEST?