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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <vxdnyz3e6c5whsd4let47ms75a7kcjykzud6x7d6pwkfd4yd2z@odddgxwsst4d>
Date: Fri, 19 Sep 2025 18:00:30 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Steven Rostedt <rostedt@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org, 
	bpf@...r.kernel.org, Masami Hiramatsu <mhiramat@...nel.org>, 
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, Peter Zijlstra <peterz@...radead.org>, 
	Ingo Molnar <mingo@...nel.org>, Jiri Olsa <jolsa@...nel.org>, 
	Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>, 
	Thomas Gleixner <tglx@...utronix.de>, Andrii Nakryiko <andrii@...nel.org>, 
	Indu Bhagat <indu.bhagat@...cle.com>, "Jose E. Marchesi" <jemarch@....org>, 
	Beau Belgrave <beaub@...ux.microsoft.com>, Jens Remus <jremus@...ux.ibm.com>, 
	Linus Torvalds <torvalds@...ux-foundation.org>, Andrew Morton <akpm@...ux-foundation.org>, 
	Jens Axboe <axboe@...nel.dk>, Florian Weimer <fweimer@...hat.com>, Sam James <sam@...too.org>
Subject: Re: [PATCH v16 06/10] unwind deferred: Use bitmask to determine
 which callbacks to call

On Tue, Jul 29, 2025 at 02:23:10PM -0400, Steven Rostedt wrote:
> @@ -212,32 +225,59 @@ int unwind_deferred_request(struct unwind_work *work, u64 *cookie)
>  
>  	*cookie = get_cookie(info);
>  
> -	/* callback already pending? */
> -	pending = READ_ONCE(info->pending);
> -	if (pending)
> -		return 1;
> +	old = READ_ONCE(info->unwind_mask);
>  
> -	/* Claim the work unless an NMI just now swooped in to do so. */
> -	if (!try_cmpxchg(&info->pending, &pending, 1))
> +	/* Is this already queued or executed */
> +	if (old & bit)
>  		return 1;
>  
> +	/*
> +	 * This work's bit hasn't been set yet. Now set it with the PENDING
> +	 * bit and fetch the current value of unwind_mask. If ether the
> +	 * work's bit or PENDING was already set, then this is already queued
> +	 * to have a callback.
> +	 */
> +	bits = UNWIND_PENDING | bit;
> +	old = atomic_long_fetch_or(bits, (atomic_long_t *)&info->unwind_mask);
> +	if (old & bits) {
> +		/*
> +		 * If the work's bit was set, whatever set it had better
> +		 * have also set pending and queued a callback.
> +		 */
> +		WARN_ON_ONCE(!(old & UNWIND_PENDING));
> +		return old & bit;

Per the function comment, the function returns 0, 1, or negative.  So
this should be 

		return !!(old & bit)

right?

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