public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Mark Salter <msalter@redhat.com>
Cc: linux-arch@vger.kernel.org
Subject: Re: [PATCH 08/24] C6X: process management
Date: Mon, 22 Aug 2011 22:55:49 +0200	[thread overview]
Message-ID: <1606029.05YQUzWRG5@wuerfel> (raw)
In-Reply-To: <1314043785-2880-9-git-send-email-msalter@redhat.com>

On Monday 22 August 2011 16:09:29 Mark Salter wrote:

> diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c
> new file mode 100644
> index 0000000..d7bc66f
> --- /dev/null
> +++ b/arch/c6x/kernel/process.c
>
> +/* hooks for board specific support */
> +void	(*c6x_restart)(void);
> +void	(*c6x_halt)(void);
> +void	(*c6x_power_off)(void);
> +
> +/*
> + * power off function, if any
> + */
> +void (*pm_power_off)(void);
> +EXPORT_SYMBOL(pm_power_off);
> +
> +/*
> + * power management idle function, if any..
> + */
> +void (*pm_idle)(void);
> +EXPORT_SYMBOL(pm_idle);

You probably don't want two levels of indirection for the power_off
callback, so just reassign pm_power_off from a driver when needed.

> +static void default_idle(void)
> +{
> +	asm volatile ("IDLE\n");
> +}
> +
> +/*
> + * The idle loop for C64x
> + */
> +void cpu_idle(void)
> +{
> +	/* endless idle loop with no priority at all */
> +	while (1) {
> +		tick_nohz_stop_sched_tick(1);
> +		while (!need_resched()) {
> +			void (*idle)(void);
> +
> +			smp_rmb();
> +			idle = pm_idle;
> +			if (!idle)
> +				idle = default_idle;
> +			idle();
> +		}
> +		tick_nohz_restart_sched_tick();
> +
> +		preempt_enable_no_resched();
> +		schedule();
> +		preempt_disable();
> +	}
> +}

Hmm, I'm having a small deja-vue here. I think I just commented on the same
bug in the hexagon architecture patches ;-)

You need to disable all interrupts before checking need_resched() and keep
them disabled until returning from the idle function. Otherwise you might
not wake up (or wake up late) after an interrupt handler has set
need_resched() and waits for interrupts to process while you have entered
the idle call.

	Arnd

  reply	other threads:[~2011-08-22 20:56 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22 20:09 [PATCH v2 00/24] C6X: New architecture patch set Mark Salter
2011-08-22 20:09 ` [PATCH 01/24] fix default __strnlen_user macro Mark Salter
2011-08-22 20:09 ` [PATCH 02/24] fixed generic page.h for non-zero PAGE_OFFSET Mark Salter
2011-08-22 20:09 ` [PATCH 03/24] add ELF machine define for TI C6X DSPs Mark Salter
2011-08-22 20:09 ` [PATCH 04/24] C6X: build infrastructure Mark Salter
2011-08-22 20:55   ` Sam Ravnborg
2011-08-23 13:23     ` Mark Salter
2011-08-24 13:47       ` David Woodhouse
2011-08-24 14:10         ` Mark Salter
2011-08-22 20:09 ` [PATCH 05/24] C6X: early boot code Mark Salter
2011-08-22 20:09 ` [PATCH 06/24] C6X: devicetree Mark Salter
2011-08-22 20:09 ` [PATCH 07/24] C6X: memory management and DMA support Mark Salter
2011-08-22 20:09 ` [PATCH 08/24] C6X: process management Mark Salter
2011-08-22 20:55   ` Arnd Bergmann [this message]
2011-08-22 20:09 ` [PATCH 09/24] C6X: signal management Mark Salter
2011-08-22 20:09 ` [PATCH 10/24] C6X: time management Mark Salter
2011-08-22 20:09 ` [PATCH 11/24] C6X: interrupt handling Mark Salter
2011-08-22 20:58   ` Arnd Bergmann
2011-08-22 21:08     ` Mark Salter
2011-08-22 21:29     ` Benjamin Herrenschmidt
2011-08-22 20:09 ` [PATCH 12/24] C6X: syscalls Mark Salter
2011-08-22 21:00   ` Arnd Bergmann
2011-08-22 20:09 ` [PATCH 13/24] C6X: traps Mark Salter
2011-08-22 20:09 ` [PATCH 14/24] C6X: clocks Mark Salter
2011-08-22 20:09 ` [PATCH 15/24] C6X: cache control Mark Salter
2011-08-22 20:09 ` [PATCH 16/24] C6X: loadable module support Mark Salter
2011-08-22 21:04   ` Arnd Bergmann
2011-08-22 21:14     ` Mark Salter
2011-08-22 20:09 ` [PATCH 17/24] C6X: ptrace support Mark Salter
2011-08-22 21:07   ` Arnd Bergmann
2011-08-22 20:09 ` [PATCH 18/24] C6X: headers Mark Salter
2011-08-22 21:14   ` Arnd Bergmann
2011-08-23 13:43     ` Mark Salter
2011-08-24  4:53       ` Sam Ravnborg
2011-08-22 20:09 ` [PATCH 19/24] C6X: library code Mark Salter
2011-08-22 20:09 ` [PATCH 20/24] C6X: general SoC support Mark Salter
2011-08-22 20:09 ` [PATCH 21/24] C6X: specific " Mark Salter
2011-08-22 22:21   ` Arnd Bergmann
2011-08-22 20:09 ` [PATCH 22/24] C6X: EMIF - External Memory Interface Mark Salter
2011-08-22 21:17   ` Arnd Bergmann
2011-08-22 21:34     ` Mark Salter
2011-08-22 20:09 ` [PATCH 23/24] C6X: Power and Sleep Controller Mark Salter
2011-08-22 21:20   ` Arnd Bergmann
2011-08-22 21:32     ` Mark Salter
2011-08-22 20:09 ` [PATCH 24/24] C6X: MAINTAINERS Mark Salter
2011-08-22 22:25 ` [PATCH v2 00/24] C6X: New architecture patch set Arnd Bergmann
2011-09-26 14:31   ` Arnd Bergmann
2011-09-26 14:38     ` Mark Salter
2011-08-25 14:53 ` Peter Zijlstra
2011-08-25 16:00   ` Mark Salter
2011-08-25 17:27     ` Peter Zijlstra
2011-08-25 17:34       ` Mark Salter
2011-08-25 17:36         ` Peter Zijlstra
  -- strict thread matches above, loose matches on Subject: below --
2011-08-08 21:44 [PATCH " Mark Salter
2011-08-08 21:44 ` [PATCH 08/24] C6X: process management Mark Salter
2011-08-09 16:31   ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1606029.05YQUzWRG5@wuerfel \
    --to=arnd@arndb.de \
    --cc=linux-arch@vger.kernel.org \
    --cc=msalter@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox