From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: v7_flush_kern_cache_louis flushes up to L2?
Date: Fri, 19 Apr 2013 10:21:42 +0000 [thread overview]
Message-ID: <20130419102142.GI14496@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <51656A89.9090600@arm.com>
On Wed, Apr 10, 2013 at 02:35:05PM +0100, Jonathan Austin wrote:
> Note that on SMP, you would also need to clean/flush again after turning
> off the caches, as read-speculation could have sucked dirty data from
> another cache in to your cache, which would need to be written back
> before sleeping.
Err, no. If you read data into a cache, it is always populated in a clean
state. You never suck dirty data out of one cache, remove it there and
place it immediately in a dirty state in an upper level cache.
So, if we start from the idea that reads will populate the upper level
cache with clean data, that cache is populated merely with a _copy_ of
the data held elsewhere in the system.
In that case, there is no need to clean or flush that cache after turning
it off - if the cache only contains _copies_ of data elsewhere in the
system, then it's perfectly fine for that data to be discarded in any
way - be that by turning the power off to the cache or invalidating it.
There is a step further in this: if the cache is being dirtied by the
local CPU, and that data will only ever be used by the local CPU, again,
in the CPU shutdown path, you really do not need to write that data out -
because the only CPU which cares about it is the local CPU which is going
to be shutdown. So, loss of that data is not a problem.
In other words, shutdown of a CPU is a process which involves pushing out
data which the rest of the system requires (that's done by an initial
flush). Once that flush is done, provided the dying CPU does not _write_
to any shared data (this includes spinlocks and such like too), there is
no need to flush the cache anymore.
next prev parent reply other threads:[~2013-04-19 10:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 10:43 v7_flush_kern_cache_louis flushes up to L2? Bastian Hecht
2013-04-10 11:51 ` Jonathan Austin
2013-04-10 12:16 ` Bastian Hecht
2013-04-10 13:35 ` Jonathan Austin
2013-04-10 14:49 ` Bastian Hecht
2013-04-19 10:21 ` Russell King - ARM Linux [this message]
2013-04-19 10:48 ` Russell King - ARM Linux
2013-04-10 13:51 ` Lorenzo Pieralisi
2013-04-10 15:08 ` Bastian Hecht
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=20130419102142.GI14496@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