All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] KVM: x86: Intel LBR related perf cleanups.
@ 2022-08-31  0:00 Sean Christopherson
  2022-08-31  0:00 ` [PATCH v3 1/3] perf/x86/core: Remove unnecessary stubs provided for KVM-only helpers Sean Christopherson
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Sean Christopherson @ 2022-08-31  0:00 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Sean Christopherson, Paolo Bonzini
  Cc: Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-perf-users, linux-kernel, kvm, Like Xu

WAS: Bug fixes and cleanups related to KVM's handling of PERF_CAPABILITIES.

Fix a bug where KVM incorrectly advertises PMU_CAP_LBR_FMT to userspace if
perf has disabled LBRs, e.g. because probing one or more LBR MSRs during
setup hit a #GP.

The non-KVM patches remove unnecessary stubs and unreachable error paths,
which allows for a cleaner fix for said bug.

v3:
 - Drop patches for bug #1 (already merged).
 - Drop misguided "clean up the capability check" patch. [Like]

v2:
 - https://lore.kernel.org/all/20220803192658.860033-1-seanjc@google.com
 - Add patches to fix bug #2. [Like]
 - Add a patch to clean up the capability check.
 - Tweak the changelog for the PMU refresh bug fix to call out that
   KVM should disallow changing feature MSRs after KVM_RUN. [Like]

v1: https://lore.kernel.org/all/20220727233424.2968356-1-seanjc@google.com

Sean Christopherson (3):
  perf/x86/core: Remove unnecessary stubs provided for KVM-only helpers
  perf/x86/core: Drop the unnecessary return value from
    x86_perf_get_lbr()
  KVM: VMX: Advertise PMU LBRs if and only if perf supports LBRs

 arch/x86/events/intel/lbr.c       |  6 +---
 arch/x86/include/asm/perf_event.h | 55 ++++++++-----------------------
 arch/x86/kvm/vmx/capabilities.h   |  5 ++-
 3 files changed, 19 insertions(+), 47 deletions(-)


base-commit: 372d07084593dc7a399bf9bee815711b1fb1bcf2
-- 
2.37.2.672.g94769d06f0-goog


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 1/3] perf/x86/core: Remove unnecessary stubs provided for KVM-only helpers
  2022-08-31  0:00 [PATCH v3 0/3] KVM: x86: Intel LBR related perf cleanups Sean Christopherson
@ 2022-08-31  0:00 ` Sean Christopherson
  2022-08-31  0:00 ` [PATCH v3 2/3] perf/x86/core: Drop the unnecessary return value from x86_perf_get_lbr() Sean Christopherson
  2022-08-31  0:00 ` [PATCH v3 3/3] KVM: VMX: Advertise PMU LBRs if and only if perf supports LBRs Sean Christopherson
  2 siblings, 0 replies; 8+ messages in thread
From: Sean Christopherson @ 2022-08-31  0:00 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Sean Christopherson, Paolo Bonzini
  Cc: Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-perf-users, linux-kernel, kvm, Like Xu

Remove CONFIG_PERF_EVENT=n stubs for functions that are effectively
KVM-only.  KVM selects PERF_EVENT and will never consume the stubs.
Dropping the unnecessary stubs will allow simplifying x86_perf_get_lbr()
by getting rid of the impossible-to-hit error path (which KVM doesn't
even check).

Opportunstically reorganize the declarations to collapse multiple
CONFIG_PERF_EVENTS #ifdefs.

Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 arch/x86/include/asm/perf_event.h | 53 ++++++++-----------------------
 1 file changed, 13 insertions(+), 40 deletions(-)

diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
index f6fc8dd51ef4..f839eb55f298 100644
--- a/arch/x86/include/asm/perf_event.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -525,46 +525,18 @@ extern u64 perf_get_hw_event_config(int hw_event);
 extern void perf_check_microcode(void);
 extern void perf_clear_dirty_counters(void);
 extern int x86_perf_rdpmc_index(struct perf_event *event);
-#else
-static inline void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap)
-{
-	memset(cap, 0, sizeof(*cap));
-}
 
