Thread (27 messages) 27 messages, 5 authors, 2021-09-07

Re: [PATCH v5 bpf-next 1/3] perf: enable branch record for software events

From: Song Liu <hidden>
Date: 2021-09-03 16:50:39
Also in: lkml

On Sep 3, 2021, at 1:02 AM, Peter Zijlstra [off-list ref] wrote:

On Thu, Sep 02, 2021 at 09:57:04AM -0700, Song Liu wrote:
quoted
+static int
+intel_pmu_snapshot_branch_stack(struct perf_branch_entry *entries, unsigned int cnt)
+{
+	struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
+
+	intel_pmu_disable_all();
+	intel_pmu_lbr_read();
+	cnt = min_t(unsigned int, cnt, x86_pmu.lbr_nr);
+
+	memcpy(entries, cpuc->lbr_entries, sizeof(struct perf_branch_entry) * cnt);
+	intel_pmu_enable_all(0);
+	return cnt;
+}
Would something like the below help get rid of that memcpy() ?

(compile tested only)
We can get rid of the memcpy. But we will need an extra "size" or "num_entries" 
parameter for intel_pmu_lbr_read. I can add this change in the next version. 

Thanks,
Song
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help