xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Alexandru Isaila <aisaila@bitdefender.com>
Cc: wei.liu2@citrix.com, andrew.cooper3@citrix.com,
	ian.jackson@eu.citrix.com, xen-devel@lists.xen.org,
	paul.durrant@citrix.com, jbeulich@suse.com
Subject: Re: [PATCH v17 11/13] x86/domctl: Use hvm_save_vcpu_handler
Date: Wed, 22 Aug 2018 16:28:25 +0200	[thread overview]
Message-ID: <20180822142825.nozuvyxg7ksyj5bc@mac> (raw)
In-Reply-To: <1534946563-12084-12-git-send-email-aisaila@bitdefender.com>

On Wed, Aug 22, 2018 at 05:02:41PM +0300, Alexandru Isaila wrote:
> This patch is aimed on using the new save_one fuctions in the hvm_save
> 
> Signed-off-by: Alexandru Isaila <aisaila@bitdefender.com>
> 
> ---
> Changes since V15:
> 	- Moved declarations into their scopes
> 	- Remove redundant NULL check
> 	- Remove rc variable
> 	- Change fault return to -ENODATA.
> ---
>  xen/arch/x86/hvm/save.c | 27 +++++++++++++++++++++++----
>  1 file changed, 23 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/save.c b/xen/arch/x86/hvm/save.c
> index 1106b96..1eb2b01 100644
> --- a/xen/arch/x86/hvm/save.c
> +++ b/xen/arch/x86/hvm/save.c
> @@ -195,7 +195,6 @@ int hvm_save(struct domain *d, hvm_domain_context_t *h)
>      char *c;
>      struct hvm_save_header hdr;
>      struct hvm_save_end end;
> -    hvm_save_handler handler;
>      unsigned int i;
>  
>      if ( d->is_dying )
> @@ -223,17 +222,37 @@ int hvm_save(struct domain *d, hvm_domain_context_t *h)
>      /* Save all available kinds of state */
>      for ( i = 0; i <= HVM_SAVE_CODE_MAX; i++ )
>      {
> -        handler = hvm_sr_handlers[i].save;
> -        if ( handler != NULL )
> +        struct vcpu *v;

This could be moved...

> +        hvm_save_vcpu_handler save_one_handler = hvm_sr_handlers[i].save_one;
> +        hvm_save_handler handler = hvm_sr_handlers[i].save;;

Double ';'.

Also, I would expect that a device either has a global save handler
(handler) or a per-vcpu save handler (save_one_handler), but not both
at the same time?

In which case, I would add something like:

ASSERT(save_one_handler == NULL || handler == NULL);

In order to make sure both are not set at the same time.

> +
> +        if ( save_one_handler )
> +        {

...here if you are reducing the scope.

> +            for_each_vcpu ( d, v )
> +            {
> +                printk(XENLOG_G_INFO "HVM %pv save: %s\n",
> +                       v, hvm_sr_handlers[i].name);
> +
> +                if ( save_one_handler(v, h) != 0 )
> +                {
> +                    printk(XENLOG_G_ERR
> +                           "HVM %pv save: failed to save type %"PRIu16"\n",

I wonder why PRIu16 is used here in order to print i which is unsigned
int. Isn't it the same as using '%u'?

> +                           v, i);
> +                    return -ENODATA;
> +                }
> +            }
> +        }
> +        else if ( handler )
>          {
>              printk(XENLOG_G_INFO "HVM%d save: %s\n",
>                     d->domain_id, hvm_sr_handlers[i].name);
> +

Stray newline?

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-08-22 14:28 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-22 14:02 [PATCH v17 00/14] x86/domctl: Save info for one vcpu instance Alexandru Isaila
2018-08-22 14:02 ` [PATCH v17 01/13] x86/cpu: Introduce vmce_save_vcpu_ctxt_one() func Alexandru Isaila
2018-08-22 14:02 ` [PATCH v17 02/13] x86/hvm: Introduce hvm_save_tsc_adjust_one() func Alexandru Isaila
2018-08-22 14:02 ` [PATCH v17 03/13] x86/hvm: Introduce hvm_save_cpu_ctxt_one func Alexandru Isaila
2018-08-28 15:33   ` Razvan Cojocaru
2018-08-28 15:43     ` Jan Beulich
2018-08-22 14:02 ` [PATCH v17 04/13] x86/hvm: Introduce hvm_save_cpu_xsave_states_one Alexandru Isaila
2018-08-22 14:02 ` [PATCH v17 05/13] x86/hvm: Introduce hvm_save_cpu_msrs_one func Alexandru Isaila
2018-08-22 14:02 ` [PATCH v17 06/13] x86/hvm: Introduce hvm_save_mtrr_msr_one func Alexandru Isaila
2018-08-22 14:02 ` [PATCH v17 07/13] x86/hvm: Introduce viridian_save_vcpu_ctxt_one() func Alexandru Isaila
2018-08-22 14:02 ` [PATCH v17 08/13] x86/hvm: Introduce lapic_save_hidden_one Alexandru Isaila
2018-08-22 14:02 ` [PATCH v17 09/13] x86/hvm: Introduce lapic_save_regs_one func Alexandru Isaila
2018-08-22 14:02 ` [PATCH v17 10/13] x86/hvm: Add handler for save_one funcs Alexandru Isaila
2018-08-22 14:02 ` [PATCH v17 11/13] x86/domctl: Use hvm_save_vcpu_handler Alexandru Isaila
2018-08-22 14:28   ` Roger Pau Monné [this message]
2018-08-27  8:39     ` Jan Beulich
2018-08-22 14:02 ` [PATCH v17 12/13] x86/hvm: Remove redundant save functions Alexandru Isaila
2018-08-22 15:04   ` Roger Pau Monné
2018-08-22 15:22     ` Isaila Alexandru
2018-08-22 15:26       ` Roger Pau Monné
2018-08-28 15:27   ` Jan Beulich
2018-08-22 14:02 ` [PATCH v17 13/13] x86/domctl: Don't pause the whole domain if only getting vcpu state Alexandru Isaila
2018-08-22 14:41   ` Roger Pau Monné
2018-08-22 15:15     ` Isaila Alexandru
2018-08-29 14:02       ` Isaila Alexandru
2018-08-29 14:13         ` Jan Beulich
2018-08-31 13:56           ` Isaila Alexandru
2018-08-31 15:23             ` Jan Beulich
2018-09-03 14:36             ` Roger Pau Monné
2018-09-03 14:42               ` Isaila Alexandru
2018-09-03 14:56                 ` Roger Pau Monné

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=20180822142825.nozuvyxg7ksyj5bc@mac \
    --to=roger.pau@citrix.com \
    --cc=aisaila@bitdefender.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=paul.durrant@citrix.com \
    --cc=wei.liu2@citrix.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).