Date: Sun, 20 May 2018 19:35:24 +0000 (UTC) From: Matt Macy <mmacy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333935 - head/sys/dev/hwpmc Message-ID: <201805201935.w4KJZONj026412@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805201935.w4KJZONj026412>