qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: kvmarm@lists.cs.columbia.edu, qemu-devel@nongnu.org,
	ard.biesheuvel@linaro.org, christoffer.dall@linaro.org,
	marc.zyngier@arm.com, peter.maydell@linaro.org
Cc: pbonzini@redhat.com, lersek@redhat.com, agraf@suse.de,
	catalin.marinas@arm.com
Subject: Re: [Qemu-devel] the arm cache coherency cluster
Date: Wed, 18 Mar 2015 20:00:19 +0100	[thread overview]
Message-ID: <20150318190019.GA7077@hawk.usersys.redhat.com> (raw)
In-Reply-To: <1425667780-3449-1-git-send-email-drjones@redhat.com>

On Fri, Mar 06, 2015 at 01:49:40PM -0500, Andrew Jones wrote:
> In reply to this message I'll send two series' one for KVM and
> one for QEMU. The two series' are their respective component
> complements, and attempt to implement cache coherency for arm
> guests using emulated devices, where the emulator (qemu) uses
> cached memory for the device memory, but the guest uses
> uncached - as device memory is generally used. Right now I've
> just focused on VGA vram.
> 
> This approach starts as the "add a new memslot flag" approach,
> and then turns into the "make qemu do some cache maintenance"
> approach with the final patch of each series (6/6). It stops
> short of the "add syscalls..." approach. Below is a summary of
> all the approaches discussed so far, to my knowledge.
> 
> "MAIR manipulating"
> Posted[1] by Ard. Works. No performance degradation. Potential
> issues with device assignment and the guest getting confused.
> 
> "add a new memslot flag"
> This posting (not counting patches 6/6). Works. Huge performance
> degradation.
> 
> "make qemu do some cache maintenance"
> This posting (patches 6/6). We can only do so much in qemu
> without syscalls. This series does what it can. Almost works,
> probably could work, after playing 'find the missing flush'.
> This approach still requires the new memslot flag, as userspace
> can't invalidate the cache, only clean, or clean+invalidate.
> No noticeable performance degradation.
> 
> "add syscalls to make qemu do all cache maintenance"
> Variant 1: implement as kvm ioctls - to avoid trying to get
>            syscalls into the general kernel
> Variant 2: add real syscalls, or maybe just ARM private SWIs
>            like __ARM_NR_cacheflush
> This approach should work, and if we add an invalidate syscall,
> then we shouldn't need any kvm changes at all, i.e. no need for
> the memslot flag. I haven't experimented with this yet, but I'm
> starting to like the idea of variant 2, with a private SWI, so
> will try to pull something together soon for that.
> 
> "describe the problematic memory as cached to the guest"
> Not an ideal solution for virt. Could maybe be workable as a
> quirk for a specific device though.
> 
> re: $SUBJECT; Here 'cluster' is defined by the urban dictionary.
> 
> [1] http://thread.gmane.org/gmane.comp.emulators.kvm.arm.devel/34/

I'm going to send another pair of series'. A "v2", as, IMO, the
new approach supersedes the pair implemented here. After poking
around in qemu, looking for the best places to do cache maintenance,
I decided I didn't really like doing it there at all, and opted to
try another approach, that I'd forgotten to mention in this mail.
That approach is the "MADV_UNCACHED" type that Paolo suggested.
This type of approach could also be described as "make userspace's
memory access type match the expected access type of the guest",
and Mario has suggested using a memory driver, which could have
the same result.

The series I'll send is inspired by both Paolo's and Mario's
suggestions, but it uses a kvm memslot flag, rather than an
madvise flag, and thus for the memory driver, it's just KVM.

drew

      parent reply	other threads:[~2015-03-18 19:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-06 18:49 [Qemu-devel] the arm cache coherency cluster Andrew Jones
2015-03-06 18:52 ` [Qemu-devel] [RFC PATCH 0/6] flush/invalidate on entry/exit Andrew Jones
2015-03-06 18:52   ` [Qemu-devel] [RFC PATCH 1/6] kvm: promote KVM_MEMSLOT_INCOHERENT to uapi Andrew Jones
2015-03-06 18:52   ` [Qemu-devel] [RFC PATCH 2/6] KVM: Introduce incoherent cache maintenance API Andrew Jones
2015-03-06 18:52   ` [Qemu-devel] [RFC PATCH 3/6] KVM: ARM: change __coherent_cache_guest_page interface Andrew Jones
2015-03-06 18:52   ` [Qemu-devel] [RFC PATCH 4/6] KVM: ARM: extend __coherent_cache_guest_page Andrew Jones
2015-03-06 18:52   ` [Qemu-devel] [RFC PATCH 5/6] KVM: ARM: implement kvm_*_incoherent_memory_regions Andrew Jones
2015-03-06 18:52   ` [Qemu-devel] [RFC PATCH 6/6] KVM: ARM: no need for kvm_arch_flush_incoherent Andrew Jones
2015-03-06 18:53 ` [Qemu-devel] [RFC PATCH 0/6] support KVM_MEM_INCOHERENT Andrew Jones
2015-03-06 18:53   ` [Qemu-devel] [RFC PATCH 1/6] memory: add incoherent cache flag Andrew Jones
2015-03-06 18:53   ` [Qemu-devel] [RFC PATCH 2/6] HACK: linux header update Andrew Jones
2015-03-06 18:53   ` [Qemu-devel] [PATCH 3/6] kvm-all: put kvm_mem_flags to more work Andrew Jones
2015-03-06 18:53   ` [Qemu-devel] [RFC PATCH 4/6] kvm-all: set KVM_MEM_INCOHERENT Andrew Jones
2015-03-06 18:53   ` [Qemu-devel] [RFC PATCH 5/6] vga: flag vram as incoherent Andrew Jones
2015-03-06 18:53   ` [Qemu-devel] [RFC/WIP PATCH 6/6] memory: add clear_cache_to_poc Andrew Jones
2015-03-11 19:21     ` Andrew Jones
2015-03-18 19:00 ` Andrew Jones [this message]

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=20150318190019.GA7077@hawk.usersys.redhat.com \
    --to=drjones@redhat.com \
    --cc=agraf@suse.de \
    --cc=ard.biesheuvel@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=christoffer.dall@linaro.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=lersek@redhat.com \
    --cc=marc.zyngier@arm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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).