Thread (42 messages) 42 messages, 9 authors, 2026-03-12

Re: [PATCH v4 01/17] perf: Protect perf_guest_cbs with RCU

From: Peter Zijlstra <peterz@infradead.org>
Date: 2021-11-11 10:49:08
Also in: kvm, kvmarm, linux-perf-users, linux-riscv, lkml, xen-devel

On Thu, Nov 11, 2021 at 08:26:58AM +0100, Paolo Bonzini wrote:
On 11/11/21 03:07, Sean Christopherson wrote:
quoted
  EXPORT_SYMBOL_GPL(perf_register_guest_info_callbacks);
  int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)
  {
-	perf_guest_cbs = NULL;
+	if (WARN_ON_ONCE(rcu_access_pointer(perf_guest_cbs) != cbs))
+		return -EINVAL;
+
+	rcu_assign_pointer(perf_guest_cbs, NULL);
+	synchronize_rcu();
This technically could be RCU_INIT_POINTER but it's not worth a respin.
There are dozens of other occurrences, and if somebody wanted they
could use Coccinelle to fix all of them.
I've been pushing the other way, trying to get rid of RCU_INIT_POINTER()
since rcu_assign_pointer(, NULL) actualy DTRT per __builtin_constant_p()
etc.

There's a very few sites where we use RCU_INIT_POINTER() with a !NULL
argument, and those are 'special'.

_______________________________________________
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