From: Mukesh Rathor <mukesh.rathor@oracle.com>
To: Tim Deegan <tim@xen.org>
Cc: "Xen-devel@lists.xensource.com" <Xen-devel@lists.xensource.com>
Subject: Re: [PATCH 10/18 V2]: PVH xen: introduce vmx_pvh.c and pvh.c
Date: Tue, 2 Apr 2013 18:37:34 -0700 [thread overview]
Message-ID: <20130402183734.16b1ba68@mantra.us.oracle.com> (raw)
In-Reply-To: <20130321164912.GO12338@ocelot.phlegethon.org>
On Thu, 21 Mar 2013 16:49:12 +0000
Tim Deegan <tim@xen.org> wrote:
> ???
>
> > + rc = 1;
> > +
> > + } else if (vector == TRAP_page_fault) {
> > + printk("PVH: Unexpected vector page_fault. IP:%lx\n",
> > regs->eip);
> > + rc = 1;
> > + }
>
> This probably ought to be a switch statement rather than a chain of
> 'else if'. Then the single 'default' case would catch all unexpected
> exits (AFAICS there are three different variations on that here). And
> since you've set the exception bitmap in the VMCS, presumably the
> correct response to an unexpected trap type is to BUG().
Changed to switch.
> > + return rc;
> > +}
> > +
> > +static int vmxit_invlpg(void)
> > +{
> > + ulong vaddr = __vmread(EXIT_QUALIFICATION);
> > +
> > + vmx_update_guest_eip();
> > + vpid_sync_vcpu_gva(current, vaddr);
>
> If there's no special handling of invlpg, you should just not
> intercept it.
well, we call vpid_sync_vcpu_gva(), but we can optimize this further
in future.
> > __vmread(EXIT_QUALIFICATION);
> > + uint acc_typ = VMX_CONTROL_REG_ACCESS_TYPE(exit_qualification);
> > + int cr, rc = 1;
> > +
> > + switch ( acc_typ )
> > + {
> > + case VMX_CONTROL_REG_ACCESS_TYPE_MOV_TO_CR:
> > + case VMX_CONTROL_REG_ACCESS_TYPE_MOV_FROM_CR:
> > + {
> > + uint gpr =
> > VMX_CONTROL_REG_ACCESS_GPR(exit_qualification);
> > + uint64_t *regp = decode_register(gpr, regs, 0);
> > + cr = VMX_CONTROL_REG_ACCESS_NUM(exit_qualification);
> > +
> > + if (regp == NULL)
> > + break;
> > +
> > + /* pl don't embed switch statements */ <========
> > + if (cr == 0)
> > + rc = access_cr0(regs, acc_typ, regp);
> > + else if (cr == 3) {
> > + printk("PVH: d%d: unexpected cr3 access vmexit.
> > rip:%lx\n",
> > + current->domain->domain_id, regs->rip);
> > + domain_crash_synchronous();
>
> Again, ITYM BUG(). And again. probably a switch statement.
No, lets not embed switch statements please, that is obfuscating.
thanks,
Mukesh
next prev parent reply other threads:[~2013-04-03 1:37 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-16 0:41 [PATCH 10/18 V2]: PVH xen: introduce vmx_pvh.c and pvh.c Mukesh Rathor
2013-03-18 12:16 ` Jan Beulich
2013-04-02 0:08 ` Mukesh Rathor
2013-04-02 7:00 ` Jan Beulich
2013-03-18 16:32 ` Konrad Rzeszutek Wilk
2013-04-02 1:26 ` Mukesh Rathor
2013-04-02 14:10 ` Konrad Rzeszutek Wilk
2013-04-03 1:29 ` Mukesh Rathor
2013-04-03 14:40 ` Konrad Rzeszutek Wilk
2013-04-03 1:45 ` Mukesh Rathor
2013-04-03 1:42 ` Mukesh Rathor
2013-04-04 1:01 ` Mukesh Rathor
2013-04-04 8:23 ` Jan Beulich
2013-03-21 16:49 ` Tim Deegan
2013-03-22 8:32 ` Jan Beulich
2013-03-22 10:06 ` Tim Deegan
2013-04-03 1:37 ` Mukesh Rathor [this message]
2013-04-03 8:06 ` Jan Beulich
2013-04-03 23:38 ` Mukesh Rathor
2013-04-04 9:12 ` Tim Deegan
2013-04-04 23:00 ` Mukesh Rathor
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=20130402183734.16b1ba68@mantra.us.oracle.com \
--to=mukesh.rathor@oracle.com \
--cc=Xen-devel@lists.xensource.com \
--cc=tim@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).