From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (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 748C623A9 for ; Tue, 21 Jan 2025 15:44:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737474247; cv=none; b=S2Dk2K5/tshiKVukoB4feD/h+rlKptuDBgN9T4spKXXWJISme14hRL0sJWI/vz2AD06dUugkA3SG5rBxfOhtET2I6A7tQHky2IEKoe2QnyVbSidYuojSnsTbEfUXBJb2czlj8RmwNCAiQRPwGkzUxYTiDHoL/9tr6FIJ8Hez+IM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737474247; c=relaxed/simple; bh=b+4csRbUueKF3ZX5iYLlhjnU3JM4B8To8fnyX3tA6AI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=uHmx4kBAalLg193k92Bbqw3yVnXotaVdU0gcQljphy4j2DNCDmimEPOgMiARMp5Dka0JEnzruM98Hd6GZYMvUnqCdR+w9wx3YFHYkuA5xrQIPN0P59ZSgF656uaMbQh2Z4YcJ/AWlFolRYqF6nNzafkLFL2pniMdHmmtj7Bn+r4= 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=CT8RILUC; arc=none smtp.client-ip=209.85.214.201 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="CT8RILUC" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2162259a5dcso173813955ad.3 for ; Tue, 21 Jan 2025 07:44:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1737474244; x=1738079044; 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=8PCljT+D66JwBF6N6v2y7VFSXya1XW/aQ2CIHDg3OVo=; b=CT8RILUCZUb8tEIE+xM33bRi+7Ojn8B6ZDQL0LPFHDGM8kvjbaKVs4hAlv6Fk9GFV4 sucoktB19WzZrxpYAUE3nEM/aBuEyCn/QO/RfrS/N7qYyS/Ve8+NYu9QTO1MT/NA4ytC grdjEkrdVPn+xKjO4YlbEaU23iDhPwGNJe0XpCQUBAVs3TXH1ldPD+EBvt/TNnEQx8re eGJ0Ybj2VcOhUaHFPLcrQHl/1pWKCYN4FxYx2nzKXj+yMNoGZTzsiYGjYMvKc5ePTNVK r5snwZJhf/EVWIsPmVPgrtTksqbnIeeJYMaRmVQpNiumo8mekO4XKN3TAETvXvKvg0aJ H6hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737474244; x=1738079044; 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=8PCljT+D66JwBF6N6v2y7VFSXya1XW/aQ2CIHDg3OVo=; b=FuQwZUzIvjtf9+ZXgHpbi4dl/269EiugDe5i/29tOr8WdUNLAHVxjOPLK6w4FsXn9j U19mgcxB92+wWkT8OjHdluZo4jh1h7AapzpdQXYLhiJ6IoWAUK9+ej/QjosFHSwWLjgx yjZD6rrLO9F6pFeljgQn3JTT67qmvbPP+kaMZFFdw9rhrS+SOrWeXUW0nAmzonpu9QDi qwA5sr0c6lSMN31WcWKDTqFc8jpiH0dVPTqfrocTZoe6RNJzkDqSdvbYqtfXml0UDw8G pJNyHl3BXJbQ3kztK7W/AZVZPe7cTf0jsOXa+u47UgZeRe4HQqL/kBS3QsfOCyS5LYV2 IN9Q== X-Forwarded-Encrypted: i=1; AJvYcCUUqXUcjcYLSwJDFmbIav3/PLFtyjW8duO7XRggf75E1Xm17/phpeFd3LSp9QS82rOT9ZWLUl3CUft/T9Q=@vger.kernel.org X-Gm-Message-State: AOJu0YwwAEpYv02DQ5IbCmeTc/mLTcjlryymka1Gu8AmSOO0tKgT5tzr 1w/6eIi2CVo9KAfABCpOHkgz1N8pEIN3cv7Jbg1ddg5QfMY4F7+ntXqQTm7gxjLcdzTZuEZEpjf J+A== X-Google-Smtp-Source: AGHT+IGQtRScZKc0wjEnvD9y0eY8uhqqwlzVAD9VF6BQL99yX3piQEk1sKLlVMHK/Wj6xBuVEenSHPxEJfU= X-Received: from pfbmb8.prod.google.com ([2002:a05:6a00:7608:b0:725:ec78:5008]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:788b:b0:1e1:9bea:659e with SMTP id adf61e73a8af0-1eb215d4c46mr28702196637.35.1737474243736; Tue, 21 Jan 2025 07:44:03 -0800 (PST) Date: Tue, 21 Jan 2025 07:44:02 -0800 In-Reply-To: <8734hd8rrx.fsf@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250118005552.2626804-1-seanjc@google.com> <20250118005552.2626804-10-seanjc@google.com> <8734hd8rrx.fsf@redhat.com> Message-ID: Subject: Re: [PATCH 09/10] KVM: x86: Setup Hyper-V TSC page before Xen PV clocks (during clock update) From: Sean Christopherson To: Vitaly Kuznetsov Cc: Paolo Bonzini , David Woodhouse , Paul Durrant , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+352e553a86e0d75f5120@syzkaller.appspotmail.com, Paul Durrant , David Woodhouse Content-Type: text/plain; charset="us-ascii" On Mon, Jan 20, 2025, Vitaly Kuznetsov wrote: > Sean Christopherson writes: > > > When updating paravirtual clocks, setup the Hyper-V TSC page before > > Xen PV clocks. This will allow dropping xen_pvclock_tsc_unstable in favor > > of simply clearing PVCLOCK_TSC_STABLE_BIT in the reference flags. > > > > Cc: Vitaly Kuznetsov > > Signed-off-by: Sean Christopherson > > --- > > arch/x86/kvm/x86.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > > index 9eabd70891dd..c68e7f7ba69d 100644 > > --- a/arch/x86/kvm/x86.c > > +++ b/arch/x86/kvm/x86.c > > @@ -3280,6 +3280,8 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) > > hv_clock.flags &= ~PVCLOCK_GUEST_STOPPED; > > } > > > > + kvm_hv_setup_tsc_page(v->kvm, &hv_clock); > > + > > #ifdef CONFIG_KVM_XEN > > if (vcpu->xen.vcpu_info_cache.active) > > kvm_setup_guest_pvclock(&hv_clock, v, &vcpu->xen.vcpu_info_cache, > > @@ -3289,7 +3291,6 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) > > kvm_setup_guest_pvclock(&hv_clock, v, &vcpu->xen.vcpu_time_info_cache, 0, > > xen_pvclock_tsc_unstable); > > #endif > > - kvm_hv_setup_tsc_page(v->kvm, &hv_clock); > > return 0; > > } > > "No functional change detected". > > Reviewed-by: Vitaly Kuznetsov > > (What I'm wondering is if (from mostly theoretical PoV) it's OK to pass > *some* of the PV clocks as stable and some as unstable to the same > guest, i.e. if it would make sense to disable Hyper-V TSC page when > KVM_XEN_HVM_CONFIG_PVCLOCK_TSC_UNSTABLE too. I think it's ok to keep the Hyper-V TSC page in this case. It's not that the Xen PV clock is truly unstable, it's that some guests get tripped up by the STABLE flag. A guest that can't handle the STABLE flag has bigger problems than the existence of a completely unrelated clock that is implied to be stable. > I don't know if anyone combines Xen and Hyper-V emulation capabilities for > the same guest on KVM though.) That someone would have to be quite "brave" :-D