HomeFreeBSD

Major callout subsystem cleanup and rewrite:

Description

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.
  • 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
Differential Revision: https://reviews.freebsd.org/D1438

Details

Provenance
hselaskyAuthored on
Differential Revision
D1438: FreeBSD callout rewrite and cleanup
Parents
rS282413: Merge ^/head r281025 through r282412.
Branches
Unknown
Tags
Unknown