-static inline u64 perf_get_hw_event_config(int hw_event)
-{
-	return 0;
-}
-
-static inline void perf_events_lapic_init(void)	{ }
-static inline void perf_check_microcode(void) { }
-#endif
-
-#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL)
+#ifdef CONFIG_CPU_SUP_INTEL
 extern struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr, void *data);
 extern int x86_perf_get_lbr(struct x86_pmu_lbr *lbr);
-#else
-struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr, void *data);
-static inline int x86_perf_get_lbr(struct x86_pmu_lbr *lbr)
-{
-	return -1;
-}
-#endif
+extern void intel_pt_handle_vmx(int on);
+#endif /* CONFIG_CPU_SUP_INTEL */
 
-#ifdef CONFIG_CPU_SUP_INTEL
- extern void intel_pt_handle_vmx(int on);
-#else
-static inline void intel_pt_handle_vmx(int on)
-{
+#ifdef CONFIG_CPU_SUP_AMD
+extern void amd_pmu_enable_virt(void);
+extern void amd_pmu_disable_virt(void);
 
-}
-#endif
-
-#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD)
- extern void amd_pmu_enable_virt(void);
- extern void amd_pmu_disable_virt(void);
-
-#if defined(CONFIG_PERF_EVENTS_AMD_BRS)
+#ifdef CONFIG_PERF_EVENTS_AMD_BRS
 
 #define PERF_NEEDS_LOPWR_CB 1
 
@@ -582,12 +554,13 @@ static inline void perf_lopwr_cb(bool lopwr_in)
 	static_call_mod(perf_lopwr_cb)(lopwr_in);
 }
 
-#endif /* PERF_NEEDS_LOPWR_CB */
+#endif /* CONFIG_PERF_EVENTS_AMD_BRS */
+#endif /* CONFIG_CPU_SUP_AMD */
 
-#else
- static inline void amd_pmu_enable_virt(void) { }
- static inline void amd_pmu_disable_virt(void) { }
-#endif
+#else  /* !CONFIG_PERF_EVENTS */
+static inline void perf_events_lapic_init(void)	{ }
+static inline void perf_check_microcode(void) { }
+#endif /* CONFIG_PERF_EVENTS */
 
 #define arch_perf_out_copy_user copy_from_user_nmi
 
