On 4/14/2021 6:07 PM, kernel test robot wrote:
tree:
https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git perf/hybrid
head: d8d36d49b08781039deaf70e63f661cf55d28d2a
commit: a90ca7c4fc7dbada15912371642b1bb9e24b2b25 [17/26] perf/x86: Register hybrid PMUs
config: i386-randconfig-s001-20210414 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-280-g2cd6d34e-dirty
#
https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?...
git remote add peterz-queue
https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git
git fetch --no-tags peterz-queue perf/hybrid
git checkout a90ca7c4fc7dbada15912371642b1bb9e24b2b25
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
arch/x86/events/core.c: In function 'init_hw_perf_events':
>> arch/x86/events/core.c:2121:17: error: implicit declaration of function
'get_this_hybrid_cpu_type' [-Werror=implicit-function-declaration]
2121 | u8 cpu_type = get_this_hybrid_cpu_type();
| ^~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
Hi Peter,
The commit bfe6f62d7a8f ("x86/cpu: Add helper function to get the type
of the current hybrid CPU") in your perf/hybrid branch is not complete.
The changes in arch/x86/include/asm/cpu.h are missed.
Thanks,
Kan
>
>
> vim +/get_this_hybrid_cpu_type +2121 arch/x86/events/core.c
>
> 2021
> 2022 static int __init init_hw_perf_events(void)
> 2023 {
> 2024 struct x86_pmu_quirk *quirk;
> 2025 int err;
> 2026
> 2027 pr_info("Performance Events: ");
> 2028
> 2029 switch (boot_cpu_data.x86_vendor) {
> 2030 case X86_VENDOR_INTEL:
> 2031 err = intel_pmu_init();
> 2032 break;
> 2033 case X86_VENDOR_AMD:
> 2034 err = amd_pmu_init();
> 2035 break;
> 2036 case X86_VENDOR_HYGON:
> 2037 err = amd_pmu_init();
> 2038 x86_pmu.name = "HYGON";
> 2039 break;
> 2040 case X86_VENDOR_ZHAOXIN:
> 2041 case X86_VENDOR_CENTAUR:
> 2042 err = zhaoxin_pmu_init();
> 2043 break;
> 2044 default:
> 2045 err = -ENOTSUPP;
> 2046 }
> 2047 if (err != 0) {
> 2048 pr_cont("no PMU driver, software events only.\n");
> 2049 return 0;
> 2050 }
> 2051
> 2052 pmu_check_apic();
> 2053
> 2054 /* sanity check that the hardware exists or is emulated */
> 2055 if (!check_hw_exists(&pmu, x86_pmu.num_counters,
x86_pmu.num_counters_fixed))
> 2056 return 0;
> 2057
> 2058 pr_cont("%s PMU driver.\n", x86_pmu.name);
> 2059
> 2060 x86_pmu.attr_rdpmc = 1; /* enable userspace RDPMC usage by default */
> 2061
> 2062 for (quirk = x86_pmu.quirks; quirk; quirk = quirk->next)
> 2063 quirk->func();
> 2064
> 2065 if (!x86_pmu.intel_ctrl)
> 2066 x86_pmu.intel_ctrl = (1 << x86_pmu.num_counters) - 1;
> 2067
> 2068 perf_events_lapic_init();
> 2069 register_nmi_handler(NMI_LOCAL, perf_event_nmi_handler, 0,
"PMI");
> 2070
> 2071 unconstrained = (struct event_constraint)
> 2072 __EVENT_CONSTRAINT(0, (1ULL << x86_pmu.num_counters) - 1,
> 2073 0, x86_pmu.num_counters, 0, 0);
> 2074
> 2075 x86_pmu_format_group.attrs = x86_pmu.format_attrs;
> 2076
> 2077 if (!x86_pmu.events_sysfs_show)
> 2078 x86_pmu_events_group.attrs = &empty_attrs;
> 2079
> 2080 pmu.attr_update = x86_pmu.attr_update;
> 2081
> 2082 if (!is_hybrid()) {
> 2083 x86_pmu_show_pmu_cap(x86_pmu.num_counters,
> 2084 x86_pmu.num_counters_fixed,
> 2085 x86_pmu.intel_ctrl);
> 2086 }
> 2087
> 2088 if (!x86_pmu.read)
> 2089 x86_pmu.read = _x86_pmu_read;
> 2090
> 2091 if (!x86_pmu.guest_get_msrs)
> 2092 x86_pmu.guest_get_msrs = (void *)&__static_call_return0;
> 2093
> 2094 x86_pmu_static_call_update();
> 2095
> 2096 /*
> 2097 * Install callbacks. Core will call them for each online
> 2098 * cpu.
> 2099 */
> 2100 err = cpuhp_setup_state(CPUHP_PERF_X86_PREPARE,
"perf/x86:prepare",
> 2101 x86_pmu_prepare_cpu, x86_pmu_dead_cpu);
> 2102 if (err)
> 2103 return err;
> 2104
> 2105 err = cpuhp_setup_state(CPUHP_AP_PERF_X86_STARTING,
> 2106 "perf/x86:starting", x86_pmu_starting_cpu,
> 2107 x86_pmu_dying_cpu);
> 2108 if (err)
> 2109 goto out;
> 2110
> 2111 err = cpuhp_setup_state(CPUHP_AP_PERF_X86_ONLINE,
"perf/x86:online",
> 2112 x86_pmu_online_cpu, NULL);
> 2113 if (err)
> 2114 goto out1;
> 2115
> 2116 if (!is_hybrid()) {
> 2117 err = perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW);
> 2118 if (err)
> 2119 goto out2;
> 2120 } else {
>> 2121 u8 cpu_type = get_this_hybrid_cpu_type();
> 2122 struct x86_hybrid_pmu *hybrid_pmu;
> 2123 int i, j;
> 2124
> 2125 if (!cpu_type && x86_pmu.get_hybrid_cpu_type)
> 2126 cpu_type = x86_pmu.get_hybrid_cpu_type();
> 2127
> 2128 for (i = 0; i < x86_pmu.num_hybrid_pmus; i++) {
> 2129 hybrid_pmu = &x86_pmu.hybrid_pmu[i];
> 2130
> 2131 hybrid_pmu->pmu = pmu;
> 2132 hybrid_pmu->pmu.type = -1;
> 2133 hybrid_pmu->pmu.attr_update = x86_pmu.attr_update;
> 2134 hybrid_pmu->pmu.capabilities |= PERF_PMU_CAP_HETEROGENEOUS_CPUS;
> 2135
> 2136 err = perf_pmu_register(&hybrid_pmu->pmu, hybrid_pmu->name,
> 2137 (hybrid_pmu->cpu_type == hybrid_big) ? PERF_TYPE_RAW : -1);
> 2138 if (err)
> 2139 break;
> 2140
> 2141 if (cpu_type == hybrid_pmu->cpu_type)
> 2142 x86_pmu_update_cpu_context(&hybrid_pmu->pmu,
raw_smp_processor_id());
> 2143 }
> 2144
> 2145 if (i < x86_pmu.num_hybrid_pmus) {
> 2146 for (j = 0; j < i; j++)
> 2147 perf_pmu_unregister(&x86_pmu.hybrid_pmu[j].pmu);
> 2148 pr_warn("Failed to register hybrid PMUs\n");
> 2149 kfree(x86_pmu.hybrid_pmu);
> 2150 x86_pmu.hybrid_pmu = NULL;
> 2151 x86_pmu.num_hybrid_pmus = 0;
> 2152 goto out2;
> 2153 }
> 2154 }
> 2155
> 2156 return 0;
> 2157
> 2158 out2:
> 2159 cpuhp_remove_state(CPUHP_AP_PERF_X86_ONLINE);
> 2160 out1:
> 2161 cpuhp_remove_state(CPUHP_AP_PERF_X86_STARTING);
> 2162 out:
> 2163 cpuhp_remove_state(CPUHP_PERF_X86_PREPARE);
> 2164 return err;
> 2165 }
> 2166 early_initcall(init_hw_perf_events);
> 2167
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
>
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>