All of lore.kernel.org
 help / color / mirror / Atom feed
From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] Add physical count arch timer support for clocksource in ARMv7.
Date: Thu, 12 Sep 2013 17:39:31 +0100	[thread overview]
Message-ID: <5231EE43.5090900@arm.com> (raw)
In-Reply-To: <CAK3cCBwu4somtfc9J1ZDVcC-iYD1qDJwSWzWeOomTqY9tQA2kg@mail.gmail.com>

On 12/09/13 17:07, cinifr wrote:
>> This cannot be a compile-time option as above in a multiplatform build.
>> Other paltforms (e.g. KVM guests) *must* use the virtual counters to get
>> any semblance of a consistent view of time.
> Yes I accept compile-time option is not perfect  in my pre email,
> But,Why Ohter paltforms *must* use the virtual counters? I think KVM
> should not limit how to use arch timer in its guest OS. Of cause, if
> KVM guest use vct can be more efficiency then that use pct. but KVM
> should and must support guest OS to access pct.

The virtual counter is there for a good reason: it allows a virtual
machine to:
- see its time starting at zero
- be migrated to another host without seeing time shifting one way or
another.

So using the physical counter in a VM is a recipe for disaster if you're
doing any kind of time tracking. The counter being used for
sched_clock(), we cannot afford to see it being shifted one way or another.

If you have issues with the use of the virtual counter, I suggest you
fix your firmware to have a consistent CNTVOFF across CPUs. And/or even
better, boot your kernel in HYP mode, as it will take care of setting
CNTVOFF to zero.

Cheers,

	M.
-- 
Jazz is not dead. It just smells funny...

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <marc.zyngier@arm.com>
To: cinifr <cinifr@gmail.com>
Cc: Mark Rutland <Mark.Rutland@arm.com>,
	"coosty@163.com" <coosty@163.com>,
	"maxime.ripard@free-electrons.com"
	<maxime.ripard@free-electrons.com>,
	"daniel.lezcano@linaro.org" <daniel.lezcano@linaro.org>,
	"linux@arm.linux.org.uk" <linux@arm.linux.org.uk>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"pawel.moll@arm.co" <pawel.moll@arm.co>,
	"rob.herring@calxeda.com" <rob.herring@calxeda.com>,
	"linux-sunxi@googlegroups.com" <linux-sunxi@googlegroups.com>
Subject: Re: [PATCH 3/4] Add physical count arch timer support for clocksource in ARMv7.
Date: Thu, 12 Sep 2013 17:39:31 +0100	[thread overview]
Message-ID: <5231EE43.5090900@arm.com> (raw)
In-Reply-To: <CAK3cCBwu4somtfc9J1ZDVcC-iYD1qDJwSWzWeOomTqY9tQA2kg@mail.gmail.com>

On 12/09/13 17:07, cinifr wrote:
>> This cannot be a compile-time option as above in a multiplatform build.
>> Other paltforms (e.g. KVM guests) *must* use the virtual counters to get
>> any semblance of a consistent view of time.
> Yes I accept compile-time option is not perfect  in my pre email,
> But,Why Ohter paltforms *must* use the virtual counters? I think KVM
> should not limit how to use arch timer in its guest OS. Of cause, if
> KVM guest use vct can be more efficiency then that use pct. but KVM
> should and must support guest OS to access pct.

The virtual counter is there for a good reason: it allows a virtual
machine to:
- see its time starting at zero
- be migrated to another host without seeing time shifting one way or
another.

So using the physical counter in a VM is a recipe for disaster if you're
doing any kind of time tracking. The counter being used for
sched_clock(), we cannot afford to see it being shifted one way or another.

If you have issues with the use of the virtual counter, I suggest you
fix your firmware to have a consistent CNTVOFF across CPUs. And/or even
better, boot your kernel in HYP mode, as it will take care of setting
CNTVOFF to zero.

Cheers,

	M.
