From: Wei Liu <wei.liu2@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: elena.ufimtseva@oracle.com, wei.liu2@citrix.com,
konrad.wilk@oracle.com, andrew.cooper3@citrix.com,
daniel.kiper@oracle.com, ian.jackson@eu.citrix.com,
xen-devel@lists.xen.org, Eric DeVolder <eric.devolder@oracle.com>
Subject: Re: [PATCH v3] kexec: implement STATUS hypercall to check if image is loaded
Date: Wed, 18 Jan 2017 10:37:37 +0000 [thread overview]
Message-ID: <20170118103737.GO5089@citrix.com> (raw)
In-Reply-To: <587F4F550200007800131287@prv-mh.provo.novell.com>
On Wed, Jan 18, 2017 at 03:19:49AM -0700, Jan Beulich wrote:
> >>> On 17.01.17 at 18:29, <eric.devolder@oracle.com> wrote:
> > --- a/xen/common/kexec.c
> > +++ b/xen/common/kexec.c
> > @@ -1169,6 +1169,22 @@ static int kexec_unload(XEN_GUEST_HANDLE_PARAM(void) uarg)
> > return kexec_do_unload(&unload);
> > }
> >
> > +static int kexec_status(XEN_GUEST_HANDLE_PARAM(void) uarg)
> > +{
> > + xen_kexec_status_t status;
> > + int base, bit;
> > +
> > + if ( unlikely(copy_from_guest(&status, uarg, 1)) )
> > + return -EFAULT;
> > +
> > + /* No need to check KEXEC_FLAG_IN_PROGRESS. */
> > +
> > + if ( kexec_load_get_bits(status.type, &base, &bit) )
> > + return -EINVAL;
> > +
> > + return test_bit(bit, &kexec_flags);
>
> In the public header you promise to return zero or one here (unless
> an error occurs), which requires the use of !!. Please see x86's
> implementation of the function for how/when there can actually be
> other non-zero values returned here (in particular all ones, which
> would resolve to -EPERM).
>
> > --- a/xen/include/public/kexec.h
> > +++ b/xen/include/public/kexec.h
> > @@ -227,6 +227,19 @@ typedef struct xen_kexec_unload {
> > } xen_kexec_unload_t;
> > DEFINE_XEN_GUEST_HANDLE(xen_kexec_unload_t);
> >
> > +/*
> > + * Figure out whether we have an image loaded. A return value of
> > + * zero indicates no image loaded. A return value of one
> > + * indicates an image is loaded. A negative return value
> > + * indicates an error.
> > + *
> > + * Type must be one of KEXEC_TYPE_DEFAULT or KEXEC_TYPE_CRASH.
> > + */
> > +#define KEXEC_CMD_kexec_status 6
> > +typedef struct xen_kexec_status {
> > + uint8_t type;
> > +} xen_kexec_status_t;
> > +DEFINE_XEN_GUEST_HANDLE(xen_kexec_status_t);
> > #else /* __XEN_INTERFACE_VERSION__ < 0x00040400 */
>
> There was a blank line above here before your addition, and you
> shouldn't eliminate it (making quickly scanning over the file harder).
>
> I guess both items are simple enough to fix while committing.
>
Oops, I already committed this patch with Andrew's review. A follow-up
patch is appreciated. Thanks.
Wei.
> Jan
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-01-18 10:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-17 17:29 [PATCH v3] kexec: implement STATUS hypercall to check if image is loaded Eric DeVolder
2017-01-17 20:41 ` Andrew Cooper
2017-01-17 22:09 ` Daniel Kiper
2017-01-18 9:47 ` Wei Liu
2017-01-18 10:19 ` Jan Beulich
2017-01-18 10:37 ` Wei Liu [this message]
2017-01-18 10:45 ` Jan Beulich
2017-01-18 10:47 ` Wei Liu
2017-01-18 17:48 ` Eric DeVolder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170118103737.GO5089@citrix.com \
--to=wei.liu2@citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=daniel.kiper@oracle.com \
--cc=elena.ufimtseva@oracle.com \
--cc=eric.devolder@oracle.com \
--cc=ian.jackson@eu.citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).