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, 13 Jun 2008 00:28:08 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Thomas Gleixner <tglx@...utronix.de>
Cc:	linux-kernel@...r.kernel.org, mingo@...e.hu, arjan@...radead.org,
	andreas.herrmann3@....com
Subject: Re: [patch 6/6] x86: add c1e aware idle function

On Fri, 13 Jun 2008 08:02:30 +0200 (CEST) Thomas Gleixner <tglx@...utronix.de> wrote:

> On Thu, 12 Jun 2008, Andrew Morton wrote:
> > On Thu, 12 Jun 2008 10:29:00 -0000
> > Thomas Gleixner <tglx@...utronix.de> wrote:
> > > +		clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu);
> > > +		default_idle();
> > > +		local_irq_disable();
> > > +		clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);
> > > +		local_irq_enable();
> > 
> > I worked it out!  It took me a while.
> > 
> > This function is called with local irqs disabled.
> > 
> > default_idle() is entered with local irqs disabled but returns with them
> > enabled.
> > 
> > clockevents_notify() is supposed to be called with local irqs disabled.
> > 
> > This functions returns with local irqs enabled.
> 
> Damn, you decoded my sekrit.

The wonders of the GPL.

> > Was I right?  None of any of that is documented anywhere.  But it should
> > be.
> 
> Yeah, needs a big comment. Will add one.
> 

Actually it need lots of little comments.  One at default_idle(), one at
clockevents_notify(), one at whatever-this-function-was.

Because "must be called with local irqs disabled" is as much a part of
a function's interface as "must be passed a foo* and an integer and
returns a bar*".  Ditto "must be called under zot_lock".  But people
often forget these things.

I guess kerneldoc should have a standard "call environment" template. 
Maybe it does, dunno.

Of course, WARN_ON(!irqs_disabled()) and WARN_ON(!spin_is_locked(foo))
is robust documentation.


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