* [Linux-ia64] Re: 2.5.69 process.c: cpu_idle() cleanup
@ 2003-05-12 23:31 David Mosberger
2003-05-13 0:41 ` Jes Sorensen
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: David Mosberger @ 2003-05-12 23:31 UTC (permalink / raw)
To: linux-ia64
>>>>> On Sun, 11 May 2003 14:33:48 -0400, Jes Sorensen <jes@wildopensource.com> said:
Jes> Hi David. Looking at the 2.5.69 cpu_idle() code and noticing
Jes> that it has some SGI specific hooks in it. However I can see
Jes> other platforms having leds or lcds or something else they want
Jes> to flash or play little jingles when the box is idle.
Jes> As such I suggest we make these hooks that any platform can
Jes> register. Adding the extra code to the idle loop doesn't seem
Jes> all that expensive ;-)
Is this a real need or is this just something hypothetical? If the
latter, I'd rather leave what's there now.
--david
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Linux-ia64] Re: 2.5.69 process.c: cpu_idle() cleanup
2003-05-12 23:31 [Linux-ia64] Re: 2.5.69 process.c: cpu_idle() cleanup David Mosberger
@ 2003-05-13 0:41 ` Jes Sorensen
2003-05-13 0:48 ` David Mosberger
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Jes Sorensen @ 2003-05-13 0:41 UTC (permalink / raw)
To: linux-ia64
>>>>> "David" = David Mosberger <davidm@napali.hpl.hp.com> writes:
David> Is this a real need or is this just something hypothetical? If
David> the latter, I'd rather leave what's there now.
Hi David,
The problem with the current code is that it doesn't work for generic
kernels and for the SN2 we really like to have this feature in place.
The PROM allows you to go in and look at the led status even if the
kernel has hung.
The other reason was that I was trying to get rid of SN specific
features from generic files and having a more generic API for this
seemed useful to me.
So to answer your question, yes I think there is a real use for this.
Cheers,
Jes
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Linux-ia64] Re: 2.5.69 process.c: cpu_idle() cleanup
2003-05-12 23:31 [Linux-ia64] Re: 2.5.69 process.c: cpu_idle() cleanup David Mosberger
2003-05-13 0:41 ` Jes Sorensen
@ 2003-05-13 0:48 ` David Mosberger
2003-05-13 2:09 ` Jes Sorensen
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: David Mosberger @ 2003-05-13 0:48 UTC (permalink / raw)
To: linux-ia64
>>>>> On 12 May 2003 20:41:03 -0400, Jes Sorensen <jes@wildopensource.com> said:
>>>>> "David" = David Mosberger <davidm@napali.hpl.hp.com> writes:
David> Is this a real need or is this just something hypothetical?
David> If the latter, I'd rather leave what's there now.
Jes> The problem with the current code is that it doesn't work for
Jes> generic kernels and for the SN2 we really like to have this
Jes> feature in place. The PROM allows you to go in and look at the
Jes> led status even if the kernel has hung.
Jes> The other reason was that I was trying to get rid of SN
Jes> specific features from generic files and having a more generic
Jes> API for this seemed useful to me.
Jes> So to answer your question, yes I think there is a real use for
Jes> this.
OK, I can probably live with that argument. However, let's make it a
platform vector then (which I was opposed to back when) and make it a
single function (e.g., "mark_idle"), which takes an "idleness"
argument.
--david
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Linux-ia64] Re: 2.5.69 process.c: cpu_idle() cleanup
2003-05-12 23:31 [Linux-ia64] Re: 2.5.69 process.c: cpu_idle() cleanup David Mosberger
2003-05-13 0:41 ` Jes Sorensen
2003-05-13 0:48 ` David Mosberger
@ 2003-05-13 2:09 ` Jes Sorensen
2003-05-13 6:51 ` David Mosberger
2003-05-13 18:33 ` Jes Sorensen
4 siblings, 0 replies; 6+ messages in thread
From: Jes Sorensen @ 2003-05-13 2:09 UTC (permalink / raw)
To: linux-ia64
>>>>> "David" = David Mosberger <davidm@napali.hpl.hp.com> writes:
David> OK, I can probably live with that argument. However, let's
David> make it a platform vector then (which I was opposed to back
David> when) and make it a single function (e.g., "mark_idle"), which
David> takes an "idleness" argument.
Hi David,
It was actually a deliberate decision of mine to not make it a machine
vector, because this was meant to be an optional feature. With a
machine vector one always ends up calling a dummy function on
platforms that do not wish to do anything here.
I'll be happy to change it over to a machine vector if you still
prefer, let me know.
Cheers,
Jes
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Linux-ia64] Re: 2.5.69 process.c: cpu_idle() cleanup
2003-05-12 23:31 [Linux-ia64] Re: 2.5.69 process.c: cpu_idle() cleanup David Mosberger
` (2 preceding siblings ...)
2003-05-13 2:09 ` Jes Sorensen
@ 2003-05-13 6:51 ` David Mosberger
2003-05-13 18:33 ` Jes Sorensen
4 siblings, 0 replies; 6+ messages in thread
From: David Mosberger @ 2003-05-13 6:51 UTC (permalink / raw)
To: linux-ia64
>>>>> On 12 May 2003 22:09:17 -0400, Jes Sorensen <jes@wildopensource.com> said:
Jes> It was actually a deliberate decision of mine to not make it a machine
Jes> vector, because this was meant to be an optional feature. With a
Jes> machine vector one always ends up calling a dummy function on
Jes> platforms that do not wish to do anything here.
Jes> I'll be happy to change it over to a machine vector if you still
Jes> prefer, let me know.
It doesn't make a huge difference either way. But I definitely want
there to be only a single function/callback. In fact, if you load the
function pointer into a local variable, the load (and NULL check) can
be amortized across both calls and we can rest assured that we squeze
every single cycle out of the idle loop! ;-)
(Actually, on the more serious side, we don't want to waste CPU cycles
outright in the idle loop either, as that could negatively affect
power consumption---not that it makes a huge difference on current
generation CPUs.)
--david
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Linux-ia64] Re: 2.5.69 process.c: cpu_idle() cleanup
2003-05-12 23:31 [Linux-ia64] Re: 2.5.69 process.c: cpu_idle() cleanup David Mosberger
` (3 preceding siblings ...)
2003-05-13 6:51 ` David Mosberger
@ 2003-05-13 18:33 ` Jes Sorensen
4 siblings, 0 replies; 6+ messages in thread
From: Jes Sorensen @ 2003-05-13 18:33 UTC (permalink / raw)
To: linux-ia64
>>>>> "David" = David Mosberger <davidm@napali.hpl.hp.com> writes:
David> It doesn't make a huge difference either way. But I definitely
David> want there to be only a single function/callback. In fact, if
David> you load the function pointer into a local variable, the load
David> (and NULL check) can be amortized across both calls and we can
David> rest assured that we squeze every single cycle out of the idle
David> loop! ;-)
Here you go!
A top tuned idle loop, just as you all dreamed of last Christmas and
were really disappointed when your dream didn't come true! This time
it did, so start dancing around the Christmas tree!
This one goes on top of the gettimeoffset() patch as well.
Cheers,
Jes
diff -urN -X /home/jes/exclude-linux linux-2.5.69-030509-timer/arch/ia64/kernel/process.c linux-2.5.69-030509/arch/ia64/kernel/process.c
--- linux-2.5.69-030509-timer/arch/ia64/kernel/process.c Sun May 11 10:53:49 2003
+++ linux-2.5.69-030509/arch/ia64/kernel/process.c Tue May 13 13:20:32 2003
@@ -33,16 +33,15 @@
#include <asm/unwind.h>
#include <asm/user.h>
-#ifdef CONFIG_IA64_SGI_SN
-#include <asm/sn/idle.h>
-#endif
-
#ifdef CONFIG_PERFMON
# include <asm/perfmon.h>
#endif
#include "sigframe.h"
+void (*ia64_mark_idle)(int);
+
+
void
ia64_do_show_stack (struct unw_frame_info *info, void *arg)
{
@@ -175,6 +174,8 @@
void __attribute__((noreturn))
cpu_idle (void *unused)
{
+ register void (*__mark_idle)(int) = ia64_mark_idle;
+
/* endless idle loop with no priority at all */
while (1) {
void (*idle)(void) = pm_idle;
@@ -187,15 +188,13 @@
#endif
while (!need_resched()) {
-#ifdef CONFIG_IA64_SGI_SN
- snidle();
-#endif
+ if (__mark_idle)
+ (*__mark_idle)(1);
(*idle)();
}
-#ifdef CONFIG_IA64_SGI_SN
- snidleoff();
-#endif
+ if (__mark_idle)
+ (*__mark_idle)(0);
#ifdef CONFIG_SMP
normal_xtp();
diff -urN -X /home/jes/exclude-linux linux-2.5.69-030509-timer/arch/ia64/sn/kernel/idle.c linux-2.5.69-030509/arch/ia64/sn/kernel/idle.c
--- linux-2.5.69-030509-timer/arch/ia64/sn/kernel/idle.c Wed Dec 31 19:00:00 1969
+++ linux-2.5.69-030509/arch/ia64/sn/kernel/idle.c Mon May 12 22:28:48 2003
@@ -0,0 +1,36 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (c) 2001-2003 Silicon Graphics, Inc. All rights reserved.
+ */
+
+#include <linux/config.h>
+#include <asm/sn/leds.h>
+#include <asm/sn/simulator.h>
+
+void snidle(int state) {
+ if (state) {
+ if (pda.idle_flag = 0) {
+ /*
+ * Turn the activity LED off.
+ */
+ set_led_bits(0, LED_CPU_ACTIVITY);
+ }
+
+#ifdef CONFIG_IA64_SGI_SN_SIM
+ if (IS_RUNNING_ON_SIMULATOR())
+ SIMULATOR_SLEEP();
+#endif
+
+ pda.idle_flag = 1;
+ } else {
+ /*
+ * Turn the activity LED on.
+ */
+ set_led_bits(LED_CPU_ACTIVITY, LED_CPU_ACTIVITY);
+
+ pda.idle_flag = 0;
+ }
+}
diff -urN -X /home/jes/exclude-linux linux-2.5.69-030509-timer/arch/ia64/sn/kernel/setup.c linux-2.5.69-030509/arch/ia64/sn/kernel/setup.c
--- linux-2.5.69-030509-timer/arch/ia64/sn/kernel/setup.c Sun May 11 14:27:17 2003
+++ linux-2.5.69-030509/arch/ia64/sn/kernel/setup.c Tue May 13 14:23:35 2003
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1999,2001-2002 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (C) 1999,2001-2003 Silicon Graphics, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License
@@ -79,6 +79,8 @@
extern void bte_init_node (nodepda_t *, cnodeid_t);
extern void bte_init_cpu (void);
extern void sn_timer_init (void);
+extern void (*ia64_mark_idle)(int);
+extern void snidle(int);
unsigned long sn_rtc_cycles_per_second;
@@ -304,6 +306,8 @@
current->thread.flags |= IA64_THREAD_FPEMU_NOPRINT;
sn_timer_init();
+
+ ia64_mark_idle = &snidle;
}
/**
diff -urN -X /home/jes/exclude-linux linux-2.5.69-030509-timer/include/asm-ia64/sn/idle.h linux-2.5.69-030509/include/asm-ia64/sn/idle.h
--- linux-2.5.69-030509-timer/include/asm-ia64/sn/idle.h Sun May 4 19:53:32 2003
+++ linux-2.5.69-030509/include/asm-ia64/sn/idle.h Wed Dec 31 19:00:00 1969
@@ -1,57 +0,0 @@
-#ifndef _ASM_IA64_SN_IDLE_H
-#define _ASM_IA64_SN_IDLE_H
-
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (c) 2001-2002 Silicon Graphics, Inc. All rights reserved.
- */
-
-#include <linux/config.h>
-#include <asm/sn/leds.h>
-#include <asm/sn/simulator.h>
-
-static __inline__ void
-snidle(void) {
-#if 0
-#ifdef CONFIG_IA64_SGI_AUTOTEST
- {
- extern int autotest_enabled;
- if (autotest_enabled) {
- extern void llsc_main(int);
- llsc_main(smp_processor_id());
- }
- }
-#endif
-
- if (pda.idle_flag = 0) {
- /*
- * Turn the activity LED off.
- */
- set_led_bits(0, LED_CPU_ACTIVITY);
- }
-
-#ifdef CONFIG_IA64_SGI_SN_SIM
- if (IS_RUNNING_ON_SIMULATOR())
- SIMULATOR_SLEEP();
-#endif
-
- pda.idle_flag = 1;
-#endif
-}
-
-static __inline__ void
-snidleoff(void) {
-#if 0
- /*
- * Turn the activity LED on.
- */
- set_led_bits(LED_CPU_ACTIVITY, LED_CPU_ACTIVITY);
-
- pda.idle_flag = 0;
-#endif
-}
-
-#endif /* _ASM_IA64_SN_IDLE_H */
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-05-13 18:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-12 23:31 [Linux-ia64] Re: 2.5.69 process.c: cpu_idle() cleanup David Mosberger
2003-05-13 0:41 ` Jes Sorensen
2003-05-13 0:48 ` David Mosberger
2003-05-13 2:09 ` Jes Sorensen
2003-05-13 6:51 ` David Mosberger
2003-05-13 18:33 ` Jes Sorensen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox