All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] xen-time: decreasing the rating of the xen clocksource below that of the tsc clocksource for dom0's
@ 2015-01-07 16:16 Imre Palik
  2015-01-07 16:30 ` [Xen-devel] " Ian Campbell
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Imre Palik @ 2015-01-07 16:16 UTC (permalink / raw)
  To: xen-devel
  Cc: Konrad Rzeszutek Wilk, Boris Ostrovsky, David Vrabel,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, linux-kernel,
	Palik, Imre, Anthony Liguori

From: "Palik, Imre" <imrep@amazon.de>

In Dom0's the use of the TSC clocksource (whenever it is stable enough to
be used) instead of the Xen clocksource should not cause any issues, as
Dom0 VMs never live-migrated.  The TSC clocksource is somewhat more
efficient than the Xen paravirtualised clocksource, thus it should have
higher rating.

Cc: Anthony Liguori <aliguori@amazon.com>
Signed-off-by: Imre Palik <imrep@amazon.de>
---
 arch/x86/xen/time.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index f473d26..c768726 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -487,6 +487,10 @@ static void __init xen_time_init(void)
 	int cpu = smp_processor_id();
 	struct timespec tp;
 
+	/* As Dom0 is never moved, no penalty on using TSC there */
+	if (xen_initial_domain())
+		xen_clocksource.rating = 275;
+
 	clocksource_register_hz(&xen_clocksource, NSEC_PER_SEC);
 
 	if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL) == 0) {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [Xen-devel] [PATCH RFC] xen-time: decreasing the rating of the xen clocksource below that of the tsc clocksource for dom0's
  2015-01-07 16:16 [PATCH RFC] xen-time: decreasing the rating of the xen clocksource below that of the tsc clocksource for dom0's Imre Palik
@ 2015-01-07 16:30 ` Ian Campbell
  2015-01-07 16:57   ` Jan Beulich
                     ` (3 more replies)
  2015-01-07 16:30 ` Ian Campbell
                   ` (2 subsequent siblings)
  3 siblings, 4 replies; 12+ messages in thread
From: Ian Campbell @ 2015-01-07 16:30 UTC (permalink / raw)
  To: Imre Palik
  Cc: xen-devel, Palik, Imre, x86, linux-kernel, Ingo Molnar,
	David Vrabel, Anthony Liguori, H. Peter Anvin, Boris Ostrovsky,
	Thomas Gleixner

On Wed, 2015-01-07 at 17:16 +0100, Imre Palik wrote:
> From: "Palik, Imre" <imrep@amazon.de>
> 
> In Dom0's the use of the TSC clocksource (whenever it is stable enough to
> be used) instead of the Xen clocksource should not cause any issues, as
> Dom0 VMs never live-migrated.

Is this still true given that dom0's vcpus are migrated amongst pcpus on
the host? The tsc are not synchronised on some generations of hardware
so the result there would be the TSC appearing to do very odd things
under dom0's feet. Does Linux cope with that or does it not matter for
some other reason?

> 
> Cc: Anthony Liguori <aliguori@amazon.com>
> Signed-off-by: Imre Palik <imrep@amazon.de>
> ---
>  arch/x86/xen/time.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
> index f473d26..c768726 100644
> --- a/arch/x86/xen/time.c
> +++ b/arch/x86/xen/time.c
> @@ -487,6 +487,10 @@ static void __init xen_time_init(void)
>  	int cpu = smp_processor_id();
>  	struct timespec tp;
>  
> +	/* As Dom0 is never moved, no penalty on using TSC there */
> +	if (xen_initial_domain())
> +		xen_clocksource.rating = 275;
> +
>  	clocksource_register_hz(&xen_clocksource, NSEC_PER_SEC);
>  
>  	if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL) == 0) {



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH RFC] xen-time: decreasing the rating of the xen clocksource below that of the tsc clocksource for dom0's
  2015-01-07 16:16 [PATCH RFC] xen-time: decreasing the rating of the xen clocksource below that of the tsc clocksource for dom0's Imre Palik
  2015-01-07 16:30 ` [Xen-devel] " Ian Campbell
@ 2015-01-07 16:30 ` Ian Campbell
  2015-01-07 16:59 ` Boris Ostrovsky
  2015-01-07 16:59 ` Boris Ostrovsky
  3 siblings, 0 replies; 12+ messages in thread
