All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Thomas Gleixner <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	rusty@rustcorp.com.au, torvalds@linux-foundation.org,
	peterz@infradead.org, tony.luck@intel.com,
	srivatsa.bhat@linux.vnet.ibm.com, paulmck@linux.vnet.ibm.com,
	tglx@linutronix.de, magnus.damm@gmail.com
Subject: [tip:smp/hotplug] ia64: Use generic idle loop
Date: Mon, 8 Apr 2013 13:28:30 -0700	[thread overview]
Message-ID: <tip-91d591c387af34db00c39da2d1d25e69a91cf591@git.kernel.org> (raw)
In-Reply-To: <20130321215234.406851909@linutronix.de>

Commit-ID:  91d591c387af34db00c39da2d1d25e69a91cf591
Gitweb:     http://git.kernel.org/tip/91d591c387af34db00c39da2d1d25e69a91cf591
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Thu, 21 Mar 2013 22:49:47 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 8 Apr 2013 17:39:25 +0200

ia64: Use generic idle loop

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Reviewed-by: Cc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Tony Luck <tony.luck@intel.com>
Link: http://lkml.kernel.org/r/20130321215234.406851909@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/ia64/Kconfig          |  1 +
 arch/ia64/kernel/perfmon.c | 14 +++------
 arch/ia64/kernel/process.c | 78 ++++++++++------------------------------------
 arch/ia64/kernel/smpboot.c |  2 +-
 4 files changed, 23 insertions(+), 72 deletions(-)

diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 9a02f71..e0b39c3 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -35,6 +35,7 @@ config IA64
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG
 	select GENERIC_IOMAP
 	select GENERIC_SMP_IDLE_THREAD
+	select GENERIC_IDLE_LOOP
 	select ARCH_INIT_TASK
 	select ARCH_TASK_STRUCT_ALLOCATOR
 	select ARCH_THREAD_INFO_ALLOCATOR
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 2eda284..9ea25fc 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -42,6 +42,7 @@
 #include <linux/completion.h>
 #include <linux/tracehook.h>
 #include <linux/slab.h>
+#include <linux/cpu.h>
 
 #include <asm/errno.h>
 #include <asm/intrinsics.h>
@@ -1322,8 +1323,6 @@ out:
 }
 EXPORT_SYMBOL(pfm_unregister_buffer_fmt);
 
-extern void update_pal_halt_status(int);
-
 static int
 pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned int cpu)
 {
@@ -1371,9 +1370,9 @@ pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned int cpu)
 		cpu));
 
 	/*
-	 * disable default_idle() to go to PAL_HALT
+	 * Force idle() into poll mode
 	 */
-	update_pal_halt_status(0);
+	cpu_idle_poll_ctrl(true);
 
 	UNLOCK_PFS(flags);
 
@@ -1430,11 +1429,8 @@ pfm_unreserve_session(pfm_context_t *ctx, int is_syswide, unsigned int cpu)
 		is_syswide,
 		cpu));
 
-	/*
-	 * if possible, enable default_idle() to go into PAL_HALT
-	 */
-	if (pfm_sessions.pfs_task_sessions == 0 && pfm_sessions.pfs_sys_sessions == 0)
-		update_pal_halt_status(1);
+	/* Undo forced polling. Last session reenables pal_halt */
+	cpu_idle_poll_ctrl(false);
 
 	UNLOCK_PFS(flags);
 
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 6f7dc8b..a26fc64 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -209,41 +209,13 @@ do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall)
 	local_irq_disable();	/* force interrupt disable */
 }
 
-static int pal_halt        = 1;
-static int can_do_pal_halt = 1;
-
 static int __init nohalt_setup(char * str)
 {
-	pal_halt = can_do_pal_halt = 0;
+	cpu_idle_poll_ctrl(true);
 	return 1;
 }
 __setup("nohalt", nohalt_setup);
 
-void
-update_pal_halt_status(int status)
-{
-	can_do_pal_halt = pal_halt && status;
-}
-
-/*
- * We use this if we don't have any better idle routine..
- */
-void
-default_idle (void)
-{
-	local_irq_enable();
-	while (!need_resched()) {
-		if (can_do_pal_halt) {
-			local_irq_disable();
-			if (!need_resched()) {
-				safe_halt();
-			}
-			local_irq_enable();
-		} else
-			cpu_relax();
-	}
-}
-
 #ifdef CONFIG_HOTPLUG_CPU
 /* We don't actually take CPU down, just spin without interrupts. */
 static inline void play_dead(void)
@@ -270,47 +242,29 @@ static inline void play_dead(void)
 }
 #endif /* CONFIG_HOTPLUG_CPU */
 
