2005-09-26 19:47:01

by john stultz

[permalink] [raw]
Subject: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs (resend)

Andrew,
This patch should resolve the issue seen in bugme bug #5105, where it
is assumed that dualcore x86_64 systems have synced TSCs. This is not
the case, and alternate timesources should be used instead.

For more details, see:
http://bugzilla.kernel.org/show_bug.cgi?id=5105

Andi's earlier concerns that the TSCs should be synced on dualcore
systems have been resolved by confirmation from AMD folks that they can
be unsynced.

Please consider for inclusion in your tree.

thanks
-john

diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -959,9 +959,6 @@ static __init int unsynchronized_tsc(voi
are handled in the OEM check above. */
if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
return 0;
- /* All in a single socket - should be synchronized */
- if (cpus_weight(cpu_core_map[0]) == num_online_cpus())
- return 0;
#endif
/* Assume multi socket systems are not synchronized */
return num_online_cpus() > 1;



2005-09-26 20:33:29

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs (resend)

john stultz <[email protected]> wrote:
>
> This patch should resolve the issue seen in bugme bug #5105, where it
> is assumed that dualcore x86_64 systems have synced TSCs. This is not
> the case, and alternate timesources should be used instead.
>
> For more details, see:
> http://bugzilla.kernel.org/show_bug.cgi?id=5105
>
> Andi's earlier concerns that the TSCs should be synced on dualcore
> systems have been resolved by confirmation from AMD folks that they can
> be unsynced.

OK, thanks - it's good to knock that one over.

Andi, does this look OK for 2.6.14?

2005-09-26 22:07:28

by Stefan Smietanowski

[permalink] [raw]
Subject: Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs (resend)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi John.

> This patch should resolve the issue seen in bugme bug #5105, where it
> is assumed that dualcore x86_64 systems have synced TSCs. This is not
> the case, and alternate timesources should be used instead.
>
> For more details, see:
> http://bugzilla.kernel.org/show_bug.cgi?id=5105
>
> Andi's earlier concerns that the TSCs should be synced on dualcore
> systems have been resolved by confirmation from AMD folks that they can
> be unsynced.
>
> Please consider for inclusion in your tree.

Wouldn't it be a good idea to change the comment following
the code you removed as well?

Why have a comment saying "multi socket systems" if there is no
distinction anymore?

>
> diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
> --- a/arch/x86_64/kernel/time.c
> +++ b/arch/x86_64/kernel/time.c
> @@ -959,9 +959,6 @@ static __init int unsynchronized_tsc(voi
> are handled in the OEM check above. */
> if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
> return 0;
> - /* All in a single socket - should be synchronized */
> - if (cpus_weight(cpu_core_map[0]) == num_online_cpus())
> - return 0;
> #endif
> /* Assume multi socket systems are not synchronized */
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> return num_online_cpus() > 1;

// Stefan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)

iD8DBQFDOHMbBrn2kJu9P78RAnSlAKCE2NSTYbi553i0OGadmRfuMdD3hgCgwedE
blCF8zdC+fuTOgIuBy1Af60=
=T4tA
-----END PGP SIGNATURE-----

2005-09-26 22:28:31

by john stultz

[permalink] [raw]
Subject: Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs (resend)

On Tue, 2005-09-27 at 00:15 +0200, Stefan Smietanowski wrote:

> Wouldn't it be a good idea to change the comment following
> the code you removed as well?
>
> Why have a comment saying "multi socket systems" if there is no
> distinction anymore?
>
> >
> > diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
> > --- a/arch/x86_64/kernel/time.c
> > +++ b/arch/x86_64/kernel/time.c
> > @@ -959,9 +959,6 @@ static __init int unsynchronized_tsc(voi
> > are handled in the OEM check above. */
> > if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
> > return 0;
> > - /* All in a single socket - should be synchronized */
> > - if (cpus_weight(cpu_core_map[0]) == num_online_cpus())
> > - return 0;
> > #endif
> > /* Assume multi socket systems are not synchronized */
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > return num_online_cpus() > 1;

Yea, good point, that should probably be "SMP systems".

Do you want to send the patch to Andrew? :)

thanks
-john

2005-09-26 23:23:00

by Stefan Smietanowski

[permalink] [raw]
Subject: Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs (resend)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

john stultz wrote:
> On Tue, 2005-09-27 at 00:15 +0200, Stefan Smietanowski wrote:
>
>
>>Wouldn't it be a good idea to change the comment following
>>the code you removed as well?
>>
>>Why have a comment saying "multi socket systems" if there is no
>>distinction anymore?
>>

> Yea, good point, that should probably be "SMP systems".
>
> Do you want to send the patch to Andrew? :)

Sure. Something like this should suffice.

Signed-off-by: Stefan Smietanowski <[email protected]>

diff --git old/arch/x86_64/kernel/time.c new/arch/x86_64/kernel/time.c
- --- old/arch/x86_64/kernel/time.c
+++ new/arch/x86_64/kernel/time.c
@@ -959,11 +959,8 @@ static __init int unsynchronized_tsc(voi
are handled in the OEM check above. */
if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
return 0;
- - /* All in a single socket - should be synchronized */
- - if (cpus_weight(cpu_core_map[0]) == num_online_cpus())
- - return 0;
#endif
- - /* Assume multi socket systems are not synchronized */
+ /* Assume SMP systems are not synchronized */
return num_online_cpus() > 1;
}

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)

iD8DBQFDOITIBrn2kJu9P78RAopLAJ0anLvWElwgW+vmxJ7jPWehWF0F3gCfUXv8
2ORxa8Jfj9o4LE3P0A+dSTE=
=AGkR
-----END PGP SIGNATURE-----

2005-09-27 08:34:47

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] x86-64: Fix bad assumption that dualcore cpus have synced TSCs (resend)

On Monday 26 September 2005 22:33, Andrew Morton wrote:
> john stultz <[email protected]> wrote:
> > This patch should resolve the issue seen in bugme bug #5105, where it
> > is assumed that dualcore x86_64 systems have synced TSCs. This is not
> > the case, and alternate timesources should be used instead.
> >
> > For more details, see:
> > http://bugzilla.kernel.org/show_bug.cgi?id=5105
> >
> > Andi's earlier concerns that the TSCs should be synced on dualcore
> > systems have been resolved by confirmation from AMD folks that they can
> > be unsynced.
>
> OK, thanks - it's good to knock that one over.
>
> Andi, does this look OK for 2.6.14?

Yes.

-Andi