Author: mmacy
Date: Mon May 14 01:08:47 2018
New Revision: 333598
URL: https://svnweb.freebsd.org/changeset/base/333598

Log:
  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

Modified:
  head/sys/dev/hwpmc/hwpmc_mod.c

Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_mod.c      Mon May 14 00:56:33 2018        
(r333597)
+++ head/sys/dev/hwpmc/hwpmc_mod.c      Mon May 14 01:08:47 2018        
(r333598)
@@ -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;
@@ -2748,6 +2741,12 @@ pmc_start(struct pmc *pm)
                if (po->po_logprocmaps == 0) {
                        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);
                }
        }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to