From: Paul Durrant <Paul.Durrant@citrix.com>
To: 'Jan Beulich' <JBeulich@suse.com>
Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>,
Wei Liu <wei.liu2@citrix.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
Ian Jackson <Ian.Jackson@citrix.com>
Subject: Re: [PATCH 7/7] x86/viridian: implement the crash MSRs
Date: Mon, 20 Mar 2017 12:48:51 +0000 [thread overview]
Message-ID: <641a2b8a62c84cf083356b564a893080@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <58CFDB480200007800145014@prv-mh.provo.novell.com>
> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: 20 March 2017 12:38
> To: Paul Durrant <Paul.Durrant@citrix.com>
> Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>; Wei Liu
> <wei.liu2@citrix.com>; Ian Jackson <Ian.Jackson@citrix.com>; xen-
> devel@lists.xenproject.org
> Subject: Re: [PATCH 7/7] x86/viridian: implement the crash MSRs
>
> >>> On 17.03.17 at 10:57, <paul.durrant@citrix.com> wrote:
> > @@ -234,6 +247,10 @@ void cpuid_viridian_leaves(const struct vcpu *v,
> uint32_t leaf,
> >
> > res->a = u.lo;
> > res->b = u.hi;
> > +
> > + if ( viridian_feature_mask(d) & HVMPV_crash_ctl )
> > + res->d = CPUID3D_CRASH_MSRS;
>
> |= (for consistency with other code as well as to avoid the need
> to touch this line again going forward)
Ok.
>
> > @@ -603,6 +620,37 @@ int wrmsr_viridian_regs(uint32_t idx, uint64_t val)
> > update_reference_tsc(d, 1);
> > break;
> >
> > + case HV_X64_MSR_CRASH_P0:
> > + case HV_X64_MSR_CRASH_P1:
> > + case HV_X64_MSR_CRASH_P2:
> > + case HV_X64_MSR_CRASH_P3:
> > + case HV_X64_MSR_CRASH_P4:
> > + BUILD_BUG_ON(HV_X64_MSR_CRASH_P4 -
> HV_X64_MSR_CRASH_P0 >
> > + ARRAY_SIZE(d->arch.hvm_domain.viridian.crash_param));
>
> >= as it looks.
Yes.
>
> > + idx -= HV_X64_MSR_CRASH_P0;
> > + d->arch.hvm_domain.viridian.crash_param[idx] = val;
> > + break;
> > +
> > + case HV_X64_MSR_CRASH_CTL:
> > + {
> > + HV_CRASH_CTL_REG_CONTENTS ctl;
> > +
> > + ctl.AsUINT64 = val;
> > +
> > + if ( !ctl.CrashNotify )
> > + break;
> > +
> > + printk(XENLOG_G_INFO "d%d: VIRIDIAN CRASH: %lx %lx %lx %lx
> %lx\n",
> > + d->domain_id,
> > + d->arch.hvm_domain.viridian.crash_param[0],
> > + d->arch.hvm_domain.viridian.crash_param[1],
> > + d->arch.hvm_domain.viridian.crash_param[2],
> > + d->arch.hvm_domain.viridian.crash_param[3],
> > + d->arch.hvm_domain.viridian.crash_param[4]);
> > + break;
> > + }
> > +
> > default:
> > if (idx >= VIRIDIAN_MSR_MIN && idx <= VIRIDIAN_MSR_MAX)
> > gdprintk(XENLOG_WARNING, "unimplemented MSR %08x\n",
> > @@ -730,6 +778,25 @@ int rdmsr_viridian_regs(uint32_t idx, uint64_t *val)
> > break;
> > }
> >
> > + case HV_X64_MSR_CRASH_P0:
> > + case HV_X64_MSR_CRASH_P1:
> > + case HV_X64_MSR_CRASH_P2:
> > + case HV_X64_MSR_CRASH_P3:
> > + case HV_X64_MSR_CRASH_P4:
> > + idx -= HV_X64_MSR_CRASH_P0;
> > + *val = d->arch.hvm_domain.viridian.crash_param[idx];
> > + break;
>
> I think it would be better to reproduce the BUILD_BUG_ON() here.
>
Ok.
> > + case HV_X64_MSR_CRASH_CTL:
> > + {
> > + HV_CRASH_CTL_REG_CONTENTS ctl;
> > +
> > + ctl.CrashNotify = 1;
>
> You leak 63 bits of hypervisor stack here.
>
Yes. Should use a struct initializer instead.
> > --- a/xen/include/asm-x86/hvm/viridian.h
> > +++ b/xen/include/asm-x86/hvm/viridian.h
> > @@ -96,6 +96,7 @@ struct viridian_domain
> > union viridian_hypercall_gpa hypercall_gpa;
> > struct viridian_time_ref_count time_ref_count;
> > union viridian_reference_tsc reference_tsc;
> > + uint64_t crash_param[5];
>
> Are these really per-domain values (normally MSRs are per-vCPU)?
I don't think the usage described in section 4.3 really warrants per-vCPU. I've not looked at the exact sequence of events but I'm fairly sure the MSRs are written by the Windows crash kernel, which is single threaded.
> And don't they need migrating?
>
I don't think so, given that they are only written just prior to the domain dying anyway.
Paul
> Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-03-20 12:48 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-17 9:57 [PATCH 0/7] x86/viridian updates Paul Durrant
2017-03-17 9:57 ` [PATCH 1/7] x86/viridian: update to version 5.0a of the specification Paul Durrant
2017-03-20 11:27 ` Jan Beulich
2017-03-20 11:43 ` Paul Durrant
2017-03-20 11:54 ` Jan Beulich
2017-03-17 9:57 ` [PATCH 2/7] x86/viridian: fix xen-hvmcrash when vp_assist page is present Paul Durrant
2017-03-20 11:36 ` Jan Beulich
2017-03-20 11:50 ` Paul Durrant
2017-03-20 13:42 ` Paul Durrant
2017-03-20 13:58 ` Jan Beulich
2017-03-17 9:57 ` [PATCH 3/7] x86/viridian: don't put Xen version information in CPUID leaf 2 Paul Durrant
2017-03-20 11:41 ` Jan Beulich
2017-03-20 11:57 ` Paul Durrant
2017-03-20 12:03 ` Jan Beulich
2017-03-20 13:08 ` Paul Durrant
2017-03-20 13:20 ` Jan Beulich
2017-03-17 9:57 ` [PATCH 4/7] x86/viridian: get rid of the magic numbers in CPUID leaves 1 and 2 Paul Durrant
2017-03-20 12:15 ` Jan Beulich
2017-03-20 12:56 ` Paul Durrant
2017-03-17 9:57 ` [PATCH 5/7] x86/viridian: add warnings for unimplemented hypercalls and MSRs Paul Durrant
2017-03-20 12:21 ` Jan Beulich
2017-03-20 12:54 ` Paul Durrant
2017-03-17 9:57 ` [PATCH 6/7] x86/viridian: make the threshold for HvNotifyLongSpinWait tunable Paul Durrant
2017-03-20 12:26 ` Jan Beulich
2017-03-20 12:51 ` Paul Durrant
2017-03-20 13:22 ` Jan Beulich
2017-03-20 17:03 ` Andrew Cooper
2017-03-20 17:07 ` Paul Durrant
2017-03-17 9:57 ` [PATCH 7/7] x86/viridian: implement the crash MSRs Paul Durrant
2017-03-20 12:38 ` Jan Beulich
2017-03-20 12:48 ` Paul Durrant [this message]
2017-03-20 13:29 ` Jan Beulich
2017-03-20 13:33 ` 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=641a2b8a62c84cf083356b564a893080@AMSPEX02CL03.citrite.net \
--to=paul.durrant@citrix.com \
--cc=Andrew.Cooper3@citrix.com \
--cc=Ian.Jackson@citrix.com \
--cc=JBeulich@suse.com \
--cc=wei.liu2@citrix.com \
--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).