From: Ian Campbell @ 2015-01-07 16:30 UTC (permalink / raw)
  To: Imre Palik
  Cc: Palik, Imre, x86, linux-kernel, Ingo Molnar, David Vrabel,
	Anthony Liguori, H. Peter Anvin, xen-devel, Boris Ostrovsky,
	Thomas Gleixner

On Wed, 2015-01-07 at 17:16 +0100, Imre Palik wrote:
> From: "Palik, Imre" <imrep@amazon.de>
> 
> In Dom0's the use of the TSC clocksource (whenever it is stable enough to
> be used) instead of the Xen clocksource should not cause any issues, as
> Dom0 VMs never live-migrated.

Is this still true given that dom0's vcpus are migrated amongst pcpus on
the host? The tsc are not synchronised on some generations of hardware
so the result there would be the TSC appearing to do very odd things
under dom0's feet. Does Linux cope with that or does it not matter for
some other reason?

> 
> Cc: Anthony Liguori <aliguori@amazon.com>
> Signed-off-by: Imre Palik <imrep@amazon.de>
> ---
>  arch/x86/xen/time.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
> index f473d26..c768726 100644
> --- a/arch/x86/xen/time.c
> +++ b/arch/x86/xen/time.c
> @@ -487,6 +487,10 @@ static void __init xen_time_init(void)
>  	int cpu = smp_processor_id();
>  	struct timespec tp;
>  
> +	/* As Dom0 is never moved, no penalty on using TSC there */
> +	if (xen_initial_domain())
> +		xen_clocksource.rating = 275;
> +
>  	clocksource_register_hz(&xen_clocksource, NSEC_PER_SEC);
>  
>  	if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL) == 0) {

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xen-devel] [PATCH RFC] xen-time: decreasing the rating of the xen clocksource below that of the tsc clocksource for dom0's
  2015-01-07 16:30 ` [Xen-devel] " Ian Campbell
@ 2015-01-07 16:57   ` Jan Beulich
  2015-01-07 16:57   ` Jan Beulich
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Jan Beulich @ 2015-01-07 16:57 UTC (permalink / raw)
  To: Ian Campbell, Imre Palik
  Cc: Anthony Liguori, Imre Palik, David Vrabel, x86, Thomas Gleixner,
	xen-devel, Boris Ostrovsky, Ingo Molnar, linux-kernel,
	H. Peter Anvin

>>> On 07.01.15 at 17:30, <Ian.Campbell@citrix.com> wrote:
> On Wed, 2015-01-07 at 17:16 +0100, Imre Palik wrote:
>> From: "Palik, Imre" <imrep@amazon.de>
>> 
>> In Dom0's the use of the TSC clocksource (whenever it is stable enough to
>> be used) instead of the Xen clocksource should not cause any issues, as
>> Dom0 VMs never live-migrated.
> 
> Is this still true given that dom0's vcpus are migrated amongst pcpus on
> the host? The tsc are not synchronised on some generations of hardware
> so the result there would be the TSC appearing to do very odd things
> under dom0's feet. Does Linux cope with that or does it not matter for
> some other reason?

Indeed. The textual qualification above ("whenever it is stable enough")
isn't being expressed in the code change at all.

Jan


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH RFC] xen-time: decreasing the rating of the xen clocksource below that of the tsc clocksource for dom0's
  2015-01-07 16:30 ` [Xen-devel] " Ian Campbell
  2015-01-07 16:57   ` Jan Beulich
@ 2015-01-07 16:57   ` Jan Beulich
  2015-01-08 15:06   ` [Xen-devel] " Imre Palik
  2015-01-08 15:06   ` Imre Palik
  3 siblings, 0 replies; 12+ messages in thread
From: Jan Beulich @ 2015-01-07 16:57 UTC (permalink / raw)
  To: Ian Campbell, Imre Palik
  Cc: Imre Palik, x86, linux-kernel, Ingo Molnar, David Vrabel,
	Anthony Liguori, H. Peter Anvin, xen-devel, Thomas Gleixner,
	Boris Ostrovsky

>>> On 07.01.15 at 17:30, <Ian.Campbell@citrix.com> wrote:
> On Wed, 2015-01-07 at 17:16 +0100, Imre Palik wrote:
>> From: "Palik, Imre" <imrep@amazon.de>
>> 
>> In Dom0's the use of the TSC clocksource (whenever it is stable enough to
>> be used) instead of the Xen clocksource should not cause any issues, as
>> Dom0 VMs never live-migrated.
> 
> Is this still true given that dom0's vcpus are migrated amongst pcpus on
> the host? The tsc are not synchronised on some generations of hardware
> so the result there would be the TSC appearing to do very odd things
> under dom0's feet. Does Linux cope with that or does it not matter for
> some other reason?

