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] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 10 Apr 2015 11:04:39 +0200
From:	Ingo Molnar <mingo@...nel.org>
To:	Jason Low <jason.low2@...com>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Paul McKenney <paulmck@...ux.vnet.ibm.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Davidlohr Bueso <dave@...olabs.net>,
	Tim Chen <tim.c.chen@...ux.intel.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Aswin Chandramouleeswaran <aswin@...com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] locking/rwsem: Use a return variable in
 rwsem_spin_on_owner()


* Jason Low <jason.low2@...com> wrote:

> +static inline bool owner_running(struct rw_semaphore *sem, struct task_struct *owner)
> +{
> +	bool ret;
> +
> +#ifdef CONFIG_DEBUG_PAGEALLOC
> +	rcu_read_lock();
> +#endif
> +	if (READ_ONCE(sem->owner) == owner) {
> +		/*
> +		 * Ensure we emit the owner->on_cpu dereference
> +		 * after checking sem->owner still matches owner.
> +		 */
> +		barrier();
> +		ret = owner->on_cpu;
> +	} else {
> +		/* Owner changed. */
> +		ret = false;
> +	}
> +
> +#ifdef CONFIG_DEBUG_PAGEALLOC
> +	rcu_read_unlock();
> +#endif
> +	return ret;
> +}

So I really don't like this due to the assymetric RCU pattern. (Also, 
the fact that we might read from already freed kernel memory here 
needs big honking comments.)

But, I think we can do this differently, see the patch I just sent:

  [PATCH] mutex: Speed up mutex_spin_on_owner() by not taking the RCU lock

that should I think work just as well, without having to introduce 
owner_running() as the whole mutex_spin_on_owner() logic is kept 
pretty simple.

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