All of lore.kernel.org
 help / color / mirror / Atom feed
* range operation of outer cache when start >= end?
@ 2016-01-08  2:54 ` Masahiro Yamada
  0 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2016-01-08  2:54 UTC (permalink / raw)
  To: linux-arm-kernel, Russell King - ARM Linux, Arnd Bergmann
  Cc: Linux Kernel Mailing List

Hi.


I know I am nitpicking.  Forgive me if I am asking a silly question.


How should the outer-cache handle such an insane case like  start >= end?

Assumed answers are:

[1] Do not care about that.  It should never happen.  If it does, fix
the caller.

[2]  Add   "if (start < end)" checking to
      outer_inv_range(), outer_clean_range(), outer_flush_range()
      in arch/arm/include/asm/outercache.h

[3] It should be cared in each of callbacks as needed



For example, l2c210_inv_range()
flushes the both ends of the range even if start >= end.

In this case, there is nothing to do, so should it have something like this?
    if (start >= end)
                 return;


static void l2c210_inv_range(unsigned long start, unsigned long end)
{
        void __iomem *base = l2x0_base;

        if (start & (CACHE_LINE_SIZE - 1)) {
                  start &= ~(CACHE_LINE_SIZE - 1);
                  writel_relaxed(start, base + L2X0_CLEAN_INV_LINE_PA);
                  start += CACHE_LINE_SIZE;
        }

        if (end & (CACHE_LINE_SIZE - 1)) {
                  end &= ~(CACHE_LINE_SIZE - 1);
                  writel_relaxed(end, base + L2X0_CLEAN_INV_LINE_PA);
        }

        __l2c210_op_pa_range(base + L2X0_INV_LINE_PA, start, end);
        __l2c210_cache_sync(base);
}





-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

* range operation of outer cache when start >= end?
@ 2016-01-08  2:54 ` Masahiro Yamada
  0 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2016-01-08  2:54 UTC (permalink / raw)
  To: linux-arm-kernel

Hi.


I know I am nitpicking.  Forgive me if I am asking a silly question.


How should the outer-cache handle such an insane case like  start >= end?

Assumed answers are:

[1] Do not care about that.  It should never happen.  If it does, fix
the caller.

[2]  Add   "if (start < end)" checking to
      outer_inv_range(), outer_clean_range(), outer_flush_range()
      in arch/arm/include/asm/outercache.h

[3] It should be cared in each of callbacks as needed



For example, l2c210_inv_range()
flushes the both ends of the range even if start >= end.

In this case, there is nothing to do, so should it have something like this?
    if (start >= end)
                 return;


static void l2c210_inv_range(unsigned long start, unsigned long end)
{
        void __iomem *base = l2x0_base;

        if (start & (CACHE_LINE_SIZE - 1)) {
                  start &= ~(CACHE_LINE_SIZE - 1);
                  writel_relaxed(start, base + L2X0_CLEAN_INV_LINE_PA);
                  start += CACHE_LINE_SIZE;
        }

        if (end & (CACHE_LINE_SIZE - 1)) {
                  end &= ~(CACHE_LINE_SIZE - 1);
                  writel_relaxed(end, base + L2X0_CLEAN_INV_LINE_PA);
        }

        __l2c210_op_pa_range(base + L2X0_INV_LINE_PA, start, end);
        __l2c210_cache_sync(base);
}





-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: range operation of outer cache when start >= end?
  2016-01-08  2:54 ` Masahiro Yamada
@ 2016-01-08 15:06   ` Russell King - ARM Linux
  -1 siblings, 0 replies; 6+ messages in thread
From: Russell King - ARM Linux @ 2016-01-08 15:06 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-arm-kernel, Arnd Bergmann, Linux Kernel Mailing List

On Fri, Jan 08, 2016 at 11:54:30AM +0900, Masahiro Yamada wrote:
> I know I am nitpicking.  Forgive me if I am asking a silly question.
> 
> 
> How should the outer-cache handle such an insane case like  start >= end?