Indeed. The textual qualification above ("whenever it is stable enough")
isn't being expressed in the code change at all.

Jan

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH RFC] xen-time: decreasing the rating of the xen clocksource below that of the tsc clocksource for dom0's
  2015-01-07 16:16 [PATCH RFC] xen-time: decreasing the rating of the xen clocksource below that of the tsc clocksource for dom0's Imre Palik
  2015-01-07 16:30 ` [Xen-devel] " Ian Campbell
  2015-01-07 16:30 ` Ian Campbell
@ 2015-01-07 16:59 ` Boris Ostrovsky
  2015-01-07 16:59 ` Boris Ostrovsky
  3 siblings, 0 replies; 12+ messages in thread
From: Boris Ostrovsky @ 2015-01-07 16:59 UTC (permalink / raw)
  To: Imre Palik, xen-devel
  Cc: Konrad Rzeszutek Wilk, David Vrabel, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, x86, linux-kernel, Palik, Imre,
	Anthony Liguori

On 01/07/2015 11:16 AM, Imre Palik wrote:
> From: "Palik, Imre" <imrep@amazon.de>
>
> In Dom0's the use of the TSC clocksource (whenever it is stable enough to
> be used) instead of the Xen clocksource should not cause any issues, as
> Dom0 VMs never live-migrated.  The TSC clocksource is somewhat more
> efficient than the Xen paravirtualised clocksource, thus it should have
> higher rating.
>
> Cc: Anthony Liguori <aliguori@amazon.com>
> Signed-off-by: Imre Palik <imrep@amazon.de>
> ---
>   arch/x86/xen/time.c |    4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
> index f473d26..c768726 100644
> --- a/arch/x86/xen/time.c
> +++ b/arch/x86/xen/time.c
> @@ -487,6 +487,10 @@ static void __init xen_time_init(void)
>   	int cpu = smp_processor_id();
>   	struct timespec tp;
>   
> +	/* As Dom0 is never moved, no penalty on using TSC there */
> +	if (xen_initial_domain())
> +		xen_clocksource.rating = 275;


Should this only be limited to dom0? Can we do this for guests running 
with TSC_MODE_NEVER_EMULATE as well?

We also have disable_migrate flag for guests (but it doesn't appear to 
be accessible to a guest kernel).

-boris


> +
>   	clocksource_register_hz(&xen_clocksource, NSEC_PER_SEC);
>   
>   	if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL) == 0) {


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH RFC] xen-time: decreasing the rating of the xen clocksource below that of the tsc clocksource for dom0's
  2015-01-07 16:16 [PATCH RFC] xen-time: decreasing the rating of the xen clocksource below that of the tsc clocksource for dom0's Imre Palik
                   ` (2 preceding siblings ...)
  2015-01-07 16:59 ` Boris Ostrovsky
@ 2015-01-07 16:59 ` Boris Ostrovsky
  3 siblings, 0 replies; 12+ messages in thread
From: Boris Ostrovsky @ 2015-01-07 16:59 UTC (permalink / raw)
  To: Imre Palik, xen-devel
  Cc: Palik, Imre, x86, linux-kernel, Ingo Molnar, David Vrabel,
	Anthony Liguori, H. Peter Anvin, Thomas Gleixner

On 01/07/2015 11:16 AM, Imre Palik wrote:
> From: "Palik, Imre" <imrep@amazon.de>
>
> In Dom0's the use of the TSC clocksource (whenever it is stable enough to
> be used) instead of the Xen clocksource should not cause any issues, as
> Dom0 VMs never live-migrated.  The TSC clocksource is somewhat more
> efficient than the Xen paravirtualised clocksource, thus it should have
> higher rating.
>
> Cc: Anthony Liguori <aliguori@amazon.com>
> Signed-off-by: Imre Palik <imrep@amazon.de>
> ---
>   arch/x86/xen/time.c |    4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
> index f473d26..c768726 100644
> --- a/arch/x86/xen/time.c
> +++ b/arch/x86/xen/time.c
> @@ -487,6 +487,10 @@ static void __init xen_time_init(void)
>   	int cpu = smp_processor_id();
>   	struct timespec tp;
>   
> +	/* As Dom0 is never moved, no penalty on using TSC there */
> +	if (xen_initial_domain())
> +		xen_clocksource.rating = 275;


Should this only be limited to dom0? Can we do this for guests running 
with TSC_MODE_NEVER_EMULATE as well?

We also have disable_migrate flag for guests (but it doesn't appear to 
be accessible to a guest kernel).

-boris


> +
>   	clocksource_register_hz(&xen_clocksource, NSEC_PER_SEC);
>   
>   	if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL) == 0) {

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xen-devel] [PATCH RFC] xen-time: decreasing the rating of the xen clocksource below that of the tsc clocksource for dom0's
  2015-01-07 16:30 ` [Xen-devel] " Ian Campbell
  2015-01-07 16:57   ` Jan Beulich
  2015-01-07 16:57   ` Jan Beulich
