From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 9/9] ARM: Add SWP/SWPB emulation for ARMv7 processors (v5)
Date: Mon, 13 Sep 2010 12:55:26 +0100 [thread overview]
Message-ID: <20100913115526.GE30787@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1283787775.12076.115.camel@e102109-lin.cambridge.arm.com>
On Mon, Sep 06, 2010 at 04:42:55PM +0100, Catalin Marinas wrote:
> +/*
> + * Error-checking SWP macros implemented using ldrex{b}/strex{b}
> + */
> +#define __user_swpX_asm(data, addr, res, B) \
> + __asm__ __volatile__( \
> + " mov r3, %1\n" \
> + "0: ldrex"B" %1, [%2]\n" \
> + "1: strex"B" %0, r3, [%2]\n" \
> + " cmp %0, #0\n" \
> + " movne %0, %3\n" \
> + "2:\n" \
> + " .section .fixup,\"ax\"\n" \
> + " .align 2\n" \
> + "3: mov %0, %4\n" \
> + " b 2b\n" \
> + " .previous\n" \
> + " .section __ex_table,\"a\"\n" \
> + " .align 3\n" \
> + " .long 0b, 3b\n" \
> + " .long 1b, 3b\n" \
> + " .previous" \
> + : "=&r" (res), "+r" (data) \
> + : "r" (addr), "i" (-EAGAIN), "i" (-EFAULT) \
> + : "cc", "r3")
This assembly needs to be cleaned up to avoid using a fixed register.
r3 is the first register gcc choses to use when allocating registers,
so to clobber it almost guarantees making gcc's job a little harder.
Instead, do this:
unsigned long temp;
and in the asm() output line:
: "=&r" (res), "+r" (data), "=&r" (temp)
> +static unsigned long long swpcounter;
> +static unsigned long long swpbcounter;
> +static unsigned long long abtcounter;
long long can't be atomically updated - and if you have over 4000000000
faults, do you really care at that point?
> +static long previous_pid;
There is a typedef for pids.
Apart from that, the rest looks fine.
next prev parent reply other threads:[~2010-09-13 11:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-31 13:57 [PATCH 0/9] Various patches for 2.6.37-rc1 Catalin Marinas
2010-08-31 13:58 ` [PATCH 1/9] ARM: Allow lazy cache flushing via PG_arch_1 for highmem pages Catalin Marinas
2010-08-31 13:58 ` [PATCH 2/9] ARM: Assume new page cache pages have dirty D-cache Catalin Marinas
2010-08-31 13:58 ` [PATCH 3/9] ARM: Introduce __sync_icache_dcache() for VIPT caches Catalin Marinas
2010-08-31 13:58 ` [PATCH 4/9] ARM: Use lazy cache flushing on ARMv7 SMP systems Catalin Marinas
2010-08-31 13:58 ` [PATCH 5/9] ARM: Remove superfluous flush_kernel_dcache_page() Catalin Marinas
2010-08-31 13:58 ` [PATCH 6/9] ARM: Implement phys_mem_access_prot() to avoid attributes aliasing Catalin Marinas
2010-08-31 13:58 ` [PATCH 7/9] ARM: Improve the L2 cache performance when PL310 is used Catalin Marinas
2010-09-13 11:36 ` Russell King - ARM Linux
2010-09-13 11:57 ` Catalin Marinas
2010-08-31 13:58 ` [PATCH 8/9] ARM: Remove the domain switching on ARMv6k/v7 CPUs Catalin Marinas
2010-08-31 13:58 ` [PATCH 9/9] ARM: Add SWP/SWPB emulation for ARMv7 processors (v5) Catalin Marinas
2010-08-31 15:05 ` Kirill A. Shutemov
2010-09-06 15:42 ` Catalin Marinas
2010-09-13 11:55 ` Russell King - ARM Linux [this message]
2010-09-14 13:50 ` Leif Lindholm
2010-09-01 4:08 ` Olof Johansson
2010-09-02 17:04 ` Leif Lindholm
2010-09-02 17:20 ` Olof Johansson
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=20100913115526.GE30787@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).