Thread (8 messages) 8 messages, 5 authors, 2021-07-08

Re: [PATCH V7 01/18] perf/core: Use static_call to optimize perf_guest_info_callbacks

From: Peter Zijlstra <peterz@infradead.org>
Date: 2021-07-02 16:21:43
Also in: kvm, kvmarm, linux-riscv, lkml, xen-devel

Possibly related (same subject, not in this thread)

On Fri, Jul 02, 2021 at 09:00:22AM -0700, Joe Perches wrote:
On Fri, 2021-07-02 at 13:22 +0200, Peter Zijlstra wrote:
quoted
On Tue, Jun 22, 2021 at 05:42:49PM +0800, Zhu Lingshan wrote:
quoted
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
[]
quoted
quoted
@@ -90,6 +90,27 @@ DEFINE_STATIC_CALL_NULL(x86_pmu_pebs_aliases, *x86_pmu.pebs_aliases);
  */
 DEFINE_STATIC_CALL_RET0(x86_pmu_guest_get_msrs, *x86_pmu.guest_get_msrs);
 

+DEFINE_STATIC_CALL_RET0(x86_guest_state, *(perf_guest_cbs->state));
+DEFINE_STATIC_CALL_RET0(x86_guest_get_ip, *(perf_guest_cbs->get_ip));
+DEFINE_STATIC_CALL_RET0(x86_guest_handle_intel_pt_intr, *(perf_guest_cbs->handle_intel_pt_intr));
+
+void arch_perf_update_guest_cbs(void)
+{
+	static_call_update(x86_guest_state, (void *)&__static_call_return0);
+	static_call_update(x86_guest_get_ip, (void *)&__static_call_return0);
+	static_call_update(x86_guest_handle_intel_pt_intr, (void *)&__static_call_return0);
+
+	if (perf_guest_cbs && perf_guest_cbs->state)
+		static_call_update(x86_guest_state, perf_guest_cbs->state);
+
+	if (perf_guest_cbs && perf_guest_cbs->get_ip)
+		static_call_update(x86_guest_get_ip, perf_guest_cbs->get_ip);
+
+	if (perf_guest_cbs && perf_guest_cbs->handle_intel_pt_intr)
+		static_call_update(x86_guest_handle_intel_pt_intr,
+				   perf_guest_cbs->handle_intel_pt_intr);
+}
Coding style wants { } on that last if().
That's just your personal preference.
As a maintainer, those carry weight, also that's tip rules:

  https://lore.kernel.org/lkml/20181107171149.165693799@linutronix.de/ (local)

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help