@ 2015-01-08 15:06   ` Imre Palik
  2015-01-12 11:30     ` David Vrabel
  2015-01-12 11:30     ` [Xen-devel] " David Vrabel
  2015-01-08 15:06   ` Imre Palik
  3 siblings, 2 replies; 12+ messages in thread
From: Imre Palik @ 2015-01-08 15:06 UTC (permalink / raw)
  To: Ian Campbell
  Cc: xen-devel, Palik, Imre, x86, linux-kernel, Ingo Molnar,
	David Vrabel, Anthony Liguori, H. Peter Anvin, Boris Ostrovsky,
	Thomas Gleixner

On 01/07/15 17:30, Ian Campbell wrote:
> On Wed, 2015-01-07 at 17:16 +0100, Imre Palik wrote:
>> From: "Palik, Imre" <imrep@amazon.de>
>>
>> In Dom0's the use of the TSC clocksource (whenever it is stable enough to
>> be used) instead of the Xen clocksource should not cause any issues, as
>> Dom0 VMs never live-migrated.
> 
> Is this still true given that dom0's vcpus are migrated amongst pcpus on
> the host? The tsc are not synchronised on some generations of hardware
> so the result there would be the TSC appearing to do very odd things
> under dom0's feet. Does Linux cope with that or does it not matter for
> some other reason?

First of all, if the initial pcpus are not synchronised, linux won't consider
TSC as a viable clocksource.

If the initial pcpus are synchronised, but then the dom0 vcpus are migrated to
unsynchronised pcpus, then hopefully the tsc watchdog catches the issue, and
the kernel falls back to the xen clocksource.  The issue here is that the
watchdog can only detect clock skews bigger than 0.0625s/0.5s.  Hopefully this
is enough to avoid the weirdest things.

Also, some parts of the kernel (e.g., scheduling) will always use the paravirt
clock.  No matter what priorities are set.

So it should be safe for some definition of safe.
But I was unable to test it on a hardware platform that would hit the problematic
case described above.

> 
>>
>> Cc: Anthony Liguori <aliguori@amazon.com>
>> Signed-off-by: Imre Palik <imrep@amazon.de>
>> ---
>>  arch/x86/xen/time.c |    4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
>> index f473d26..c768726 100644
>> --- a/arch/x86/xen/time.c
>> +++ b/arch/x86/xen/time.c
>> @@ -487,6 +487,10 @@ static void __init xen_time_init(void)
>>  	int cpu = smp_processor_id();
>>  	struct timespec tp;
>>  
>> +	/* As Dom0 is never moved, no penalty on using TSC there */
>> +	if (xen_initial_domain())
>> +		xen_clocksource.rating = 275;
>> +
>>  	clocksource_register_hz(&xen_clocksource, NSEC_PER_SEC);
>>  
>>  	if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL) == 0) {
> 
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH RFC] xen-time: decreasing the rating of the xen clocksource below that of the tsc clocksource for dom0's
  2015-01-07 16:30 ` [Xen-devel] " Ian Campbell
                     ` (2 preceding siblings ...)
  2015-01-08 15:06   ` [Xen-devel] " Imre Palik
@ 2015-01-08 15:06   ` Imre Palik
  3 siblings, 0 replies; 12+ messages in thread
From: Imre Palik @ 2015-01-08 15:06 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Palik, Imre, x86, linux-kernel, Ingo Molnar, David Vrabel,
	Anthony Liguori, H. Peter Anvin, xen-devel, Boris Ostrovsky,
	Thomas Gleixner

On 01/07/15 17:30, Ian Campbell wrote:
> On Wed, 2015-01-07 at 17:16 +0100, Imre Palik wrote:
>> From: "Palik, Imre" <imrep@amazon.de>
>>
>> In Dom0's the use of the TSC clocksource (whenever it is stable enough to
>> be used) instead of the Xen clocksource should not cause any issues, as
>> Dom0 VMs never live-migrated.
> 
> Is this still true given that dom0's vcpus are migrated amongst pcpus on
> the host? The tsc are not synchronised on some generations of hardware
> so the result there would be the TSC appearing to do very odd things
> under dom0's feet. Does Linux cope with that or does it not matter for
> some other reason?

