LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/1] export native versions of machine_ops functions
@ 2008-03-05 17:44 Glauber Costa
  2008-03-06 10:55 ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Glauber Costa @ 2008-03-05 17:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, glommer, mingo, tglx, Glauber Costa

People overriding machine_ops provided functions may want to
call the native version after its pre-processing. It already
happens for the smp_ops functions, so I don't see a reason
for avoiding it here.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 arch/x86/kernel/reboot.c |   10 +++++-----
 include/asm-x86/reboot.h |    5 +++++
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 7fd6ac4..8b577f1 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -326,7 +326,7 @@ static inline void kb_wait(void)
 	}
 }
 
-static void native_machine_emergency_restart(void)
+void native_machine_emergency_restart(void)
 {
 	int i;
 
@@ -376,7 +376,7 @@ #endif
 	}
 }
 
-static void native_machine_shutdown(void)
+void native_machine_shutdown(void)
 {
 	/* Stop the cpus and apics */
 #ifdef CONFIG_SMP
@@ -420,7 +420,7 @@ #ifdef CONFIG_X86_64
 #endif
 }
 
-static void native_machine_restart(char *__unused)
+void native_machine_restart(char *__unused)
 {
 	printk("machine restart\n");
 
@@ -429,11 +429,11 @@ static void native_machine_restart(char 
 	machine_emergency_restart();
 }
 
-static void native_machine_halt(void)
+void native_machine_halt(void)
 {
 }
 
-static void native_machine_power_off(void)
+void native_machine_power_off(void)
 {
 	if (pm_power_off) {
 		if (!reboot_force)
diff --git a/include/asm-x86/reboot.h b/include/asm-x86/reboot.h
index e9e3ffc..fb1bdf1 100644
--- a/include/asm-x86/reboot.h
+++ b/include/asm-x86/reboot.h
@@ -16,5 +16,10 @@ struct machine_ops
 extern struct machine_ops machine_ops;
 
 void machine_real_restart(unsigned char *code, int length);
+void native_machine_emergency_restart(void);
+void native_machine_shutdown(void);
+void native_machine_restart(char *__unused);
+void native_machine_halt(void);
+void native_machine_power_off(void);
 
 #endif	/* _ASM_REBOOT_H */
-- 
1.4.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] export native versions of machine_ops functions
  2008-03-05 17:44 [PATCH 1/1] export native versions of machine_ops functions Glauber Costa
@ 2008-03-06 10:55 ` Ingo Molnar
  2008-03-06 11:49   ` Glauber Costa
  0 siblings, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2008-03-06 10:55 UTC (permalink / raw)
  To: Glauber Costa; +Cc: linux-kernel, akpm, glommer, tglx


* Glauber Costa <gcosta@redhat.com> wrote:

> People overriding machine_ops provided functions may want to call the 
> native version after its pre-processing. It already happens for the 
> smp_ops functions, so I don't see a reason for avoiding it here.

i'd like to do this only if there are actual users - otherwise we'll get 
a trickle of "make needlessly global functions static" patches a few 
weeks later ;-)

	Ingo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] export native versions of machine_ops functions
  2008-03-06 10:55 ` Ingo Molnar
@ 2008-03-06 11:49   ` Glauber Costa
  2008-03-06 12:13     ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Glauber Costa @ 2008-03-06 11:49 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Glauber Costa, linux-kernel, akpm, tglx

On Thu, Mar 6, 2008 at 7:55 AM, Ingo Molnar <mingo@elte.hu> wrote:
>
>  * Glauber Costa <gcosta@redhat.com> wrote:
>
>  > People overriding machine_ops provided functions may want to call the
>  > native version after its pre-processing. It already happens for the
>  > smp_ops functions, so I don't see a reason for avoiding it here.
>
>  i'd like to do this only if there are actual users - otherwise we'll get
>  a trickle of "make needlessly global functions static" patches a few
>  weeks later ;-)
>
>         Ingo
>

KVM is a user for that. Because it registers a memory area in which
the host will be continually writting to (the clock), when it
shutdown, the host
have no way to know it has to stop. If you're really shutting down,
there's no problem. But if you're kexecing, for example, the host will
keep writting to a random
memory area after the new kernel installs.


-- 
Glauber  Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] export native versions of machine_ops functions
  2008-03-06 11:49   ` Glauber Costa
@ 2008-03-06 12:13     ` Ingo Molnar
  2008-03-06 12:15       ` Avi Kivity
  0 siblings, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2008-03-06 12:13 UTC (permalink / raw)
  To: Glauber Costa; +Cc: Glauber Costa, linux-kernel, akpm, tglx


* Glauber Costa <glommer@gmail.com> wrote:

> >  i'd like to do this only if there are actual users - otherwise 
> >  we'll get a trickle of "make needlessly global functions static" 
> >  patches a few weeks later ;-)
> 
> KVM is a user for that. Because it registers a memory area in which 
> the host will be continually writting to (the clock), when it 
> shutdown, the host have no way to know it has to stop. If you're 
> really shutting down, there's no problem. But if you're kexecing, for 
> example, the host will keep writting to a random memory area after the 
> new kernel installs.

i mean, i agree in general - but KVM is not a user of any of those 
currently static functions. So i've applied your patch but lets make 
sure those functions really get used :)

	Ingo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] export native versions of machine_ops functions
  2008-03-06 12:13     ` Ingo Molnar
