All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: KVM devel mailing list <kvm@vger.kernel.org>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Laszlo Ersek <lersek@redhat.com>,
	"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [RFC/RFT PATCH 0/3] arm64: KVM: work around incoherency with uncached guest mappings
Date: Wed, 4 Mar 2015 15:12:12 +0100	[thread overview]
Message-ID: <20150304141212.GA5352@hawk.usersys.redhat.com> (raw)
In-Reply-To: <CAKv+Gu-JnvXFzr-fpjZZ-zTt8hOSfGqefw69s+4JX2iu_6_BMw@mail.gmail.com>

On Wed, Mar 04, 2015 at 01:43:02PM +0100, Ard Biesheuvel wrote:
> On 4 March 2015 at 13:29, Catalin Marinas <catalin.marinas@arm.com> wrote:
> > On Wed, Mar 04, 2015 at 12:50:57PM +0100, Ard Biesheuvel wrote:
> >> On 4 March 2015 at 12:35, Catalin Marinas <catalin.marinas@arm.com> wrote:
> >> > On Mon, Mar 02, 2015 at 06:20:19PM -0800, Mario Smarduch wrote:
> >> >> On 03/02/2015 08:31 AM, Christoffer Dall wrote:
> >> >> > However, my concern with these patches are on two points:
> >> >> >
> >> >> > 1. It's not a fix-all.  We still have the case where the guest expects
> >> >> > the behavior of device memory (for strong ordering for example) on a RAM
> >> >> > region, which we now break.  Similiarly this doesn't support the
> >> >> > non-coherent DMA to RAM region case.
> >> >> >
> >> >> > 2. While the code is probably as nice as this kind of stuff gets, it
> >> >> > is non-trivial and extremely difficult to debug.  The counter-point here
> >> >> > is that we may end up handling other stuff at EL2 for performanc reasons
> >> >> > in the future.
> >> >> >
> >> >> > Mainly because of point 1 above, I am leaning to thinking userspace
> >> >> > should do the invalidation when it knows it needs to, either through KVM
> >> >> > via a memslot flag or through some other syscall mechanism.
> >> >
> >> > I expressed my concerns as well, I'm definitely against merging this
> >> > series.
> >>
> >> Don't worry, that was never the intention, at least not as-is :-)
> >
> > I wasn't worried, just wanted to make my position clearer ;).
> >
> >> I think we have established that the performance hit is not the
> >> problem but the correctness is.
> >
> > I haven't looked at the performance figures but has anyone assessed the
> > hit caused by doing cache maintenance in Qemu vs cacheable guest
> > accesses (and no maintenance)?
> >

I'm working on a PoC of a QEMU/KVM cache maintenance approach now.
Hopefully I'll send it out this evening. Tomorrow at the latest.
Getting numbers of that approach vs. a guest's use of cached memory
for devices would take a decent amount of additional work, so won't
be part of that post. I'm actually not sure we should care about
the numbers for a guest using normal mem attributes for device
memory - other than out of curiosity. For correctness this issue
really needs to be solved 100% host-side. We can't rely on a
guest to do different/weird things, just because it's a guest.
Ideally guests don't even know that they're guests. (Even if we
describe the memory as cache-able to the guest, I don't think we
can rely on the guest believing us.)

drew

WARNING: multiple messages have this Message-ID (diff)
From: drjones@redhat.com (Andrew Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC/RFT PATCH 0/3] arm64: KVM: work around incoherency with uncached guest mappings
Date: Wed, 4 Mar 2015 15:12:12 +0100	[thread overview]
Message-ID: <20150304141212.GA5352@hawk.usersys.redhat.com> (raw)
In-Reply-To: <CAKv+Gu-JnvXFzr-fpjZZ-zTt8hOSfGqefw69s+4JX2iu_6_BMw@mail.gmail.com>