-- 
2.37.2.672.g94769d06f0-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 2/3] perf/x86/core: Drop the unnecessary return value from x86_perf_get_lbr()
  2022-08-31  0:00 [PATCH v3 0/3] KVM: x86: Intel LBR related perf cleanups Sean Christopherson
  2022-08-31  0:00 ` [PATCH v3 1/3] perf/x86/core: Remove unnecessary stubs provided for KVM-only helpers Sean Christopherson
@ 2022-08-31  0:00 ` Sean Christopherson
  2022-08-31  0:00 ` [PATCH v3 3/3] KVM: VMX: Advertise PMU LBRs if and only if perf supports LBRs Sean Christopherson
  2 siblings, 0 replies; 8+ messages in thread
From: Sean Christopherson @ 2022-08-31  0:00 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Sean Christopherson, Paolo Bonzini
  Cc: Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-perf-users, linux-kernel, kvm, Like Xu

Drop the return value from x86_perf_get_lbr() now that there's no stub,
i.e. now that success is guaranteed (which is a bit of a lie since
success was always guaranteed, it's just more obvious now).

Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 arch/x86/events/intel/lbr.c       | 6 +-----
 arch/x86/include/asm/perf_event.h | 2 +-
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c
index 4f70fb6c2c1e..b8ad31c52cf0 100644
--- a/arch/x86/events/intel/lbr.c
+++ b/arch/x86/events/intel/lbr.c
@@ -1868,10 +1868,8 @@ void __init intel_pmu_arch_lbr_init(void)
  * x86_perf_get_lbr - get the LBR records information
  *
  * @lbr: the caller's memory to store the LBR records information
- *
- * Returns: 0 indicates the LBR info has been successfully obtained
  */
-int x86_perf_get_lbr(struct x86_pmu_lbr *lbr)
+void x86_perf_get_lbr(struct x86_pmu_lbr *lbr)
 {
 	int lbr_fmt = x86_pmu.intel_cap.lbr_format;
 
@@ -1879,8 +1877,6 @@ int x86_perf_get_lbr(struct x86_pmu_lbr *lbr)
 	lbr->from = x86_pmu.lbr_from;
 	lbr->to = x86_pmu.lbr_to;
 	lbr->info = (lbr_fmt == LBR_FORMAT_INFO) ? x86_pmu.lbr_info : 0;
-
-	return 0;
 }
 EXPORT_SYMBOL_GPL(x86_perf_get_lbr);
 
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
index f839eb55f298..f6d9230cdfab 100644
--- a/arch/x86/include/asm/perf_event.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -528,7 +528,7 @@ extern int x86_perf_rdpmc_index(struct perf_event *event);
 
 #ifdef CONFIG_CPU_SUP_INTEL
 extern struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr, void *data);
-extern int x86_perf_get_lbr(struct x86_pmu_lbr *lbr);
+extern void x86_perf_get_lbr(struct x86_pmu_lbr *lbr);
 extern void intel_pt_handle_vmx(int on);
 #endif /* CONFIG_CPU_SUP_INTEL */
 
-- 
2.37.2.672.g94769d06f0-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 3/3] KVM: VMX: Advertise PMU LBRs if and only if perf supports LBRs
  2022-08-31  0:00 [PATCH v3 0/3] KVM: x86: Intel LBR related perf cleanups Sean Christopherson
  2022-08-31  0:00 ` [PATCH v3 1/3] perf/x86/core: Remove unnecessary stubs provided for KVM-only helpers Sean Christopherson
  2022-08-31  0:00 ` [PATCH v3 2/3] perf/x86/core: Drop the unnecessary return value from x86_perf_get_lbr() Sean Christopherson
@ 2022-08-31  0:00 ` Sean Christopherson
  2022-08-31  9:49   ` kernel test robot
  2022-08-31 11:12   ` kernel test robot
  2 siblings, 2 replies; 8+ messages in thread
From: Sean Christopherson @ 2022-08-31  0:00 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Sean Christopherson, Paolo Bonzini
  Cc: Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-perf-users, linux-kernel, kvm, Like Xu

Advertise LBR support to userspace via MSR_IA32_PERF_CAPABILITIES if and
only if perf fully supports LBRs.  Perf may disable LBRs (by zeroing the
number of LBRs) even on platforms the allegedly support LBRs, e.g. if
probing any LBR MSRs during setup fails.