First of all, if the initial pcpus are not synchronised, linux won't consider
TSC as a viable clocksource.

If the initial pcpus are synchronised, but then the dom0 vcpus are migrated to
unsynchronised pcpus, then hopefully the tsc watchdog catches the issue, and
the kernel falls back to the xen clocksource.  The issue here is that the
watchdog can only detect clock skews bigger than 0.0625s/0.5s.  Hopefully this
is enough to avoid the weirdest things.

Also, some parts of the kernel (e.g., scheduling) will always use the paravirt
clock.  No matter what priorities are set.

So it should be safe for some definition of safe.
But I was unable to test it on a hardware platform that would hit the problematic
case described above.

> 
>>
>> Cc: Anthony Liguori <aliguori@amazon.com>
>> Signed-off-by: Imre Palik <imrep@amazon.de>
>> ---
>>  arch/x86/xen/time.c |    4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
>> index f473d26..c768726 100644
>> --- a/arch/x86/xen/time.c
>> +++ b/arch/x86/xen/time.c
>> @@ -487,6 +487,10 @@ static void __init xen_time_init(void)
>>  	int cpu = smp_processor_id();
>>  	struct timespec tp;
>>  
>> +	/* As Dom0 is never moved, no penalty on using TSC there */
>> +	if (xen_initial_domain())
>> +		xen_clocksource.rating = 275;
>> +
>>  	clocksource_register_hz(&xen_clocksource, NSEC_PER_SEC);
>>  
>>  	if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL) == 0) {
> 
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xen-devel] [PATCH RFC] xen-time: decreasing the rating of the xen clocksource below that of the tsc clocksource for dom0's
  2015-01-08 15:06   ` [Xen-devel] " Imre Palik
  2015-01-12 11:30     ` David Vrabel
@ 2015-01-12 11:30     ` David Vrabel
  1 sibling, 0 replies; 12+ messages in thread
From: David Vrabel @ 2015-01-12 11:30 UTC (permalink / raw)
  To: Imre Palik, Ian Campbell
  Cc: Palik, Imre, x86, linux-kernel, Ingo Molnar, David Vrabel,
	Anthony Liguori, H. Peter Anvin, xen-devel, Boris Ostrovsky,
	Thomas Gleixner

On 08/01/15 15:06, Imre Palik wrote:
> On 01/07/15 17:30, Ian Campbell wrote:
>> On Wed, 2015-01-07 at 17:16 +0100, Imre Palik wrote:
>>> From: "Palik, Imre" <imrep@amazon.de>
>>>
>>> In Dom0's the use of the TSC clocksource (whenever it is stable enough to
>>> be used) instead of the Xen clocksource should not cause any issues, as
>>> Dom0 VMs never live-migrated.
>>
>> Is this still true given that dom0's vcpus are migrated amongst pcpus on
>> the host? The tsc are not synchronised on some generations of hardware
>> so the result there would be the TSC appearing to do very odd things
>> under dom0's feet. Does Linux cope with that or does it not matter for
>> some other reason?
> 
> First of all, if the initial pcpus are not synchronised, linux won't consider
> TSC as a viable clocksource.
> 
> If the initial pcpus are synchronised, but then the dom0 vcpus are migrated to
> unsynchronised pcpus, then hopefully the tsc watchdog catches the issue, and
> the kernel falls back to the xen clocksource.  The issue here is that the
> watchdog can only detect clock skews bigger than 0.0625s/0.5s.  Hopefully this
> is enough to avoid the weirdest things.

I don't think any such hardware exists.  Either TSC is synchronized
across all CPUs or none.

> Also, some parts of the kernel (e.g., scheduling) will always use the paravirt
> clock.  No matter what priorities are set.
> 
> So it should be safe for some definition of safe.
> But I was unable to test it on a hardware platform that would hit the problematic
> case described above.

Ok.  Can you list the various time sources and their ratings in the
commit message for clarity.  i.e, to justify 275 (below TSC = 300. above
hpet = 250).

David

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH RFC] xen-time: decreasing the rating of the xen clocksource below that of the tsc clocksource for dom0's
  2015-01-08 15:06   ` [Xen-devel] " Imre Palik
