From: Jan Kiszka <jan.kiszka@web.de>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
kvm@vger.kernel.org, Gleb Natapov <gleb@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>, Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 1/8] kvm: Set cpu_single_env only once
Date: Sat, 11 Feb 2012 11:06:42 +0100 [thread overview]
Message-ID: <4F363DB2.3080908@web.de> (raw)
In-Reply-To: <CAAu8pHt4dR5vp3wM4nVdnwoyxBUBi5L-LkskV=CQ9P0fNOLD9Q@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2290 bytes --]
On 2012-02-11 11:02, Blue Swirl wrote:
> On Fri, Feb 10, 2012 at 18:31, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>> As we have thread-local cpu_single_env now and KVM uses exactly one
>> thread per VCPU, we can drop the cpu_single_env updates from the loop
>> and initialize this variable only once during setup.
>
> I don't think this is correct. Maybe you missed the part that sets
> cpu_single_env to NULL, which I think is to annoy broken code that
> assumes that some CPU state is always globally available. This is not
> true for monitor context.
I did check this before changing, and I see no such need. Particularly
as this old debugging help prevents valid use case.
Jan
>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>> cpus.c | 1 +
>> kvm-all.c | 5 -----
>> 2 files changed, 1 insertions(+), 5 deletions(-)
>>
>> diff --git a/cpus.c b/cpus.c
>> index f45a438..d0c8340 100644
>> --- a/cpus.c
>> +++ b/cpus.c
>> @@ -714,6 +714,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg)
>> qemu_mutex_lock(&qemu_global_mutex);
>> qemu_thread_get_self(env->thread);
>> env->thread_id = qemu_get_thread_id();
>> + cpu_single_env = env;
>>
>> r = kvm_init_vcpu(env);
>> if (r < 0) {
>> diff --git a/kvm-all.c b/kvm-all.c
>> index c4babda..e2cbc03 100644
>> --- a/kvm-all.c
>> +++ b/kvm-all.c
>> @@ -1118,8 +1118,6 @@ int kvm_cpu_exec(CPUState *env)
>> return EXCP_HLT;
>> }
>>
>> - cpu_single_env = env;
>> -
>> do {
>> if (env->kvm_vcpu_dirty) {
>> kvm_arch_put_registers(env, KVM_PUT_RUNTIME_STATE);
>> @@ -1136,13 +1134,11 @@ int kvm_cpu_exec(CPUState *env)
>> */
>> qemu_cpu_kick_self();
>> }
>> - cpu_single_env = NULL;
>> qemu_mutex_unlock_iothread();
>>
>> run_ret = kvm_vcpu_ioctl(env, KVM_RUN, 0);
>>
>> qemu_mutex_lock_iothread();
>> - cpu_single_env = env;
>> kvm_arch_post_run(env, run);
>>
>> kvm_flush_coalesced_mmio_buffer();
>> @@ -1206,7 +1202,6 @@ int kvm_cpu_exec(CPUState *env)
>> }
>>
>> env->exit_request = 0;
>> - cpu_single_env = NULL;
>> return ret;
>> }
>>
>> --
>> 1.7.3.4
>>
>>
>
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2012-02-11 10:06 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-10 18:31 [Qemu-devel] [PATCH v2 0/8] uq/master: TPR access optimization for Windows guests Jan Kiszka
2012-02-10 18:31 ` [Qemu-devel] [PATCH v2 1/8] kvm: Set cpu_single_env only once Jan Kiszka
2012-02-11 10:02 ` Blue Swirl
2012-02-11 10:06 ` Jan Kiszka [this message]
2012-02-11 11:25 ` Blue Swirl
2012-02-11 11:49 ` Andreas Färber
2012-02-11 12:43 ` Jan Kiszka
2012-02-11 13:06 ` Andreas Färber
2012-02-11 13:07 ` Jan Kiszka
2012-02-11 13:21 ` Andreas Färber
2012-02-11 13:35 ` Jan Kiszka
2012-02-11 13:59 ` Andreas Färber
2012-02-11 14:02 ` Jan Kiszka
2012-02-11 14:12 ` Andreas Färber
2012-02-11 14:24 ` Jan Kiszka
2012-02-11 14:49 ` Andreas Färber
2012-02-13 8:17 ` Paolo Bonzini
2012-02-11 13:54 ` Blue Swirl
2012-02-11 14:00 ` Jan Kiszka
2012-02-11 14:11 ` Blue Swirl
2012-02-11 14:18 ` Jan Kiszka
2012-02-11 14:23 ` Blue Swirl
2012-02-11 12:41 ` Jan Kiszka
2012-02-10 18:31 ` [Qemu-devel] [PATCH v2 2/8] Allow to use pause_all_vcpus from VCPU context Jan Kiszka
2012-02-11 14:16 ` Blue Swirl
2012-02-11 14:31 ` Jan Kiszka
2012-02-10 18:31 ` [Qemu-devel] [PATCH v2 3/8] target-i386: Add infrastructure for reporting TPR MMIO accesses Jan Kiszka
2012-02-11 14:32 ` Blue Swirl
2012-02-10 18:31 ` [Qemu-devel] [PATCH v2 4/8] kvmvapic: Add option ROM Jan Kiszka
2012-02-10 18:31 ` [Qemu-devel] [PATCH v2 5/8] kvmvapic: Introduce TPR access optimization for Windows guests Jan Kiszka
2012-02-11 15:25 ` Blue Swirl
2012-02-13 10:16 ` Jan Kiszka
2012-02-13 18:50 ` Blue Swirl
2012-02-13 19:11 ` Gleb Natapov
2012-02-13 19:22 ` Jan Kiszka
2012-02-14 7:54 ` Gleb Natapov
2012-02-14 8:55 ` Jan Kiszka
2012-02-14 8:59 ` Gleb Natapov
2012-02-10 18:31 ` [Qemu-devel] [PATCH v2 6/8] kvmvapic: Simplify mp/up_set_tpr Jan Kiszka
2012-02-10 18:31 ` [Qemu-devel] [PATCH v2 7/8] optionsrom: Reserve space for checksum Jan Kiszka
2012-02-11 11:46 ` Andreas Färber
2012-02-11 12:45 ` Jan Kiszka
2012-02-11 12:51 ` Andreas Färber
2012-02-11 12:57 ` Jan Kiszka
2012-02-10 18:31 ` [Qemu-devel] [PATCH v2 8/8] kvmvapic: Use optionrom helpers Jan Kiszka
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=4F363DB2.3080908@web.de \
--to=jan.kiszka@web.de \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@nongnu.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).