Project

General

Profile

Actions

Bug #13917

open

ctxops interfaces could be more ergonomic

Added by Patrick Mooney 4 months ago. Updated 3 months ago.

Status:
In Progress
Priority:
Normal
Category:
kernel
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

With the integration of #13915, the argument lists for installctx and removectx have continued to grow even more unwieldy. What's more, those interfaces are consumed by external drivers (KVM and VirtualBox), despite being outside the scope of the DDI. This means a flag day for those external drivers when making any meaningful changes to the ctxops interface. I propose several changes to the ctxops interface to address some of these challenges:

First, use ctxop_ prefixed names for functions consumed by outside logic. This would exclude kernel-internal bits like savectx and restorectx (called by swtch), but would cover installctx, removectx, and installctx_preallocate.

Just changing the function names is not enough to help with the argument soup problem, though. To deal with that, it should be switched to use template struct for configuring the functions associated with a ctxop (similar to struct dev_ops). This will help in a few ways: C99 struct initialization allows us to omit unused handlers. The template struct can bear a revision (again, like devo_rev) so that we can have better tools to handle updates without the need for a flag day.

The final change as part of the ergonomic overhaul has to do with ctxop allocation and freeing. In #13915, the ability to preallocate a struct ctxop was added. To expand on this for bhyve, which attaches/detaches ctxops handlers for every VM_RUN call, we'll add an interface to detach a ctxop struct without implicitly freeing it (ctxop_detach). This will allow consumers like bhyve, who wish to reuse pre-allocated ctxop storage, to operate in the manner they desire.


Related issues

Related to illumos gate - Bug #13915: installctx() blocking allocate causes problemsClosedDan McDonald

Actions
Actions #1

Updated by Electric Monk 4 months ago

  • Gerrit CR set to 1582
Actions #2

Updated by Patrick Mooney 4 months ago

  • Related to Bug #13915: installctx() blocking allocate causes problems added
Actions #3

Updated by Patrick Mooney 3 months ago

Like #13915 before, this represents a flag day for out-of-gate ctxop consumers, namely KVM and VirtualBox.

Actions #4

Updated by Andy Fiddaman 3 months ago

A (draft at time of writing) pull request for Virtualbox 6 is at https://github.com/omniosorg/omnios-extra/pull/921

Actions

Also available in: Atom PDF