All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dexuan Cui <decui@microsoft.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"0x7f454c46@gmail.com" <0x7f454c46@gmail.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"sashal@kernel.org" <sashal@kernel.org>,
	"linux@rasmusvillemoes.dk" <linux@rasmusvillemoes.dk>,
	"bp@alien8.de" <bp@alien8.de>,
	"daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"apw@canonical.com" <apw@canonical.com>,
	"linux-mips@vger.kernel.org" <linux-mips@vger.kernel.org>,
	"paul.burton@mips.com" <paul.burton@mips.com>,
	Michael Kelley <mikelley@microsoft.com>,
	Sunil Muthuswamy <sunilmut@microsoft.com>,
	"marc.zyngier@arm.com" <marc.zyngier@arm.com>,
	"linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>,
	"jasowang@redhat.com" <jasowang@redhat.com>,
	"huw@codeweavers.com" <huw@codeweavers.com>,
	"ralf@linux-mips.org" <ralf@linux-mips.org>ma
Subject: RE: [tip:timers/core] clocksource/drivers: Make Hyper-V clocksource ISA agnostic
Date: Sat, 6 Jul 2019 01:09:06 +0000	[thread overview]
Message-ID: <PU1P153MB0169E8E3898897BF3B3BE0F6BFF40@PU1P153MB0169.APCP153.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <tip-fd1fea6834d0f9f93062ae6685862908a9baed39@git.kernel.org>

> From: linux-hyperv-owner@vger.kernel.org
> <linux-hyperv-owner@vger.kernel.org> On Behalf Of tip-bot for Michael Kelley
> Sent: Wednesday, July 3, 2019 2:07 AM
> clocksource/drivers: Make Hyper-V clocksource ISA agnostic
> 
> Hyper-V clock/timer code and data structures are currently mixed
> in with other code in the ISA independent drivers/hv directory as
> well as the ISA dependent Hyper-V code under arch/x86.
> 
> Consolidate this code and data structures into a Hyper-V clocksource driver
> to better follow the Linux model. In doing so, separate out the ISA
> dependent portions so the new clocksource driver works for x86 and for the
> in-process Hyper-V on ARM64 code.
> 
> To start, move the existing clockevents code to create the new clocksource
> driver. Update the VMbus driver to call initialization and cleanup routines
> since the Hyper-V synthetic timers are not independently enumerated in
> ACPI.
> 
> No behavior is changed and no new functionality is added.
>... 
> +void hv_stimer_cleanup(unsigned int cpu)
> +{
> +	struct clock_event_device *ce;
> +
> +	/* Turn off clockevent device */
> +	if (ms_hyperv.features & HV_MSR_SYNTIMER_AVAILABLE) {
> +		ce = per_cpu_ptr(hv_clock_event, cpu);
> +		hv_ce_shutdown(ce);
> +	}
> +}

