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: <Pine.LNX.4.64.0811200414100.17455@hs20-bc2-1.build.redhat.com>
Date:	Thu, 20 Nov 2008 04:18:17 -0500 (EST)
From:	Mikulas Patocka <mpatocka@...hat.com>
To:	Alan Cox <alan@...rguk.ukuu.org.uk>
cc:	Peter Zijlstra <peterz@...radead.org>,
	linux-kernel@...r.kernel.org, mingo@...e.hu, rml@...h9.net,
	Alasdair G Kergon <agk@...hat.com>,
	Milan Broz <mbroz@...hat.com>
Subject: Re: Active waiting with yield()



On Tue, 18 Nov 2008, Alan Cox wrote:

> > This makes a code branch that is very rarely tested and a potential bug. 
> > Every such rarely executed branch is a danger and even a silly typo in the 
> > code can hide there for many years without being noticed.
> 
> Learn to use a debugger. You want an unusual timing to occur you
> breakpoint the relevant task and suspend it for a bit.
> 
> > So, I say msleep(1) instead of yield(). What are the counterarguments to 
> > msleep?
> 
> msleep isn't particularly a problem. You are giving up the CPU and not
> wasting so much power and you won't deadlock in realtime. Assuming you
> only expect one or two msleep cycles its fine.

So msleep(1) should be OK. I can't think of a case when it could break.

> And if you think virtualisation and power management and correctness
> (as Ingo noted) are a "bad reason" you need to wake up to the real world.

If the involved cases are:
- a race condition that never happened to a user, only seen during 
artifical testing
- a race condition that existed for 5 years and just one user hit it

--- then yes, considering power management is a bad reason.

Mikulas

> Alan
> 
--
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