From 8fa7df36682f51fef0b1bf1248dff8d56a5dad27 Mon Sep 17 00:00:00 2001 From: Matt Macy Date: Mon, 14 May 2018 01:08:47 +0000 Subject: [PATCH] pmc: don't add pmc owner to list until setup is complete Once a pmc owner is added to the pmc_ss_owners list it is visible for all to see. We don't want this to happen until setup is complete. Reported by: mjg Approved by: sbruno --- sys/dev/hwpmc/hwpmc_mod.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c index 0b5388370d3..f6ce795916b 100644 --- a/sys/dev/hwpmc/hwpmc_mod.c +++ b/sys/dev/hwpmc/hwpmc_mod.c @@ -2733,13 +2733,6 @@ pmc_start(struct pmc *pm) */ if (mode == PMC_MODE_SS) { - if (po->po_sscount == 0) { - CK_LIST_INSERT_HEAD(&pmc_ss_owners, po, po_ssnext); - atomic_add_rel_int(&pmc_ss_count, 1); - PMCDBG1(PMC,OPS,1, "po=%p in global list", po); - } - po->po_sscount++; - /* * Log mapping information for all existing processes in the * system. Subsequent mappings are logged as they happen; @@ -2749,6 +2742,12 @@ pmc_start(struct pmc *pm) pmc_log_all_process_mappings(po); po->po_logprocmaps = 1; } + po->po_sscount++; + if (po->po_sscount == 1) { + atomic_add_rel_int(&pmc_ss_count, 1); + CK_LIST_INSERT_HEAD(&pmc_ss_owners, po, po_ssnext); + PMCDBG1(PMC,OPS,1, "po=%p in global list", po); + } } /*