All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Razvan Cojocaru <rcojocaru@bitdefender.com>, xen-devel@lists.xen.org
Cc: mdontu@bitdefender.com, tim@xen.org, JBeulich@suse.com
Subject: Re: [PATCH RFC V2 6/6] xen: Handle resumed instruction based on previous mem_event reply
Date: Fri, 11 Jul 2014 19:36:54 +0100	[thread overview]
Message-ID: <53C02EC6.7070003@citrix.com> (raw)
In-Reply-To: <1405093418-23481-6-git-send-email-rcojocaru@bitdefender.com>

On 11/07/14 16:43, Razvan Cojocaru wrote:
> In a scenario where a page fault that triggered a mem_event occured,
> p2m_mem_access_check() will now be able to either 1) emulate the
> current instruction, or 2) emulate it, but don't allow it to perform
> any writes.
>
> Changes since V1:
>  - Removed the 'skip' code which required computing the current
>    instruction length.
>  - Removed the set_ad_bits() code that attempted to modify the
>    'accessed' and 'dirty' bits for instructions that the emulator
>    can't handle at the moment.
>
> Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
> ---
>  xen/arch/x86/domain.c          |    5 +++
>  xen/arch/x86/mm/p2m.c          |   90 ++++++++++++++++++++++++++++++++++++++++
>  xen/include/asm-x86/domain.h   |    9 ++++
>  xen/include/public/mem_event.h |   12 +++---
>  4 files changed, 111 insertions(+), 5 deletions(-)
>
> diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
> index e896210..5cd283b 100644
> --- a/xen/arch/x86/domain.c
> +++ b/xen/arch/x86/domain.c
> @@ -407,6 +407,11 @@ int vcpu_initialise(struct vcpu *v)
>  
>      v->arch.flags = TF_kernel_mode;
>  
> +    /* By default, do not emulate */
> +    v->arch.mem_event.emulate_flags = 0;
> +    v->arch.mem_event.gpa = 0;
> +    v->arch.mem_event.eip = 0;
> +
>      rc = mapcache_vcpu_init(v);
>      if ( rc )
>          return rc;
> diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
> index 13fdf78..7aff480 100644
> --- a/xen/arch/x86/mm/p2m.c
> +++ b/xen/arch/x86/mm/p2m.c
> @@ -1377,6 +1377,7 @@ bool_t p2m_mem_access_check(paddr_t gpa, bool_t gla_valid, unsigned long gla,
>  {
>      struct vcpu *v = current;
>      unsigned long gfn = gpa >> PAGE_SHIFT;
> +    unsigned long exit_qualification;
>      struct domain *d = v->domain;    
>      struct p2m_domain* p2m = p2m_get_hostp2m(d);
>      mfn_t mfn;
> @@ -1384,6 +1385,9 @@ bool_t p2m_mem_access_check(paddr_t gpa, bool_t gla_valid, unsigned long gla,
>      p2m_access_t p2ma;
>      mem_event_request_t *req;
>      int rc;
> +    unsigned long eip = guest_cpu_user_regs()->eip;
> +
> +    __vmread(EXIT_QUALIFICATION, &exit_qualification);

This absolutely can't be put into common code.  I presume you haven't
attempted to run a Xen patched with this on an AMD cpu ?

~Andrew

  reply	other threads:[~2014-07-11 18:36 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-11 15:43 [PATCH RFC V2 1/6] xen: Emulate with no writes Razvan Cojocaru
2014-07-11 15:43 ` [PATCH RFC V2 2/6] xen: Optimize introspection access to guest state Razvan Cojocaru
2014-07-11 16:54   ` Andrew Cooper
2014-07-11 16:57     ` Andrew Cooper
2014-07-11 18:03     ` Razvan Cojocaru
2014-07-11 18:09       ` Andrew Cooper
2014-07-11 15:43 ` [PATCH RFC V2 3/6] xen: Force-enable relevant MSR events; optimize the number of sent MSR events Razvan Cojocaru
2014-07-11 17:03   ` Andrew Cooper
2014-07-11 18:09     ` Razvan Cojocaru
     [not found]       ` <CAGU+ausrcu=L7Kf30gZJXRnnxrKe7EMYXTGByOY4agwoK0nXeA@mail.gmail.com>
2014-07-11 18:18         ` Aravindh Puthiyaparambil (aravindp)
2014-07-11 18:19       ` Andrew Cooper
2014-07-11 18:22         ` Razvan Cojocaru
2014-07-11 18:29           ` Andrew Cooper
2014-07-11 15:43 ` [PATCH RFC V2 4/6] xen: Support for VMCALL mem_events Razvan Cojocaru
2014-07-11 17:23   ` Andrew Cooper
2014-07-11 18:15     ` Razvan Cojocaru
2015-03-17 13:50     ` Razvan Cojocaru
2015-03-17 13:58       ` Jan Beulich
2015-03-17 14:07         ` Razvan Cojocaru
2015-03-17 14:20           ` Jan Beulich
2015-03-17 14:33             ` Razvan Cojocaru
2014-07-11 15:43 ` [PATCH RFC V2 5/6] xen, libxc: Request page fault injection via libxc Razvan Cojocaru
2014-07-11 18:06   ` Andrew Cooper
2014-07-17 11:53     ` Ian Campbell
2014-07-17 12:07       ` Razvan Cojocaru
2014-07-17 12:22     ` Razvan Cojocaru
2014-07-17 12:38       ` Andrew Cooper
2014-07-11 15:43 ` [PATCH RFC V2 6/6] xen: Handle resumed instruction based on previous mem_event reply Razvan Cojocaru
2014-07-11 18:36   ` Andrew Cooper [this message]
2014-07-11 18:41     ` Razvan Cojocaru
2014-07-11 19:12       ` Andrew Cooper
2014-07-11 16:23 ` [PATCH RFC V2 1/6] xen: Emulate with no writes Andrew Cooper
2014-07-11 18:00   ` Razvan Cojocaru
2014-07-14  8:37   ` Razvan Cojocaru

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=53C02EC6.7070003@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=mdontu@bitdefender.com \
    --cc=rcojocaru@bitdefender.com \
    --cc=tim@xen.org \
    --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.