lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <168765ff-98ea-42a1-82f7-56178bfcf7ec@efficios.com>
Date: Tue, 20 Feb 2024 09:50:13 -0500
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Steven Rostedt <rostedt@...dmis.org>, LKML
 <linux-kernel@...r.kernel.org>,
 Linux Trace Kernel <linux-trace-kernel@...r.kernel.org>
Cc: Masami Hiramatsu <mhiramat@...nel.org>,
 Mark Rutland <mark.rutland@....com>
Subject: Re: [PATCH v3] ring-buffer: Simplify reservation with try_cmpxchg()
 loop

On 2024-02-20 09:19, Steven Rostedt wrote:
> On Mon, 19 Feb 2024 18:20:32 -0500
> Steven Rostedt <rostedt@...dmis.org> wrote:
> 
>> 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_stamp), using cmpxchg() does get rid of the more complex case when
>> an interrupting event occurs between getting the timestamps and reserving
>> the data, as when that happens, it just tries again instead of dealing
>> with it.
>>
>> Before we had:
>>
>> 	w = local_read(&tail_page->write);
>> 	/* get time stamps */
>> 	write = local_add_return(length, &tail_page->write);
>> 	if (write - length == w) {
>> 		/* do simple case */
>> 	} else {
>> 		/* do complex case */
>> 	}
>>
>> By switching the local_add_return() to a local_try_cmpxchg() it can now be:
>>
>> 	 w = local_read(&tail_page->write);
>>   again:
>> 	/* get time stamps */
>> 	if (!local_try_cmpxchg(&tail_page->write, &w, w + length))
>> 		goto again;
>>
>> 	 /* do simple case */
> 
> Something about this logic is causing __rb_next_reserve() to sometimes
> always return -EAGAIN and triggering the:
> 
>      RB_WARN_ON(cpu_buffer, ++nr_loops > 1000)
> 
> Which disables the ring buffer.
> 
> I'm not sure what it is, but until I do, I'm removing the patch from my
> queue.

Try resetting the info->add_timestamp flags to add_ts_default on goto again
within __rb_reserve_next().

Thanks,

Mathieu


-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