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: <201106201020.39097.arnd@arndb.de>
Date:	Mon, 20 Jun 2011 10:20:39 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	Jonas Bonn <jonas@...thpole.se>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 11/19] OpenRISC: Idle/Power management

On Sunday 19 June 2011 13:43:37 Jonas Bonn wrote:
> +void cpu_idle(void)
> +{
> +        unsigned int cpu = smp_processor_id();
> +
> +        set_thread_flag(TIF_POLLING_NRFLAG);
> +
> +        /* endless idle loop with no priority at all */
> +        while (1) {
> +                tick_nohz_stop_sched_tick(1);
> +
> +                while (!need_resched()) {
> +                        check_pgt_cache();
> +                        rmb();
> +
> +/*                        if (cpu_is_offline(cpu))
> +                                play_dead();
> +*/
> +                       clear_thread_flag(TIF_POLLING_NRFLAG);
> +
> +                        local_irq_disable();
> +                        /* Don't trace irqs off for idle */
> +                        stop_critical_timings();
> +                       if (powersave != NULL )
> +                               powersave();
> +                       start_critical_timings();
> +                       local_irq_enable();
> +                       set_thread_flag(TIF_POLLING_NRFLAG);
> +                }
> +
> +                tick_nohz_restart_sched_tick();
> +                preempt_enable_no_resched();
> +                schedule();
> +                preempt_disable();
> +        }

Shouldn't you check need_resched() inside of local_irq_disable? Otherwise
you may get interrupted between the check at the start of the loop and
the irq_disable, which tries to wake up another process just before you go
to sleep indefinitely.

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