-void __attribute__((noreturn))
-cpu_idle (void)
+void arch_cpu_idle_dead(void)
+{
+	play_dead();
+}
+
+void arch_cpu_idle(void)
 {
 	void (*mark_idle)(int) = ia64_mark_idle;
-  	int cpu = smp_processor_id();
-
-	/* endless idle loop with no priority at all */
-	while (1) {
-		rcu_idle_enter();
-		if (can_do_pal_halt) {
-			current_thread_info()->status &= ~TS_POLLING;
-			/*
-			 * TS_POLLING-cleared state must be visible before we
-			 * test NEED_RESCHED:
-			 */
-			smp_mb();
-		} else {
-			current_thread_info()->status |= TS_POLLING;
-		}
 
-		if (!need_resched()) {
 #ifdef CONFIG_SMP
-			min_xtp();
+	min_xtp();
 #endif
-			rmb();
-			if (mark_idle)
-				(*mark_idle)(1);
+	rmb();
+	if (mark_idle)
+		(*mark_idle)(1);
+
+	safe_halt();
 
-			default_idle();
-			if (mark_idle)
-				(*mark_idle)(0);
+	if (mark_idle)
+		(*mark_idle)(0);
 #ifdef CONFIG_SMP
-			normal_xtp();
+	normal_xtp();
 #endif
-		}
-		rcu_idle_exit();
-		schedule_preempt_disabled();
-		check_pgt_cache();
-		if (cpu_is_offline(cpu))
-			play_dead();
-	}
 }
 
 void
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 500f1e4..8d87168 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -455,7 +455,7 @@ start_secondary (void *unused)
 	preempt_disable();
 	smp_callin();
 
-	cpu_idle();
+	cpu_startup_entry(CPUHP_ONLINE);
 	return 0;
 }
 

  parent reply	other threads:[~2013-04-08 20:29 UTC|newest]

Thread overview: 147+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-21 21:52 [patch 00/34] idle: Consolidate idle implementations Thomas Gleixner
2013-03-21 21:52 ` [patch 01/34] arch: Cleanup enable/disable_hlt Thomas Gleixner
2013-04-08 20:08   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:52 ` [patch 02/34] arch: Consolidate tsk_is_polling() Thomas Gleixner
2013-03-22  5:01   ` Tony Breeds
2013-03-22  5:20   ` Tony Breeds
2013-03-22  9:26     ` Thomas Gleixner
2013-04-08 20:09   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:52 ` [patch 03/34] idle: Implement set/clr functions for need_resched poll Thomas Gleixner
2013-03-22  9:38   ` James Hogan
2013-03-22  9:38     ` James Hogan
2013-04-08 20:10   ` [tip:smp/hotplug] idle: Implement set/ clr " tip-bot for Thomas Gleixner
2013-03-21 21:52 ` [patch 04/34] idle: Provide a generic entry point for the idle code Thomas Gleixner
2013-04-08 20:12   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-04-14  0:42     ` Yinghai Lu
2013-03-21 21:53 ` [patch 06/34] arc: Use generic idle loop Thomas Gleixner
2013-03-22  9:02   ` Vineet Gupta
2013-03-22  9:02     ` Vineet Gupta
2013-04-08 20:15   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 05/34] idle: Implement generic idle function Thomas Gleixner
2013-03-23  8:56   ` Heiko Carstens
2013-03-25 10:39     ` Thomas Gleixner
2013-03-28 15:39   ` Srivatsa S. Bhat
2013-04-08 20:14   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-04-15 22:25     ` Tony Luck
2013-04-16 13:28       ` Thomas Gleixner
2013-04-16 18:25         ` Tony Luck
2013-04-16 18:35           ` [PATCH] ia64: Make sure interrupts enabled when we "safe_halt()" Luck, Tony
2013-04-17  9:00             ` [tip:smp/hotplug] ia64: Make sure interrupts enabled when we " safe_halt()" tip-bot for Luck, Tony
2013-11-18  6:05   ` [patch 05/34] idle: Implement generic idle function Viresh Kumar
2013-11-22 22:32     ` Thomas Gleixner
2013-03-21 21:53 ` [patch 07/34] alpha: Use generic idle loop Thomas Gleixner
2013-03-28 15:37   ` Srivatsa S. Bhat
2013-03-29 11:22     ` Thomas Gleixner
2013-04-08 20:16   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 08/34] arm: " Thomas Gleixner
2013-03-22 21:24   ` Kevin Hilman
2013-03-25 11:31     ` Thomas Gleixner
2013-03-25 11:48       ` Russell King - ARM Linux
2013-03-25 14:02         ` Thomas Gleixner
2013-04-08 21:47           ` Russell King - ARM Linux
2013-04-09  9:20             ` Thomas Gleixner
2013-04-09  9:38               ` Russell King - ARM Linux
2013-04-25 20:03                 ` Stephen Boyd
2013-04-25 21:01                   ` Thomas Gleixner
2013-05-01  0:49                     ` Stephen Boyd
2013-05-01  0:55                       ` Paul E. McKenney
2013-05-01  0:55                         ` Paul E. McKenney
2013-05-21  0:57                         ` [PATCH] ARM: smp: Drop RCU_NONIDLE usage in cpu_die() Stephen Boyd
2013-04-08 20:17   ` [tip:smp/hotplug] arm: Use generic idle loop tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 09/34] arm64: " Thomas Gleixner
2013-03-25 18:06   ` Catalin Marinas
2013-04-08 20:18   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 10/34] avr32: " Thomas Gleixner
2013-04-08 20:20   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-04-09  7:31     ` Hans-Christian Egtvedt
2013-03-21 21:53 ` [patch 12/34] c6x: " Thomas Gleixner
2013-04-08 20:22   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 11/34] bfin: " Thomas Gleixner
2013-04-08 20:21   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 13/34] cris: " Thomas Gleixner
2013-03-27 15:04   ` Jesper Nilsson
2013-03-27 17:10     ` Thomas Gleixner
2013-04-08 20:23   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 14/34] frv: " Thomas Gleixner
2013-04-08 20:24   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 15/34] h8300: " Thomas Gleixner
2013-04-08 20:26   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 16/34] hexagon: " Thomas Gleixner
2013-04-08 20:27   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 18/34] m32r: " Thomas Gleixner
2013-04-08 20:29   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 17/34] ia64: " Thomas Gleixner
2013-03-28 15:40   ` Srivatsa S. Bhat
2013-04-08 20:28   ` tip-bot for Thomas Gleixner [this message]
2013-03-21 21:53 ` [patch 19/34] m68k: " Thomas Gleixner
2013-04-08 20:30   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 20/34] metag: " Thomas Gleixner
2013-03-22 10:16   ` James Hogan
2013-03-22 10:16     ` James Hogan
2013-03-25 11:26     ` Thomas Gleixner
2013-04-08 20:32   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 21/34] microblaze: " Thomas Gleixner
2013-04-08 20:33   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 22/34] mips: " Thomas Gleixner
2013-03-28 15:42   ` Srivatsa S. Bhat
2013-04-08 20:34   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 24/34] openrisc: " Thomas Gleixner
2013-04-08 20:36   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 23/34] mn10300: " Thomas Gleixner
2013-04-08 20:35   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 25/34] parisc: " Thomas Gleixner
2013-04-08 20:38   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 26/34] powerpc: " Thomas Gleixner
2013-03-28 15:40   ` Srivatsa S. Bhat
2013-04-01  9:13     ` Deepthi Dharwar
2013-04-08 20:39   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 27/34] s390: " Thomas Gleixner
2013-03-23  9:38   ` Heiko Carstens
2013-03-23  9:39   ` Heiko Carstens
2013-03-23  9:39     ` Heiko Carstens
2013-04-08 20:40   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 28/34] score: " Thomas Gleixner
2013-04-08 20:41   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 29/34] sh: " Thomas Gleixner
2013-03-28 15:40   ` Srivatsa S. Bhat
2013-04-08 20:42   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 30/34] tile: Enter idle with preemption disabled Thomas Gleixner
2013-03-22 20:34   ` Chris Metcalf
2013-03-22 20:34     ` Chris Metcalf
2013-03-22 20:40   ` Chris Metcalf
2013-03-22 20:40     ` Chris Metcalf
2013-03-28 15:43   ` Srivatsa S. Bhat
2013-04-08 20:44   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 31/34] tile: Use generic idle loop Thomas Gleixner
2013-03-28 15:41   ` Srivatsa S. Bhat
2013-03-29 11:24     ` Thomas Gleixner
2013-04-08 20:45   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 32/34] unicore: " Thomas Gleixner
2013-04-08 20:46   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 33/34] x86: " Thomas Gleixner
2013-03-28 15:43   ` Srivatsa S. Bhat
2013-04-08 20:47   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-21 21:53 ` [patch 34/34] xtensa: " Thomas Gleixner
2013-03-22 12:37   ` Max Filippov
2013-04-08 20:48   ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2013-03-22 20:09 ` [patch 00/34] idle: Consolidate idle implementations Sam Ravnborg
     [not found] ` <alpine.LFD.2.02.1303271940150.22263@ionos>
     [not found]   ` <5153EC43.7070808@zankel.net>
