From patchwork Mon Aug 24 00:24:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 510063 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D66DC140518 for ; Tue, 25 Aug 2015 00:35:39 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=braap.org header.i=@braap.org header.b=AiHMcPu5; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b=GS+g4Qi9; dkim-atps=neutral Received: from localhost ([::1]:48693 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTsqX-0007RS-PL for incoming@patchwork.ozlabs.org; Mon, 24 Aug 2015 10:35:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTfZB-00075y-9e for qemu-devel@nongnu.org; Sun, 23 Aug 2015 20:24:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZTfZ8-0000ou-2i for qemu-devel@nongnu.org; Sun, 23 Aug 2015 20:24:49 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:57738) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTfZ7-0000oh-Tn for qemu-devel@nongnu.org; Sun, 23 Aug 2015 20:24:45 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id C5FC9209DD for ; Sun, 23 Aug 2015 20:24:45 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Sun, 23 Aug 2015 20:24:45 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-sasl-enc:x-sasl-enc; s=mesmtp; bh=zMHqKRpNwYcLKMmRrbCK2dUphfg =; b=AiHMcPu5/ZXaZUdVeUj2KDJBzJQQ+aGfJNYu7CquBrB1Q+vgX3+yCr72b8z jQlF2iUQxOJoa4IjJoARybvbCrKWBRTq8QSlNuXKWNM9clorEpGNtiKXWzMwE8vx G0tSh3xBZHQ4ovVdURa50iTvfoe2JxaO+O3++oTSgIZG+UIo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=zMHq KRpNwYcLKMmRrbCK2dUphfg=; b=GS+g4Qi9dbMpr9WP4727SYb0vjBGcnvn9VhT Q7vaS7gLe2TpKToirOgRH1T+eQyrMb2AGF2PSuaMwAWHYAn3tsbOyLG0OUAOJUZE pTcswz6fW9UNLy1vitL7zyU+Jnygg0QfOBXDSMHqhFP8xCQyyX+93Ko5/mD0Qdaj 803zar0= X-Sasl-enc: 541hln/7vKcuGaepCgrjK4Ae0cEeCwspSBvupCoULfAS 1440375885 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 83E63C00016; Sun, 23 Aug 2015 20:24:45 -0400 (EDT) From: "Emilio G. Cota" To: qemu-devel@nongnu.org, mttcg@listserver.greensocs.com Date: Sun, 23 Aug 2015 20:24:07 -0400 Message-Id: <1440375847-17603-39-git-send-email-cota@braap.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1440375847-17603-1-git-send-email-cota@braap.org> References: <1440375847-17603-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.28 Cc: mark.burton@greensocs.com, a.rigo@virtualopensystems.com, guillaume.delbergue@greensocs.com, pbonzini@redhat.com, alex.bennee@linaro.org, Frederic Konrad Subject: [Qemu-devel] [RFC 38/38] Revert "target-i386: yield to another VCPU on PAUSE" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This reverts commit 81f3053b77f7d3a4d9100c425cd8cec99ee7a3d4. The interrupt raised by the change in the commit above kills performance when running many idling VCPUs. For example, on my 64-core host when running a workload where cores are idling often (e.g. blackscholes), performance drops significantly because threads are most of the time just exiting the CPU loop, thereby causing great contention on the BQL. Fix it by reverting to the old behaviour by which no interrupt is raised, which shouldn't be an issue given that we have now one thread per VCPU. Signed-off-by: Emilio G. Cota Conflicts: target-i386/misc_helper.c --- target-i386/helper.h | 1 - target-i386/misc_helper.c | 22 ++-------------------- target-i386/translate.c | 5 +---- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/target-i386/helper.h b/target-i386/helper.h index 7d92140..495d9f8 100644 --- a/target-i386/helper.h +++ b/target-i386/helper.h @@ -56,7 +56,6 @@ DEF_HELPER_2(sysret, void, env, int) DEF_HELPER_2(hlt, void, env, int) DEF_HELPER_2(monitor, void, env, tl) DEF_HELPER_2(mwait, void, env, int) -DEF_HELPER_2(pause, void, env, int) DEF_HELPER_1(debug, void, env) DEF_HELPER_1(reset_rf, void, env) DEF_HELPER_3(raise_interrupt, void, env, int, int) diff --git a/target-i386/misc_helper.c b/target-i386/misc_helper.c index 52c5d65..0389df2 100644 --- a/target-i386/misc_helper.c +++ b/target-i386/misc_helper.c @@ -556,15 +556,6 @@ void helper_rdmsr(CPUX86State *env) } #endif -static void do_pause(X86CPU *cpu) -{ - CPUState *cs = CPU(cpu); - - /* Just let another CPU run. */ - cs->exception_index = EXCP_INTERRUPT; - cpu_loop_exit(cs); -} - static void do_hlt(X86CPU *cpu) { CPUState *cs = CPU(cpu); @@ -610,22 +601,13 @@ void helper_mwait(CPUX86State *env, int next_eip_addend) cs = CPU(cpu); /* XXX: not complete but not completely erroneous */ if (cs->cpu_index != 0 || CPU_NEXT(cs) != NULL) { - do_pause(cpu); + /* more than one CPU: do not sleep because another CPU may + wake this one */ } else { do_hlt(cpu); } } -void helper_pause(CPUX86State *env, int next_eip_addend) -{ - X86CPU *cpu = x86_env_get_cpu(env); - - cpu_svm_check_intercept_param(env, SVM_EXIT_PAUSE, 0); - env->eip += next_eip_addend; - - do_pause(cpu); -} - void helper_debug(CPUX86State *env) { CPUState *cs = CPU(x86_env_get_cpu(env)); diff --git a/target-i386/translate.c b/target-i386/translate.c index 4d6030f..3b68660 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -6934,10 +6934,7 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s, goto do_xchg_reg_eax; } if (prefixes & PREFIX_REPZ) { - gen_update_cc_op(s); - gen_jmp_im(pc_start - s->cs_base); - gen_helper_pause(cpu_env, tcg_const_i32(s->pc - pc_start)); - s->is_jmp = DISAS_TB_JUMP; + gen_svm_check_intercept(s, pc_start, SVM_EXIT_PAUSE); } break; case 0x9b: /* fwait */