linux-mips
[Top] [All Lists]

Re: [PATCH] MIPS: Implement __read_mostly

To: David Daney <ddaney@caviumnetworks.com>
Subject: Re: [PATCH] MIPS: Implement __read_mostly
From: "Gleb O. Raiko" <raiko@niisi.msk.ru>
Date: Fri, 15 Oct 2010 15:25:24 +0400
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org
In-reply-to: <1287085009-16445-1-git-send-email-ddaney@caviumnetworks.com>
Organization: NIISI RAN
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1287085009-16445-1-git-send-email-ddaney@caviumnetworks.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0
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.

<Prev in Thread] Current Thread [Next in Thread>