From patchwork Tue Feb 13 22:10:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 10217663 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 C61F16055C for ; Tue, 13 Feb 2018 22:10:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC41E28EFE for ; Tue, 13 Feb 2018 22:10:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA66E28F45; Tue, 13 Feb 2018 22:10:21 +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,FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 028AA28F12 for ; Tue, 13 Feb 2018 22:10:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965900AbeBMWKU (ORCPT ); Tue, 13 Feb 2018 17:10:20 -0500 Received: from mout.gmx.net ([212.227.15.15]:55639 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965898AbeBMWKU (ORCPT ); Tue, 13 Feb 2018 17:10:20 -0500 Received: from ls3530.fritz.box ([89.244.189.156]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MMBun-1etB281xoT-0084kG; Tue, 13 Feb 2018 23:10:13 +0100 Date: Tue, 13 Feb 2018 23:10:10 +0100 From: Helge Deller To: linux-parisc@vger.kernel.org, James Bottomley , John David Anglin Subject: [PATCH] parisc: Improve cache flushing under qemu Message-ID: <20180213221010.GA27272@ls3530.fritz.box> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.1 (2017-09-22) X-Provags-ID: V03:K0:al3z3c9bej/hwURVbEOIlskj8qJp7+LjUQ9dkijPltUosnV9mMZ J5fUEZlGrrxm0Gf4VOKGhw4dbML2LaSVYDdQFJEutJpxeCf+06wiMwJVNBp0vyOz0vQ5q6G zprwsS6tigME5uSxahH+bg/levbOFvcUTQBERPjhka1JeUZczk6nspvSP9T6Sj8Js2shgmy vX+Ddj2RJG9DOXl5tm8EA== X-UI-Out-Filterresults: notjunk:1; V01:K0:lGZpBoQdzFQ=:9xAAzp0sx7a7Xx4MQniN+L JnI4GM/+SxZw4l+UsQI8XcD7D0LW4uzszMY5GK0W+BTRJBxKgyh5TglcbN1mEt9Cqkfbroz1U k48nWhO6c91x0Hz7pP2OlNBHyZDwFhQKjZMi3n4nQkGsPBOESTWWQd6qks6LXWiY0JQxVz/oz 1+hkBKIGVTOln4RmQzhyo0sSpgwhpzHCqB0Wn0Se87tu/m9FXZd2TV+NF7B9HAV+tHDxK7GqG Ndfyn3BdTTHyb5E6FnX7eH7UCowX3pjcpG7Jvx4Fz88L3Zg4GYlfu66Zlf3ZtmddQvbrt/PCc k4BqBJIhYF//X8lfY8Om2Nbz/FOWo5eGMl4urcr3ezbL0/vgX5sHe787ltIP2iz0pPyXQSqv4 hYtcGi7xuvlkLO9evc2QagRm9TFVt1tY6OKLJjE+vbRv1S2+Rj/w9n6AkW4a9xXm4ZyUei8O6 RxQCawL63OOIbDVZCNth5A6vAF/atuYbTOrY8i4pw4paIlnqF/fsGL40Xk7QGl+PoX04kS4AH B8QwMl32bdEdUP4mOOwt7EDUefCAEa4pvJxalJ1D6VIsSO18k1nh30p5ywywvN4Ler/6TlNiy L5VxgiyTzuJUtASdz2WM8iERQR+xLortHby+ircWxuCFwnJiadBeGIwakyPx1nLL/Ydp2Hu4H Tm8pme3AgEoRJbi6DMQceavhrtWA09SXKFWvK4Nl/wetaedWOVVY9R6ZnqlDW7wGJtgrBKjnC gznKA6NJ1NP532fgjWksjWZfumGIjruimv0ZkXubH63OJVz7W41TWRBR5bIp4jsZpZGM0cSD9 vXN52sqrC9XnYmBqa70Cld+veVYpg== Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In QEMU we emulate a machine without any data or instruction caches. Avoid calling the assembly cache flush functions when we have no caches improves speed with qemu a lot. Signed-off-by: Helge Deller --- To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c index d5381b3e8f95..b4b6f6631d3b 100644 --- a/arch/parisc/kernel/cache.c +++ b/arch/parisc/kernel/cache.c @@ -55,11 +55,17 @@ static struct pdc_btlb_info btlb_info __read_mostly; void flush_data_cache(void) { + if (unlikely(!cache_info.dc_size)) + return; + on_each_cpu(flush_data_cache_local, NULL, 1); } void flush_instruction_cache(void) { + if (unlikely(!cache_info.ic_size)) + return; + on_each_cpu(flush_instruction_cache_local, NULL, 1); } #endif @@ -67,8 +73,10 @@ flush_instruction_cache(void) void flush_cache_all_local(void) { - flush_instruction_cache_local(NULL); - flush_data_cache_local(NULL); + if (likely(cache_info.ic_size)) + flush_instruction_cache_local(NULL); + if (likely(cache_info.dc_size)) + flush_data_cache_local(NULL); } EXPORT_SYMBOL(flush_cache_all_local); @@ -506,7 +515,8 @@ static void cacheflush_h_tmp_function(void *dummy) void flush_cache_all(void) { - on_each_cpu(cacheflush_h_tmp_function, NULL, 1); + if (likely(cache_info.dc_size || cache_info.ic_size)) + on_each_cpu(cacheflush_h_tmp_function, NULL, 1); } static inline unsigned long mm_total_size(struct mm_struct *mm)