Re: [RFC PATCH v2 3/4] hp: Implement Hazard Pointers

2024-10-07 Thread Mathieu Desnoyers
On 2024-10-07 21:06, Paul E. McKenney wrote: On Mon, Oct 07, 2024 at 11:18:14AM -0700, Paul E. McKenney wrote: On Mon, Oct 07, 2024 at 10:50:46AM -0400, Mathieu Desnoyers wrote: On 2024-10-07 12:40, Peter Zijlstra wrote: On Sat, Oct 05, 2024 at 02:50:17PM -0400, Mathieu Desnoyers wrote: On 20

Re: [RFC PATCH v2 3/4] hp: Implement Hazard Pointers

2024-10-07 Thread Paul E. McKenney
On Mon, Oct 07, 2024 at 11:18:14AM -0700, Paul E. McKenney wrote: > On Mon, Oct 07, 2024 at 10:50:46AM -0400, Mathieu Desnoyers wrote: > > On 2024-10-07 12:40, Peter Zijlstra wrote: > > > On Sat, Oct 05, 2024 at 02:50:17PM -0400, Mathieu Desnoyers wrote: > > > > On 2024-10-05 18:04, Peter Zijlstra

Re: [RFC PATCH v2 3/4] hp: Implement Hazard Pointers

2024-10-07 Thread Paul E. McKenney
On Mon, Oct 07, 2024 at 10:50:46AM -0400, Mathieu Desnoyers wrote: > On 2024-10-07 12:40, Peter Zijlstra wrote: > > On Sat, Oct 05, 2024 at 02:50:17PM -0400, Mathieu Desnoyers wrote: > > > On 2024-10-05 18:04, Peter Zijlstra wrote: > > > > > > > > > +/* > > > > > + * hp_allocate: Allocate a hazar

Re: [RFC PATCH v2 3/4] hp: Implement Hazard Pointers

2024-10-07 Thread Mathieu Desnoyers
On 2024-10-07 12:40, Peter Zijlstra wrote: On Sat, Oct 05, 2024 at 02:50:17PM -0400, Mathieu Desnoyers wrote: On 2024-10-05 18:04, Peter Zijlstra wrote: +/* + * hp_allocate: Allocate a hazard pointer. + * + * Allocate a hazard pointer slot for @addr. The object existence should + * be guaran

Re: [RFC PATCH v2 3/4] hp: Implement Hazard Pointers

2024-10-07 Thread Mathieu Desnoyers
On 2024-10-07 12:42, Peter Zijlstra wrote: On Sat, Oct 05, 2024 at 02:56:26PM -0400, Mathieu Desnoyers wrote: On 2024-10-05 18:07, Peter Zijlstra wrote: On Sat, Oct 05, 2024 at 06:04:44PM +0200, Peter Zijlstra wrote: On Fri, Oct 04, 2024 at 02:27:33PM -0400, Mathieu Desnoyers wrote: +void h

Re: [RFC PATCH v2 3/4] hp: Implement Hazard Pointers

2024-10-07 Thread Peter Zijlstra
On Sat, Oct 05, 2024 at 02:56:26PM -0400, Mathieu Desnoyers wrote: > On 2024-10-05 18:07, Peter Zijlstra wrote: > > On Sat, Oct 05, 2024 at 06:04:44PM +0200, Peter Zijlstra wrote: > > > On Fri, Oct 04, 2024 at 02:27:33PM -0400, Mathieu Desnoyers wrote: > > > > > > +void hp_scan(struct hp_slot __pe

Re: [RFC PATCH v2 3/4] hp: Implement Hazard Pointers

2024-10-07 Thread Peter Zijlstra
On Sat, Oct 05, 2024 at 02:50:17PM -0400, Mathieu Desnoyers wrote: > On 2024-10-05 18:04, Peter Zijlstra wrote: > > > +/* > > > + * hp_allocate: Allocate a hazard pointer. > > > + * > > > + * Allocate a hazard pointer slot for @addr. The object existence should > > > + * be guaranteed by the call

Re: [RFC PATCH v2 3/4] hp: Implement Hazard Pointers

2024-10-05 Thread Mathieu Desnoyers
On 2024-10-05 18:07, Peter Zijlstra wrote: On Sat, Oct 05, 2024 at 06:04:44PM +0200, Peter Zijlstra wrote: On Fri, Oct 04, 2024 at 02:27:33PM -0400, Mathieu Desnoyers wrote: +void hp_scan(struct hp_slot __percpu *percpu_slots, void *addr, +void (*retire_cb)(int cpu, struct hp_slot

Re: [RFC PATCH v2 3/4] hp: Implement Hazard Pointers

2024-10-05 Thread Mathieu Desnoyers
On 2024-10-05 18:04, Peter Zijlstra wrote: On Fri, Oct 04, 2024 at 02:27:33PM -0400, Mathieu Desnoyers wrote: include/linux/hp.h | 158 + kernel/Makefile| 2 +- kernel/hp.c| 46 + 3 files changed, 205 insertions(+), 1 de

Re: [RFC PATCH v2 3/4] hp: Implement Hazard Pointers

2024-10-05 Thread Peter Zijlstra
On Sat, Oct 05, 2024 at 06:04:44PM +0200, Peter Zijlstra wrote: > On Fri, Oct 04, 2024 at 02:27:33PM -0400, Mathieu Desnoyers wrote: > > +void hp_scan(struct hp_slot __percpu *percpu_slots, void *addr, > > +void (*retire_cb)(int cpu, struct hp_slot *slot, void *addr)) > > +{ > > + int cp

Re: [RFC PATCH v2 3/4] hp: Implement Hazard Pointers

2024-10-05 Thread Peter Zijlstra
On Fri, Oct 04, 2024 at 02:27:33PM -0400, Mathieu Desnoyers wrote: > include/linux/hp.h | 158 + > kernel/Makefile| 2 +- > kernel/hp.c| 46 + > 3 files changed, 205 insertions(+), 1 deletion(-) > create mode 100644 include/li

Re: [RFC PATCH v2 3/4] hp: Implement Hazard Pointers

2024-10-05 Thread Mathieu Desnoyers
On 2024-10-04 23:25, Joel Fernandes wrote: On Fri, Oct 4, 2024 at 2:29 PM Mathieu Desnoyers wrote: This API provides existence guarantees of objects through Hazard Pointers (HP). This minimalist implementation is specific to use with preemption disabled, but can be extended further as needed.

Re: [RFC PATCH v2 3/4] hp: Implement Hazard Pointers

2024-10-05 Thread Mathieu Desnoyers
On 2024-10-05 13:19, Frederic Weisbecker wrote: Le Fri, Oct 04, 2024 at 02:27:33PM -0400, Mathieu Desnoyers a écrit : +void hp_scan(struct hp_slot __percpu *percpu_slots, void *addr, +void (*retire_cb)(int cpu, struct hp_slot *slot, void *addr)) +{ + int cpu; + + /* +

Re: [RFC PATCH v2 3/4] hp: Implement Hazard Pointers

2024-10-05 Thread Frederic Weisbecker
Le Fri, Oct 04, 2024 at 02:27:33PM -0400, Mathieu Desnoyers a écrit : > +void hp_scan(struct hp_slot __percpu *percpu_slots, void *addr, > + void (*retire_cb)(int cpu, struct hp_slot *slot, void *addr)) > +{ > + int cpu; > + > + /* > + * Store A precedes hp_scan(): it unpublis

Re: [RFC PATCH v2 3/4] hp: Implement Hazard Pointers

2024-10-04 Thread Joel Fernandes
On Fri, Oct 4, 2024 at 2:29 PM Mathieu Desnoyers wrote: > > This API provides existence guarantees of objects through Hazard > Pointers (HP). This minimalist implementation is specific to use > with preemption disabled, but can be extended further as needed. > > Each HP domain defines a fixed numb

[RFC PATCH v2 3/4] hp: Implement Hazard Pointers

2024-10-04 Thread Mathieu Desnoyers
This API provides existence guarantees of objects through Hazard Pointers (HP). This minimalist implementation is specific to use with preemption disabled, but can be extended further as needed. Each HP domain defines a fixed number of hazard pointer slots (nr_cpus) across the entire system. Its