All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gleb O. Raiko" <raiko@niisi.msk.ru>
To: David Daney <ddaney@caviumnetworks.com>
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] MIPS: Implement __read_mostly
Date: Fri, 15 Oct 2010 15:25:24 +0400	[thread overview]
Message-ID: <4CB83A24.2050004@niisi.msk.ru> (raw)
In-Reply-To: <1287085009-16445-1-git-send-email-ddaney@caviumnetworks.com>

On 14.10.2010 23:36, David Daney wrote:
> diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
> --- a/arch/mips/kernel/setup.c
> +++ b/arch/mips/kernel/setup.c
> @@ -69,7 +69,7 @@ static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
>    * mips_io_port_base is the begin of the address space to which x86 style
>    * I/O ports are mapped.
>    */
> -const unsigned long mips_io_port_base __read_mostly = -1;
> +const unsigned long mips_io_port_base = -1;
>   EXPORT_SYMBOL(mips_io_port_base);

While we're here could we eliminate mips_io_port_base for boards that 
don't need it.

Now, it almost might be done by defining something like
__swizzle_addr_[bwlq](port)	((port) - mips_io_port_base)

Unfortunately, __swizzle_addr_[bwlq] is also used for memory acceeses 
too (in read/write[bwlq]), so definition above doesn't work.

By providing two variants, e.g. __swizzle_io_addr_[bwlq] and 
__swizzle_mem_addr_[bwlq] we can eliminate unnecessary loads of 
mips_io_port_base.

BTW, in recent kernels the trick with mips_io_port_base doesn't work 
well anyway. The solely purpose of the trick was to prevent loading of 
mips_io_port_base across function calls. Now drivers tend to use 
ioread/iowrite that don't use mips_io_port_base at all or use its own 
wrappers for in/out[bwlq] that _do_ load mips_io_port_base on every call.

Gleb.

  reply	other threads:[~2010-10-15 11:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-14 19:36 [PATCH] MIPS: Implement __read_mostly David Daney
2010-10-15 11:25 ` Gleb O. Raiko [this message]
2010-10-15 19:04   ` David Daney
2010-10-16  8:04 ` Geert Uytterhoeven
2010-10-16  8:05   ` Geert Uytterhoeven
2010-10-20 19:05   ` Ralf Baechle
2010-10-21  8:07     ` Geert Uytterhoeven
2011-01-17 23:55 ` Ralf Baechle

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=4CB83A24.2050004@niisi.msk.ru \
    --to=raiko@niisi.msk.ru \
    --cc=ddaney@caviumnetworks.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.