[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1215565962.16450.8.camel@caritas-dev.intel.com>
Date: Wed, 09 Jul 2008 09:12:42 +0800
From: Huang Ying <ying.huang@...el.com>
To: Pavel Machek <pavel@...e.cz>
Cc: "Eric W. Biederman" <ebiederm@...ssion.com>,
nigel@...el.suspend2.net, "Rafael J. Wysocki" <rjw@...k.pl>,
Andrew Morton <akpm@...ux-foundation.org>,
Vivek Goyal <vgoyal@...hat.com>, linux-kernel@...r.kernel.org,
linux-pm@...ts.linux-foundation.org,
Kexec Mailing List <kexec@...ts.infradead.org>
Subject: Re: [PATCH -mm 1/2] kexec jump -v12: kexec jump
Hi, Pavel,
On Tue, 2008-07-08 at 12:40 +0200, Pavel Machek wrote:
> Hi!
>
> > > > @@ -1411,3 +1421,50 @@ static int __init crash_save_vmcoreinfo_
> > > > }
> > > >
> > > > module_init(crash_save_vmcoreinfo_init)
> > > > +
> > > > +/**
> > > > + * kernel_kexec - reboot the system
> >
> > > Really?
> >
> > I will change the comments to reflect the changes to kernel_kexec.
> >
> > > > + * Move into place and start executing a preloaded standalone
> > > > + * executable. If nothing was preloaded return an error.
> > > > + */
> > > > +int kernel_kexec(void)
> > > > +{
> > > > + int error = 0;
> > > > +
> > > > + if (xchg(&kexec_lock, 1))
> > > > + return -EBUSY;
> > >
> > > That's quite a strange way to provide a lock. mutex_trylock?
> >
> > I think this is because kexec_lock is used by crash_kexec() too, which
> > may be called in some extreme environment, such as during panic().
> >
> > > > + if (!kexec_image) {
> > > > + error = -EINVAL;
> > > > + goto Unlock;
> > > > + }
> > > > +
> > > > + if (kexec_image->preserve_context) {
> > > > +#ifdef CONFIG_KEXEC_JUMP
> > > > + local_irq_disable();
> > > > + save_processor_state();
> > >
> > > #else
> > > BUG()
> > >
> > > ...because otherwise you silently do nothing?
> > >
> > > > +#endif
> >
> > If CONFIG_KEXEC_JUMP is defined, kexec_image->preserve_context will
> > always be 0. So current code is safe. Here, #ifdef is used to resolve
> > the dependency issue. For example, save_processor_state() may be
> > undefined if CONFIG_KEXEC_JUMP is not defined.
>
> Move the #ifdef outside the if (), then, so this is clear?
I think this is reasonable, I will do it.
> Actually, if preserve_context is always zero in !KEXEC_JUMP case, it
> might make sense to remove whole variable...
I think this will add too many #ifndef CONFIG_KEXEC_JUMP ... #endif that
is necessary. The memory and performance gain is too little to
compensate the code readability reduction.
Best Regards,
Huang Ying
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists