From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Roman Kagan <rkagan@virtuozzo.com>
Cc: "Stephen Hemminger" <sthemmin@microsoft.com>,
kvm@vger.kernel.org, "Radim Krčmář" <rkrcmar@redhat.com>,
"Haiyang Zhang" <haiyangz@microsoft.com>,
x86@kernel.org, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org,
"Michael Kelley (EOSG)" <Michael.H.Kelley@microsoft.com>,
"Ingo Molnar" <mingo@redhat.com>,
"Andy Lutomirski" <luto@kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Mohammed Gamal" <mmorsy@redhat.com>
Subject: Re: [PATCH 3/6] x86/hyper-v: reenlightenment notifications support
Date: Tue, 12 Dec 2017 09:04:49 +0100 [thread overview]
Message-ID: <874low5q3i.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20171211171023.GA2304@rkaganb.sw.ru> (Roman Kagan's message of "Mon, 11 Dec 2017 20:10:24 +0300")
Roman Kagan <rkagan@virtuozzo.com> writes:
> On Mon, Dec 11, 2017 at 10:56:33AM +0100, Vitaly Kuznetsov wrote:
>> Roman Kagan <rkagan@virtuozzo.com> writes:
>> > On Fri, Dec 08, 2017 at 11:49:57AM +0100, Vitaly Kuznetsov wrote:
>> >> +void register_hv_tsc_update(void (*cb)(void))
>> >> +{
>> >
>> > The function name seems unfortunate. IMHO such a name suggests
>> > registering a callback on a notifier chain (rather than unconditionally
>> > replacing the old callback), and having no other side effects.
>>
>> I see, any suggestion? register_hv_reenlightenment_cb? register_hv_tscchange_cb?
>
> IMHO arm_hv_reenlightenment_cb or arm_hv_tscchange_cb would be better,
> but I'm not very good at giving descriptive names.
>
I would probably try to avoid using 'arm' word in x86 code to assist
poor git-greppers :-) And we actually need a pair of functions
(enable/disable). I will probably go with
set_hv_tscchange_cb()
clear_hv_tscchange_cb()
in v2 unless there's a better suggestion.
>>
>> >
>> >> + struct hv_reenlightenment_control re_ctrl = {
>> >> + .vector = HYPERV_REENLIGHTENMENT_VECTOR,
>> >> + .enabled = 1,
>> >> + .target_vp = hv_vp_index[smp_processor_id()]
>> >> + };
>> >> + struct hv_tsc_emulation_control emu_ctrl = {.enabled = 1};
>> >> +
>> >> + if (!(ms_hyperv.features & HV_X64_ACCESS_REENLIGHTENMENT))
>> >> + return;
>> >
>> > What happens then? L2 guests keep running with their clocks ticking at
>> > a different speed?
>> >
>>
>> In reallity this never happens -- in case nested virtualization is
>> supported reenlightenment is also available. In theory, L0 can emulate
>> TSC acceess for forever after migration.
>
> I would think that Hyper-V only started rdtsc emulation if
> TSC_EMULATION_CONTROL was turned on, which wouldn't happen here.
>
Yes, this is the de-facto behavior I observe with WS2016.
> But indeed, normally this shouldn't be a problem. It may make sense
> just to issue a warning if the feature is unsupported, though.
Will do in v2, thanks.
--
Vitaly
WARNING: multiple messages have this Message-ID (diff)
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Roman Kagan <rkagan@virtuozzo.com>
Cc: kvm@vger.kernel.org, x86@kernel.org,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>,
"K. Y. Srinivasan" <kys@microsoft.com>,
"Haiyang Zhang" <haiyangz@microsoft.com>,
"Stephen Hemminger" <sthemmin@microsoft.com>,
"Michael Kelley (EOSG)" <Michael.H.Kelley@microsoft.com>,
"Andy Lutomirski" <luto@kernel.org>,
"Mohammed Gamal" <mmorsy@redhat.com>,
"Cathy Avery" <cavery@redhat.com>,
linux-kernel@vger.kernel.org, devel@linuxdriverproject.org
Subject: Re: [PATCH 3/6] x86/hyper-v: reenlightenment notifications support
Date: Tue, 12 Dec 2017 09:04:49 +0100 [thread overview]
Message-ID: <874low5q3i.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20171211171023.GA2304@rkaganb.sw.ru> (Roman Kagan's message of "Mon, 11 Dec 2017 20:10:24 +0300")
Roman Kagan <rkagan@virtuozzo.com> writes:
> On Mon, Dec 11, 2017 at 10:56:33AM +0100, Vitaly Kuznetsov wrote:
>> Roman Kagan <rkagan@virtuozzo.com> writes:
>> > On Fri, Dec 08, 2017 at 11:49:57AM +0100, Vitaly Kuznetsov wrote:
>> >> +void register_hv_tsc_update(void (*cb)(void))
>> >> +{
>> >
>> > The function name seems unfortunate. IMHO such a name suggests
>> > registering a callback on a notifier chain (rather than unconditionally
>> > replacing the old callback), and having no other side effects.
>>
>> I see, any suggestion? register_hv_reenlightenment_cb? register_hv_tscchange_cb?
>
> IMHO arm_hv_reenlightenment_cb or arm_hv_tscchange_cb would be better,
> but I'm not very good at giving descriptive names.
>
I would probably try to avoid using 'arm' word in x86 code to assist
poor git-greppers :-) And we actually need a pair of functions
(enable/disable). I will probably go with
set_hv_tscchange_cb()
clear_hv_tscchange_cb()
in v2 unless there's a better suggestion.
>>
>> >
>> >> + struct hv_reenlightenment_control re_ctrl = {
>> >> + .vector = HYPERV_REENLIGHTENMENT_VECTOR,
>> >> + .enabled = 1,
>> >> + .target_vp = hv_vp_index[smp_processor_id()]
>> >> + };
>> >> + struct hv_tsc_emulation_control emu_ctrl = {.enabled = 1};
>> >> +
>> >> + if (!(ms_hyperv.features & HV_X64_ACCESS_REENLIGHTENMENT))
>> >> + return;
>> >
>> > What happens then? L2 guests keep running with their clocks ticking at
>> > a different speed?
>> >
>>
>> In reallity this never happens -- in case nested virtualization is
>> supported reenlightenment is also available. In theory, L0 can emulate
>> TSC acceess for forever after migration.
>
> I would think that Hyper-V only started rdtsc emulation if
> TSC_EMULATION_CONTROL was turned on, which wouldn't happen here.
>
Yes, this is the de-facto behavior I observe with WS2016.
> But indeed, normally this shouldn't be a problem. It may make sense
> just to issue a warning if the feature is unsupported, though.
Will do in v2, thanks.
--
Vitaly
next prev parent reply other threads:[~2017-12-12 8:04 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-08 10:49 [PATCH 0/6] x86/kvm/hyperv: stable clocksorce for L2 guests when running nested KVM on Hyper-V Vitaly Kuznetsov
2017-12-08 10:49 ` Vitaly Kuznetsov
2017-12-08 10:49 ` [PATCH 1/6] x86/hyper-v: check for required priviliges in hyperv_init() Vitaly Kuznetsov
2017-12-08 10:49 ` [PATCH 2/6] x86/hyper-v: add a function to read both TSC and TSC page value simulateneously Vitaly Kuznetsov
2017-12-08 10:49 ` Vitaly Kuznetsov
2017-12-08 10:49 ` [PATCH 3/6] x86/hyper-v: reenlightenment notifications support Vitaly Kuznetsov
2017-12-08 18:10 ` Roman Kagan
2017-12-11 9:56 ` Vitaly Kuznetsov
2017-12-11 17:10 ` Roman Kagan
2017-12-12 8:04 ` Vitaly Kuznetsov [this message]
2017-12-12 8:04 ` Vitaly Kuznetsov
2017-12-13 0:50 ` Michael Kelley (EOSG)
2017-12-13 10:03 ` Vitaly Kuznetsov
2017-12-13 10:03 ` Vitaly Kuznetsov
2017-12-08 10:49 ` [PATCH 4/6] x86/hyper-v: redirect reenlightment notifications on CPU offlining Vitaly Kuznetsov
2017-12-08 10:49 ` Vitaly Kuznetsov
2017-12-08 10:49 ` [PATCH 5/6] x86/kvm: pass stable clocksource to guests when running nested on Hyper-V Vitaly Kuznetsov
2017-12-08 10:49 ` Vitaly Kuznetsov
2017-12-08 10:50 ` [PATCH 6/6] x86/kvm: support Hyper-V reenlightenment Vitaly Kuznetsov
2017-12-08 17:39 ` Roman Kagan
2017-12-11 9:57 ` Vitaly Kuznetsov
2017-12-11 9:57 ` Vitaly Kuznetsov
2017-12-12 8:17 ` Vitaly Kuznetsov
2017-12-12 8:17 ` Vitaly Kuznetsov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874low5q3i.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=Michael.H.Kelley@microsoft.com \
--cc=devel@linuxdriverproject.org \
--cc=haiyangz@microsoft.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=mmorsy@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rkagan@virtuozzo.com \
--cc=rkrcmar@redhat.com \
--cc=sthemmin@microsoft.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.