Re: [PATCH] ring-buffer: Simplify reservation with try_cmpxchg() loop

2024-01-25 Thread Steven Rostedt
On Thu, 25 Jan 2024 16:18:37 -0500 Mathieu Desnoyers wrote: > > > > This is how you are able to avoid the "before/after" logic I have, as > > the race is automatically detected. The least significant bits of the > > timestamp is ignored for the event delta calculation. > > Not quite, as I exp

Re: [PATCH] ring-buffer: Simplify reservation with try_cmpxchg() loop

2024-01-25 Thread Mathieu Desnoyers
On 2024-01-20 08:47, Steven Rostedt wrote: On Fri, 19 Jan 2024 20:49:36 -0500 Mathieu Desnoyers wrote: Let's say we have the following ktime_get() values (monotonic timestamp value) for a sequence of events: Timestamp (Hex)Encoding in the trace Packe

Re: [PATCH] ring-buffer: Simplify reservation with try_cmpxchg() loop

2024-01-20 Thread Steven Rostedt
On Sat, 20 Jan 2024 08:47:13 -0500 Steven Rostedt wrote: > > I would also consider reducing code complexity as a worthwhile metric > > in addition to speed. It makes it easier to extend in the future, > > easier to understand for reviewers, and subtle bugs are less likely > > to creep in. > >

Re: [PATCH] ring-buffer: Simplify reservation with try_cmpxchg() loop

2024-01-20 Thread Steven Rostedt
On Fri, 19 Jan 2024 20:49:36 -0500 Mathieu Desnoyers wrote: > >> Let's say we have the following ktime_get() values (monotonic timestamp > >> value) for > >> a sequence of events: > >> > >> Timestamp (Hex)Encoding in the > >> trace > >> > >> Packet header

Re: [PATCH] ring-buffer: Simplify reservation with try_cmpxchg() loop

2024-01-19 Thread Mathieu Desnoyers
On 2024-01-19 16:42, Steven Rostedt wrote: On Fri, 19 Jan 2024 15:56:21 -0500 Mathieu Desnoyers wrote: So when an overflow happens, you just insert a timestamp, and then events after that is based on that? No. Let's use an example to show how it works. For reference, LTTng uses 5-bit for ev

Re: [PATCH] ring-buffer: Simplify reservation with try_cmpxchg() loop

2024-01-19 Thread Steven Rostedt
On Fri, 19 Jan 2024 15:56:21 -0500 Mathieu Desnoyers wrote: > > So when an overflow happens, you just insert a timestamp, and then events > > after that is based on that? > > No. Let's use an example to show how it works. > > For reference, LTTng uses 5-bit for event ID and 27-bit for timesta

Re: [PATCH] ring-buffer: Simplify reservation with try_cmpxchg() loop

2024-01-19 Thread Mathieu Desnoyers
On 2024-01-19 10:37, Steven Rostedt wrote: On Fri, 19 Jan 2024 09:40:27 -0500 Mathieu Desnoyers wrote: On 2024-01-18 18:12, Steven Rostedt wrote: From: "Steven Rostedt (Google)" [...] Although, it does not get rid of the double time stamps (before_stamp and write_stamp), using cmpxchg()

Re: [PATCH] ring-buffer: Simplify reservation with try_cmpxchg() loop

2024-01-19 Thread Steven Rostedt
On Fri, 19 Jan 2024 09:40:27 -0500 Mathieu Desnoyers wrote: > On 2024-01-18 18:12, Steven Rostedt wrote: > > From: "Steven Rostedt (Google)" > > > > Instead of using local_add_return() to reserve the ring buffer data, > > Mathieu Desnoyers suggested using local_cmpxchg(). This would simplify th

Re: [PATCH] ring-buffer: Simplify reservation with try_cmpxchg() loop

2024-01-19 Thread Mathieu Desnoyers
On 2024-01-18 18:12, Steven Rostedt wrote: From: "Steven Rostedt (Google)" Instead of using local_add_return() to reserve the ring buffer data, Mathieu Desnoyers suggested using local_cmpxchg(). This would simplify the reservation with the time keeping code. I admire the effort of trying to s

[PATCH] ring-buffer: Simplify reservation with try_cmpxchg() loop

2024-01-18 Thread Steven Rostedt
From: "Steven Rostedt (Google)" Instead of using local_add_return() to reserve the ring buffer data, Mathieu Desnoyers suggested using local_cmpxchg(). This would simplify the reservation with the time keeping code. Although, it does not get rid of the double time stamps (before_stamp and write_