From: Jan Beulich <jbeulich@suse.com>
To: Paul Durrant <paul@xen.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Julien Grall <julien@xen.org>, Wei Liu <wl@xen.org>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Paul Durrant <pdurrant@amazon.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
George Dunlap <george.dunlap@citrix.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v5 4/5] common/domain: add a domain context record for shared_info...
Date: Fri, 22 May 2020 16:34:25 +0200 [thread overview]
Message-ID: <6090d080-e771-81fe-0b64-e25c7a8c52eb@suse.com> (raw)
In-Reply-To: <20200521161939.4508-5-paul@xen.org>
On 21.05.2020 18:19, Paul Durrant wrote:
> @@ -1649,6 +1650,70 @@ int continue_hypercall_on_cpu(
> return 0;
> }
>
> +static int save_shared_info(const struct domain *d, struct domain_context *c,
> + bool dry_run)
> +{
> + struct domain_shared_info_context ctxt = {
> +#ifdef CONFIG_COMPAT
> + .flags = has_32bit_shinfo(d) ? DOMAIN_SAVE_32BIT_SHINFO : 0,
> +#endif
> + .buffer_size = sizeof(shared_info_t),
But this size varies between native and compat.
> +static int load_shared_info(struct domain *d, struct domain_context *c)
> +{
> + struct domain_shared_info_context ctxt;
> + size_t hdr_size = offsetof(typeof(ctxt), buffer);
> + unsigned int i;
> + int rc;
> +
> + rc = DOMAIN_LOAD_BEGIN(SHARED_INFO, c, &i);
> + if ( rc )
> + return rc;
> +
> + if ( i ) /* expect only a single instance */
> + return -ENXIO;
> +
> + rc = domain_load_data(c, &ctxt, hdr_size);
> + if ( rc )
> + return rc;
> +
> + if ( ctxt.buffer_size != sizeof(shared_info_t) )
> + return -EINVAL;
While on the save side things could be left as they are (yet
I'd prefer a change), this should be flexible enough to allow
at least the smaller compat size as well in the compat case.
I wonder whether any smaller sizes might be acceptable, once
again with the rest getting zero-padded.
> + if ( ctxt.flags & DOMAIN_SAVE_32BIT_SHINFO )
> +#ifdef CONFIG_COMPAT
> + has_32bit_shinfo(d) = true;
> +#else
> + return -EINVAL;
> +#endif
Am I mis-remembering or was a check lost of the remaining
flags being zero? If I am, one needs adding in any case, imo.
Jan
next prev parent reply other threads:[~2020-05-22 14:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-21 16:19 [PATCH v5 0/5] domain context infrastructure Paul Durrant
2020-05-21 16:19 ` [PATCH v5 1/5] xen/common: introduce a new framework for save/restore of 'domain' context Paul Durrant
2020-05-22 14:24 ` Jan Beulich
2020-05-22 14:35 ` Durrant, Paul
2020-05-21 16:19 ` [PATCH v5 2/5] xen/common/domctl: introduce XEN_DOMCTL_get/setdomaincontext Paul Durrant
2020-05-21 16:19 ` [PATCH v5 3/5] tools/misc: add xen-domctx to present domain context Paul Durrant
2020-05-21 16:19 ` [PATCH v5 4/5] common/domain: add a domain context record for shared_info Paul Durrant
2020-05-22 14:34 ` Jan Beulich [this message]
2020-05-22 14:45 ` Durrant, Paul
2020-05-21 16:19 ` [PATCH v5 5/5] tools/libxc: make use of domain context SHARED_INFO record Paul Durrant
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=6090d080-e771-81fe-0b64-e25c7a8c52eb@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=julien@xen.org \
--cc=paul@xen.org \
--cc=pdurrant@amazon.com \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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).