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)
Thu, Nov 7, 3:24 AM
Unknown Object (File)
Fri, Nov 1, 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
Unknown Object (File)
Sep 9 2024, 1:16 AM
Unknown Object (File)
Sep 9 2024, 1:13 AM
Unknown Object (File)
Sep 9 2024, 1:13 AM
Subscribers

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 1784
Build 1790: arc lint + arc unit

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

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.