From patchwork Thu Apr 2 03:32:27 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Mundt X-Patchwork-Id: 15832 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n323cttX018541 for ; Thu, 2 Apr 2009 03:38:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765833AbZDBDhK (ORCPT ); Wed, 1 Apr 2009 23:37:10 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S934072AbZDBDhK (ORCPT ); Wed, 1 Apr 2009 23:37:10 -0400 Received: from 124x34x33x190.ap124.ftth.ucom.ne.jp ([124.34.33.190]:56422 "EHLO master.linux-sh.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934045AbZDBDhI (ORCPT ); Wed, 1 Apr 2009 23:37:08 -0400 Received: from localhost (unknown [127.0.0.1]) by master.linux-sh.org (Postfix) with ESMTP id 4F71363754; Thu, 2 Apr 2009 03:32:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at linux-sh.org Received: from master.linux-sh.org ([127.0.0.1]) by localhost (master.linux-sh.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vdlB3GOGxj5d; Thu, 2 Apr 2009 12:32:27 +0900 (JST) Received: by master.linux-sh.org (Postfix, from userid 500) id BB9DD63758; Thu, 2 Apr 2009 12:32:27 +0900 (JST) Date: Thu, 2 Apr 2009 12:32:27 +0900 From: Paul Mundt To: Shin-ichiro KAWASAKI Cc: Magnus Damm , "linux-sh@vger.kernel.org" Subject: Re: qemu-sh CF access perormance Message-ID: <20090402033227.GA11327@linux-sh.org> Mail-Followup-To: Paul Mundt , Shin-ichiro KAWASAKI , Magnus Damm , "linux-sh@vger.kernel.org" References: <49D2185C.4050909@juno.dti.ne.jp> <49D3875F.5020103@juno.dti.ne.jp> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <49D3875F.5020103@juno.dti.ne.jp> User-Agent: Mutt/1.5.13 (2006-08-11) Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org On Thu, Apr 02, 2009 at 12:25:19AM +0900, Shin-ichiro KAWASAKI wrote: > Hi, Magnus! Thank you for your explanation. > > Magnus Damm wrote: > >2009/3/31 Shin-ichiro KAWASAKI : > >>I'd like to ask following questions to linux-sh experts, > >> > >> - Why such io-traps are used to access CF? > >> - Will this io-traps are used for SH7785LCR's SD card access? > >> > >>I guess these io-traps can be the reason why gcc takes so much time on > >>qemu-sh. > > > >The r2d hardware implements 16-bit only CF interface while driver > >software requires 8-bit access. To work around this issue io_trapped > >is used to convert 8-bit accesses to 16-bit accesses. This is quite > >slow. > > > >For more information, please see the comment in > >arch/sh/boards/mach-r2d/setup.c > > > >To improve performance, consider adding a command line flag to the > >kernel that disables io_trapped. This flag can then be set on the > >kernel command line by the person running qemu. > > > >Hope this helps! > > It really helps! > > The attached patch is a rough implementation to add a command line > flag 'avoid_trap', which Magnus suggested. It is just a reference, > but it reduces the gcc compile time from 40 seconds to around 4 seconds. > 10 times faster! > > Is it OK to add such qemu specific options to linux kernel mainline? > Sure, why not. Try this: Tested-by: Shin-ichiro KAWASAKI --- commit eeee7853c4ffaf5b9eb58f39708e3c78f66cee15 Author: Paul Mundt Date: Thu Apr 2 12:31:16 2009 +0900 sh: Add a command line option for disabling I/O trapping. This adds a 'noiotrap' kernel command line option to permit disabling of I/O trapping. This is mostly useful for running on emulators where the physical device limitations are not an issue. Signed-off-by: Paul Mundt -- To unsubscribe from this list: send the line "unsubscribe linux-sh" 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/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 240257d..8b2067c 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -1544,6 +1544,8 @@ and is between 256 and 4096 characters. It is defined in the file Valid arguments: on, off Default: on + noiotrap [SH] Disables trapped I/O port accesses. + noirqdebug [X86-32] Disables the code which attempts to detect and disable unhandled interrupt sources. diff --git a/arch/sh/kernel/io_trapped.c b/arch/sh/kernel/io_trapped.c index 39cd7f3..c22853b 100644 --- a/arch/sh/kernel/io_trapped.c +++ b/arch/sh/kernel/io_trapped.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,15 @@ EXPORT_SYMBOL_GPL(trapped_mem); #endif static DEFINE_SPINLOCK(trapped_lock); +static int trapped_io_disable __read_mostly; + +static int __init trapped_io_setup(char *__unused) +{ + trapped_io_disable = 1; + return 1; +} +__setup("noiotrap", trapped_io_setup); + int register_trapped_io(struct trapped_io *tiop) { struct resource *res; @@ -39,6 +49,9 @@ int register_trapped_io(struct trapped_io *tiop) struct page *pages[TRAPPED_PAGES_MAX]; int k, n; + if (unlikely(trapped_io_disable)) + return 0; + /* structure must be page aligned */ if ((unsigned long)tiop & (PAGE_SIZE - 1)) goto bad;