@ 2008-03-06 12:15       ` Avi Kivity
  2008-03-06 12:28         ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Avi Kivity @ 2008-03-06 12:15 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Glauber Costa, Glauber Costa, linux-kernel, akpm, tglx

Ingo Molnar wrote:
> * Glauber Costa <glommer@gmail.com> wrote:
>
>   
>>>  i'd like to do this only if there are actual users - otherwise 
>>>  we'll get a trickle of "make needlessly global functions static" 
>>>  patches a few weeks later ;-)
>>>       
>> KVM is a user for that. Because it registers a memory area in which 
>> the host will be continually writting to (the clock), when it 
>> shutdown, the host have no way to know it has to stop. If you're 
>> really shutting down, there's no problem. But if you're kexecing, for 
>> example, the host will keep writting to a random memory area after the 
>> new kernel installs.
>>     
>
> i mean, i agree in general - but KVM is not a user of any of those 
> currently static functions. So i've applied your patch but lets make 
> sure those functions really get used :)
>   

The user will be in my 2.6.26 queue.  Unfortunately it means a 
dependency between kvm.git and x86.git, again.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] export native versions of machine_ops functions
  2008-03-06 12:15       ` Avi Kivity
@ 2008-03-06 12:28         ` Ingo Molnar
  0 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2008-03-06 12:28 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Glauber Costa, Glauber Costa, linux-kernel, akpm, tglx


* Avi Kivity <avi@qumranet.com> wrote:

>> i mean, i agree in general - but KVM is not a user of any of those 
>> currently static functions. So i've applied your patch but lets make 
>> sure those functions really get used :)
>
> The user will be in my 2.6.26 queue.  Unfortunately it means a 
> dependency between kvm.git and x86.git, again.

a couple of solutions:

- add the same patch to kvm.git (find it below), integrators 
  ought to be able to detect and exclude it

- i could start an x86.git#core tree that would include the for-linus 
  bits and any agreed-upon infrastructure changes [like this one]. (but 
  it would not include any other more experimental x86.git bits) You 
  could base kvm.git on that and track it. This makes integration even 
  easier because the commit IDs would be the same and git would be able 
  to resolve it. [but note, x86.git#core would not be an append-only 
  tree, it's a daily-rebased tree]

	Ingo

------------------>
Subject: x86: export native versions of machine_ops functions
From: Glauber Costa <gcosta@redhat.com>
Date: Wed, 5 Mar 2008 14:44:00 -0300

People overriding machine_ops provided functions may want to
call the native version after its pre-processing. It already
happens for the smp_ops functions, so I don't see a reason
for avoiding it here.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/reboot.c |   10 +++++-----
 include/asm-x86/reboot.h |    5 +++++
 2 files changed, 10 insertions(+), 5 deletions(-)

Index: linux-x86.q/arch/x86/kernel/reboot.c
===================================================================
--- linux-x86.q.orig/arch/x86/kernel/reboot.c
+++ linux-x86.q/arch/x86/kernel/reboot.c
@@ -326,7 +326,7 @@ static inline void kb_wait(void)
 	}
 }
 
-static void native_machine_emergency_restart(void)
+void native_machine_emergency_restart(void)
 {
 	int i;
 
@@ -376,7 +376,7 @@ static void native_machine_emergency_res
 	}
 }
 
-static void native_machine_shutdown(void)
+void native_machine_shutdown(void)
 {
 	/* Stop the cpus and apics */
 #ifdef CONFIG_SMP
@@ -432,7 +432,7 @@ static void native_machine_shutdown(void
 #endif
 }
 
-static void native_machine_restart(char *__unused)
+void native_machine_restart(char *__unused)
 {
 	printk("machine restart\n");
 
@@ -441,11 +441,11 @@ static void native_machine_restart(char 
 	machine_emergency_restart();
 }
 
-static void native_machine_halt(void)
+void native_machine_halt(void)
 {
 }
 
-static void native_machine_power_off(void)
+void native_machine_power_off(void)
 {
 	if (pm_power_off) {
 		if (!reboot_force)
Index: linux-x86.q/include/asm-x86/reboot.h
===================================================================
--- linux-x86.q.orig/include/asm-x86/reboot.h
+++ linux-x86.q/include/asm-x86/reboot.h
@@ -16,5 +16,10 @@ struct machine_ops
 extern struct machine_ops machine_ops;
 
 void machine_real_restart(unsigned char *code, int length);
+void native_machine_emergency_restart(void);
+void native_machine_shutdown(void);
+void native_machine_restart(char *__unused);
+void native_machine_halt(void);
+void native_machine_power_off(void);
 
 #endif	/* _ASM_REBOOT_H */

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-03-06 12:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-05 17:44 [PATCH 1/1] export native versions of machine_ops functions Glauber Costa
2008-03-06 10:55 ` Ingo Molnar
2008-03-06 11:49   ` Glauber Costa
2008-03-06 12:13     ` Ingo Molnar
2008-03-06 12:15       ` Avi Kivity
2008-03-06 12:28         ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).