summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemy Noel <mocramis@gmail.com>2018-05-04 01:18:12 +0200
committerRemy Noel <mocramis@gmail.com>2018-05-04 01:18:12 +0200
commitdbf7c70e04a4f05f90d99d466eaad1932b0e0460 (patch)
tree0818a1c49c8706acb7b97fb893ea71a8ba233b25
parent58c17bd912ec450f8132597cdba6afd300a63586 (diff)
pmu: fix driver initialization.
-rw-r--r--arch/x86/machine/pmu_amd.c1
-rw-r--r--arch/x86/machine/pmu_intel.c3
2 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/machine/pmu_amd.c b/arch/x86/machine/pmu_amd.c
index 8e56bfa..82dc9de 100644
--- a/arch/x86/machine/pmu_amd.c
+++ b/arch/x86/machine/pmu_amd.c
@@ -226,6 +226,7 @@ pmu_amd_setup(void)
pmu = pmu_amd_get();
pmu->pmc_bm = (1U << PMU_AMD_NR_PMCS) - 1;
+ memset(&pmu_driver, 0, sizeof(pmu_driver));
pmu_driver.pmc_width = PMU_AMD_PMC_WIDTH;
/* Set max_tick to half the number of instruction per seconds. */
pmu_driver.of_max_ticks =
diff --git a/arch/x86/machine/pmu_intel.c b/arch/x86/machine/pmu_intel.c
index 6fbdbae..8b2f309 100644
--- a/arch/x86/machine/pmu_intel.c
+++ b/arch/x86/machine/pmu_intel.c
@@ -354,6 +354,7 @@ pmu_intel_setup(void)
pmu->events = ~ebx & ((1U << ev_len) - 1);
+ memset(&pmu_driver, 0, sizeof(pmu_driver));
pmu_driver.pmc_width = pmu->pmc_width;
pmu_driver.ops.info = pmu_intel_info;
pmu_driver.ops.translate = pmu_intel_translate;
@@ -366,10 +367,8 @@ pmu_intel_setup(void)
if (pmu->version >= 2) {
pmu_driver.ops.handle_of_intr = pmu_intel_handle_of_intr_v2;
- pmu_driver.of_max_ticks = 0;
} else {
/* Set max_tick to half the number of instruction per seconds. */
- pmu_driver.ops.handle_of_intr = NULL;
pmu_driver.of_max_ticks =
(1ULL << (pmu_driver.pmc_width - 1)) / (cpu_get_freq() / CLOCK_FREQ);
}