2013-03-28  9:24     ` Thomas Gleixner
2013-03-28 22:16       ` Chris Zankel
2013-03-29 16:19 ` Sam Ravnborg
2013-03-29 20:29   ` [PATCH] sparc: Use generic idle loop Sam Ravnborg
2013-03-31 23:46     ` David Miller
2013-04-01  6:53     ` Srivatsa S. Bhat
2013-04-01  9:06       ` Sam Ravnborg
2013-04-01  9:06         ` Sam Ravnborg
2013-04-01  9:06         ` Sam Ravnborg
2013-04-08 12:33         ` Srivatsa S. Bhat
2013-04-08 17:10           ` Sam Ravnborg
2013-04-08 19:24             ` David Miller
2013-04-11 19:38               ` [PATCH v2] " Sam Ravnborg
2013-04-11 19:38                 ` Sam Ravnborg
2013-04-11 19:38                 ` Sam Ravnborg
2013-04-12 18:56                 ` Thomas Gleixner
2013-04-12 18:58                   ` David Miller
2013-04-13 19:53                 ` [tip:smp/hotplug] " tip-bot for Sam Ravnborg
2013-05-03  9:47 ` [patch 00/34] idle: Consolidate idle implementations Geert Uytterhoeven
2013-05-03  9:47   ` Geert Uytterhoeven

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=tip-91d591c387af34db00c39da2d1d25e69a91cf591@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=rusty@rustcorp.com.au \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.