Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1394628lqd; Thu, 25 Apr 2024 14:24:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWxQ7gu2LDTugZo9/rZNysHIelMk/Lp7EVk/7MuBLeK6qu/FKHI63hRR9gvyxrCyAkHmz9/j7ihv/xEMoHg4YxRIdX6DRjSzO4tMNwbMA== X-Google-Smtp-Source: AGHT+IFX3CDgHDmFrloaaR2lp5WLQD0B4VM1elokxA9DAwlVyS8E/mckLiWhQu8omydRtNkF1pki X-Received: by 2002:a05:6e02:138d:b0:36c:ae5:c4da with SMTP id d13-20020a056e02138d00b0036c0ae5c4damr1305401ilo.17.1714080295629; Thu, 25 Apr 2024 14:24:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714080295; cv=pass; d=google.com; s=arc-20160816; b=NR97MymAocelM3XViDL0ztswZ3/hJwKkBaII+ur+smrk5DALFrChroGaFtY037uJGT EYNkPEejqbRr43Na81JDrp3BiO2zY5fGrRbnnbTSI8qVPZ/9GkJVrZwJgJWRS2KgQyzn XbbiK139ItsxOur2xoKepfqSsOEnXLapYQBCsAlbT/Ud5mOEjR9cl6tIrPfRBDOiPMnk dycgWSBAjpwrifhl6eP0L7TWZGpq/FsBmqfPuIwuceeNN/80Qbehtz1DrDz262JC48rr A0sZkglQK3yb/gaicdgEv5VSB+uKA0NcvC4ox7zABOFkda88rVQaJxBIBK4P3p23wk5S qXJQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=+sTAaqGLz3q6cw6em6Db0obkyEoxueelx3yWm6F/yNA=; fh=ezDhvCRhIp+kaxZ5Ra9PEDycJOMnHMyQxQZs15WOv5w=; b=Aw+27UmaXOkO7RdtZgzTKPkzTlW86qgwdbJQHrymg08NOedBgWu6eFTYrfHFZEOas9 VxhYDi6pbHKVpDXEfLYkSyokprV5OCKZH3EbQJjykHGCDr+Ms/j+3ASb5Fm/1rBxb2DE pFgfAyXWto7EOQ6IRC3FzFpmfh2bAqsYCM3h0cqN9dUYLZbgZpLrMPkXDYHdPAFsN/qo NB6C0ORr5OtNqSaUqhAt4d82n0mHSuf57CThFgpd1aH4wkaE5hwk1Lqp2bc3l1OFwKQm Cq180vUCFl+oeoIUnbfPzFnpSTWeTOvM2FrrxWE5hIEz9UXEhd71duWSxwHJ4QtS4Kf2 SCUA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BL0ymAq0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-159201-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159201-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id e25-20020a656899000000b005f796ab3c0asi13163223pgt.11.2024.04.25.14.24.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 14:24:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159201-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BL0ymAq0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-159201-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159201-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 717FDB21EEB for ; Thu, 25 Apr 2024 21:19:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 293EB1553BF; Thu, 25 Apr 2024 21:19:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BL0ymAq0" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4ECD1149DE3 for ; Thu, 25 Apr 2024 21:19:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714079947; cv=none; b=Vd594GRtibGJIziL7CXDvYOCdsOGvVKZBDtEoM3vklb9ApC/RQbofP9siLbDIrjvrNcuvAFku8YPw95beOOJeAkX9g4PtODJKzaRERZw0jmqW4zJa6+XLtJdg0CWtkZMgqSNqO1TzKyL62hHgDklGbu0WTiZa6SgE34N9v/CBKY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714079947; c=relaxed/simple; bh=f03FWO3QGytI/s63sia25tBtQ3FBL0DfGAEeg1DeVdQ=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=muPQLbpM/rNSavoYN44NmIAO/wFebQcJ0MHpJdREfx6PjsG0feRY1WwjPowM7GgpeUZhnrNjWQ2lQGq/7FujX0TU48ryJiBWb8nX4UFcrrzauhFH5PR1l3oGBUyO6CX7efiUxAZ6BQm+1bRA+nsktFjpiM2wtF2eiTSmWBWu73A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BL0ymAq0; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B23CC113CC; Thu, 25 Apr 2024 21:19:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714079946; bh=f03FWO3QGytI/s63sia25tBtQ3FBL0DfGAEeg1DeVdQ=; h=Date:From:To:Cc:Subject:From; b=BL0ymAq0PyY58xec2nDNYdpldltZ5BMV5Y0zc+A/0ALnKCZaZta5BIYUdyvLCKy+N d4bm7On98kTnm09Pk989frKLEjJ5fUUshLNbH+3/+PdFhqWhi5lDtzNpzkrFONM8Tt sZL/BMDnGqwD/RSiamC6iit5Nt4uiPB1Alg5RGbBV/NQLZCNzQclZXtptWQMzX4i1r S5aHBOhehR8JSpG6wH0yuw/wKQzNSYGHYk+UTM1BaMGEruab0G32GAH7uFVLbd0rnn jsuI2ZRm+DJ6kFzPv12+jujGoweZbFMX0BPTWuT0BCkYUHsR+rmlx3kliMsJJenJ0F 6vRkGwxCPvatw== Date: Thu, 25 Apr 2024 18:19:03 -0300 From: Arnaldo Carvalho de Melo To: linux-kernel@vger.kernel.org Cc: Adrian Hunter , Daniel Sneddon , Ian Rogers , Jiri Olsa , Namhyung Kim , Pawan Gupta , Thomas Gleixner Subject: [PATCH 1/1 fyi] tools headers x86 cpufeatures: Sync with the kernel sources to pick TDX, Zen, APIC MSR fence changes Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline tldr; Just FYI, I'm carrying this on the perf tools tree. Full explanation: There used to be no copies, with tools/ code using kernel headers directly. From time to time tools/perf/ broke due to legitimate kernel hacking. At some point Linus complained about such direct usage. Then we adopted the current model. The way these headers are used in perf are not restricted to just including them to compile something. There are sometimes used in scripts that convert defines into string tables, etc, so some change may break one of these scripts, or new MSRs may use some different #define pattern, etc. E.g.: $ ls -1 tools/perf/trace/beauty/*.sh | head -5 tools/perf/trace/beauty/arch_errno_names.sh tools/perf/trace/beauty/drm_ioctl.sh tools/perf/trace/beauty/fadvise.sh tools/perf/trace/beauty/fsconfig.sh tools/perf/trace/beauty/fsmount.sh $ $ tools/perf/trace/beauty/fadvise.sh static const char *fadvise_advices[] = { [0] = "NORMAL", [1] = "RANDOM", [2] = "SEQUENTIAL", [3] = "WILLNEED", [4] = "DONTNEED", [5] = "NOREUSE", }; $ The tools/perf/check-headers.sh script, part of the tools/ build process, points out changes in the original files. So its important not to touch the copies in tools/ when doing changes in the original kernel headers, that will be done later, when check-headers.sh inform about the change to the perf tools hackers. To pick the changes from: 95a6ccbdc7199a14 ("x86/bhi: Mitigate KVM by default") ec9404e40e8f3642 ("x86/bhi: Add BHI mitigation knob") be482ff9500999f5 ("x86/bhi: Enumerate Branch History Injection (BHI) bug") 0f4a837615ff925b ("x86/bhi: Define SPEC_CTRL_BHI_DIS_S") 7390db8aea0d64e9 ("x86/bhi: Add support for clearing branch history at syscall entry") This causes these perf files to be rebuilt and brings some X86_FEATURE that will be used when updating the copies of tools/arch/x86/lib/mem{cpy,set}_64.S with the kernel sources: CC /tmp/build/perf/bench/mem-memcpy-x86-64-asm.o CC /tmp/build/perf/bench/mem-memset-x86-64-asm.o And addresses this perf build warning: Warning: Kernel ABI header differences: diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h Cc: Adrian Hunter Cc: Daniel Sneddon Cc: Ian Rogers Cc: Jiri Olsa Cc: Namhyung Kim Cc: Pawan Gupta Cc: Thomas Gleixner Signed-off-by: Arnaldo Carvalho de Melo --- tools/arch/x86/include/asm/cpufeatures.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/arch/x86/include/asm/cpufeatures.h b/tools/arch/x86/include/asm/cpufeatures.h index a38f8f9ba6572912..3c7434329661c66e 100644 --- a/tools/arch/x86/include/asm/cpufeatures.h +++ b/tools/arch/x86/include/asm/cpufeatures.h @@ -461,11 +461,15 @@ /* * Extended auxiliary flags: Linux defined - for features scattered in various - * CPUID levels like 0x80000022, etc. + * CPUID levels like 0x80000022, etc and Linux defined features. * * Reuse free bits when adding new feature flags! */ #define X86_FEATURE_AMD_LBR_PMC_FREEZE (21*32+ 0) /* AMD LBR and PMC Freeze */ +#define X86_FEATURE_CLEAR_BHB_LOOP (21*32+ 1) /* "" Clear branch history at syscall entry using SW loop */ +#define X86_FEATURE_BHI_CTRL (21*32+ 2) /* "" BHI_DIS_S HW control available */ +#define X86_FEATURE_CLEAR_BHB_HW (21*32+ 3) /* "" BHI_DIS_S HW control enabled */ +#define X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT (21*32+ 4) /* "" Clear branch history at vmexit using SW loop */ /* * BUG word(s) @@ -515,4 +519,5 @@ #define X86_BUG_SRSO X86_BUG(1*32 + 0) /* AMD SRSO bug */ #define X86_BUG_DIV0 X86_BUG(1*32 + 1) /* AMD DIV0 speculation bug */ #define X86_BUG_RFDS X86_BUG(1*32 + 2) /* CPU is vulnerable to Register File Data Sampling */ +#define X86_BUG_BHI X86_BUG(1*32 + 3) /* CPU is affected by Branch History Injection */ #endif /* _ASM_X86_CPUFEATURES_H */ -- 2.44.0