diff options
author | Patrick Mooney <pmooney@pfmooney.com> | 2020-05-11 13:36:12 -0500 |
---|---|---|
committer | Patrick Mooney <pmooney@pfmooney.com> | 2020-05-19 16:05:00 +0000 |
commit | ee8ae3fa63afd7fd57d5e63676a991af0fb8d887 (patch) | |
tree | 1bbb9e05fadca22521284ff1b31c8ee7f91aea33 /usr/src/compat | |
parent | b22a70abf81f995ecc990b8444e63308bc389d5c (diff) | |
download | illumos-gate-ee8ae3fa63afd7fd57d5e63676a991af0fb8d887.tar.gz |
12738 Panic in vlapic_callout_handler
Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
Reviewed by: Jason King <jason.king@joyent.com>
Reviewed by: Mike Zeller <mike.zeller@joyent.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/compat')
-rw-r--r-- | usr/src/compat/freebsd/sys/callout.h | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/usr/src/compat/freebsd/sys/callout.h b/usr/src/compat/freebsd/sys/callout.h index 6087a09f54..11823e6321 100644 --- a/usr/src/compat/freebsd/sys/callout.h +++ b/usr/src/compat/freebsd/sys/callout.h @@ -12,6 +12,7 @@ /* * Copyright 2014 Pluribus Networks Inc. * Copyright 2018 Joyent, Inc. + * Copyright 2020 Oxide Computer Company */ #ifndef _COMPAT_FREEBSD_SYS_CALLOUT_H_ @@ -21,20 +22,27 @@ struct callout { cyclic_id_t c_cyc_id; - int c_flags; + hrtime_t c_target; + hrtime_t c_fired; void (*c_func)(void *); void *c_arg; - }; -#define CALLOUT_ACTIVE 0x0002 /* callout is currently active */ -#define CALLOUT_PENDING 0x0004 /* callout is waiting for timeout */ - #define C_ABSOLUTE 0x0200 /* event time is absolute. */ -#define callout_active(c) ((c)->c_flags & CALLOUT_ACTIVE) -#define callout_deactivate(c) ((c)->c_flags &= ~CALLOUT_ACTIVE) -#define callout_pending(c) ((c)->c_flags & CALLOUT_PENDING) +/* Callout considered active if t_target has not been zeroed */ +#define callout_active(c) ((c)->c_target != 0) +#define callout_deactivate(c) ((c)->c_target = 0) + +/* + * If a callout is rescheduled (into the future) while its handler is running, + * it will be able to detect the pending invocation by the target time being + * greater than the time at which the handler was fired. + * + * This is only valid when checked from the callout handler, which is the only + * place where it is used by bhyve today. + */ +#define callout_pending(c) ((c)->c_target > (c)->c_fired) void vmm_glue_callout_init(struct callout *c, int mpsafe); int vmm_glue_callout_reset_sbt(struct callout *c, sbintime_t sbt, |