All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Dexuan Cui <decui@microsoft.com>
Cc: "mark.rutland@arm.com" <mark.rutland@arm.com>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"rkrcmar@redhat.com" <rkrcmar@redhat.com>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"jasowang@redhat.com" <jasowang@redhat.com>,
	"linux@rasmusvillemoes.dk" <linux@rasmusvillemoes.dk>,
	"linux-mips@vger.kernel.org" <linux-mips@vger.kernel.org>,
	"linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>,
	"hpa@zytor.com" <hpa@zytor.com>,
	KY Srinivasan <kys@microsoft.com>,
	"shuah@kernel.org" <shuah@kernel.org>,
	"mingo@kernel.org" <mingo@kernel.org>,
	"sashal@kernel.org" <sashal@kernel.org>,
	"sfr@canb.auug.org.au" <sfr@canb.auug.org.au>,
	"vincenzo.frascino@arm.com" <vincenzo.frascino@arm.com>,
	"linux-tip-commits@vger.kernel.org"
	<linux-tip-commits@vger.kernel.org>,
	"daniel.lezcano@linaro.org" <daniel.le>
Subject: RE: [tip:timers/core] clocksource/drivers: Make Hyper-V clocksource ISA agnostic
Date: Sat, 6 Jul 2019 09:56:32 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1907060944200.3648@nanos.tec.linutronix.de> (raw)
In-Reply-To: <PU1P153MB0169E8E3898897BF3B3BE0F6BFF40@PU1P153MB0169.APCP153.PROD.OUTLOOK.COM>

On Sat, 6 Jul 2019, Dexuan Cui wrote:
> > From: linux-hyperv-owner@vger.kernel.org
> > <linux-hyperv-owner@vger.kernel.org> On Behalf Of tip-bot for Michael Kelley
> > 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...

The way this is normally done is to suspend the clockevent device on
hibernation and resume it when coming back. From a kernel POV resume is
really different than boot.

But that needs probably more surgery. I'll add the unbind() call back for
now.

Thanks,

	tglx

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

On Sat, 6 Jul 2019, Dexuan Cui wrote:
> > From: linux-hyperv-owner@vger.kernel.org
> > <linux-hyperv-owner@vger.kernel.org> On Behalf Of tip-bot for Michael Kelley
> > 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...

The way this is normally done is to suspend the clockevent device on
hibernation and resume it when coming back. From a kernel POV resume is
really different than boot.

But that needs probably more surgery. I'll add the unbind() call back for
now.

Thanks,

	tglx

_______________________________________________
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  7:56 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
2019-07-06  1:09       ` Dexuan Cui
2019-07-06  7:56       ` Thomas Gleixner [this message]
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=alpine.DEB.2.21.1907060944200.3648@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=catalin.marinas@arm.com \
    --cc=decui@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=rkrcmar@redhat.com \
    --cc=sashal@kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=shuah@kernel.org \
    --cc=vincenzo.frascino@arm.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.