From: Alexandru Stefan ISAILA <aisaila@bitdefender.com>
To: "Paul.Durrant@citrix.com" <Paul.Durrant@citrix.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Cc: "Ian.Jackson@citrix.com" <Ian.Jackson@citrix.com>,
"wei.liu2@citrix.com" <wei.liu2@citrix.com>,
"jbeulich@suse.com" <jbeulich@suse.com>,
"Andrew.Cooper3@citrix.com" <Andrew.Cooper3@citrix.com>
Subject: Re: [PATCH v9 07/11] x86/hvm: Introduce viridian_save_vcpu_ctxt_one() func
Date: Mon, 2 Jul 2018 13:15:33 +0000 [thread overview]
Message-ID: <1530537358.8880.28.camel@bitdefender.com> (raw)
In-Reply-To: <c056fc1fcf1641b4afb622346099a567@AMSPEX02CL03.citrite.net>
On Lu, 2018-07-02 at 09:38 +0000, Paul Durrant wrote:
> >
> > -----Original Message-----
> > From: Alexandru Isaila [mailto:aisaila@bitdefender.com]
> > Sent: 28 June 2018 10:26
> > 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 v9 07/11] 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 | 26 ++++++++++++++++++--------
> > 1 file changed, 18 insertions(+), 8 deletions(-)
> >
> > diff --git a/xen/arch/x86/hvm/viridian.c
> > b/xen/arch/x86/hvm/viridian.c
> > index 694eae6..ed164ab 100644
> > --- a/xen/arch/x86/hvm/viridian.c
> > +++ b/xen/arch/x86/hvm/viridian.c
> > @@ -1026,20 +1026,30 @@ 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 int viridian_save_vcpu_ctxt(struct domain *d,
> > hvm_domain_context_t *h)
> > +static int viridian_save_vcpu_ctxt_one(struct vcpu *v,
> > hvm_domain_context_t *h)
> > {
> > - struct vcpu *v;
> > + struct hvm_viridian_vcpu_context ctxt;
> >
> > - if ( !is_viridian_domain(d) )
> > + if ( !is_viridian_domain(v->domain) )
> > return 0;
> >
> > + memset(&ctxt, 0, sizeof(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;
> > +
> > + if ( hvm_save_entry(VIRIDIAN_VCPU, v->vcpu_id, h, &ctxt) != 0
> > )
> > + return 1;
> > + return 0;
> Jan also queried the return values from the _save_one functions. I
> assume you need to make your 'continue' value reasonably global such
> that it can still be used when you move the iteration up in the outer
> save function. He suggested passing through the return of
> hvm_save_entry() but we also need to be sure it won't clash will the
> 'continue' value in future so it may now be necessary to actually
> define what the possible return values are.
>
It returns 0 for ok and -1 for error so I think the return check could
be removed.
But whit this we will introduce a potential fail point if someone
changes the return of hvm_save_entry(). At this moment the patch works
both ways. Its up to Jan to have the last word here if he is sure that
I should just return hvm_save_entry().
Alex
>
> >
> > +}
> > +
> > +static int viridian_save_vcpu_ctxt(struct domain *d,
> > hvm_domain_context_t *h)
> > +{
> > + struct vcpu *v;
> > +
> > 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,
> > - };
> > + int rc = viridian_save_vcpu_ctxt_one(v, h);
> >
> > - if ( hvm_save_entry(VIRIDIAN_VCPU, v->vcpu_id, h, &ctxt)
> > != 0 )
> > + if ( rc != 0 )
> > return 1;
> > }
> >
> > --
> > 2.7.4
________________________
This email was scanned by Bitdefender
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-07-02 13:15 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-28 9:25 [PATCH v9 00/11] x86/domctl: Save info for one vcpu instance Alexandru Isaila
2018-06-28 9:25 ` [PATCH v9 01/11] x86/cpu: Introduce vmce_save_vcpu_ctxt_one() func Alexandru Isaila
2018-06-29 15:54 ` Jan Beulich
2018-06-28 9:25 ` [PATCH v9 02/11] x86/hvm: Introduce hvm_save_tsc_adjust_one() func Alexandru Isaila
2018-06-28 9:25 ` [PATCH v9 03/11] x86/hvm: Introduce hvm_save_cpu_ctxt_one func Alexandru Isaila
2018-06-29 16:00 ` Jan Beulich
2018-07-03 12:05 ` Alexandru Stefan ISAILA
2018-07-03 12:17 ` Jan Beulich
2018-06-28 9:25 ` [PATCH v9 04/11] x86/hvm: Introduce hvm_save_cpu_xsave_states_one Alexandru Isaila
2018-06-28 9:25 ` [PATCH v9 05/11] x86/hvm: Introduce hvm_save_cpu_msrs_one func Alexandru Isaila
2018-06-28 9:25 ` [PATCH v9 06/11] x86/hvm: Introduce hvm_save_mtrr_msr_one func Alexandru Isaila
2018-06-28 9:25 ` [PATCH v9 07/11] x86/hvm: Introduce viridian_save_vcpu_ctxt_one() func Alexandru Isaila
2018-07-02 9:38 ` Paul Durrant
2018-07-02 13:15 ` Alexandru Stefan ISAILA [this message]
2018-07-02 13:27 ` Jan Beulich
2018-06-28 9:25 ` [PATCH v9 08/11] x86/hvm: Add handler for save_one funcs Alexandru Isaila
2018-06-28 9:25 ` [PATCH v9 09/11] x86/domctl: Don't pause the whole domain if only getting vcpu state Alexandru Isaila
2018-06-28 9:25 ` [PATCH v9 10/11] x86/hvm: Remove redundant save functions Alexandru Isaila
2018-06-28 9:25 ` [PATCH v9 11/11] x86/hvm: Remove save_one handler Alexandru Isaila
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=1530537358.8880.28.camel@bitdefender.com \
--to=aisaila@bitdefender.com \
--cc=Andrew.Cooper3@citrix.com \
--cc=Ian.Jackson@citrix.com \
--cc=Paul.Durrant@citrix.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.