summaryrefslogtreecommitdiffstats
path: root/sys/sys/_callout.h
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2015-01-15 15:32:30 +0000
committerhselasky <hselasky@FreeBSD.org>2015-01-15 15:32:30 +0000
commita9eed96a6bda13eed9a6320cbe91959c48407fb8 (patch)
treeebd024c7dff919c77c0677d25786d9d0e272bcb1 /sys/sys/_callout.h
parent535e5620c99b6193aa79f6f7f2604a6a1443672f (diff)
downloadFreeBSD-src-a9eed96a6bda13eed9a6320cbe91959c48407fb8.zip
FreeBSD-src-a9eed96a6bda13eed9a6320cbe91959c48407fb8.tar.gz
Major callout subsystem cleanup and rewrite:
- Close a migration race where callout_reset() failed to set the CALLOUT_ACTIVE flag. - Callout callback functions are now allowed to be protected by spinlocks. - Switching the callout CPU number cannot always be done on a per-callout basis. See the updated timeout(9) manual page for more information. - The timeout(9) manual page has been updated to reflect how all the functions inside the callout API are working. The manual page has been made function oriented to make it easier to deduce how each of the functions making up the callout API are working without having to first read the whole manual page. Group all functions into a handful of sections which should give a quick top-level overview when the different functions should be used. - The CALLOUT_SHAREDLOCK flag and its functionality has been removed to reduce the complexity in the callout code and to avoid problems about atomically stopping callouts via callout_stop(). If someone needs it, it can be re-added. From my quick grep there are no CALLOUT_SHAREDLOCK clients in the kernel. - A new callout API function named "callout_drain_async()" has been added. See the updated timeout(9) manual page for a complete description. - Update the callout clients in the "kern/" folder to use the callout API properly, like cv_timedwait(). Previously there was some custom sleepqueue code in the callout subsystem, which has been removed, because we now allow callouts to be protected by spinlocks. This allows us to tear down the callout like done with regular mutexes, and a "td_slpmutex" has been added to "struct thread" to atomically teardown the "td_slpcallout". Further the "TDF_TIMOFAIL" and "SWT_SLEEPQTIMO" states can now be completely removed. Currently they are marked as available and will be cleaned up in a follow up commit. - Bump the __FreeBSD_version to indicate kernel modules need recompilation. - There has been several reports that this patch "seems to squash a serious bug leading to a callout timeout and panic". Kernel build testing: all architectures were built MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D1438 Sponsored by: Mellanox Technologies Reviewed by: jhb, adrian, sbruno and emaste
Diffstat (limited to 'sys/sys/_callout.h')
-rw-r--r--sys/sys/_callout.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/sys/sys/_callout.h b/sys/sys/_callout.h
index e186aec..f58a383 100644
--- a/sys/sys/_callout.h
+++ b/sys/sys/_callout.h
@@ -46,19 +46,30 @@ LIST_HEAD(callout_list, callout);
SLIST_HEAD(callout_slist, callout);
TAILQ_HEAD(callout_tailq, callout);
+typedef void callout_func_t(void *);
+
+struct callout_args {
+ sbintime_t time; /* absolute time for the event */
+ sbintime_t precision; /* delta allowed wrt opt */
+ void *arg; /* function argument */
+ callout_func_t *func; /* function to call */
+ int flags; /* flags passed to callout_reset() */
+ int cpu; /* CPU we're scheduled on */
+};
+
struct callout {
union {
LIST_ENTRY(callout) le;
SLIST_ENTRY(callout) sle;
TAILQ_ENTRY(callout) tqe;
} c_links;
- sbintime_t c_time; /* ticks to the event */
+ sbintime_t c_time; /* absolute time for the event */
sbintime_t c_precision; /* delta allowed wrt opt */
void *c_arg; /* function argument */
- void (*c_func)(void *); /* function to call */
- struct lock_object *c_lock; /* lock to handle */
+ callout_func_t *c_func; /* function to call */
+ struct lock_object *c_lock; /* callback lock */
int c_flags; /* state of this entry */
- volatile int c_cpu; /* CPU we're scheduled on */
+ int c_cpu; /* CPU we're scheduled on */
};
#endif
OpenPOWER on IntegriCloud