Fixes: be635e34c284 ("KVM: vmx/pmu: Expose LBR_FMT in the MSR_IA32_PERF_CAPABILITIES")
Reported-by: Like Xu <like.xu.linux@gmail.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 arch/x86/kvm/vmx/capabilities.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/vmx/capabilities.h b/arch/x86/kvm/vmx/capabilities.h
index c5e5dfef69c7..d2fdaf888d33 100644
--- a/arch/x86/kvm/vmx/capabilities.h
+++ b/arch/x86/kvm/vmx/capabilities.h
@@ -404,6 +404,7 @@ static inline bool vmx_pebs_supported(void)
 static inline u64 vmx_get_perf_capabilities(void)
 {
 	u64 perf_cap = PMU_CAP_FW_WRITES;
+	struct x86_pmu_lbr lbr;
 	u64 host_perf_cap = 0;
 
 	if (!enable_pmu)
@@ -412,7 +413,9 @@ static inline u64 vmx_get_perf_capabilities(void)
 	if (boot_cpu_has(X86_FEATURE_PDCM))
 		rdmsrl(MSR_IA32_PERF_CAPABILITIES, host_perf_cap);
 
-	perf_cap |= host_perf_cap & PMU_CAP_LBR_FMT;
+	x86_perf_get_lbr(&lbr);
+	if (lbr.nr)
+		perf_cap |= host_perf_cap & PMU_CAP_LBR_FMT;
 
 	if (vmx_pebs_supported()) {
 		perf_cap |= host_perf_cap & PERF_CAP_PEBS_MASK;
-- 
2.37.2.672.g94769d06f0-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/3] KVM: VMX: Advertise PMU LBRs if and only if perf supports LBRs
  2022-08-31  0:00 ` [PATCH v3 3/3] KVM: VMX: Advertise PMU LBRs if and only if perf supports LBRs Sean Christopherson
@ 2022-08-31  9:49   ` kernel test robot
  2022-08-31 11:12   ` kernel test robot
  1 sibling, 0 replies; 8+ messages in thread
From: kernel test robot @ 2022-08-31  9:49 UTC (permalink / raw)
  To: Sean Christopherson, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Paolo Bonzini
  Cc: llvm, kbuild-all, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, linux-perf-users, linux-kernel, kvm, Like Xu

Hi Sean,

I love your patch! Yet something to improve:

[auto build test ERROR on 372d07084593dc7a399bf9bee815711b1fb1bcf2]

url:    https://github.com/intel-lab-lkp/linux/commits/Sean-Christopherson/KVM-x86-Intel-LBR-related-perf-cleanups/20220831-080309
base:   372d07084593dc7a399bf9bee815711b1fb1bcf2
config: x86_64-randconfig-a012 (https://download.01.org/0day-ci/archive/20220831/202208311746.VAzmtgNx-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/094f42374997562fff3f9f9637ec9aa8257490a0
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Sean-Christopherson/KVM-x86-Intel-LBR-related-perf-cleanups/20220831-080309
        git checkout 094f42374997562fff3f9f9637ec9aa8257490a0
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 prepare

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from arch/x86/kernel/asm-offsets.c:22:
   In file included from arch/x86/kernel/../kvm/vmx/vmx.h:11:
>> arch/x86/kernel/../kvm/vmx/capabilities.h:416:2: error: implicit declaration of function 'x86_perf_get_lbr' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
           x86_perf_get_lbr(&lbr);
           ^
   1 error generated.
   make[2]: *** [scripts/Makefile.build:117: arch/x86/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [Makefile:1207: prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [Makefile:222: __sub-make] Error 2
   make: Target 'prepare' not remade because of errors.


vim +/x86_perf_get_lbr +416 arch/x86/kernel/../kvm/vmx/capabilities.h

   403	
   404	static inline u64 vmx_get_perf_capabilities(void)
   405	{
   406		u64 perf_cap = PMU_CAP_FW_WRITES;
   407		struct x86_pmu_lbr lbr;
   408		u64 host_perf_cap = 0;
   409	
   410		if (!enable_pmu)
   411			return 0;
   412	
   413		if (boot_cpu_has(X86_FEATURE_PDCM))
   414			rdmsrl(MSR_IA32_PERF_CAPABILITIES, host_perf_cap);
   415	
 > 416		x86_perf_get_lbr(&lbr);
   417		if (lbr.nr)
   418			perf_cap |= host_perf_cap & PMU_CAP_LBR_FMT;
   419	
   420		if (vmx_pebs_supported()) {
   421			perf_cap |= host_perf_cap & PERF_CAP_PEBS_MASK;
   422			if ((perf_cap & PERF_CAP_PEBS_FORMAT) < 4)
   423				perf_cap &= ~PERF_CAP_PEBS_BASELINE;
   424		}
   425	
   426		return perf_cap;
   427	}
   428	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/3] KVM: VMX: Advertise PMU LBRs if and only if perf supports LBRs
  2022-08-31  0:00 ` [PATCH v3 3/3] KVM: VMX: Advertise PMU LBRs if and only if perf supports LBRs Sean Christopherson
  2022-08-31  9:49   ` kernel test robot
@ 2022-08-31 11:12   ` kernel test robot
  2022-08-31 19:54       ` Sean Christopherson
  1 sibling, 1 reply; 8+ messages in thread
From: kernel test robot @ 2022-08-31 11:12 UTC (permalink / raw)
  To: Sean Christopherson, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Paolo Bonzini
  Cc: kbuild-all, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, linux-perf-users, linux-kernel, kvm, Like Xu

Hi Sean,

I love your patch! Yet something to improve:

[auto build test ERROR on 372d07084593dc7a399bf9bee815711b1fb1bcf2]

url:    https://github.com/intel-lab-lkp/linux/commits/Sean-Christopherson/KVM-x86-Intel-LBR-related-perf-cleanups/20220831-080309
base:   372d07084593dc7a399bf9bee815711b1fb1bcf2
config: i386-randconfig-s001 (https://download.01.org/0day-ci/archive/20220831/202208311831.zQ4oCG1b-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://github.com/intel-lab-lkp/linux/commit/094f42374997562fff3f9f9637ec9aa8257490a0
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Sean-Christopherson/KVM-x86-Intel-LBR-related-perf-cleanups/20220831-080309
        git checkout 094f42374997562fff3f9f9637ec9aa8257490a0
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 prepare

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from arch/x86/kernel/../kvm/vmx/vmx.h:11,
                    from arch/x86/kernel/asm-offsets.c:22:
   arch/x86/kernel/../kvm/vmx/capabilities.h: In function 'vmx_get_perf_capabilities':
>> arch/x86/kernel/../kvm/vmx/capabilities.h:416:9: error: implicit declaration of function 'x86_perf_get_lbr' [-Werror=implicit-function-declaration]
     416 |         x86_perf_get_lbr(&lbr);
         |         ^~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
   make[2]: *** [scripts/Makefile.build:117: arch/x86/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [Makefile:1207: prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [Makefile:222: __sub-make] Error 2
   make: Target 'prepare' not remade because of errors.


vim +/x86_perf_get_lbr +416 arch/x86/kernel/../kvm/vmx/capabilities.h

   403	
   404	static inline u64 vmx_get_perf_capabilities(void)
   405	{
   406		u64 perf_cap = PMU_CAP_FW_WRITES;
   407		struct x86_pmu_lbr lbr;
   408		u64 host_perf_cap = 0;
   409	
   410		if (!enable_pmu)
   411			return 0;
   412	
   413		if (boot_cpu_has(X86_FEATURE_PDCM))
   414			rdmsrl(MSR_IA32_PERF_CAPABILITIES, host_perf_cap);
   415	
 > 416		x86_perf_get_lbr(&lbr);
   417		if (lbr.nr)
   418			perf_cap |= host_perf_cap & PMU_CAP_LBR_FMT;
   419	
   420		if (vmx_pebs_supported()) {
   421			perf_cap |= host_perf_cap & PERF_CAP_PEBS_MASK;
   422			if ((perf_cap & PERF_CAP_PEBS_FORMAT) < 4)
   423				perf_cap &= ~PERF_CAP_PEBS_BASELINE;
   424		}
   425	
   426		return perf_cap;
   427	}
   428	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/3] KVM: VMX: Advertise PMU LBRs if and only if perf supports LBRs
  2022-08-31 11:12   ` kernel test robot
@ 2022-08-31 19:54       ` Sean Christopherson
  0 siblings, 0 replies; 8+ messages in thread
From: Sean Christopherson @ 2022-08-31 19:54 UTC (permalink / raw)
  To: kernel test robot
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Paolo Bonzini, kbuild-all, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, linux-perf-users, linux-kernel, kvm,
	Like Xu

On Wed, Aug 31, 2022, kernel test robot wrote:
> Hi Sean,
> 
> I love your patch! Yet something to improve:
> 
> [auto build test ERROR on 372d07084593dc7a399bf9bee815711b1fb1bcf2]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Sean-Christopherson/KVM-x86-Intel-LBR-related-perf-cleanups/20220831-080309
> base:   372d07084593dc7a399bf9bee815711b1fb1bcf2
> config: i386-randconfig-s001 (https://download.01.org/0day-ci/archive/20220831/202208311831.zQ4oCG1b-lkp@intel.com/config)
> compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
> reproduce:
>         # apt-get install sparse
>         # sparse version: v0.6.4-39-gce1a6720-dirty
>         # https://github.com/intel-lab-lkp/linux/commit/094f42374997562fff3f9f9637ec9aa8257490a0
>         git remote add linux-review https://github.com/intel-lab-lkp/linux
>         git fetch --no-tags linux-review Sean-Christopherson/KVM-x86-Intel-LBR-related-perf-cleanups/20220831-080309
>         git checkout 094f42374997562fff3f9f9637ec9aa8257490a0
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 prepare
> 
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>    In file included from arch/x86/kernel/../kvm/vmx/vmx.h:11,
>                     from arch/x86/kernel/asm-offsets.c:22:

Argh, KVM's "internal" vmx.h gets included by arch/x86/kernel/asm-offsets.c even
when KVM is disabled, and vmx_get_perf_capabilities() is oddly inlined there.

The simple fix is to move the definition of vmx_get_perf_capabilities() into vmx.c.

Long term, I want to figure out a way to break the dependency on asm-offsets.  I
ran afoul of this a week ago for something else, but couldn't figure an easy
solution and it wasn't (yet) a blocking issue.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/3] KVM: VMX: Advertise PMU LBRs if and only if perf supports LBRs
@ 2022-08-31 19:54       ` Sean Christopherson
  0 siblings, 0 replies; 8+ messages in thread
From: Sean Christopherson @ 2022-08-31 19:54 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1963 bytes --]