-- 
Jazz is not dead. It just smells funny...


  reply	other threads:[~2013-09-12 16:39 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-12  6:51 [PATCH 0/4] Add smp support for Allwinner A20 and phy arch count timer Fan Rong
2013-09-12  6:51 ` Fan Rong
2013-09-12  6:51 ` [PATCH 1/4] Add smp support for Allwinner A20(sunxi 7i) Fan Rong
2013-09-12  6:51   ` Fan Rong
2013-09-12 14:26   ` Mark Rutland
2013-09-12 14:26     ` Mark Rutland
2013-09-12 15:53     ` cinifr
2013-09-12 15:53       ` cinifr
2013-09-12 14:40   ` Russell King - ARM Linux
2013-09-12 14:40     ` Russell King - ARM Linux
2013-09-12  6:51 ` [PATCH 2/4] Add cpuconfig nodes in dts for smp configure Fan Rong
2013-09-12  6:51   ` Fan Rong
2013-09-14 11:50   ` Maxime Ripard
2013-09-14 11:50     ` Maxime Ripard
2013-09-12  6:51 ` [PATCH 3/4] Add physical count arch timer support for clocksource in ARMv7 Fan Rong
2013-09-12  6:51   ` Fan Rong
2013-09-12 11:24   ` Mark Rutland
2013-09-12 11:24     ` Mark Rutland
2013-09-12 14:33     ` Russell King - ARM Linux
2013-09-12 14:33       ` Russell King - ARM Linux
2013-09-12 16:09       ` cinifr
2013-09-12 16:09         ` cinifr
2013-09-12 15:39     ` [linux-sunxi] " Ian Campbell
2013-09-12 15:39       ` Ian Campbell
2013-09-12 16:07     ` cinifr
2013-09-12 16:07       ` cinifr
2013-09-12 16:39       ` Marc Zyngier [this message]
2013-09-12 16:39         ` Marc Zyngier
2013-09-13  8:49         ` cinifr
2013-09-13  8:49           ` cinifr
2013-09-13  9:30           ` Marc Zyngier
2013-09-13  9:30             ` Marc Zyngier
2013-09-13 13:09             ` cinifr
2013-09-13 13:09               ` cinifr
2013-09-13 13:40               ` Marc Zyngier
2013-09-13 13:40                 ` Marc Zyngier
2013-09-13 14:55                 ` cinifr
2013-09-13 14:55                   ` cinifr
2013-09-18  9:03                 ` cinifr
2013-09-18  9:03                   ` cinifr
2013-09-14 12:05             ` maxime.ripard at free-electrons.com
2013-09-14 12:05               ` maxime.ripard
2013-09-16  8:16               ` Marc Zyngier
2013-09-16  8:16                 ` Marc Zyngier
2013-09-12  6:51 ` [PATCH 4/4] Add arch count timer node in dts for Allwinner A20(sunxi 7i) Fan Rong
2013-09-12  6:51   ` Fan Rong
2013-09-12 14:57   ` Mark Rutland
2013-09-12 14:57     ` Mark Rutland
2013-09-12 15:44     ` [linux-sunxi] " Ian Campbell
2013-09-12 15:44       ` Ian Campbell
2013-09-12 16:23       ` cinifr
2013-09-12 16:23         ` cinifr
2013-09-12 19:53         ` Henrik Nordström
2013-09-12 19:53           ` Henrik Nordström
2013-09-12 14:39 ` [PATCH 0/4] Add smp support for Allwinner A20 and phy arch count timer Mark Rutland
2013-09-12 14:39   ` Mark Rutland
2013-09-12 15:46   ` cinifr
2013-09-12 15:46     ` cinifr
2013-09-13 11:20     ` Mark Rutland
2013-09-13 11:20       ` Mark Rutland
2013-09-13 13:23       ` cinifr
2013-09-13 13:23         ` cinifr

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=5231EE43.5090900@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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.