Passing start >= end isn't defined, code should not pass start >= end.

> Assumed answers are:
> 
> [1] Do not care about that.  It should never happen.  If it does, fix
> the caller.

This applies.  What situation are you seeing start >= end?

What you will get with the existing code is potentially some cache
cleaning and a sync, but nothing apart from that.  __l2c210_op_pa_range()
becomes a no-op of start >= end.  However, that behaviour is not
guaranteed.

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* range operation of outer cache when start >= end?
@ 2016-01-08 15:06   ` Russell King - ARM Linux
  0 siblings, 0 replies; 6+ messages in thread
From: Russell King - ARM Linux @ 2016-01-08 15:06 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 08, 2016 at 11:54:30AM +0900, Masahiro Yamada wrote:
> I know I am nitpicking.  Forgive me if I am asking a silly question.
> 
> 
> How should the outer-cache handle such an insane case like  start >= end?

Passing start >= end isn't defined, code should not pass start >= end.

> Assumed answers are:
> 
> [1] Do not care about that.  It should never happen.  If it does, fix
> the caller.

This applies.  What situation are you seeing start >= end?

What you will get with the existing code is potentially some cache
cleaning and a sync, but nothing apart from that.  __l2c210_op_pa_range()
becomes a no-op of start >= end.  However, that behaviour is not
guaranteed.

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: range operation of outer cache when start >= end?
  2016-01-08 15:06   ` Russell King - ARM Linux
@ 2016-01-08 16:06     ` Masahiro Yamada
  -1 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2016-01-08 16:06 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Arnd Bergmann, linux-arm-kernel, Linux Kernel Mailing List

Hi Russell,


2016-01-09 0:06 GMT+09:00 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> On Fri, Jan 08, 2016 at 11:54:30AM +0900, Masahiro Yamada wrote:
>> I know I am nitpicking.  Forgive me if I am asking a silly question.
>>
>>
>> How should the outer-cache handle such an insane case like  start >= end?
>
> Passing start >= end isn't defined, code should not pass start >= end.
>
>> Assumed answers are:
>>
>> [1] Do not care about that.  It should never happen.  If it does, fix
>> the caller.
>
> This applies.  What situation are you seeing start >= end?

I never see such a case at all.
When I saw l2c210_inv_range(), I just wondered whether it should be
cared or not.


> What you will get with the existing code is potentially some cache
> cleaning and a sync, but nothing apart from that.  __l2c210_op_pa_range()
> becomes a no-op of start >= end.  However, that behaviour is not
> guaranteed.

Thanks for your explanation!

-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

* range operation of outer cache when start >= end?
@ 2016-01-08 16:06     ` Masahiro Yamada
  0 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2016-01-08 16:06 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Russell,


2016-01-09 0:06 GMT+09:00 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> On Fri, Jan 08, 2016 at 11:54:30AM +0900, Masahiro Yamada wrote:
>> I know I am nitpicking.  Forgive me if I am asking a silly question.
>>
>>
>> How should the outer-cache handle such an insane case like  start >= end?
>
> Passing start >= end isn't defined, code should not pass start >= end.
>
>> Assumed answers are:
>>
>> [1] Do not care about that.  It should never happen.  If it does, fix
>> the caller.
>
> This applies.  What situation are you seeing start >= end?

I never see such a case at all.
When I saw l2c210_inv_range(), I just wondered whether it should be
cared or not.


> What you will get with the existing code is potentially some cache
> cleaning and a sync, but nothing apart from that.  __l2c210_op_pa_range()
> becomes a no-op of start >= end.  However, that behaviour is not
> guaranteed.

Thanks for your explanation!

-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-01-08 16:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-08  2:54 range operation of outer cache when start >= end? Masahiro Yamada
2016-01-08  2:54 ` Masahiro Yamada
2016-01-08 15:06 ` Russell King - ARM Linux
2016-01-08 15:06   ` Russell King - ARM Linux
2016-01-08 16:06   ` Masahiro Yamada
2016-01-08 16:06     ` Masahiro Yamada

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.