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]
Message-ID: <472A30A9.7040203@redhat.com>
Date:	Thu, 01 Nov 2007 16:01:45 -0400
From:	Chuck Ebbert <cebbert@...hat.com>
To:	Nick Piggin <npiggin@...e.de>
CC:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andi Kleen <ak@...e.de>, Ingo Molnar <mingo@...e.hu>
Subject: Re: [patch 1/4] x86: FIFO ticket spinlocks

On 11/01/2007 10:03 AM, Nick Piggin wrote:

[edited to show the resulting code]

> +	__asm__ __volatile__ (
> +		LOCK_PREFIX "xaddw %w0, %1\n"
> +		"1:\t"
> +		"cmpb %h0, %b0\n\t"
> +		"je 2f\n\t"
> +		"rep ; nop\n\t"
> +		"movb %1, %b0\n\t"
> +		/* don't need lfence here, because loads are in-order */
>  		"jmp 1b\n"
> +		"2:"
> +		:"+Q" (inc), "+m" (lock->slock)
> +		:
> +		:"memory", "cc");
>  }

If you really thought you might get long queues, you could figure out
how far back you are and use that to determine how long to wait before
testing the lock again. That cmpb could become a subb without adding
overhead to the fast path -- that would give you the queue length (or
its complement anyway.)

-
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