Thread (17 messages) flat view 17 messages, 2 authors, 2016-06-15
STALE3731d

Revision v1 of 4 in this series.

Revisions (4)
  1. v1 [diff vs current]
  2. v1 [diff vs current]
  3. v1 current
  4. v1 [diff vs current]

[PATCH 7/8] arm64: pmu: Enable multiple PMUs in an ACPI system

From: Jeremy Linton <hidden>
Date: 2016-06-15 15:21:12
Also in: linux-acpi

On 06/15/2016 08:22 AM, Will Deacon wrote:
On Thu, Jun 09, 2016 at 05:23:32PM -0500, Jeremy Linton wrote:
quoted
Its possible that an ACPI system has multiple CPU types in it
with differing PMU counters. Use the newly provided acpi_pmu routines
to detect that case, and instantiate more than one set of counters.
[...]
quoted
+	pmus = kcalloc(num_possible_cpus(), sizeof(struct pmu_types),
+		       GFP_KERNEL);
+
+	if (pmus) {
+		arm_pmu_acpi_determine_cpu_types(pmus);
+
+		for (j = 0; pmus[j].cpu_count; j++) {
+			pr_devel("CPU type %X, count %d\n", pmus[j].cpu_type,
+				 pmus[j].cpu_count);
+			res = kcalloc(pmus[j].cpu_count,
+				      sizeof(struct resource), GFP_KERNEL);
Given that you already have dynamic allocation in here, why not use a
linked-list for the pmus list, and avoid having a potentially huge temporary
data structure?
Sure... But, its really only going to be 2 entries on any existing 
system, I considered limiting this to something reasonable like "4" with 
a WARN() because who will ever build a machine with more than 4 
different CPU types in it? <chuckle> Is that an acceptable solution, or 
do you prefer the list?

Although, maybe the list is better, because then when someone does build 
such a machine it will "just work (TM)". <shrug>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help