public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
From: Shin-ichiro KAWASAKI <kawasaki@juno.dti.ne.jp>
To: linux-sh@vger.kernel.org
Subject: Re: qemu-sh CF access perormance
Date: Thu, 02 Apr 2009 14:36:17 +0000	[thread overview]
Message-ID: <49D4CD61.5000603@juno.dti.ne.jp> (raw)
In-Reply-To: <49D2185C.4050909@juno.dti.ne.jp>

Paul Mundt wrote:
> 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 <kawasaki@juno.dti.ne.jp>:
>>>> 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:

It works fine, and gains same performance improvement as my dirty patch.
Thank you Paul for your quick clean patch!

Tested-by: Shin-ichiro KAWASAKI <kawasaki@juno.dti.ne.jp>

> ---
> 
> commit eeee7853c4ffaf5b9eb58f39708e3c78f66cee15
> Author: Paul Mundt <lethal@linux-sh.org>
> 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 <lethal@linux-sh.org>
> 
> 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 <linux/bitops.h>
>  #include <linux/vmalloc.h>
>  #include <linux/module.h>
> +#include <linux/init.h>
>  #include <asm/system.h>
>  #include <asm/mmu_context.h>
>  #include <asm/uaccess.h>
> @@ -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;
> --
> 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
> 


      parent reply	other threads:[~2009-04-02 14:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-31 13:19 qemu-sh CF access perormance Shin-ichiro KAWASAKI
2009-04-01  4:22 ` Magnus Damm
2009-04-01 15:25 ` Shin-ichiro KAWASAKI
2009-04-02  3:32 ` Paul Mundt
2009-04-02 14:36 ` Shin-ichiro KAWASAKI [this message]

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=49D4CD61.5000603@juno.dti.ne.jp \
    --to=kawasaki@juno.dti.ne.jp \
    --cc=linux-sh@vger.kernel.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