xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Tamas K Lengyel <tamas@tklengyel.com>
To: Razvan Cojocaru <rcojocaru@bitdefender.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
	"wei.liu2@citrix.com" <wei.liu2@citrix.com>,
	Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH] tests/xen-access: Added vm_event emulation tests
Date: Fri, 14 Apr 2017 13:29:26 -0600	[thread overview]
Message-ID: <CABfawhmmSTeCGcPeSm2BEcFtiUPq=7VuRTJhqBvSOe9zUbApNA@mail.gmail.com> (raw)
In-Reply-To: <66a80650-028e-ae6e-3983-8fada2120600@bitdefender.com>


[-- Attachment #1.1: Type: text/plain, Size: 3365 bytes --]

On Fri, Apr 14, 2017 at 1:03 PM, Razvan Cojocaru <rcojocaru@bitdefender.com>
wrote:

> On 04/14/2017 09:08 PM, Tamas K Lengyel wrote:
> >
> >
> > On Thu, Apr 13, 2017 at 4:20 AM, Razvan Cojocaru
> > <rcojocaru@bitdefender.com <mailto:rcojocaru@bitdefender.com>> wrote:
> >
> >     On 04/12/2017 08:11 PM, Tamas K Lengyel wrote:
> >     >
> >     >
> >     > On Mon, Apr 10, 2017 at 3:44 AM, Razvan Cojocaru
> >     >     +        emulate = 1;
> >     >     +        memaccess = 1;
> >     >     +    }
> >     >      #if defined(__i386__) || defined(__x86_64__)
> >     >          else if ( !strcmp(argv[0], "breakpoint") )
> >     >          {
> >     >     @@ -536,7 +551,7 @@ int main(int argc, char *argv[])
> >     >              }
> >     >
> >     >              rc = xc_set_mem_access(xch, domain_id, default_access,
> >     >     START_PFN,
> >     >     -                               (xenaccess->max_gpfn -
> START_PFN) );
> >     >     +                               emulate ? 1000 :
> >     >     (xenaccess->max_gpfn - START_PFN));
> >     >
> >     >
> >     > Why only 1000? What if the domain has less then 1000?
> >
> >     Because it will kill the guest to emulate everything, and the
> emulator
> >     still can't handle all instructions (this is easy to see by using all
> >     the guest's pages and looking at the output of xl dmesg with
> loglvl=all
> >     guest_loglvl=all on the Xen command line).
> >
> >
> > So what's the guarantee that the emulator will work if you only do it
> > only up to the first 1000 pages? Seems totally arbitrary to me. If the
> > emulator can't handle all instructions then you would have to check that
> > the instruction for which you are returning the emulate flag is in the
> > list of instruction that can be handled.. Can such a list be derived
> > right now?
>
> If an instruction can't be emulated it will be shown as such in the ring
> buffer used by xl dmesg. Speaking of that, I'd like to, at some point,
> send a patch that sends a vm_event saying that emulation failed to
> userspace when that is the case, to give it a chance to do something
> else (for example use altp2m, or lift the page restrictions).
>

I think that would be a much needed addition to make this system more
robust.


>
> We can also probably go through the emulator code and build an exact
> list of all the officially supported instructions, but I believe that
> that would have to be manual work - I am not aware of a tool to extract
> them or a header file that lists them in some structure. I'd love to be
> wrong about this.
>
> As for your question, there's no guarantee that the emulator will
> work,obut that's not why I chose 1000. I chose that number because the
> application will get less EPT events, and the guest will not be bogged
> down by handling them. But in my experiments it's also less likely to
> hit unhandleable instructions in the first 1000 pages since those are
> usually used by the guest kernel, drivers, and so on, and are less
> likely to cause problems.
>
> In any case, I don't mind dropping the 1000 pages limit - I can always
> build a custom xen-access when I need it.
>

I don't mind setting it only for a 1000 in the test program, just wanted to
understand rationale behind it. I think a comment in the program explaining
what has been discussed here would also be helpful.

Tamas

[-- Attachment #1.2: Type: text/html, Size: 4634 bytes --]

[-- Attachment #2: Type: text/plain, Size: 127 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

      reply	other threads:[~2017-04-14 19:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-10  9:44 [PATCH] tests/xen-access: Added vm_event emulation tests Razvan Cojocaru
2017-04-12 16:50 ` Wei Liu
2017-04-12 16:53   ` Razvan Cojocaru
2017-04-12 17:11 ` Tamas K Lengyel
2017-04-13 10:20   ` Razvan Cojocaru
2017-04-14 18:08     ` Tamas K Lengyel
2017-04-14 19:03       ` Razvan Cojocaru
2017-04-14 19:29         ` Tamas K Lengyel [this message]

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='CABfawhmmSTeCGcPeSm2BEcFtiUPq=7VuRTJhqBvSOe9zUbApNA@mail.gmail.com' \
    --to=tamas@tklengyel.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=rcojocaru@bitdefender.com \
    --cc=wei.liu2@citrix.com \
    --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 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).