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 5FE3D408602 for ; Tue, 9 Jun 2026 12:28:27 +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=1781008108; cv=none; b=BTxinfiKRKpnKE3Is8xk68NIUtoYfCzbzB1dVOSX7tnIb7Jqj9Gxra7on79WuZBcIG/9OJ1qANa1ZTEyxvnyesoPK3ZuvC9asIWwV6cno/eSHMSA4y9obT0VVtHHXkm8hYGm9I2QskLRtiNQKwjkvdzhjeUZLiRUzMk00aC3/as= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781008108; c=relaxed/simple; bh=lGEDaxP9s5MVbkz0GqDIcVYCTfkJX1Q1PY4dt58kBow=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=U1aVjhpyqyv2Ns1WCNGJcbibNrktnNe5R+VKXHZqkA3PLtCXgFTwrdA3k+Uu/m+xLS0zjuo0NsdsWzCshARTyc55NpUGrUQN/qB/9+8m24me0gJaIx+Ns/V8cF3PmD9H0oLvvfhF6qXrAgaqqQx1iVKrdKwmdDA6IpnMu97bnX0= 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=DU+WTCSR; 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="DU+WTCSR" Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-8425a9979e1so3773236b3a.2 for ; Tue, 09 Jun 2026 05:28:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781008107; x=1781612907; 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=unmnrNbCXlEEjkFhHM3DLJAuHv468WBx57rOjaror7w=; b=DU+WTCSRssJwa5wdtrb4CWbSufN3OC0Prz86X0WlYIDJI+tJgnlOg6zPqp+N4CDzFW FCKi8B17p5aS0Yi2MEADjSiwugwoaxswbwIQZWQQsj/6H2MlT8ZMYahbTTpYWOukY6wV RnU6+HrAcEJmpcuwuQjFkHITFNwhE/5j0PEr4p1RAt+ZrGr9lb3NAVHMY5LwMHBoRbAq XP8exaSCqWeLrDm3/eOnLqNfmPA/qnThrR5vMvCgaY8BrDwlhkr1e77FyWj6XdJm2bBo TPZ6hLalYkmWqS2mNlsvmbBa42aYETE+dDZgwqd5HCCFBsQa3T3E0ViAPj5Gaubcljli jq6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781008107; x=1781612907; 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=unmnrNbCXlEEjkFhHM3DLJAuHv468WBx57rOjaror7w=; b=CCAM2S840HEpi8VWZKvirjNVrnFRAKrk0Ru+16dTFCYyCNuTPljynJ+bzEO7HxJ4Sd hP4/aHjKo+3lO1USJB51hnTSla5GMOukEWvaP6KZwsS9Gbv2jIpta6ToJM7XFdd0ZzeL OcY7eeyLr0Wp22I+SCgNRYNPqT3AOOUad5nCl7JS717Gddh3jkuiTCK8mdxuy1Ep7AFy Ek06jgigzpCVIYGEVx4BLGjYUHb0oC1sRNK3R6zNZj8Qhz0HGOlO1b6BhmdqTREnuJAy l+YTFq1f6V6q77EtIcRxH2tDWpnjrXRlVWaC5ltztwxT/UdWELkoql0/Zm0e2JOxQcB+ VIrg== X-Forwarded-Encrypted: i=1; AFNElJ8d90aRWsfUkhmh/buSe0HKmoOJ9xBz5t3qaXpV7+zf+JgjHNl3rhIz76vzVVeJ+Pz5yzOdolrInnRrZBc=@vger.kernel.org X-Gm-Message-State: AOJu0YwWZ3CTtqSmtrNfEpepDTT5hLz1+yMZDcrn6+v7t8UrEzY8Q2X6 OMjA6N8RgHwjsTLLPA68ap8xVZsMxlirmtw2hHeBVDsbFUoScAcmtoQjjw2zprN67fNQxGuTker aLwBhyg== X-Received: from pfjf5.prod.google.com ([2002:a05:6a00:22c5:b0:842:4720:4013]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:2910:b0:842:6fce:6171 with SMTP id d2e1a72fcca58-8430a62f307mr3223335b3a.3.1781008106459; Tue, 09 Jun 2026 05:28:26 -0700 (PDT) Date: Tue, 9 Jun 2026 05:28:24 -0700 In-Reply-To: <87a4t440js.ffs@fw13> Precedence: bulk X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260529144435.704127-1-seanjc@google.com> <20260529144435.704127-11-seanjc@google.com> <877boc554l.ffs@fw13> <87a4t440js.ffs@fw13> Message-ID: Subject: Re: [PATCH v4 10/47] x86/tsc: Consolidate forcing of X86_FEATURE_TSC_KNOWN_FREQ for PV code From: Sean Christopherson To: Thomas Gleixner Cc: David Woodhouse , Paolo Bonzini , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Kiryl Shutsemau , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Ajay Kaher , Alexey Makhalov , Jan Kiszka , Andy Lutomirski , Peter Zijlstra , Juergen Gross , Daniel Lezcano , John Stultz , "H. Peter Anvin" , Rick Edgecombe , Vitaly Kuznetsov , Broadcom internal kernel review list , Boris Ostrovsky , Stephen Boyd , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev, linux-hyperv@vger.kernel.org, virtualization@lists.linux.dev, xen-devel@lists.xenproject.org, Tom Lendacky , Nikunj A Dadhania , Michael Kelley Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Tue, Jun 09, 2026, Thomas Gleixner wrote: > On Mon, Jun 08 2026 at 15:38, Sean Christopherson wrote: > > On Sat, Jun 06, 2026, David Woodhouse wrote: > >> > Along with: > >> >=20 > >> > =C2=A0=C2=A0 if (!hypervisor_is_type(X86_HYPER_NATIVE)) { > >> > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (tsc_khz_early) > >> > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pr_warn("Ignoring n= on-sensical tsc_early_khz command line argument\n"); > >> >=20 > >> > or something daft like that. > > > > Ya, I ended up in the same place once Sashiko pointed out that skipping= the SNP/TDX > > setup was hazardous[*], and also once I realized that tsc_khz_early *co= mplemented* > > the refinement instead of replacing it. > > > > This is what I have locally: > > > > if (cc_platform_has(CC_ATTR_GUEST_SNP_SECURE_TSC)) > > known_tsc_khz =3D snp_secure_tsc_init(); > > else if (boot_cpu_has(X86_FEATURE_TDX_GUEST)) > > known_tsc_khz =3D tdx_tsc_init(); > > > > /* > > * If the TSC frequency wasn't provided by trusted firmware, tr= y to get > > * it from the hypervisor (which is untrusted when running as a= CoCo guest). > > */ > > if (!known_tsc_khz && x86_init.hyper.get_tsc_khz) > > known_tsc_khz =3D x86_init.hyper.get_tsc_khz(); > > > > /* > > * Mark the TSC frequency as known if it was obtained from a hy= pervisor > > * or trusted firmware. Don't mark the frequency as known if t= he user > > * specified the frequency, as the user-provided frequency is i= ntended > > * as a "starting point", not a known, guaranteed frequency. > > */ > > if (known_tsc_khz && !tsc_early_khz) > > setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ); >=20 > If the frequenct is known via the above then you want to set the > KNOWN_FREQ feature bit unconditionally. SNP/TDX/hypervisor override the > command line argument as you print below. Doh, forgot to remove that check when I shuffled things around. Thank you!