public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -v3 1/7] kexec jump: clean up #ifdef and comments
@ 2008-08-12  3:14 Huang Ying
  2008-08-13  3:49 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Huang Ying @ 2008-08-12  3:14 UTC (permalink / raw)
  To: Eric W. Biederman, Pavel Machek, nigel, Rafael J. Wysocki,
	Andrew Morton, Vivek Goyal, mingo, Linus Torvalds
  Cc: linux-kernel, Kexec Mailing List

Move if (kexec_image->preserve_context) { ... } into #ifdef
CONFIG_KEXEC_JUMP to make code looks cleaner.

Fix no longer correct comments of kernel_kexec().

Signed-off-by: Huang Ying <ying.huang@intel.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>

---
 kernel/kexec.c |   17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -1426,11 +1426,9 @@ static int __init crash_save_vmcoreinfo_
 
 module_init(crash_save_vmcoreinfo_init)
 
-/**
- *	kernel_kexec - reboot the system
- *
- *	Move into place and start executing a preloaded standalone
- *	executable.  If nothing was preloaded return an error.
+/*
+ * Move into place and start executing a preloaded standalone
+ * executable.  If nothing was preloaded return an error.
  */
 int kernel_kexec(void)
 {
@@ -1443,8 +1441,8 @@ int kernel_kexec(void)
 		goto Unlock;
 	}
 
-	if (kexec_image->preserve_context) {
 #ifdef CONFIG_KEXEC_JUMP
+	if (kexec_image->preserve_context) {
 		mutex_lock(&pm_mutex);
 		pm_prepare_console();
 		error = freeze_processes();
@@ -1471,8 +1469,9 @@ int kernel_kexec(void)
 		if (error)
 			goto Enable_irqs;
 		save_processor_state();
+	} else
 #endif
-	} else {
+	{
 		blocking_notifier_call_chain(&reboot_notifier_list,
 					     SYS_RESTART, NULL);
 		system_state = SYSTEM_RESTART;
@@ -1484,8 +1483,8 @@ int kernel_kexec(void)
 
 	machine_kexec(kexec_image);
 
-	if (kexec_image->preserve_context) {
 #ifdef CONFIG_KEXEC_JUMP
+	if (kexec_image->preserve_context) {
 		restore_processor_state();
 		device_power_up(PMSG_RESTORE);
  Enable_irqs:
@@ -1499,8 +1498,8 @@ int kernel_kexec(void)
  Restore_console:
 		pm_restore_console();
 		mutex_unlock(&pm_mutex);
-#endif
 	}
+#endif
 
  Unlock:
 	xchg(&kexec_lock, 0);



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

* Re: [PATCH -v3 1/7] kexec jump: clean up #ifdef and comments
  2008-08-12  3:14 [PATCH -v3 1/7] kexec jump: clean up #ifdef and comments Huang Ying
@ 2008-08-13  3:49 ` Andrew Morton
  2008-08-13  4:44   ` Huang Ying
  2008-08-13  4:47   ` Eric W. Biederman
  0 siblings, 2 replies; 4+ messages in thread
From: Andrew Morton @ 2008-08-13  3:49 UTC (permalink / raw)
  To: Huang Ying
  Cc: Eric W. Biederman, Pavel Machek, nigel, Rafael J. Wysocki,
	Vivek Goyal, mingo, Linus Torvalds, linux-kernel,
	Kexec Mailing List

On Tue, 12 Aug 2008 11:14:21 +0800 Huang Ying <ying.huang@intel.com> wrote:

>  	xchg(&kexec_lock, 0);

kernel/kexec.c: In function 'kernel_kexec':
kernel/kexec.c:1501: warning: value computed is not used

Is there any reason why we cannot use the more conventional
test_and_set_bit() etc, rather than this peculiarity?

Or perhaps spin_trylock?

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

* Re: [PATCH -v3 1/7] kexec jump: clean up #ifdef and comments
  2008-08-13  3:49 ` Andrew Morton
@ 2008-08-13  4:44   ` Huang Ying
  2008-08-13  4:47   ` Eric W. Biederman
  1 sibling, 0 replies; 4+ messages in thread
From: Huang Ying @ 2008-08-13  4:44 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Eric W. Biederman, Pavel Machek, nigel, Rafael J. Wysocki,
	Vivek Goyal, mingo, Linus Torvalds, linux-kernel,
	Kexec Mailing List

On Tue, 2008-08-12 at 20:49 -0700, Andrew Morton wrote:
> On Tue, 12 Aug 2008 11:14:21 +0800 Huang Ying <ying.huang@intel.com> wrote:
> 
> >  	xchg(&kexec_lock, 0);
> 
> kernel/kexec.c: In function 'kernel_kexec':
> kernel/kexec.c:1501: warning: value computed is not used
> 
> Is there any reason why we cannot use the more conventional
> test_and_set_bit() etc, rather than this peculiarity?
> 
> Or perhaps spin_trylock?

Hi, Andrew,

I think it is of no problem to replace xchg() with test_and_set_bit() or
spin_trylock().

Hi, Eric,

Do you have some reason to use xchg() instead of others?

Best Regards,
Huang Ying



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

* Re: [PATCH -v3 1/7] kexec jump: clean up #ifdef and comments
  2008-08-13  3:49 ` Andrew Morton
  2008-08-13  4:44   ` Huang Ying
@ 2008-08-13  4:47   ` Eric W. Biederman
  1 sibling, 0 replies; 4+ messages in thread
From: Eric W. Biederman @ 2008-08-13  4:47 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Huang Ying, Pavel Machek, nigel, Rafael J. Wysocki, Vivek Goyal,
	mingo, Linus Torvalds, linux-kernel, Kexec Mailing List

Andrew Morton <akpm@linux-foundation.org> writes:

> On Tue, 12 Aug 2008 11:14:21 +0800 Huang Ying <ying.huang@intel.com> wrote:
>
>>  	xchg(&kexec_lock, 0);
>
> kernel/kexec.c: In function 'kernel_kexec':
> kernel/kexec.c:1501: warning: value computed is not used

A good question is why we are warned.

> Is there any reason why we cannot use the more conventional
> test_and_set_bit() etc, rather than this peculiarity?
>
> Or perhaps spin_trylock?

Totally odd.

Let me stop and take a look and see what has been changed.  The original
code used a xchg based read copy update scheme, which was extremely
compatible with a lot of goals.  The primary one being no blocking paths
in a successful kexec, and minimal dependence on library functions.

We need that minimal dependence to handle the kexec on panic case.

That doesn't rule out something like test_and_set_bit.

Eric

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

end of thread, other threads:[~2008-08-13  4:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-12  3:14 [PATCH -v3 1/7] kexec jump: clean up #ifdef and comments Huang Ying
2008-08-13  3:49 ` Andrew Morton
2008-08-13  4:44   ` Huang Ying
2008-08-13  4:47   ` Eric W. Biederman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox