From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.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 B04D43EFFBA for ; Thu, 21 May 2026 13:38:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779370716; cv=none; b=T+4Y60uxCheJnmX6xr/5n7GWF+t53ZCp7o5vczvZc48IM8+XuZ6mRs1Zf5Ig4O/xRU7wNQeJqjhHLQau0Lhx+xFVq8Ga9LEYCdC0kBOi7wI9oGMQhWeCfCks2NMsouOyWNYfJfX/+Zv3QDhUX1/duYIuRUHbBD1MNjNAZYpAZ0g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779370716; c=relaxed/simple; bh=rZ1N/KoZeh9+iAw5VzELz8I+bOlFA8dDM2e99AiyYKk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=gg7ABZSCLZ7R8FjMuSHzn4PmQlN+bWSSxhg9EME1P73bw6Lrgmuc96xC+uU88luhw5OvcvK4R3b33uA9Rvc9yHEcX61LpH/1aToWDQw2QWNrzJYRMJJD7l/5ClNHaciMje/DOyS0JiO386k+Qf4iqOMSOpAC9mDJnoTHa6bHB8U= 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=vD2HFtkK; arc=none smtp.client-ip=209.85.210.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="vD2HFtkK" Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-82fd55bf6cdso3796693b3a.3 for ; Thu, 21 May 2026 06:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1779370714; x=1779975514; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=jbJ4F8kl/6/QcBmB9dNne3NQOqe79KuT470iYfI7huM=; b=vD2HFtkKNCQl2Nxi2sePWDsts6BHG5KLtGT/KpuLQKm3nh+PZIP5l7oPF9PQC2nngV lrLpVQvLFbAXcRUVQ4Quntoz6Fi4ox/z4VWqrk+RaWtmpuWZwcoz8tYjot79giG5QaYg g0Spda8iBU5cEbnZPnw+hGIR6ZNO2QtihN7AgJgUjo4lpV+oTGmL7Q6HklVtdjQhz7is Qi0dX/ZqCtgDQBAcnPIp9JW9dJrVFV9O+nWHYkWfzySGLfaeAOuuC8mN8jOtfQZX8Uhk qhXaRgl+rPGT1E4aTmPnD414Ws25FYEPncCtsU6Jq6y6eDWoez/4SoGgFk7sCC6dZJn9 CLZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779370714; x=1779975514; h=content-transfer-encoding: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=jbJ4F8kl/6/QcBmB9dNne3NQOqe79KuT470iYfI7huM=; b=c0uT14vEHN4OjgI76uCCgPS+gXdYhk+sZvXST0RXNA3JCTO6hmHSW4MBsNtdBnSBig RfqC+C2OWd6W+ORoLUArb82sNA5IrAxPVEiPTlgJCorhKh56cv7bGTwgmUkkfLQSxHn4 3IIrFeKY2pjuOJMUXPZzqmChL+/LnNU8AHxBrJ7TlAmou7p4N2pNQEeKGtsxhFx7IxFv 8k5D2+tcALRaTq42QYsfgTS4YFSYM+oixpdBIjpmRS/T+n/0yKcdOOklqo22FOqfftBb h9ozfGzicJ7WJyFMtc2gY9BsH/Moox9s9dcjdfidNP7CShj6yQbNDaHW9qedVfTqITkT Pjng== X-Forwarded-Encrypted: i=1; AFNElJ9EqAcrBPnPXkqdqj6zEPLRmvUvp7Dp59WSssE7XbLlZNnLlBf5XeGNNNf7xRAE4572uHQjObZYvYtJcuQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxV834K8A/IhvKUlFkrf41jW08KLoHKXGi4zPWfpViWnBY18Qps u+zjAbskMZSe02MazrQMBOc4t1+E4X8xDFIPeROA4QiDkzAcGNKKGYW7BdIfYFm9xyYkGwPCTie 0/hKjsA== X-Received: from pfbem15.prod.google.com ([2002:a05:6a00:374f:b0:83d:3c25:eb8b]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:4c8c:b0:827:3b1b:43e6 with SMTP id d2e1a72fcca58-8414acc6e8emr3123916b3a.21.1779370713612; Thu, 21 May 2026 06:38:33 -0700 (PDT) Date: Thu, 21 May 2026 06:38:32 -0700 In-Reply-To: <20260521131019.GI3126523@noisy.programming.kicks-ass.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260515191942.1892718-1-seanjc@google.com> <20260515191942.1892718-28-seanjc@google.com> <423b37f056f0d4d596d5f4cc73802fb1079ecf63.camel@infradead.org> <20260521131019.GI3126523@noisy.programming.kicks-ass.net> Message-ID: Subject: Re: [PATCH v3 27/41] x86/kvmclock: Enable kvmclock on APs during onlining if kvmclock isn't sched_clock From: Sean Christopherson To: Peter Zijlstra Cc: David Woodhouse , 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 , 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Thu, May 21, 2026, Peter Zijlstra wrote: > On Thu, May 21, 2026 at 05:59:17AM -0700, Sean Christopherson wrote: > > On Thu, May 21, 2026, David Woodhouse wrote: > > > On Fri, 2026-05-15 at 12:19 -0700, Sean Christopherson wrote: > > > > In anticipation of making x86_cpuinit.early_percpu_clock_init(), i.= e. > > > > kvm_setup_secondary_clock(), a dedicated sched_clock hook that will= be > > > > invoked if and only if kvmclock is set as sched_clock, ensure APs e= nable > > > > their kvmclock during CPU online.=C2=A0 While a redundant write to = the MSR is > > > > technically ok, skip the registration when kvmclock is sched_clock = so that > > > > it's somewhat obvious that kvmclock *needs* to be enabled during ea= rly > > > > bringup when it's being used as sched_clock. > > > >=20 > > > > Plumb in the BSP's resume path purely for documentation purposes.= =C2=A0 Both > > > > KVM (as-a-guest) and timekeeping/clocksource hook syscore_ops, and = it's > > > > not super obvious that using KVM's hooks would be flawed.=C2=A0 E.g= . it would > > > > work today, because KVM's hooks happen to run after/before timekeep= ing's > > > > hooks during suspend/resume, but that's sheer dumb luck as the orde= r in > > > > which syscore_ops are invoked depends entirely on when a subsystem = is > > > > initialized and thus registers its hooks. > > > >=20 > > > > Opportunsitically make the registration messages more precise to he= lp > > > > debug issues where kvmclock is enabled too late. > > >=20 > > > That's a hard word to type, isn't it? > >=20 > > Heh, you have no idea. I've been "this" close to creating a VIM bindin= g for a > > while, it is time... >=20 > 'z=3D' not good enough? You people and your fancy ways. I'm just happy I can get in and out of the= editor :-)