On Wed, Mar 04, 2015 at 01:43:02PM +0100, Ard Biesheuvel wrote:
> On 4 March 2015 at 13:29, Catalin Marinas <catalin.marinas@arm.com> wrote:
> > On Wed, Mar 04, 2015 at 12:50:57PM +0100, Ard Biesheuvel wrote:
> >> On 4 March 2015 at 12:35, Catalin Marinas <catalin.marinas@arm.com> wrote:
> >> > On Mon, Mar 02, 2015 at 06:20:19PM -0800, Mario Smarduch wrote:
> >> >> On 03/02/2015 08:31 AM, Christoffer Dall wrote:
> >> >> > However, my concern with these patches are on two points:
> >> >> >
> >> >> > 1. It's not a fix-all.  We still have the case where the guest expects
> >> >> > the behavior of device memory (for strong ordering for example) on a RAM
> >> >> > region, which we now break.  Similiarly this doesn't support the
> >> >> > non-coherent DMA to RAM region case.
> >> >> >
> >> >> > 2. While the code is probably as nice as this kind of stuff gets, it
> >> >> > is non-trivial and extremely difficult to debug.  The counter-point here
> >> >> > is that we may end up handling other stuff at EL2 for performanc reasons
> >> >> > in the future.
> >> >> >
> >> >> > Mainly because of point 1 above, I am leaning to thinking userspace
> >> >> > should do the invalidation when it knows it needs to, either through KVM
> >> >> > via a memslot flag or through some other syscall mechanism.
> >> >
> >> > I expressed my concerns as well, I'm definitely against merging this
> >> > series.
> >>
> >> Don't worry, that was never the intention, at least not as-is :-)
> >
> > I wasn't worried, just wanted to make my position clearer ;).
> >
> >> I think we have established that the performance hit is not the
> >> problem but the correctness is.
> >
> > I haven't looked at the performance figures but has anyone assessed the
> > hit caused by doing cache maintenance in Qemu vs cacheable guest
> > accesses (and no maintenance)?
> >

I'm working on a PoC of a QEMU/KVM cache maintenance approach now.
Hopefully I'll send it out this evening. Tomorrow at the latest.
Getting numbers of that approach vs. a guest's use of cached memory
for devices would take a decent amount of additional work, so won't
be part of that post. I'm actually not sure we should care about
the numbers for a guest using normal mem attributes for device
memory - other than out of curiosity. For correctness this issue
really needs to be solved 100% host-side. We can't rely on a
guest to do different/weird things, just because it's a guest.
Ideally guests don't even know that they're guests. (Even if we
describe the memory as cache-able to the guest, I don't think we
can rely on the guest believing us.)

