From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE54635F17D; Wed, 27 May 2026 22:49:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779922187; cv=none; b=ITCuYQvPXjMozKN+idRfCl9+Kuls7oW/6ACryDiPP52OpdwYjBCH+rFTDLfWaJQnGID8Xz2fG0ZDssX7MAiy59YBwItTe1+Rn3bwNArRY1q+XIIpqMJaltnS4IUjpyykUUgmR9frvAAZkIwhN2wJnZyakCBp9a6AdM/KeDLGTAY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779922187; c=relaxed/simple; bh=KtFelpS9nbEgkSq4qXDM+PrUibfrIeX6yvcd9MkIPl4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jUTmCVdEnjSFvQ/tqXhLVSn0fq3p2iSRozcDr0JLRaQ+2BqChpqHVzwAkLpYE15QCVjBXQyGWdMLF2W4NT3npondLbdQZfzIfn9srlGm4gKcUR/4bUKDc+zu93TyWvuIpL8n+FZdGYzlQCGYgXrYhK1RovpT9vG1nkyKn8ok3BQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MqqBbfkJ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MqqBbfkJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 180FC1F000E9; Wed, 27 May 2026 22:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779922186; bh=PY5zeAH8y8I+c7aveQ6/4ps0vQuGZRIQexgIvS04kLE=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=MqqBbfkJx/shQqdeO9/KsHJy4We2GaKKrTHbovtoy7c0zosO/jO0tGRiPceiIG5+s a1JYeWFhAby4DWgTTEXuqbDyCOkxMwUhAxfGM5PCaqjRt9r7QOhVzAGfFnRoDKXg6L ssoMdsyAY1euJRcKfqd209ZkXJvcvSEb79oqwuXw5oIf+Nr8Pq3wf4a5e80L7dZWKQ Cfb/8lo79/THtKbxFZ6vLBwwoBWbMuiXrMeywVycKsxsDSk67yPsJE4dhqW5s4PZje 4Fh++pIU91lkpV8gh+LMBLPMBTritQSSL5e/Q1NZaGgaAq0m6tfH9LkDG1y/GGUMx5 4afVkea7mmrzg== Date: Wed, 27 May 2026 15:49:44 -0700 From: Wei Liu To: Sean Christopherson Cc: Kiryl Shutsemau , Paolo Bonzini , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Ajay Kaher , Alexey Makhalov , Jan Kiszka , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Juergen Gross , Daniel Lezcano , Thomas Gleixner , John Stultz , Rick Edgecombe , Vitaly Kuznetsov , Broadcom internal kernel review list , Boris Ostrovsky , Stephen Boyd , x86@kernel.org, linux-coco@lists.linux.dev, kvm@vger.kernel.org, linux-hyperv@vger.kernel.org, virtualization@lists.linux.dev, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, Michael Kelley , Tom Lendacky , Nikunj A Dadhania , Thomas Gleixner , David Woodhouse Subject: Re: [PATCH v3 07/41] clocksource: hyper-v: Register sched_clock save/restore iff it's necessary Message-ID: <20260527224944.GE3518940@liuwe-devbox-debian-v2.local> References: <20260515191942.1892718-1-seanjc@google.com> <20260515191942.1892718-8-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260515191942.1892718-8-seanjc@google.com> On Fri, May 15, 2026 at 12:19:08PM -0700, Sean Christopherson wrote: > Register the Hyper-V reference counter (refcounter) callbacks for saving > and restoring its PV sched_clock, if and only if the refcounter is > actually being used for sched_clock. Currently, Hyper-V overrides the > save/restore hooks if the reference TSC available, whereas the Hyper-V > refcounter code only overrides sched_clock if the reference TSC is > available *and* it's not invariant. The flaw is effectively papered over > by invoking the "old" save/restore callbacks as part of save/restore, but > that's unnecessary and fragile. > > To avoid introducing more complexity, and to allow for additional cleanups > of the PV sched_clock code, move the save/restore hooks and logic into > hyperv_timer.c and simply wire up the hooks when overriding sched_clock > itself. > > Note, while the Hyper-V refcounter code is intended to be architecture > neutral, CONFIG_PARAVIRT is firmly x86-only, i.e. adding a small amount of > x86 specific code (which will be reduced in future cleanups) doesn't > meaningfully pollute generic code. > > Reviewed-by: Michael Kelley > Tested-by: Michael Kelley > Signed-off-by: Sean Christopherson Acked-by: Wei Liu