[PATCH] Fix performance monitor on machines with logical PVR

Benjamin Herrenschmidt benh at kernel.crashing.org
Thu Oct 4 14:58:15 EST 2007


> This change works around this problem by taking out the PMU
> information from the cputable entries for the logical PVR values, and
> changing identify_cpu so that the second call to it won't overwrite
> the PMU information that was established by the first call (the one
> with the real PVR), but does update the other fields.

The description could be more precise. Something along the lines of: The
second call wlil not override the PMU information if the entry for the
logical PVR has a num_pmcs value of 0.

That way, we can -still- override them if future processor also
implement PMC backwater^H^H^Hrd compat mode via a different virtual PVR.

(This is what the code does, it's juse the description that is unclear).

Appart from that and pending testing...

Acked-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>

Oh, and another note: I dislike that:

+                       if (t->num_pmcs && !s->num_pmcs) {
+                               t->cpu_name = s->cpu_name;
+                               t->cpu_features = s->cpu_features;
+                               t->cpu_user_features =
s->cpu_user_features;
+                               t->icache_bsize = s->icache_bsize;
+                               t->dcache_bsize = s->dcache_bsize;
+                               t->cpu_setup = s->cpu_setup;
+                               t->cpu_restore = s->cpu_restore;
+                               t->platform = s->platform;
+                       } else
+                               *t = *s;

That means that we'll easily forget to update this bit of code when
we add things to cputable...

Thus, it would be best to put all the PMC related bits into a single
sub-structure, and rather than doing the above, save it, copy
everything, and eventually copy it back over (if it's a pointer it's
even easier).

Ben.





More information about the Linuxppc-dev mailing list