drew

  reply	other threads:[~2015-03-04 14:06 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-19 10:54 [RFC/RFT PATCH 0/3] arm64: KVM: work around incoherency with uncached guest mappings Ard Biesheuvel
2015-02-19 10:54 ` Ard Biesheuvel
2015-02-19 10:54 ` [RFC/RFT PATCH 1/3] arm64: KVM: handle some sysreg writes in EL2 Ard Biesheuvel
2015-02-19 10:54   ` Ard Biesheuvel
2015-03-03 17:59   ` Mario Smarduch
2015-03-03 17:59     ` Mario Smarduch
2015-02-19 10:54 ` [RFC/RFT PATCH 2/3] arm64: KVM: mangle MAIR register to prevent uncached guest mappings Ard Biesheuvel
2015-02-19 10:54   ` Ard Biesheuvel
2015-02-19 10:54 ` [RFC/RFT PATCH 3/3] arm64: KVM: keep trapping of VM sysreg writes enabled Ard Biesheuvel
2015-02-19 10:54   ` Ard Biesheuvel
2015-02-19 13:40   ` Marc Zyngier
2015-02-19 13:40     ` Marc Zyngier
2015-02-19 13:44     ` Ard Biesheuvel
2015-02-19 13:44       ` Ard Biesheuvel
2015-02-19 15:19       ` Marc Zyngier
2015-02-19 15:19         ` Marc Zyngier
2015-02-19 15:22         ` Ard Biesheuvel
2015-02-19 15:22           ` Ard Biesheuvel
2015-02-19 14:50 ` [RFC/RFT PATCH 0/3] arm64: KVM: work around incoherency with uncached guest mappings Alexander Graf
2015-02-19 14:50   ` Alexander Graf
2015-02-19 14:56   ` Ard Biesheuvel
2015-02-19 14:56     ` Ard Biesheuvel
2015-02-19 15:27     ` Alexander Graf
2015-02-19 15:27       ` Alexander Graf
2015-02-19 15:31       ` Ard Biesheuvel
2015-02-19 15:31         ` Ard Biesheuvel
2015-02-19 16:57 ` Andrew Jones
2015-02-19 16:57   ` Andrew Jones
2015-02-19 17:19   ` Ard Biesheuvel
2015-02-19 17:19     ` Ard Biesheuvel
2015-02-19 17:55     ` Andrew Jones
2015-02-19 17:55       ` Andrew Jones
2015-02-19 17:57       ` Paolo Bonzini
2015-02-19 17:57         ` Paolo Bonzini
2015-02-20 14:29         ` Andrew Jones
2015-02-20 14:29           ` Andrew Jones
2015-02-20 14:37           ` Ard Biesheuvel
2015-02-20 14:37             ` Ard Biesheuvel
2015-02-20 15:36             ` Andrew Jones
2015-02-20 15:36               ` Andrew Jones
2015-02-24 14:55               ` Andrew Jones
2015-02-24 14:55                 ` Andrew Jones
2015-02-24 17:47                 ` Ard Biesheuvel
2015-02-24 17:47                   ` Ard Biesheuvel
2015-02-24 19:12                   ` Andrew Jones
2015-02-24 19:12                     ` Andrew Jones
2015-03-02 16:31                   ` Christoffer Dall
2015-03-02 16:31                     ` Christoffer Dall
2015-03-02 16:47                     ` Paolo Bonzini
2015-03-02 16:47                       ` Paolo Bonzini
2015-03-02 16:55                       ` Laszlo Ersek
2015-03-02 16:55                         ` Laszlo Ersek
2015-03-02 17:05                         ` Andrew Jones
2015-03-02 17:05                           ` Andrew Jones
2015-03-02 16:48                     ` Andrew Jones
2015-03-02 16:48                       ` Andrew Jones
2015-03-03  2:20                     ` Mario Smarduch
2015-03-03  2:20                       ` Mario Smarduch
2015-03-04 11:35                       ` Catalin Marinas
2015-03-04 11:35                         ` Catalin Marinas
2015-03-04 11:50                         ` Ard Biesheuvel
2015-03-04 11:50                           ` Ard Biesheuvel
2015-03-04 12:29                           ` Catalin Marinas
2015-03-04 12:29                             ` Catalin Marinas
2015-03-04 12:43                             ` Ard Biesheuvel
2015-03-04 12:43                               ` Ard Biesheuvel
2015-03-04 14:12                               ` Andrew Jones [this message]
2015-03-04 14:12                                 ` Andrew Jones
2015-03-04 14:29                                 ` Catalin Marinas
2015-03-04 14:29                                   ` Catalin Marinas
2015-03-04 14:34                                   ` Peter Maydell
2015-03-04 14:34                                     ` Peter Maydell
2015-03-04 17:03                                   ` Paolo Bonzini
2015-03-04 17:03                                     ` Paolo Bonzini
2015-03-04 17:28                                     ` Catalin Marinas
2015-03-04 17:28                                       ` Catalin Marinas
2015-03-05 10:12                                       ` Paolo Bonzini
2015-03-05 10:12                                         ` Paolo Bonzini
2015-03-05 11:04                                         ` Catalin Marinas
2015-03-05 11:04                                           ` Catalin Marinas
2015-03-05 11:52                                           ` Peter Maydell
2015-03-05 11:52                                             ` Peter Maydell
2015-03-05 12:03                                             ` Catalin Marinas
2015-03-05 12:03                                               ` Catalin Marinas
2015-03-05 12:26                                               ` Paolo Bonzini
2015-03-05 12:26                                                 ` Paolo Bonzini
2015-03-05 14:58                                                 ` Catalin Marinas
2015-03-05 14:58                                                   ` Catalin Marinas
2015-03-05 17:43                                                   ` Paolo Bonzini
2015-03-05 17:43                                                     ` Paolo Bonzini
2015-03-06 21:08                                                     ` Mario Smarduch
2015-03-06 21:08                                                       ` Mario Smarduch
2015-03-09 14:26                                                       ` Andrew Jones
2015-03-09 14:26                                                         ` Andrew Jones
2015-03-09 15:33                                                         ` Mario Smarduch
2015-03-09 15:33                                                           ` Mario Smarduch
2015-03-05 19:13                                                   ` Ard Biesheuvel
2015-03-05 19:13                                                     ` Ard Biesheuvel
2015-03-06 20:33                         ` Mario Smarduch
2015-03-06 20:33                           ` Mario Smarduch
2015-02-19 18:44       ` Ard Biesheuvel
2015-02-19 18:44         ` Ard Biesheuvel
2015-03-03 17:34 ` Alexander Graf
2015-03-03 17:34   ` Alexander Graf
2015-03-03 18:13   ` Laszlo Ersek
2015-03-03 18:13     ` Laszlo Ersek
2015-03-03 20:58     ` Andrew Jones
2015-03-03 20:58       ` Andrew Jones
2015-03-03 18:32 ` Catalin Marinas
2015-03-03 18:32   ` 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=20150304141212.GA5352@hawk.usersys.redhat.com \
    --to=drjones@redhat.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=lersek@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@arm.com \
    --cc=pbonzini@redhat.com \
    /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 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.