Skip to content

Commit 91d591c

Browse files
committed
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>
1 parent 4e0fcc5 commit 91d591c

4 files changed

Lines changed: 23 additions & 72 deletions

File tree

‎arch/ia64/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ config IA64
3535
select ARCH_HAVE_NMI_SAFE_CMPXCHG
3636
select GENERIC_IOMAP
3737
select GENERIC_SMP_IDLE_THREAD
38+
select GENERIC_IDLE_LOOP
3839
select ARCH_INIT_TASK
3940
select ARCH_TASK_STRUCT_ALLOCATOR
4041
select ARCH_THREAD_INFO_ALLOCATOR

‎arch/ia64/kernel/perfmon.c‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include <linux/completion.h>
4343
#include <linux/tracehook.h>
4444
#include <linux/slab.h>
45+
#include <linux/cpu.h>
4546

4647
#include <asm/errno.h>
4748
#include <asm/intrinsics.h>
@@ -1322,8 +1323,6 @@ pfm_unregister_buffer_fmt(pfm_uuid_t uuid)
13221323
}
13231324
EXPORT_SYMBOL(pfm_unregister_buffer_fmt);
13241325

1325-
extern void update_pal_halt_status(int);
1326-
13271326
static int
13281327
pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned int cpu)
13291328
{
@@ -1371,9 +1370,9 @@ pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned int cpu)
13711370
cpu));
13721371

13731372
/*
1374-
* disable default_idle() to go to PAL_HALT
1373+
* Force idle() into poll mode
13751374
*/
1376-
update_pal_halt_status(0);
1375+
cpu_idle_poll_ctrl(true);
13771376

13781377
UNLOCK_PFS(flags);
13791378

@@ -1430,11 +1429,8 @@ pfm_unreserve_session(pfm_context_t *ctx, int is_syswide, unsigned int cpu)
14301429
is_syswide,
14311430
cpu));
14321431

1433-
/*
1434-
* if possible, enable default_idle() to go into PAL_HALT
1435-
*/
1436-
if (pfm_sessions.pfs_task_sessions == 0 && pfm_sessions.pfs_sys_sessions == 0)
1437-
update_pal_halt_status(1);
1432+
/* Undo forced polling. Last session reenables pal_halt */
1433+
cpu_idle_poll_ctrl(false);
14381434

14391435
UNLOCK_PFS(flags);
14401436

‎arch/ia64/kernel/process.c‎

Lines changed: 16 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -209,41 +209,13 @@ do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall)
209209
local_irq_disable(); /* force interrupt disable */
210210
}
211211

212-
static int pal_halt = 1;
213-
static int can_do_pal_halt = 1;
214-
215212
static int __init nohalt_setup(char * str)
216213
{
217-
pal_halt = can_do_pal_halt = 0;
214+
cpu_idle_poll_ctrl(true);
218215
return 1;
219216
}
220217
__setup("nohalt", nohalt_setup);
221218

222-
void
223-
update_pal_halt_status(int status)
224-
{
225-
can_do_pal_halt = pal_halt && status;
226-
}
227-
228-
/*
229-
* We use this if we don't have any better idle routine..
230-
*/
231-
void
232-
default_idle (void)
233-
{
234-
local_irq_enable();
235-
while (!need_resched()) {
236-
if (can_do_pal_halt) {
237-
local_irq_disable();
238-
if (!need_resched()) {
239-
safe_halt();
240-
}
241-
local_irq_enable();
242-
} else
243-
cpu_relax();
244-
}
245-
}
246-
247219
#ifdef CONFIG_HOTPLUG_CPU
248220
/* We don't actually take CPU down, just spin without interrupts. */
249221
static inline void play_dead(void)
@@ -270,47 +242,29 @@ static inline void play_dead(void)
270242
}
271243
#endif /* CONFIG_HOTPLUG_CPU */
272244

273-
void __attribute__((noreturn))
274-
cpu_idle (void)
245+
void arch_cpu_idle_dead(void)
246+
{
247+
play_dead();
248+
}
249+
250+
void arch_cpu_idle(void)
275251
{
276252
void (*mark_idle)(int) = ia64_mark_idle;
277-
int cpu = smp_processor_id();
278-
279-
/* endless idle loop with no priority at all */
280-
while (1) {
281-
rcu_idle_enter();
282-
if (can_do_pal_halt) {
283-
current_thread_info()->status &= ~TS_POLLING;
284-
/*
285-
* TS_POLLING-cleared state must be visible before we
286-
* test NEED_RESCHED:
287-
*/
288-
smp_mb();
289-
} else {
290-
current_thread_info()->status |= TS_POLLING;
291-
}
292253

293-
if (!need_resched()) {
294254
#ifdef CONFIG_SMP
295-
min_xtp();
255+
min_xtp();
296256
#endif
297-
rmb();
298-
if (mark_idle)
299-
(*mark_idle)(1);
257+
rmb();
258+
if (mark_idle)
259+
(*mark_idle)(1);
260+
261+
safe_halt();
300262

301-
default_idle();
302-
if (mark_idle)
303-
(*mark_idle)(0);
263+
if (mark_idle)
264+
(*mark_idle)(0);
304265
#ifdef CONFIG_SMP
305-
normal_xtp();
266+
normal_xtp();
306267
#endif
307-
}
308-
rcu_idle_exit();
309-
schedule_preempt_disabled();
310-
check_pgt_cache();
311-
if (cpu_is_offline(cpu))
312-
play_dead();
313-
}
314268
}
315269

316270
void

‎arch/ia64/kernel/smpboot.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ start_secondary (void *unused)
455455
preempt_disable();
456456
smp_callin();
457457

458-
cpu_idle();
458+
cpu_startup_entry(CPUHP_ONLINE);
459459
return 0;
460460
}
461461

0 commit comments

Comments
 (0)