Actually, there is a behavior change (see https://lkml.org/lkml/2019/7/1/9):
	Removed call to clockevents_unbind_device() [Thomas Gleixner]
and this breaks my ongoing work of Linux guest hibernation on Hyper-V. :-(

I guess Thomas suggested we remove the call because the clockevent device
can be automatically cleaned up in tick_cleanup_dead_cpu(), when a CPU is 
offlined? BTW, I didn't find Thomas's mail suggesting the change.

In the case of hibernation, this is not true for CPU0, because 
tick_cleanup_dead_cpu() is not called for CPU0. As a result, when the
system resumes from hibernation, we add the same clock_event_device
into the global list clockevent_devices twice in hv_stimer_init(0) ->
clockevents_config_and_register() for CPU0, causing unexpected
behaviors...

Should we call clockevents_unbind_device() or tick_cleanup_dead_cpu()
somewher for CPU0, in the case of hibernation? 

Or, in clockevents_config_and_register(), should we not add the event
device, if it's already in the global list?

Thanks,
-- Dexuan

WARNING: multiple messages have this Message-ID (diff)
From: Dexuan Cui <decui@microsoft.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"0x7f454c46@gmail.com" <0x7f454c46@gmail.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"sashal@kernel.org" <sashal@kernel.org>,
	"linux@rasmusvillemoes.dk" <linux@rasmusvillemoes.dk>,
	"bp@alien8.de" <bp@alien8.de>,
	"daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"apw@canonical.com" <apw@canonical.com>,
	"linux-mips@vger.kernel.org" <linux-mips@vger.kernel.org>,
	"paul.burton@mips.com" <paul.burton@mips.com>,
	Michael Kelley <mikelley@microsoft.com>,
	Sunil Muthuswamy <sunilmut@microsoft.com>,
	"marc.zyngier@arm.com" <marc.zyngier@arm.com>,
	"linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>,
	"jasowang@redhat.com" <jasowang@redhat.com>,
	"huw@codeweavers.com" <huw@codeweavers.com>,
	"ralf@linux-mips.org" <ralf@linux-mips.org>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"olaf@aepfle.de" <olaf@aepfle.de>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"rkrcmar@redhat.com" <rkrcmar@redhat.com>,
	"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
	KY Srinivasan <kys@microsoft.com>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"mingo@kernel.org" <mingo@kernel.org>,
	"sfr@canb.auug.org.au" <sfr@canb.auug.org.au>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"vincenzo.frascino@arm.com" <vincenzo.frascino@arm.com>,
	"will.deacon@arm.com" <will.deacon@arm.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	vkuznets <vkuznets@redhat.com>,
	"shuah@kernel.org" <shuah@kernel.org>,
	"pcc@google.com" <pcc@google.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"marcelo.cerri@canonical.com" <marcelo.cerri@canonical.com>,
	"salyzyn@android.com" <salyzyn@android.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"linux-tip-commits@vger.kernel.org"
	<linux-tip-commits@vger.kernel.org>
Subject: RE: [tip:timers/core] clocksource/drivers: Make Hyper-V clocksource ISA agnostic
Date: Sat, 6 Jul 2019 01:09:06 +0000	[thread overview]
Message-ID: <PU1P153MB0169E8E3898897BF3B3BE0F6BFF40@PU1P153MB0169.APCP153.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <tip-fd1fea6834d0f9f93062ae6685862908a9baed39@git.kernel.org>

> From: linux-hyperv-owner@vger.kernel.org
> <linux-hyperv-owner@vger.kernel.org> On Behalf Of tip-bot for Michael Kelley
> Sent: Wednesday, July 3, 2019 2:07 AM
> clocksource/drivers: Make Hyper-V clocksource ISA agnostic
> 
> Hyper-V clock/timer code and data structures are currently mixed
> in with other code in the ISA independent drivers/hv directory as
> well as the ISA dependent Hyper-V code under arch/x86.
> 
> Consolidate this code and data structures into a Hyper-V clocksource driver
> to better follow the Linux model. In doing so, separate out the ISA
> dependent portions so the new clocksource driver works for x86 and for the
> in-process Hyper-V on ARM64 code.
> 
> To start, move the existing clockevents code to create the new clocksource
> driver. Update the VMbus driver to call initialization and cleanup routines
> since the Hyper-V synthetic timers are not independently enumerated in
> ACPI.
> 
> No behavior is changed and no new functionality is added.
>... 
> +void hv_stimer_cleanup(unsigned int cpu)
> +{
> +	struct clock_event_device *ce;
> +
> +	/* Turn off clockevent device */
> +	if (ms_hyperv.features & HV_MSR_SYNTIMER_AVAILABLE) {
> +		ce = per_cpu_ptr(hv_clock_event, cpu);
> +		hv_ce_shutdown(ce);
> +	}
> +}

Actually, there is a behavior change (see https://lkml.org/lkml/2019/7/1/9):
	Removed call to clockevents_unbind_device() [Thomas Gleixner]
and this breaks my ongoing work of Linux guest hibernation on Hyper-V. :-(

I guess Thomas suggested we remove the call because the clockevent device
can be automatically cleaned up in tick_cleanup_dead_cpu(), when a CPU is 
offlined? BTW, I didn't find Thomas's mail suggesting the change.

In the case of hibernation, this is not true for CPU0, because 
tick_cleanup_dead_cpu() is not called for CPU0. As a result, when the
system resumes from hibernation, we add the same clock_event_device
into the global list clockevent_devices twice in hv_stimer_init(0) ->
clockevents_config_and_register() for CPU0, causing unexpected
behaviors...

Should we call clockevents_unbind_device() or tick_cleanup_dead_cpu()
somewher for CPU0, in the case of hibernation? 

Or, in clockevents_config_and_register(), should we not add the event
device, if it's already in the global list?

Thanks,
-- Dexuan
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-07-06  1:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-01  4:25 [PATCH v5 0/2] clocksource/drivers: Create new Hyper-V clocksource driver Michael Kelley
2019-07-01  4:25 ` Michael Kelley
2019-07-01  4:25 ` Michael Kelley
2019-07-01  4:25 ` Michael Kelley
2019-07-01  4:25 ` [PATCH v5 1/2] clocksource/drivers: Make Hyper-V clocksource ISA agnostic Michael Kelley
2019-07-01  4:25   ` Michael Kelley
2019-07-01  4:25   ` Michael Kelley
2019-07-01  4:25   ` Michael Kelley
2019-07-03  9:07   ` [tip:timers/core] " tip-bot for Michael Kelley
2019-07-03  9:07     ` tip-bot for Michael Kelley
2019-07-06  1:09     ` Dexuan Cui [this message]
2019-07-06  1:09       ` Dexuan Cui
2019-07-06  7:56       ` Thomas Gleixner
2019-07-06  7:56         ` Thomas Gleixner
2019-07-06  8:33         ` Thomas Gleixner
2019-07-06  8:33           ` Thomas Gleixner
2019-07-06 17:39           ` Dexuan Cui
2019-07-06 17:39             ` Dexuan Cui
2019-07-07 10:06             ` Thomas Gleixner
2019-07-07 10:06               ` Thomas Gleixner
2019-07-01  4:26 ` [PATCH v5 2/2] clocksource/drivers: Continue making " Michael Kelley
2019-07-01  4:26   ` Michael Kelley
2019-07-01  4:26   ` Michael Kelley
2019-07-01  4:26   ` Michael Kelley
2019-07-03  9:08   ` [tip:timers/core] " tip-bot for Michael Kelley
2019-07-03  9:08     ` tip-bot for Michael Kelley

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=PU1P153MB0169E8E3898897BF3B3BE0F6BFF40@PU1P153MB0169.APCP153.PROD.OUTLOOK.COM \
    --to=decui@microsoft.com \
    --cc=0x7f454c46@gmail.com \
    --cc=apw@canonical.com \
    --cc=bp@alien8.de \
    --cc=daniel.lezcano@linaro.org \
    --cc=huw@codeweavers.com \
    --cc=jasowang@redhat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=marc.zyngier@arm.com \
    --cc=mikelley@microsoft.com \
    --cc=paul.burton@mips.com \
    --cc=pbonzini@redhat.com \
    --cc=ralf@linux-mips.org \
    --cc=sashal@kernel.org \
    --cc=sunilmut@microsoft.com \
    /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.