From 49626c85923fafb6088616cbda005efd329d3c34 Mon Sep 17 00:00:00 2001 From: Remy Noel Date: Sat, 14 Apr 2018 10:45:15 +0200 Subject: pmu_intel: fix call to gcc's __builtin_popcount. We do not use libgcc anymore due to its usage of redzone. --- arch/x86/machine/pmu_intel.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/arch/x86/machine/pmu_intel.c b/arch/x86/machine/pmu_intel.c index 20d7aa2..c47be6c 100644 --- a/arch/x86/machine/pmu_intel.c +++ b/arch/x86/machine/pmu_intel.c @@ -113,6 +113,23 @@ pmu_intel_get(void) return &pmu_intel; } +static unsigned int +pmu_popcount(unsigned int bits) +{ + unsigned int count = 0; + + /* XXX: Dummy version of popcount. We should implement a faster one if it + * gets needed somewhere else. + */ + while (bits) { + if (bits & 1) { + count++; + } + bits >>= 1; + } + return count; +} + static void pmu_intel_info(void) { @@ -120,7 +137,7 @@ pmu_intel_info(void) unsigned int nr_events; pmu = pmu_intel_get(); - nr_events = __builtin_popcount(pmu->events); + nr_events = pmu_popcount(pmu->events); log_info("pmu: driver: intel, architectural v1\n" "pmu: nr_pmcs: %u, pmc_width: %u, events: %#x, nr_events: %u\n", pmu->nr_pmcs, pmu->pmc_width, pmu->events, nr_events); -- cgit v1.2.3