svn commit: r333935 - head/sys/dev/hwpmc
Matt Macy
mmacy at FreeBSD.org
Sun May 20 19:35:25 UTC 2018
Author: mmacy
Date: Sun May 20 19:35:24 2018
New Revision: 333935
URL: https://svnweb.freebsd.org/changeset/base/333935
Log:
pmc: avoid potential race on shutdown
Clear shutdown flag first, conservatively allow 5ms for all hardclock consumers to
see flag before drainining
Modified:
head/sys/dev/hwpmc/hwpmc_logging.c
Modified: head/sys/dev/hwpmc/hwpmc_logging.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_logging.c Sun May 20 18:26:09 2018 (r333934)
+++ head/sys/dev/hwpmc/hwpmc_logging.c Sun May 20 19:35:24 2018 (r333935)
@@ -872,18 +872,20 @@ pmclog_close(struct pmc_owner *po)
pmclog_process_closelog(po);
mtx_lock(&pmc_kthread_mtx);
-
/*
+ * Initiate shutdown: no new data queued,
+ * thread will close file on last block.
+ */
+ po->po_flags |= PMC_PO_SHUTDOWN;
+ /* give time for all to see */
+ DELAY(50);
+
+ /*
* Schedule the current buffer.
*/
pmclog_schedule_all(po);
wakeup_one(po);
- /*
- * Initiate shutdown: no new data queued,
- * thread will close file on last block.
- */
- po->po_flags |= PMC_PO_SHUTDOWN;
mtx_unlock(&pmc_kthread_mtx);
return (0);
More information about the svn-src-head
mailing list