On Wed, Aug 31, 2022, kernel test robot wrote:
> Hi Sean,
> 
> I love your patch! Yet something to improve:
> 
> [auto build test ERROR on 372d07084593dc7a399bf9bee815711b1fb1bcf2]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Sean-Christopherson/KVM-x86-Intel-LBR-related-perf-cleanups/20220831-080309
> base:   372d07084593dc7a399bf9bee815711b1fb1bcf2
> config: i386-randconfig-s001 (https://download.01.org/0day-ci/archive/20220831/202208311831.zQ4oCG1b-lkp(a)intel.com/config)
> compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
> reproduce:
>         # apt-get install sparse
>         # sparse version: v0.6.4-39-gce1a6720-dirty
>         # https://github.com/intel-lab-lkp/linux/commit/094f42374997562fff3f9f9637ec9aa8257490a0
>         git remote add linux-review https://github.com/intel-lab-lkp/linux
>         git fetch --no-tags linux-review Sean-Christopherson/KVM-x86-Intel-LBR-related-perf-cleanups/20220831-080309
>         git checkout 094f42374997562fff3f9f9637ec9aa8257490a0
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 prepare
> 
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>    In file included from arch/x86/kernel/../kvm/vmx/vmx.h:11,
>                     from arch/x86/kernel/asm-offsets.c:22:

Argh, KVM's "internal" vmx.h gets included by arch/x86/kernel/asm-offsets.c even
when KVM is disabled, and vmx_get_perf_capabilities() is oddly inlined there.

The simple fix is to move the definition of vmx_get_perf_capabilities() into vmx.c.

Long term, I want to figure out a way to break the dependency on asm-offsets.  I
ran afoul of this a week ago for something else, but couldn't figure an easy
solution and it wasn't (yet) a blocking issue.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-08-31 19:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-31  0:00 [PATCH v3 0/3] KVM: x86: Intel LBR related perf cleanups Sean Christopherson
2022-08-31  0:00 ` [PATCH v3 1/3] perf/x86/core: Remove unnecessary stubs provided for KVM-only helpers Sean Christopherson
2022-08-31  0:00 ` [PATCH v3 2/3] perf/x86/core: Drop the unnecessary return value from x86_perf_get_lbr() Sean Christopherson
2022-08-31  0:00 ` [PATCH v3 3/3] KVM: VMX: Advertise PMU LBRs if and only if perf supports LBRs Sean Christopherson
2022-08-31  9:49   ` kernel test robot
2022-08-31 11:12   ` kernel test robot
2022-08-31 19:54     ` Sean Christopherson
2022-08-31 19:54       ` Sean Christopherson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.