All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: paul@xen.org
Cc: xen-devel@lists.xenproject.org,
	'Paul Durrant' <pdurrant@amazon.com>,
	'Ian Jackson' <ian.jackson@eu.citrix.com>, 'Wei Liu' <wl@xen.org>,
	'Andrew Cooper' <andrew.cooper3@citrix.com>,
	'George Dunlap' <george.dunlap@citrix.com>,
	'Julien Grall' <julien@xen.org>,
	'Stefano Stabellini' <sstabellini@kernel.org>
Subject: Re: [PATCH v7 7/9] common/domain: add a domain context record for shared_info...
Date: Mon, 7 Sep 2020 09:01:15 +0200	[thread overview]
Message-ID: <174bb33f-9acb-dc52-76d1-e1ad7a350dc1@suse.com> (raw)
In-Reply-To: <003501d682e0$f4e8a1e0$deb9e5a0$@xen.org>

On 04.09.2020 19:29, Paul Durrant wrote:
>> From: Jan Beulich <jbeulich@suse.com>
>> Sent: 26 August 2020 14:58
>>
>> On 18.08.2020 12:30, Paul Durrant wrote:
>>> v7:
>>>  - Only restore vcpu_info and arch sub-structures for PV domains, to match
>>>    processing of SHARED_INFO in xc_sr_restore_x86_pv.c
>>
>> Since you point out this original logic, ...
>>
>>> +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) ||
>>> +         (ctxt.flags & ~DOMAIN_SAVE_32BIT_SHINFO) )
>>> +        return -EINVAL;
>>> +
>>> +    if ( ctxt.flags & DOMAIN_SAVE_32BIT_SHINFO )
>>> +    {
>>> +#ifdef CONFIG_COMPAT
>>> +        has_32bit_shinfo(d) = true;
>>> +#else
>>> +        return -EINVAL;
>>> +#endif
>>> +    }
>>> +
>>> +    if ( is_pv_domain(d) )
>>> +    {
>>> +        shared_info_t *shinfo = xmalloc(shared_info_t);
>>> +
>>> +        rc = domain_load_data(c, shinfo, sizeof(*shinfo));
>>> +        if ( rc )
>>> +        {
>>> +            xfree(shinfo);
>>> +            return rc;
>>> +        }
>>> +
>>> +#ifdef CONFIG_COMPAT
>>> +        if ( has_32bit_shinfo(d) )
>>> +        {
>>> +            memcpy(&d->shared_info->compat.vcpu_info,
>>> +                   &shinfo->compat.vcpu_info,
>>> +                   sizeof(d->shared_info->compat.vcpu_info));
>>> +            memcpy(&d->shared_info->compat.arch,
>>> +                   &shinfo->compat.arch,
>>> +                   sizeof(d->shared_info->compat.vcpu_info));
>>> +        }
>>> +        else
>>> +        {
>>> +            memcpy(&d->shared_info->native.vcpu_info,
>>> +                   &shinfo->native.vcpu_info,
>>> +                   sizeof(d->shared_info->native.vcpu_info));
>>> +            memcpy(&d->shared_info->native.arch,
>>> +                   &shinfo->native.arch,
>>> +                   sizeof(d->shared_info->native.arch));
>>> +        }
>>> +#else
>>> +        memcpy(&d->shared_info->vcpu_info,
>>> +               &shinfo->vcpu_info,
>>> +               sizeof(d->shared_info->vcpu_info));
>>> +        memcpy(&d->shared_info->arch,
>>> +               &shinfo->arch,
>>> +               sizeof(d->shared_info->shared));
>>> +#endif
>>
>> ... where does the rest of that logic (resetting of
>> arch.pfn_to_mfn_frame_list_list, evtchn_pending, evtchn_mask, and
>> evtchn_pending_sel) get done? Or why is it not needed anymore?
> 
> The resetting logic is still in xc_sr_restore_x86_pv.c (see patch #6).
> It's going to need to stay there anyway to deal with older streams so
> I made it common to both cases; it seems slightly separate from
> restoring the shared info.

I guess I at least don't fully agree: The resetting is part of restoring,
as it effectively determines which parts are restored and which parts
are simply set (not truly reset, but I agree the perception may change
depending on whose position you take). Hence at the very least this
aspect wants clearly spelling out in the description, I think. But
really I'd prefer if for old streams libxc took care of (all of) it,
and if for new streams all logic lived in the hypervisor.

Jan


  reply	other threads:[~2020-09-07  7:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-18 10:30 [PATCH v7 0/9] domain context infrastructure Paul Durrant
2020-08-18 10:30 ` [PATCH v7 1/9] xen/common: introduce a new framework for save/restore of 'domain' context Paul Durrant
2020-08-26 13:32   ` Jan Beulich
2020-08-26 13:53     ` Jan Beulich
2020-09-04 17:31       ` Paul Durrant
2020-08-18 10:30 ` [PATCH v7 2/9] xen/common/domctl: introduce XEN_DOMCTL_get/setdomaincontext Paul Durrant
2020-08-18 10:30 ` [PATCH v7 3/9] tools/misc: add xen-domctx to present domain context Paul Durrant
2020-08-18 10:30 ` [PATCH v7 4/9] docs/specs: add missing definitions to libxc-migration-stream Paul Durrant
2020-08-18 10:30 ` [PATCH v7 5/9] docs / tools: specific migration v4 to include DOMAIN_CONTEXT Paul Durrant
2020-08-18 10:30 ` [PATCH v7 6/9] tools/libxc: split restore handler handle_shared_info() functionality Paul Durrant
2020-08-18 10:30 ` [PATCH v7 7/9] common/domain: add a domain context record for shared_info Paul Durrant
2020-08-26 13:57   ` Jan Beulich
2020-09-04 17:29     ` Paul Durrant
2020-09-07  7:01       ` Jan Beulich [this message]
2020-09-07  7:11         ` [EXTERNAL] " Paul Durrant
2020-09-15 14:20       ` Durrant, Paul
2020-08-18 10:30 ` [PATCH v7 8/9] x86/time: add a domain context record for tsc_info Paul Durrant
2020-08-26 14:02   ` Jan Beulich
2020-08-28 11:08     ` [EXTERNAL] " Paul Durrant
2020-08-28 15:53       ` Jan Beulich
2020-08-28 16:36         ` Paul Durrant
2020-08-31  7:23           ` Jan Beulich
2020-08-18 10:30 ` [PATCH v7 9/9] tools/libxc: add DOMAIN_CONTEXT records to the migration stream 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=174bb33f-9acb-dc52-76d1-e1ad7a350dc1@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.