Page MenuHomeFreeBSD

Eventtimer for Hyper-V
ClosedPublic

Authored by howard0su_gmail.com on Dec 22 2015, 7:01 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 24, 3:46 PM
Unknown Object (File)
Tue, Dec 10, 10:27 AM
Unknown Object (File)
Nov 26 2024, 10:41 PM
Unknown Object (File)
Nov 7 2024, 3:24 AM
Unknown Object (File)
Nov 1 2024, 12:39 AM
Unknown Object (File)
Sep 21 2024, 8:03 AM
Unknown Object (File)
Sep 16 2024, 1:36 PM
Unknown Object (File)
Sep 10 2024, 9:56 PM
Subscribers

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

howard0su_gmail.com retitled this revision from to Eventtimer for Hyper-V.
howard0su_gmail.com updated this object.
howard0su_gmail.com edited the test plan for this revision. (Show Details)

Bascially the patch seems good to me.

Here are some small suggestions:

  1. In hv_et_intr(), we can easily avoid the rdmsr() by just doing a "full" init of 'timer_cfg' as we do in hv_et_start().

rdmsr() here is trapped into the hypervisor and at least several hundred or even thousand cycles are needed.

  1. we'd better replace "(1LL << 32)" with SBT_1S (I personally think this is more readable):

+ et.et_min_period = (1LL << 32) / HV_TIMER_FREQUENCY;
+ et.et_max_period = HV_MAX_DELTA_TICKS * ((1LL << 32) / HV_TIMER_FREQUENCY);

e.g., for min_period, we'd better use
et.et_min_period = HV_MIN_DELTA_TICKS * (SBT_1S / HV_TIMER_FREQUENCY);

  1. In hv_vmbus_isr(), we'd better invoke hv_et_intr() before msg->header.message_type = HV_MESSAGE_TYPE_NON.

Because it seems usually the users of event timer driver use one-shot mode rather than periodic mode, so we want the callback to be run ASAP.

  1. In hv_et_intr(), in the case "periodticks[curcpu] != 0" and "et.et_active) is false", it looks we needn't to do the wrmsr, so it may be a good idea to add a "if (!et.et_active) return;" at the beginning of the function.

And we need use something like EARLY_DRIVER_MODULE to make sure hyper-v timer is used as the default event timer, when the VM is running on Hyper-V.

delphij edited edge metadata.

Looks good to me.

This revision is now accepted and ready to land.Dec 29 2015, 8:02 AM
royger edited edge metadata.

LGTM. FWIW, I'm not sure there's much value in implementing both the one-shot and the periodic mode, one-shot is the preferred one AFAIK.

sys/dev/hyperv/vmbus/hv_hv.c
253 ↗(On Diff #11570)

IMHO, and that's more a suggestion: I would recommend making the event timer a device itself, that attaches to the vmbus. This will allow for more flexibility going forward, and you take advantage of newbus.

adrian added a reviewer: adrian.
This revision was automatically updated to reflect the committed changes.