From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (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 611132EF64D for ; Wed, 11 Feb 2026 16:17:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770826657; cv=none; b=CuWKeyLyU+dTzEZ0oYoQsL5tE4wfwaJMf2Cs3z4KyRzY0p3rtId0cqId34k+iQ433KzjM63W0i3EssyHTL6bNGkNx0YhVCi6c/mHYEsv87wwapH7VI7kt/IRREuGeqqXg597lf1JfankCAL/CE26X7YHyMYxQD+u0E7rIC9kP6Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770826657; c=relaxed/simple; bh=5EvPyEvkqgrA7n4tzyHxQD1hclI9/oIsK3uTskzov3E=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=MSqJO2r0iHjzep4EecOig9YzPqxfOfBRrXlhJNFSo6erh32qDQwDlfTBS/OR7+4aOjuY/9dYnEcgmcxXN+6umJoYjkt2n1481fj1hrlygqMrbSDqM6aZ9zI3Qbx5pk1ZdhRpkWgBftSw7YI+dXcdSIDpnlsREbjs8rYTN1yRKHQ= 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=Sb7HjYCT; arc=none smtp.client-ip=209.85.216.73 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="Sb7HjYCT" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-3568090851aso2166535a91.1 for ; Wed, 11 Feb 2026 08:17:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770826656; x=1771431456; 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=V146SZPvRkej/EcKHnMerrWgIyMy78Orla7tpTzo81E=; b=Sb7HjYCTRU+5218WmZMnNTRAbKzB91Ey8WV1c9FVkd0hkcKdPFD/KpRAmRe9OKb6+9 cOe4Az+wIqe9DpI+zrBggxdQynNDDNyyeHcUaQ8/rwzmPdnmYddDhf6WTnhrcAoH5cg7 7I4E8RAARBSvpEUoEMyakFEz5Qzt1Bb3WWPiE/77SnJKxq2dZmE4BM80cKPyx0XJOIDo 8tvCCDP9U0lvURCgNMfcdCLQWb2PR8XlX8bevTMetkDdQiPbZm1f0uwy3512JuaoiRNF Cqq7bY5W0pgN0dDJc/JpmCitFJvZndb6y8dx7A1VGfYiBx+cLLRtCHJfxoH7rB9t2Myb be8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770826656; x=1771431456; 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=V146SZPvRkej/EcKHnMerrWgIyMy78Orla7tpTzo81E=; b=ld/wzlNTyC0CfXxQzW8tJ/dmiKyA8MnqAvrG4y0p8Yty5KRbq3tbCe9Thi58razOMZ 125zhFFvG/xQJQuLT0vNWYh31TRRiYs3LRA4cLa15UcMx/PtjfrbMWL2faerKcUifbOR alI26VFq4rPSog5B0gm+qqqiHNVCnZ2Kxq9KIuAH3M/DsSEdla/2uRiHDMuqJl24IGjs HD/LRiGra2MuqGIL6H1WhlyJtPSYMsOYIZR/0s6f7+Y0m6mHYOlWkSwVjEO4R3zKNSiR j40ire2CZenl5YmMN+achZlwR4Jevp4ddX4U7SpUmn5ggYAhmeK+chsrehoDEGekvGT2 Xghg== X-Forwarded-Encrypted: i=1; AJvYcCV+tSBThIy+44NwOkAt6N91W4mANYzoUvWxB0+SeNGXzxWcfTKEZPRuz8KfF8rTbhf3BGRi6iFA9YyMJyQ=@vger.kernel.org X-Gm-Message-State: AOJu0YybO27ebG+svDxAjjN9YSfBW6+7JY1Mz7hwD5fe/muxCTSBJ2dr eMlQq/xaAjNVo8ruYKJY3oCAdjILObJYy5rQs7o9kdPTRylS157zSNtrWOUOxWfVZp65ATjmWOK OZ6c46A== X-Received: from pjboh4.prod.google.com ([2002:a17:90b:3a44:b0:356:5127:89c6]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90a:ec87:b0:338:3d07:5174 with SMTP id 98e67ed59e1d1-3567afccb5cmr3006508a91.5.1770826655716; Wed, 11 Feb 2026 08:17:35 -0800 (PST) Date: Wed, 11 Feb 2026 08:17:34 -0800 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260211102928.100944-1-ubizjak@gmail.com> <2af5e3a8-f520-40fd-96a5-28555c3e4a5e@citrix.com> <20260211134342.45b7e19e@pumpkin> <5276256b-9669-46df-8fcd-b216f3d3e45b@citrix.com> Message-ID: Subject: Re: [PATCH 1/2] KVM: VMX: Drop obsolete branch hint prefixes from inline asm From: Sean Christopherson To: Andrew Cooper Cc: David Laight , ubizjak@gmail.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, mingo@kernel.org, pbonzini@redhat.com, tglx@kernel.org, x86@kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Wed, Feb 11, 2026, Andrew Cooper wrote: > On 11/02/2026 3:44 pm, Sean Christopherson wrote: > > On Wed, Feb 11, 2026, Andrew Cooper wrote: > >> On 11/02/2026 1:43 pm, David Laight wrote: > >>> On Wed, 11 Feb 2026 10:57:31 +0000 > >>> Andrew Cooper wrote: > >>> > >>>>> Remove explicit branch hint prefixes (.byte 0x2e / 0x3e) from VMX > >>>>> inline assembly sequences. > >>>>> > >>>>> These prefixes (CS/DS segment overrides used as branch hints on > >>>>> very old x86 CPUs) have been ignored by modern processors for a > >>>>> long time. Keeping them provides no measurable benefit and only > >>>>> enlarges the generated code. =20 > >>>> It's actually worse than this. > >>>> > >>>> The branch-taken hint has new meaning in Lion Cove cores and later, > >>>> along with a warning saying "performance penalty for misuse". > >>>> > >>>> i.e. "only insert this prefix after profiling". > >>> Don't they really have much the same meaning as before? > >> Architecturally yes, microarchitecturally very much not. > >> > >> For a branch known to the predictor, there is no effect.=C2=A0 If a br= anch > >> unknown to the predictor gets decoded, it triggers a frontend flush an= d > >> resteer. > >> > >> It is only useful for programs large enough to exceed the working set = of > >> the conditional predictor, and for which certain branches are known to > >> be ~always taken. > >> > >> Putting the prefix on a branch that isn't ~always taken is worse than > >> not having the prefix in the first place, hence the warning. > > These branches indeed ~always follow the hinted path (not taken in this= case). Doh, forgot the !CC_HAS_ASM_GOTO_OUTPUT case uses a branch-taken hint. > > So it sounds like this definitely isn't stable@ material, and maybe eve= n begs > > the question if dropping the hints is a net positive? >=20 > The new behaviour only exists for hint-taken. Because it only has any > effect for a branch unknown to the predictor, the behaviour without this > hint would be as if it were a larger basic block. >=20 > hint-not-takens have no behaviour since the Pentium 4 that I'm aware of. >=20 > This change is almost certainly marginal at best.=C2=A0 It's not as if > VMREAD/VMWRITE lead to good code gen even at the best of times. Yeah, but adding in them in the first place was even more marginal (I added= the hints as much for documentation purposes as anything else). Absent proof t= hat having the hints is a net positive, I'm inclined to trust the compiler folk= s on what is/isn't optimal, and drop them.