linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/5] ARM: Implement read/write for ownership in the ARMv6 DMA cache ops
Date: Tue, 23 Mar 2010 21:38:25 +0000	[thread overview]
Message-ID: <20100323213825.GI19572@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20100322151945.6353.7333.stgit@e102109-lin.cambridge.arm.com>

On Mon, Mar 22, 2010 at 03:19:45PM +0000, Catalin Marinas wrote:
> diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S
> index 9d89c67..b9f2cbd 100644
> --- a/arch/arm/mm/cache-v6.S
> +++ b/arch/arm/mm/cache-v6.S
> @@ -211,6 +211,9 @@ v6_dma_inv_range:
>  	mcrne	p15, 0, r1, c7, c15, 1		@ clean & invalidate unified line
>  #endif
>  1:
> +#ifdef CONFIG_SMP
> +	str	r0, [r0]			@ write for ownership
> +#endif
>  #ifdef HARVARD_CACHE
>  	mcr	p15, 0, r0, c7, c6, 1		@ invalidate D line
>  #else
> @@ -231,6 +234,9 @@ v6_dma_inv_range:
>  v6_dma_clean_range:
>  	bic	r0, r0, #D_CACHE_LINE_SIZE - 1
>  1:
> +#ifdef CONFIG_SMP
> +	ldr	r2, [r0]			@ read for ownership
> +#endif
>  #ifdef HARVARD_CACHE
>  	mcr	p15, 0, r0, c7, c10, 1		@ clean D line
>  #else
> @@ -251,6 +257,10 @@ v6_dma_clean_range:
>  ENTRY(v6_dma_flush_range)
>  	bic	r0, r0, #D_CACHE_LINE_SIZE - 1
>  1:
> +#ifdef CONFIG_SMP
> +	ldr	r2, [r0]			@ read for ownership
> +	str	r2, [r0]			@ write for ownership

What is the effect of using the register just loaded on ARMv6?  Does it
stall like previous architectures?  If so, this str should use a different
register.

In any case, does reading then writing actually achieve anything over just
a plain write?  read surely brings the cache line into shared mode, and
a write to exclusive mode - so won't just a write do?

The converse argument is that with read allocate caches, this technique
can result in faster code, so why don't we use it in dma_inv_range?

Maybe this needs to be benchmarked to discover which method is optimal.

  reply	other threads:[~2010-03-23 21:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-22 15:19 [PATCH 0/5] Various patches for 2.6.35-rc1 Catalin Marinas
2010-03-22 15:19 ` [PATCH 1/5] ARM: Use lazy cache flushing on ARMv7 SMP systems Catalin Marinas
2010-03-23 21:33   ` Russell King - ARM Linux
2010-03-24  9:51     ` Catalin Marinas
2010-03-26 14:49     ` Catalin Marinas
2010-03-26 17:36       ` Catalin Marinas
2010-03-22 15:19 ` [PATCH 2/5] ARM: Implement read/write for ownership in the ARMv6 DMA cache ops Catalin Marinas
2010-03-23 21:38   ` Russell King - ARM Linux [this message]
2010-03-26 14:08     ` [PATCH 2/5] ARM: Implement read/write for ownership in theARMv6 " Catalin Marinas
2010-03-22 15:19 ` [PATCH 3/5] ARM: Correct the VFPv3 detection Catalin Marinas
2010-03-23 21:38   ` Russell King - ARM Linux
2010-03-22 15:19 ` [PATCH 4/5] ARM: Align machine_desc.phys_io to a 1MB section Catalin Marinas
2010-03-23 21:39   ` Russell King - ARM Linux
2010-03-22 15:20 ` [PATCH 5/5] ARM: Remove the domain switching on ARMv6k/v7 CPUs Catalin Marinas

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=20100323213825.GI19572@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).