qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Vincent Palatin <vpalatin@chromium.org>,
	qemu-devel <qemu-devel@nongnu.org>
Cc: Yu Ning <yu.ning@linux.intel.com>, Stefan Weil <sw@weilnetz.de>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v5 3/4] Plumb the HAXM-based hardware acceleration support
Date: Thu, 22 Dec 2016 10:57:20 +0100	[thread overview]
Message-ID: <fda5a694-d02f-269e-e155-1822276d74f6@redhat.com> (raw)
In-Reply-To: <85250fb0450b5b95232b39c82ab310a0632fd23f.1482164622.git.vpalatin@chromium.org>



On 19/12/2016 17:24, Vincent Palatin wrote:
>  #else /* _WIN32 */
> -    abort();
> +    if (!qemu_cpu_is_self(cpu)) {
> +        CONTEXT context;
> +        if (SuspendThread(cpu->hThread) == (DWORD)(-1)) {
> +            fprintf(stderr, "qemu:%s: GetLastError:%lu\n", __func__,
> +                    GetLastError());
> +            exit(1);
> +        }
> +
> +        /* On multi-core systems, we are not sure that the thread is actually
> +         * suspended until we can get the context.
> +         */
> +        context.ContextFlags = CONTEXT_CONTROL;
> +        while (GetThreadContext(cpu->hThread, &context) != 0) {
> +            continue;
> +        }
> +
> +        if (hax_enabled()) {
> +            cpu->exit_request = 1;
> +        }

As mentioned in the reply to patch 4, please leave the cpu->exit_request
= 1 assignment to the caller.

Apart from the above change, can you check if there are some less
heavyeight methods to force an exit?  I can think of QueueUserAPC with
an empty pfnAPC here, and SleepEx(0, TRUE) in qemu_hax_cpu_thread_fn
before qemu_wait_io_event_common.

> +        if (ResumeThread(cpu->hThread) == (DWORD)(-1)) {
> +            fprintf(stderr, "qemu:%s: GetLastError:%lu\n", __func__,
> +                    GetLastError());
> +            exit(1);
> +        }
> +    }

[...]

> 
> +            /*
> +             * In Hax, the qemu allocate the virtual address, and HAX kernel
> +             * populate the memory with physical memory. Currently we have no
> +             * paging, so user should make sure enough free memory in advance
> +             */
> +            if (hax_enabled()) {
> +                int ret;
> +                ret = hax_populate_ram((uint64_t)(uintptr_t)new_block->host,
> +                                       new_block->max_length);
> +                if (ret < 0) {
> +                    error_setg(errp, "Hax failed to populate ram");
> +                    return;
> +                }
> +            }
> +

Can you check if the interface at
http://marc.info/?l=qemu-devel&m=148225154320642&q=raw would be good for
your purposes, and if so include that patch in your v6?

Otherwise looks great, so I'm confident we can add this in QEMU 2.9.

Paolo

  reply	other threads:[~2016-12-22  9:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19 16:24 [Qemu-devel] [PATCH v5 0/4] Add HAX support Vincent Palatin
2016-12-19 16:24 ` [Qemu-devel] [PATCH v5 1/4] kvm: move cpu synchronization code Vincent Palatin
2016-12-19 16:24 ` [Qemu-devel] [PATCH v5 2/4] target-i386: Add Intel HAX files Vincent Palatin
2016-12-19 16:24 ` [Qemu-devel] [PATCH v5 3/4] Plumb the HAXM-based hardware acceleration support Vincent Palatin
2016-12-22  9:57   ` Paolo Bonzini [this message]
2017-01-05 13:50     ` Vincent Palatin
2017-01-05 14:01       ` Paolo Bonzini
2017-01-05 21:38         ` Paolo Bonzini
2017-01-06 14:08           ` Vincent Palatin
2017-01-09 13:03             ` Paolo Bonzini
2017-01-09 16:54               ` Vincent Palatin
2017-01-09  6:17           ` Yu Ning
2016-12-19 16:24 ` [Qemu-devel] [PATCH v5 4/4] hax: add Darwin support Vincent Palatin
2016-12-22  9:49   ` Paolo Bonzini
2017-01-05 13:50     ` Vincent Palatin

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=fda5a694-d02f-269e-e155-1822276d74f6@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    --cc=vpalatin@chromium.org \
    --cc=yu.ning@linux.intel.com \
    /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).