From patchwork Fri Jul 29 09:00:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 9252315 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0C84060757 for ; Fri, 29 Jul 2016 09:00:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDAB120649 for ; Fri, 29 Jul 2016 09:00:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCD1327F9E; Fri, 29 Jul 2016 09:00:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 07B6620649 for ; Fri, 29 Jul 2016 09:00:40 +0000 (UTC) Received: from localhost ([::1]:58279 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bT3ep-00044M-LA for patchwork-qemu-devel@patchwork.kernel.org; Fri, 29 Jul 2016 05:00:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bT3eW-00044D-O0 for qemu-devel@nongnu.org; Fri, 29 Jul 2016 05:00:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bT3eR-00023z-RC for qemu-devel@nongnu.org; Fri, 29 Jul 2016 05:00:19 -0400 Received: from gate.crashing.org ([63.228.1.57]:36647) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bT3eR-00023m-Ib; Fri, 29 Jul 2016 05:00:15 -0400 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id u6T900D0011878; Fri, 29 Jul 2016 04:00:02 -0500 Message-ID: <1469782800.5978.284.camel@kernel.crashing.org> From: Benjamin Herrenschmidt To: Richard Henderson , qemu-ppc@nongnu.org Date: Fri, 29 Jul 2016 19:00:00 +1000 In-Reply-To: <76968d9e-1b45-538e-a400-9069eb72f42e@twiddle.net> References: <1469571686-7284-1-git-send-email-benh@kernel.crashing.org> <1469571686-7284-28-git-send-email-benh@kernel.crashing.org> <76968d9e-1b45-538e-a400-9069eb72f42e@twiddle.net> X-Mailer: Evolution 3.20.4 (3.20.4-1.fc24) Mime-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by gate.crashing.org id u6T900D0011878 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 63.228.1.57 Subject: Re: [Qemu-devel] [PATCH 28/32] ppc: Avoid double translation for lvx/lvxl/stvx/stvxl X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Fri, 2016-07-29 at 06:19 +0530, Richard Henderson wrote: > (1) The helper, since it writes to registers controlled by tcg, must be  > described to clobber all registers.  Which will noticeably increase memory  > traffic to ENV.  For instance, you won't be able to hold the guest register  > holding the address in a host register across the call. So after fixing my test setup, I did observe indeed a small performance loss using the helper in qemu-user. It might still win us something in softmmu due to avoiding extra translations but I will leave that aside as I mentioned separately. Now out of curosity, I tried this: If my understanding is right, the above is correct, as none of these instructions will write to the env, though they can read from it and/ or generate faults. Sadly I haven't observed any performance improvement as a result in a few micro-benchmarks I cooked up. Cheers, Ben --- a/target-ppc/helper.h +++ b/target-ppc/helper.h @@ -22,12 +22,12 @@ DEF_HELPER_1(check_tlb_flush, void, env)  #endif    DEF_HELPER_3(lmw, void, env, tl, i32) -DEF_HELPER_3(stmw, void, env, tl, i32) +DEF_HELPER_FLAGS_3(stmw, TCG_CALL_NO_WG, void, env, tl, i32)  DEF_HELPER_4(lsw, void, env, tl, i32, i32)  DEF_HELPER_5(lswx, void, env, tl, i32, i32, i32) -DEF_HELPER_4(stsw, void, env, tl, i32, i32) -DEF_HELPER_3(dcbz, void, env, tl, i32) -DEF_HELPER_2(icbi, void, env, tl) +DEF_HELPER_FLAGS_4(stsw, TCG_CALL_NO_WG, void, env, tl, i32, i32) +DEF_HELPER_FLAGS_3(dcbz, TCG_CALL_NO_WG, void, env, tl, i32) +DEF_HELPER_FLAGS_2(icbi, TCG_CALL_NO_WG, void, env, tl)  DEF_HELPER_5(lscbx, tl, env, tl, i32, i32, i32)    #if defined(TARGET_PPC64)