@ 2015-01-12 11:30     ` David Vrabel
  2015-01-12 11:30     ` [Xen-devel] " David Vrabel
  1 sibling, 0 replies; 12+ messages in thread
From: David Vrabel @ 2015-01-12 11:30 UTC (permalink / raw)
  To: Imre Palik, Ian Campbell
  Cc: Palik, Imre, x86, linux-kernel, Ingo Molnar, David Vrabel,
	Anthony Liguori, H. Peter Anvin, xen-devel, Boris Ostrovsky,
	Thomas Gleixner

On 08/01/15 15:06, Imre Palik wrote:
> On 01/07/15 17:30, Ian Campbell wrote:
>> On Wed, 2015-01-07 at 17:16 +0100, Imre Palik wrote:
>>> From: "Palik, Imre" <imrep@amazon.de>
>>>
>>> In Dom0's the use of the TSC clocksource (whenever it is stable enough to
>>> be used) instead of the Xen clocksource should not cause any issues, as
>>> Dom0 VMs never live-migrated.
>>
>> Is this still true given that dom0's vcpus are migrated amongst pcpus on
>> the host? The tsc are not synchronised on some generations of hardware
>> so the result there would be the TSC appearing to do very odd things
>> under dom0's feet. Does Linux cope with that or does it not matter for
>> some other reason?
> 
> First of all, if the initial pcpus are not synchronised, linux won't consider
> TSC as a viable clocksource.
> 
> If the initial pcpus are synchronised, but then the dom0 vcpus are migrated to
> unsynchronised pcpus, then hopefully the tsc watchdog catches the issue, and
> the kernel falls back to the xen clocksource.  The issue here is that the
> watchdog can only detect clock skews bigger than 0.0625s/0.5s.  Hopefully this
> is enough to avoid the weirdest things.

I don't think any such hardware exists.  Either TSC is synchronized
across all CPUs or none.

> Also, some parts of the kernel (e.g., scheduling) will always use the paravirt
> clock.  No matter what priorities are set.
> 
> So it should be safe for some definition of safe.
> But I was unable to test it on a hardware platform that would hit the problematic
> case described above.

Ok.  Can you list the various time sources and their ratings in the
commit message for clarity.  i.e, to justify 275 (below TSC = 300. above
hpet = 250).

David

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH RFC] xen-time: decreasing the rating of the xen clocksource below that of the tsc clocksource for dom0's
@ 2015-01-07 16:16 Imre Palik
  0 siblings, 0 replies; 12+ messages in thread
From: Imre Palik @ 2015-01-07 16:16 UTC (permalink / raw)
  To: xen-devel
  Cc: Palik, Imre, x86, linux-kernel, Ingo Molnar, David Vrabel,
	Anthony Liguori, H. Peter Anvin, Boris Ostrovsky,
	Thomas Gleixner

From: "Palik, Imre" <imrep@amazon.de>

In Dom0's the use of the TSC clocksource (whenever it is stable enough to
be used) instead of the Xen clocksource should not cause any issues, as
Dom0 VMs never live-migrated.  The TSC clocksource is somewhat more
efficient than the Xen paravirtualised clocksource, thus it should have
higher rating.

Cc: Anthony Liguori <aliguori@amazon.com>
Signed-off-by: Imre Palik <imrep@amazon.de>
---
 arch/x86/xen/time.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index f473d26..c768726 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -487,6 +487,10 @@ static void __init xen_time_init(void)
 	int cpu = smp_processor_id();
 	struct timespec tp;
 
+	/* As Dom0 is never moved, no penalty on using TSC there */
+	if (xen_initial_domain())
+		xen_clocksource.rating = 275;
+
 	clocksource_register_hz(&xen_clocksource, NSEC_PER_SEC);
 
 	if (HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL) == 0) {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-01-12 11:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-07 16:16 [PATCH RFC] xen-time: decreasing the rating of the xen clocksource below that of the tsc clocksource for dom0's Imre Palik
2015-01-07 16:30 ` [Xen-devel] " Ian Campbell
2015-01-07 16:57   ` Jan Beulich
2015-01-07 16:57   ` Jan Beulich
2015-01-08 15:06   ` [Xen-devel] " Imre Palik
2015-01-12 11:30     ` David Vrabel
2015-01-12 11:30     ` [Xen-devel] " David Vrabel
2015-01-08 15:06   ` Imre Palik
2015-01-07 16:30 ` Ian Campbell
2015-01-07 16:59 ` Boris Ostrovsky
2015-01-07 16:59 ` Boris Ostrovsky
2015-01-07 16:16 Imre Palik

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.