From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mukesh Rathor Subject: Re: [V10 PATCH 23/23] PVH xen: introduce vmexit handler for PVH Date: Wed, 21 Aug 2013 18:46:26 -0700 Message-ID: <20130821184626.1989d8e2@mantra.us.oracle.com> References: <1374631171-15224-1-git-send-email-mukesh.rathor@oracle.com> <1374631171-15224-24-git-send-email-mukesh.rathor@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George Dunlap Cc: "xen-devel@lists.xensource.com" , "keir.xen@gmail.com" List-Id: xen-devel@lists.xenproject.org On Mon, 12 Aug 2013 17:21:41 +0100 George Dunlap wrote: > On Wed, Jul 24, 2013 at 2:59 AM, Mukesh Rathor > wrote: > > +static int pvh_ept_handle_violation(unsigned long qualification, > > + paddr_t gpa, struct > > cpu_user_regs *regs) +{ > > + unsigned long gla, gfn = gpa >> PAGE_SHIFT; > > + p2m_type_t p2mt; > > + mfn_t mfn = get_gfn_query_unlocked(current->domain, gfn, > > &p2mt); + > > + printk(XENLOG_G_ERR "EPT violation %#lx (%c%c%c/%c%c%c), " > > + "gpa %#"PRIpaddr", mfn %#lx, type %i. IP:0x%lx > > RSP:0x%lx\n", > > + qualification, > > + (qualification & EPT_READ_VIOLATION) ? 'r' : '-', > > + (qualification & EPT_WRITE_VIOLATION) ? 'w' : '-', > > + (qualification & EPT_EXEC_VIOLATION) ? 'x' : '-', > > + (qualification & EPT_EFFECTIVE_READ) ? 'r' : '-', > > + (qualification & EPT_EFFECTIVE_WRITE) ? 'w' : '-', > > + (qualification & EPT_EFFECTIVE_EXEC) ? 'x' : '-', > > + gpa, mfn_x(mfn), p2mt, regs->rip, regs->rsp); > > + > > + ept_walk_table(current->domain, gfn); > > + > > + if ( qualification & EPT_GLA_VALID ) > > + { > > + gla = __vmread(GUEST_LINEAR_ADDRESS); > > + printk(XENLOG_G_ERR " --- GLA %#lx\n", gla); > > + } > > + hvm_inject_hw_exception(TRAP_gp_fault, 0); > > + return 0; > > +} > > Similar to the TRAP_debug issue -- the HVM code here crashes the > guest; as there is unlikely to be anything the guest can do to fix > things up at this point, that is almost certainly the right thing to > do. The advantage of GP injection is the guest gets a chance to print debug info. Often linux will print the stacks of all vcpus before crashing itself on GP. Mukesh