All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Durrant <Paul.Durrant@citrix.com>
To: 'Alexandru Isaila' <aisaila@bitdefender.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Cc: Ian Jackson <Ian.Jackson@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	"jbeulich@suse.com" <jbeulich@suse.com>,
	Andrew Cooper <Andrew.Cooper3@citrix.com>
Subject: Re: [PATCH v5 7/8] x86/hvm: Introduce viridian_save_vcpu_ctxt_one() func
Date: Mon, 4 Jun 2018 09:11:40 +0000	[thread overview]
Message-ID: <8256d71dd44246feaaf5d86a195c5878@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <1527605938-17977-7-git-send-email-aisaila@bitdefender.com>



> -----Original Message-----
> From: Alexandru Isaila [mailto:aisaila@bitdefender.com]
> Sent: 29 May 2018 15:59
> To: xen-devel@lists.xen.org
> Cc: Ian Jackson <Ian.Jackson@citrix.com>; Wei Liu <wei.liu2@citrix.com>;
> jbeulich@suse.com; Andrew Cooper <Andrew.Cooper3@citrix.com>; Paul
> Durrant <Paul.Durrant@citrix.com>; Alexandru Isaila
> <aisaila@bitdefender.com>
> Subject: [PATCH v5 7/8] x86/hvm: Introduce viridian_save_vcpu_ctxt_one()
> func
> 
> This is used to save data from a single instance.
> 
> Signed-off-by: Alexandru Isaila <aisaila@bitdefender.com>
> ---
>  xen/arch/x86/hvm/viridian.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/viridian.c b/xen/arch/x86/hvm/viridian.c
> index 694eae6..d22c8ac 100644
> --- a/xen/arch/x86/hvm/viridian.c
> +++ b/xen/arch/x86/hvm/viridian.c
> @@ -1026,6 +1026,13 @@ static int viridian_load_domain_ctxt(struct domain
> *d, hvm_domain_context_t *h)
>  HVM_REGISTER_SAVE_RESTORE(VIRIDIAN_DOMAIN,
> viridian_save_domain_ctxt,
>                            viridian_load_domain_ctxt, 1, HVMSR_PER_DOM);
> 
> +static void viridian_save_vcpu_ctxt_one(struct vcpu *v, struct
> hvm_viridian_vcpu_context *ctxt)
> +{
> +    ctxt->vp_assist_msr = v->arch.hvm_vcpu.viridian.vp_assist.msr.raw;
> +    ctxt->vp_assist_pending = v->arch.hvm_vcpu.viridian.vp_assist.pending;
> +    *ctxt->_pad = 0;

I'd prefer a memset() to zero the context prior to setting fields. It's more robust if fields (and more padding) are added in future.

  Paul

> +}
> +
>  static int viridian_save_vcpu_ctxt(struct domain *d, hvm_domain_context_t
> *h)
>  {
>      struct vcpu *v;
> @@ -1034,10 +1041,9 @@ static int viridian_save_vcpu_ctxt(struct domain
> *d, hvm_domain_context_t *h)
>          return 0;
> 
>      for_each_vcpu( d, v ) {
> -        struct hvm_viridian_vcpu_context ctxt = {
> -            .vp_assist_msr = v->arch.hvm_vcpu.viridian.vp_assist.msr.raw,
> -            .vp_assist_pending = v->arch.hvm_vcpu.viridian.vp_assist.pending,
> -        };
> +        struct hvm_viridian_vcpu_context ctxt;
> +
> +        viridian_save_vcpu_ctxt_one(v, &ctxt);
> 
>          if ( hvm_save_entry(VIRIDIAN_VCPU, v->vcpu_id, h, &ctxt) != 0 )
>              return 1;
> --
> 2.7.4


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

  reply	other threads:[~2018-06-04  9:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-29 14:58 [PATCH v5 1/8] x86/cpu: Introduce vmce_save_vcpu_ctxt_one() func Alexandru Isaila
2018-05-29 14:58 ` [PATCH v5 2/8] x86/hvm: Introduce hvm_save_tsc_adjust_one() func Alexandru Isaila
2018-05-29 14:58 ` [PATCH v5 3/8] x86/hvm: Introduce hvm_save_cpu_ctxt_one func Alexandru Isaila
2018-05-29 14:58 ` [PATCH v5 4/8] x86/hvm: Introduce hvm_save_cpu_xsave_states_one Alexandru Isaila
2018-05-29 14:58 ` [PATCH v5 5/8] x86/hvm: Introduce hvm_save_cpu_msrs_one func Alexandru Isaila
2018-06-04  9:08   ` Paul Durrant
2018-05-29 14:58 ` [PATCH v5 6/8] x86/hvm: Introduce hvm_save_mtrr_msr_one func Alexandru Isaila
2018-05-29 14:58 ` [PATCH v5 7/8] x86/hvm: Introduce viridian_save_vcpu_ctxt_one() func Alexandru Isaila
2018-06-04  9:11   ` Paul Durrant [this message]
2018-05-29 14:58 ` [PATCH v5 8/8] x86/domctl: Don't pause the whole domain if only getting vcpu state Alexandru Isaila
2018-06-04  9:21   ` Paul Durrant
2018-06-06 12:35   ` Jan Beulich

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=8256d71dd44246feaaf5d86a195c5878@AMSPEX02CL03.citrite.net \
    --to=paul.durrant@citrix.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=Ian.Jackson@citrix.com \
    --cc=aisaila@bitdefender.com \
    --cc=jbeulich@suse.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 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.