All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: Vojtech Pavlik <vojtech@suse.cz>
Cc: Andi Kleen <andi@firstfloor.org>,
	Joerg Roedel <joerg.roedel@amd.com>,
	tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
	linux-kernel@vger.kernel.org, benjamin.serebrin@amd.com
Subject: Re: Whats the purpose of get_cycles_sync()
Date: Tue, 30 Oct 2007 23:42:34 +0100	[thread overview]
Message-ID: <20071030224234.GA19737@one.firstfloor.org> (raw)
In-Reply-To: <20071030220209.GA21142@suse.cz>

On Tue, Oct 30, 2007 at 11:02:09PM +0100, Vojtech Pavlik wrote:
> > He can give details on the test.
> > 
> > I suspect the reason was because the CPU reordered the RDTSCs so that
> > a later RDTSC could return a value before an earlier one. This can
> > happen because gettimeofday() is so fast that a tight loop calling it can
> > fit more than one iteration into the CPU's reordering window.
> 
> The K8's still guarantee that subsequent RDTSCs return increasing
> values, even if the processor reorders them.

Ah didn't realize this

> 
> What could have been happening then was that the RDTSC instruction might
> have been reordered by the CPU out of the seqlock, causing trouble in
> the calculation.

Ok anyways it fixed that problem.  So it cannot be taken out.
> 
> Anyway, adding the CPUID didn't solve all the problems we've seen back
> then, and so far none of the approaches for using TSC without acquiring
> a spinlock on multi-socket AMD boxes worked 100% correctly.

The code is not used on multi-core anyways currently (without Jiri's
patch). It should just work correctly on single core.

-Andi

  reply	other threads:[~2007-10-30 22:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-30 17:44 Whats the purpose of get_cycles_sync() Joerg Roedel
2007-10-30 20:21 ` Andi Kleen
2007-10-30 22:02   ` Vojtech Pavlik
2007-10-30 22:42     ` Andi Kleen [this message]
2007-10-31 10:23     ` Joerg Roedel
2007-10-31 10:18   ` Joerg Roedel

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=20071030224234.GA19737@one.firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=benjamin.serebrin@amd.com \
    --cc=hpa@zytor.com \
    --cc=joerg.roedel@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=vojtech@suse.cz \
    /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.