linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 00/12] arm/arm64: KVM: host cache maintenance when guest caches are off
Date: Wed, 19 Feb 2014 10:12:46 +0000	[thread overview]
Message-ID: <20140219101246.GD30457@arm.com> (raw)
In-Reply-To: <56ae8a2975cd21765b90d98260862af1@www.loen.fr>

On Wed, Feb 19, 2014 at 09:02:34AM +0000, Marc Zyngier wrote:
> On 2014-02-18 20:57, Eric Northup wrote:
> > On Tue, Feb 18, 2014 at 7:27 AM, Marc Zyngier <marc.zyngier@arm.com> 
> > wrote:
> >>
> >> When we run a guest with cache disabled, we don't flush the cache to
> >> the Point of Coherency, hence possibly missing bits of data that 
> >> have
> >> been written in the cache, but have not yet reached memory.
> >>
> >> We also have the opposite issue: when a guest enables its cache,
> >> whatever sits in the cache is suddenly going to become visible,
> >> shadowing whatever the guest has written into RAM.
> >>
> >> There are several approaches to these issues:
> >> - Using the DC bit when caches are off: this breaks guests assuming
> >>   caches off while doing DMA operations. Bootloaders, for example.
> >>   It also breaks the I-D coherency.
> >> - Fetch the memory attributes on translation fault, and flush the
> >>   cache while handling the fault. This relies on using the PAR_EL1
> >>   register to obtain the Stage-1 memory attributes, and tends to be
> >>   slow.
> >> - Detecting the translation faults occuring with MMU off (and
> >>   performing a cache clean), and trapping SCTLR_EL1 to detect the
> >>   moment when the guest is turning its caches on (and performing a
> >>   cache invalidation). Trapping of SCTLR_EL1 is then disabled to
> >>   ensure the best performance.
> >
> > This will preclude noticing the 2nd .. Nth cache off -> on cycles,
> > right?  Will any guests care - doesn't kexec go through a caches-off
> > state?
> 
> kexec, bootloaders, and whatever firmware requires to switch caches on 
> and then off. Guest does care, but we don't have an (efficient) 
> architectural solution to that.
> 
> The best I can think of so far is a "switch-the-damned-thing-off" 
> hypercall that would do the above before returning to the guest.

We could push for a PSCI extension to cover such cases as well, though
even for a host, we may not need to involve the secure world for kexec.

An alternative is to trap the set/way cache flushing and re-activate the
MMU trapping in the guest. If the MMU is still on, disable trapping
until the next set/way (since that's a normal function on power-down
code sequences). But it doesn't look nice ;).

-- 
Catalin

  reply	other threads:[~2014-02-19 10:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-18 15:27 [PATCH v4 00/12] arm/arm64: KVM: host cache maintenance when guest caches are off Marc Zyngier
2014-02-18 15:27 ` [PATCH v4 01/12] arm64: KVM: force cache clean on page fault when " Marc Zyngier
2014-02-18 15:27 ` [PATCH v4 02/12] arm64: KVM: allows discrimination of AArch32 sysreg access Marc Zyngier
2014-02-18 15:27 ` [PATCH v4 03/12] arm64: KVM: trap VM system registers until MMU and caches are ON Marc Zyngier
2014-02-18 15:27 ` [PATCH v4 04/12] ARM: KVM: introduce kvm_p*d_addr_end Marc Zyngier
2014-02-18 15:41   ` Catalin Marinas
2014-02-18 19:29   ` Christoffer Dall
2014-02-18 15:27 ` [PATCH v4 05/12] arm64: KVM: flush VM pages before letting the guest enable caches Marc Zyngier
2014-02-18 15:27 ` [PATCH v4 06/12] ARM: KVM: force cache clean on page fault when caches are off Marc Zyngier
2014-02-18 15:27 ` [PATCH v4 07/12] ARM: KVM: fix handling of trapped 64bit coprocessor accesses Marc Zyngier
2014-02-18 15:27 ` [PATCH v4 08/12] ARM: KVM: fix ordering of " Marc Zyngier
2014-02-18 15:27 ` [PATCH v4 09/12] ARM: KVM: introduce per-vcpu HYP Configuration Register Marc Zyngier
2014-02-18 15:27 ` [PATCH v4 10/12] ARM: KVM: add world-switch for AMAIR{0,1} Marc Zyngier
2014-02-18 15:27 ` [PATCH v4 11/12] ARM: KVM: trap VM system registers until MMU and caches are ON Marc Zyngier
2014-02-18 15:27 ` [PATCH v4 12/12] ARM: KVM: fix warning in mmu.c Marc Zyngier
2014-02-18 19:30   ` Christoffer Dall
2014-02-18 20:57 ` [PATCH v4 00/12] arm/arm64: KVM: host cache maintenance when guest caches are off Eric Northup
2014-02-19  9:02   ` Marc Zyngier
2014-02-19 10:12     ` Catalin Marinas [this message]
2014-02-19 10:43       ` Marc Zyngier

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=20140219101246.GD30457@arm.com \
    --to=catalin.marinas@arm.com \
    --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).