xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Tamas Lengyel <tamas.lengyel@zentific.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: kevin.tian@intel.com, Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	eddie.dong@intel.com, Ian Jackson <ian.jackson@eu.citrix.com>,
	Aravind.Gopalakrishnan@amd.com,
	Jun Nakajima <jun.nakajima@intel.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	suravee.suthikulpanit@amd.com
Subject: Re: [PATCH v2 1/2] x86/mem_event: Deliver gla fault EPT violation information
Date: Thu, 07 Aug 2014 23:58:07 +0100	[thread overview]
Message-ID: <53E4047F.8050409@citrix.com> (raw)
In-Reply-To: <CAErYnsgRYVHoZpXxhQ25C+5ko2+YtNr=-SuZFmZJ8Amdz65uBw@mail.gmail.com>

On 07/08/2014 22:53, Tamas Lengyel wrote:
> On Thu, Aug 7, 2014 at 11:39 PM, Boris Ostrovsky <boris.ostrovsky@oracle.com
>> wrote:
>> On 08/07/2014 03:47 PM, Tamas K Lengyel wrote:
>>
>>> On Intel EPT the exit qualification generated by a violation also
>>> includes a bit (EPT_GLA_FAULT) which describes the following information:
>>> Set if the access causing the EPT violation is to a guest-physical
>>> address that is the translation of a linear address. Clear if the access
>>> causing the EPT violation is to a paging-structure entry as part of a page
>>> walk or the update of an accessed or dirty bit.
>>>
>>> For more information see Table 27-7 in the Intel SDM.
>>>
>>> This patch extends the mem_event system to deliver this extra
>>> information, which could be useful for determining the cause of a violation.
>>>
>>> v2: Split gla_fault into fault_in_gpt and fault_gla to be more compatible
>>> with the AMD implementation.
>>>
>>> Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>
>>> ---
>>>   xen/arch/x86/hvm/hvm.c         |  8 ++++++--
>>>   xen/arch/x86/hvm/svm/svm.c     |  2 +-
>>>   xen/arch/x86/hvm/vmx/vmx.c     | 23 ++++++++++++++++++++++-
>>>   xen/arch/x86/mm/p2m.c          |  5 ++++-
>>>   xen/include/asm-x86/hvm/hvm.h  |  5 ++++-
>>>   xen/include/asm-x86/p2m.h      |  3 ++-
>>>   xen/include/public/mem_event.h |  4 +++-
>>>   7 files changed, 42 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
>>> index e834406..d7b5e2b 100644
>>> --- a/xen/arch/x86/hvm/hvm.c
>>> +++ b/xen/arch/x86/hvm/hvm.c
>>> @@ -2725,6 +2725,8 @@ void hvm_inject_page_fault(int errcode, unsigned
>>> long cr2)
>>>   int hvm_hap_nested_page_fault(paddr_t gpa,
>>>                                 bool_t gla_valid,
>>>                                 unsigned long gla,
>>> +                              bool_t fault_in_gpt,
>>> +                              bool_t fault_gla,
>>>                                 bool_t access_r,
>>>                                 bool_t access_w,
>>>                                 bool_t access_x)
>>> @@ -2832,8 +2834,10 @@ int hvm_hap_nested_page_fault(paddr_t gpa,
>>>             if ( violation )
>>>           {
>>> -            if ( p2m_mem_access_check(gpa, gla_valid, gla, access_r,
>>> -                                        access_w, access_x, &req_ptr) )
>>> +            if ( p2m_mem_access_check(gpa, gla_valid, gla,
>>> +                                        fault_in_gpt, fault_gla,
>>> +                                        access_r, access_w, access_x,
>>> +                                        &req_ptr) )
>>>               {
>>>                   fall_through = 1;
>>>               } else {
>>> diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
>>> index 76616ac..9e35e7a 100644
>>> --- a/xen/arch/x86/hvm/svm/svm.c
>>> +++ b/xen/arch/x86/hvm/svm/svm.c
>>> @@ -1403,7 +1403,7 @@ static void svm_do_nested_pgfault(struct vcpu *v,
>>>       p2m_access_t p2ma;
>>>       struct p2m_domain *p2m = NULL;
>>>   -    ret = hvm_hap_nested_page_fault(gpa, 0, ~0ul,
>>> +    ret = hvm_hap_nested_page_fault(gpa, 0, ~0ul, 0, 0,
>>>
>>
>> Why not pass the actual bits that the HW provides?
>>
> The actual bits could be passed but it makes no difference at this point
> since the AMD side isn't setup to work with mem_event. When it is
> integrated, those bits could and should be passed accordingly.
>
> Tamas

There is a lot more than mem_event which might want these bits from AMD.

If the bits are easily available at this point, you should fill them in.

~Andrew

  reply	other threads:[~2014-08-07 22:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-07 19:47 [PATCH v2 1/2] x86/mem_event: Deliver gla fault EPT violation information Tamas K Lengyel
2014-08-07 19:47 ` [PATCH v2 2/2] tools/xen-access: Print gla valid/fault information Tamas K Lengyel
2014-08-07 21:39 ` [PATCH v2 1/2] x86/mem_event: Deliver gla fault EPT violation information Boris Ostrovsky
2014-08-07 21:53   ` Tamas Lengyel
2014-08-07 22:58     ` Andrew Cooper [this message]
2014-08-07 23:03       ` Tamas Lengyel
2014-08-07 23:05         ` Andrew Cooper
2014-08-08 14:22         ` Boris Ostrovsky
2014-08-08 14:58           ` Jan Beulich
2014-08-08 17:47           ` Tamas Lengyel
2014-08-07 22:00 ` Andrew Cooper
2014-08-07 22:19   ` Tamas Lengyel
2014-08-07 22:54     ` Andrew Cooper
2014-08-07 22:53 ` Tian, Kevin

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=53E4047F.8050409@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Aravind.Gopalakrishnan@amd.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=eddie.dong@intel.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=tamas.lengyel@zentific.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).