LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: John Reiser <jreiser@BitWagon.com>
To: Andi Kleen <ak@muc.de>
Cc: Mikael Pettersson <mikpe@csd.uu.se>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][3/7] perfctr-2.7.2 for 2.6.6-mm2: x86_64
Date: Sat, 15 May 2004 13:40:54 -0700	[thread overview]
Message-ID: <40A68056.6090606@BitWagon.com> (raw)
In-Reply-To: <20040515191643.GA5748@colin2.muc.de>

>>>+	if( perfctr_cstatus_has_tsc(cstatus) )
>>>+		rdtscl(ctrs->tsc);
>>>+	nrctrs = perfctr_cstatus_nractrs(cstatus);
>>>+	for(i = 0; i < nrctrs; ++i) {
>>>+		unsigned int pmc = state->pmc[i].map;
>>>+		rdpmc_low(pmc, ctrs->pmc[i]);
>>>+	}
>>>
>>>K8 has speculative rdtsc. Most likely you want a sync_core() somewhere
>>>in there.
>>
>>What's the cost for sync_core()? The counts don't have to be
>>perfect.
> 
> 
> It's a CPUID to force a pipeline flush. Let's say 20-30 cycles.

I want the kernel to avoid every delay that can be avoided.  Do not force
a pipeline flush for speculative rdtsc.  Besides those 20-30 cycles
there is register eviction for %eax, %ecx, %edx and save+restore for %ebx
(CPUID scribbles on 4 registers), plus possible branch misprediction if control
is not fall-through sequential.  Also, that kernel code probably is already
several dozen cycles after the most recent user-mode instruction
(the only thing that the user can control), so waiting for quiescent
pipeline is just the kernel lollygagging on itself.  Get to work!

-- 
John Reiser, jreiser@BitWagon.com


  reply	other threads:[~2004-05-15 20:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-15 14:42 Mikael Pettersson
2004-05-15 19:16 ` Andi Kleen
2004-05-15 20:40   ` John Reiser [this message]
2004-05-15 20:49     ` Andi Kleen
  -- strict thread matches above, loose matches on Subject: below --
2004-05-16  9:58 Mikael Pettersson
2004-05-15 14:44 Mikael Pettersson
2004-05-15 19:26 ` Andi Kleen
     [not found] <1VLRr-38z-19@gated-at.bofh.it>
2004-05-14 15:14 ` Andi Kleen
2004-05-15  5:37   ` Bryan O'Sullivan
2004-05-15  9:09     ` Andi Kleen
2004-05-16  4:15       ` Bryan O'Sullivan
2004-05-14 14:11 Mikael Pettersson

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=40A68056.6090606@BitWagon.com \
    --to=jreiser@bitwagon.com \
    --cc=ak@muc.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikpe@csd.uu.se \
    --subject='Re: [PATCH][3/7] perfctr-2.7.2 for 2.6.6-mm2: x86_64' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).