xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien@xen.org>
To: paul@xen.org, xen-devel@lists.xenproject.org
Cc: 'Stefano Stabellini' <sstabellini@kernel.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>,
	'Jan Beulich' <jbeulich@suse.com>
Subject: Re: [PATCH v4 4/5] common/domain: add a domain context record for shared_info...
Date: Thu, 21 May 2020 17:02:56 +0100	[thread overview]
Message-ID: <0f562117-e541-8821-ae1a-a8f56c8004bc@xen.org> (raw)
In-Reply-To: <000001d62f88$f354b180$d9fe1480$@xen.org>

Hi,

On 21/05/2020 17:00, Paul Durrant wrote:
>> -----Original Message-----
>> From: Paul Durrant <xadimgnik@gmail.com>
>> Sent: 21 May 2020 16:26
>> To: 'Julien Grall' <julien@xen.org>; xen-devel@lists.xenproject.org
>> Cc: '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>;
>> 'Jan Beulich' <jbeulich@suse.com>; 'Stefano Stabellini' <sstabellini@kernel.org>
>> Subject: RE: [PATCH v4 4/5] common/domain: add a domain context record for shared_info...
>>
>>> -----Original Message-----
>> [snip]
>>>> diff --git a/xen/common/domain.c b/xen/common/domain.c
>>>> index 7cc9526139..14e96c3bc2 100644
>>>> --- a/xen/common/domain.c
>>>> +++ b/xen/common/domain.c
>>>> @@ -33,6 +33,7 @@
>>>>    #include <xen/xenoprof.h>
>>>>    #include <xen/irq.h>
>>>>    #include <xen/argo.h>
>>>> +#include <xen/save.h>
>>>>    #include <asm/debugger.h>
>>>>    #include <asm/p2m.h>
>>>>    #include <asm/processor.h>
>>>> @@ -1649,6 +1650,64 @@ 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),
>>>> +    };
>>>> +    size_t hdr_size = offsetof(typeof(ctxt), buffer);
>>>> +    int rc;
>>>> +
>>>> +    rc = DOMAIN_SAVE_BEGIN(SHARED_INFO, c, 0);
>>>> +    if ( rc )
>>>> +        return rc;
>>>> +
>>>> +    rc = domain_save_data(c, &ctxt, hdr_size);
>>>> +    if ( rc )
>>>> +        return rc;
>>>> +
>>>> +    rc = domain_save_data(c, d->shared_info, ctxt.buffer_size);
>>>> +    if ( rc )
>>>> +        return rc;
>>>> +
>>>> +    return domain_save_end(c);
>>>> +}
>>>> +
>>>> +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 || i ) /* expect only a single instance */
>>>> +        return rc;
>>>
>>> This will return 0 if there is multiple instance. Is it intended?
>>>
>>
>> No, it ought to be an error... probably ENOENT.
> 
> Actually I think ENXIO might be better... ENOENT tends to imply something is missing rather than unexpected.

ENXIO could work. Another one would be E2BIG.

I don't have a preference.

Cheers,

-- 
Julien Grall


  reply	other threads:[~2020-05-21 16:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-21  8:59 [PATCH v4 0/5] domain context infrastructure Paul Durrant
2020-05-21  8:59 ` [PATCH v4 1/5] xen/common: introduce a new framework for save/restore of 'domain' context Paul Durrant
2020-05-21 14:58   ` Julien Grall
2020-05-21  8:59 ` [PATCH v4 2/5] xen/common/domctl: introduce XEN_DOMCTL_get/setdomaincontext Paul Durrant
2020-05-21 15:04   ` Julien Grall
2020-05-21  8:59 ` [PATCH v4 3/5] tools/misc: add xen-domctx to present domain context Paul Durrant
2020-05-21 13:33   ` Ian Jackson
2020-05-21  8:59 ` [PATCH v4 4/5] common/domain: add a domain context record for shared_info Paul Durrant
2020-05-21 15:13   ` Julien Grall
2020-05-21 15:25     ` Paul Durrant
2020-05-21 16:00       ` Paul Durrant
2020-05-21 16:02         ` Julien Grall [this message]
2020-05-21  8:59 ` [PATCH v4 5/5] tools/libxc: make use of domain context SHARED_INFO record Paul Durrant
2020-05-21 13:34   ` Ian Jackson

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=0f562117-e541-8821-ae1a-a8f56c8004bc@xen.org \
    --to=julien@xen.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --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).