Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F137899821
D41978.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D41978.diff
View Options
diff --git a/usr.sbin/pmcstat/pmcstat.c b/usr.sbin/pmcstat/pmcstat.c
--- a/usr.sbin/pmcstat/pmcstat.c
+++ b/usr.sbin/pmcstat/pmcstat.c
@@ -713,8 +713,16 @@
errx(EX_SOFTWARE, "ERROR: Out of memory.");
(void) strncpy(ev->ev_name, optarg, c);
*(ev->ev_name + c) = '\0';
+
libpmc_initialize(&npmc);
+
if (args.pa_flags & FLAG_HAS_SYSTEM_PMCS) {
+ /*
+ * We need to check the capabilities of the
+ * desired event to determine if it should be
+ * allocated on every CPU, or only a subset of
+ * them. This requires allocating a PMC now.
+ */
if (pmc_allocate(ev->ev_spec, ev->ev_mode,
ev->ev_flags, ev->ev_cpu, &ev->ev_pmcid,
ev->ev_count) < 0)
@@ -726,8 +734,14 @@
err(EX_OSERR, "ERROR: Cannot get pmc "
"capabilities");
}
- }
+ /*
+ * Release the PMC now that we have caps; we
+ * will reallocate shortly.
+ */
+ pmc_release(ev->ev_pmcid);
+ ev->ev_pmcid = PMC_ID_INVALID;
+ }
STAILQ_INSERT_TAIL(&args.pa_events, ev, ev_next);
@@ -751,10 +765,7 @@
}
if (option == 's' || option == 'S') {
CPU_CLR(ev->ev_cpu, &cpumask);
- pmc_id_t saved_pmcid = ev->ev_pmcid;
- ev->ev_pmcid = PMC_ID_INVALID;
pmcstat_clone_event_descriptor(ev, &cpumask, &args);
- ev->ev_pmcid = saved_pmcid;
CPU_SET(ev->ev_cpu, &cpumask);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 28, 12:45 AM (18 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26268882
Default Alt Text
D41978.diff (1 KB)
Attached To
Mode
D41978: pmcstat: fix duplicate event allocation on CPU 0
Attached
Detach File
Event Timeline
Log In to Comment