public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@muc.de>
To: Mikael Pettersson <mikpe@csd.uu.se>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH][3/7] perfctr-2.7.2 for 2.6.6-mm2: x86_64
Date: Fri, 14 May 2004 17:14:43 +0200	[thread overview]
Message-ID: <m3oeorvy58.fsf@averell.firstfloor.org> (raw)
In-Reply-To: <1VLRr-38z-19@gated-at.bofh.it> (Mikael Pettersson's message of "Fri, 14 May 2004 16:30:13 +0200")

Mikael Pettersson <mikpe@csd.uu.se> writes:

Before merging all that I would definitely recommend some generic
module to allocate performance counters. IBM had a patch for this
long ago, and it is even more needed now.

> diff -ruN linux-2.6.6-mm2/drivers/perfctr/x86_64.c linux-2.6.6-mm2.perfctr-2.7.2.x86_64/drivers/perfctr/x86_64.c
> --- linux-2.6.6-mm2/drivers/perfctr/x86_64.c	1970-01-01 01:00:00.000000000 +0100
> +++ linux-2.6.6-mm2.perfctr-2.7.2.x86_64/drivers/perfctr/x86_64.c	2004-05-14 14:45:43.990230001 +0200
> @@ -0,0 +1,660 @@
> +/* $Id: x86_64.c,v 1.27 2004/05/13 23:32:50 mikpe Exp $
> + * x86_64 performance-monitoring counters driver.

[...]

Can't you share most/all of that file with i386 ? 
You'll want that definitely once you support Intel CPUs too, 
and you have to do that eventually.

Same for include/asm-x86_64/perfctr.h

+struct per_cpu_cache {	/* roughly a subset of perfctr_cpu_state */
+	union {
+		unsigned int id;	/* cache owner id */
+	} k1;
+	struct {
+		/* NOTE: these caches have physical indices, not virtual */
+		unsigned int evntsel[4];
+	} control;
+} ____cacheline_aligned;
+static struct per_cpu_cache per_cpu_cache[NR_CPUS] __cacheline_aligned;

This should use per_cpu_data

+static unsigned int new_id(void)

[...]

Why can't that wrap? Maybe it should use the functions in lib/idr.c ?

+	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.

The way you set your brackets is weird.

Why do you check for K8 C stepping? I don't see any code that
does anything special with that.

-Andi


       reply	other threads:[~2004-05-14 15:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1VLRr-38z-19@gated-at.bofh.it>
2004-05-14 15:14 ` Andi Kleen [this message]
2004-05-15  5:37   ` [PATCH][3/7] perfctr-2.7.2 for 2.6.6-mm2: x86_64 Bryan O'Sullivan
2004-05-15  9:09     ` Andi Kleen
2004-05-16  4:15       ` Bryan O'Sullivan
2004-05-16  9:58 Mikael Pettersson
  -- strict thread matches above, loose matches on Subject: below --
2004-05-15 14:44 Mikael Pettersson
2004-05-15 19:26 ` Andi Kleen
2004-05-15 14:42 Mikael Pettersson
2004-05-15 19:16 ` Andi Kleen
2004-05-15 20:40   ` John Reiser
2004-05-15 20:49     ` Andi Kleen
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=m3oeorvy58.fsf@averell.firstfloor.org \
    --to=ak@muc.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikpe@csd.uu.se \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox