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: <alpine.LFD.2.02.1303251138270.22263@ionos>
Date:	Mon, 25 Mar 2013 11:39:19 +0100 (CET)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Heiko Carstens <heiko.carstens@...ibm.com>
cc:	LKML <linux-kernel@...r.kernel.org>, linux-arch@...r.kernel.org,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Rusty Russell <rusty@...tcorp.com.au>,
	Paul McKenney <paulmck@...ux.vnet.ibm.com>,
	Ingo Molnar <mingo@...e.hu>,
	Peter Zijlstra <peterz@...radead.org>,
	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
	Magnus Damm <magnus.damm@...il.com>
Subject: Re: [patch 05/34] idle: Implement generic idle function

On Sat, 23 Mar 2013, Heiko Carstens wrote:

> On Thu, Mar 21, 2013 at 09:53:00PM -0000, Thomas Gleixner wrote:
> > All idle functions in arch/* are more or less the same, plus minus a
> > few bugs and extra instrumentation, tickless support and other
> > optional items.
> > 
> > Implement a generic idle function which resembles the functionality
> > found in arch/. Provide weak arch_cpu_idle_* functions which can be
> > overridden by the architecture code if needed.
> > 
> > Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> 
> [...]
> 
> > +static void cpu_idle_loop(void)
> > +{
> > +	while (1) {
> > +		tick_nohz_idle_enter();
> > +
> > +		while (!need_resched()) {
> > +			check_pgt_cache();
> > +			rmb();
> > +
> > +			if (cpu_is_offline(smp_processor_id()))
> > +				arch_cpu_idle_dead();
> > +
> > +			local_irq_disable();
> > +			arch_cpu_idle_enter();
> > +
> > +			if (cpu_idle_force_poll) {
> > +				cpu_idle_poll();
> > +			} else {
> > +				current_clr_polling();
> > +				if (!need_resched()) {
> > +					stop_critical_timings();
> > +					rcu_idle_enter();
> > +					arch_cpu_idle();
> > +					WARN_ON_ONCE(!irqs_disabled());
> 
> This should be WARN_ON_ONCE(irqs_disabled()), no?

Gah, yes.
 
> > +					rcu_idle_exit();
> > +					start_critical_timings();
> > +				} else {
> > +					local_irq_enable();
> > +				}
> > +				current_set_polling();
> > +			}
> > +			arch_cpu_idle_exit();
> > +		}
> > +		tick_nohz_idle_exit();
> 
> I was wondering why the scheduler doesn't complain when being called with
> irqs disabled. In fact tick_nohz_idle_exit() enables irqs unconditionally
> iff CONFIG_NO_HZ is set.

It should complain. I'll have a look again.
 
> > +		schedule_preempt_disabled();
> > +	}
> > +}
> > +
> > +void cpu_startup_entry(enum cpuhp_state state)
> > +{
> > +	current_set_polling();
> > +	arch_cpu_idle_prepare();
> > +	cpu_idle_loop();
> > +}
> > +#endif
> 
> 
--
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