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); _______________________________________________ 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"