From: Laszlo Ersek <lersek@redhat.com>
To: Christoffer Dall <christoffer.dall@linaro.org>
Cc: peter.maydell@linaro.org, Andrew Jones <drjones@redhat.com>,
ard.biesheuvel@linaro.org, marc.zyngier@arm.com,
catalin.marinas@arm.com, "Michael S. Tsirkin" <mst@redhat.com>,
qemu-devel@nongnu.org, agraf@suse.de,
Paolo Bonzini <pbonzini@redhat.com>,
j.fanguede@virtualopensystems.com, kvmarm@lists.cs.columbia.edu,
m.smarduch@samsung.com
Subject: Re: [Qemu-devel] [RFC/RFT PATCH v2 0/3] KVM: Introduce KVM_MEM_UNCACHED
Date: Thu, 14 May 2015 15:01:30 +0200 [thread overview]
Message-ID: <55549CAA.4020501@redhat.com> (raw)
In-Reply-To: <20150514123445.GW32765@cbox>
On 05/14/15 14:34, Christoffer Dall wrote:
> On Thu, May 14, 2015 at 02:28:49PM +0200, Paolo Bonzini wrote:
>>
>>
>> On 14/05/2015 14:24, Christoffer Dall wrote:
>>> On Thu, May 14, 2015 at 02:08:49PM +0200, Paolo Bonzini wrote:
>>>>
>>>>
>>>> On 14/05/2015 14:00, Christoffer Dall wrote:
>>>>> So, getting back to my original question. Is the point then that UEFI
>>>>> must assume (from ACPI/DT) the cache-coherency properties of the PCI
>>>>> controller which exists in hardware on the system you're running on,
>>>>> even for the virtual PCI bus because that will be the semantics for
>>>>> assigned devices?
>>>>>
>>>>> And in that case, we have no way to distinguish between passthrough
>>>>> devices and virtual devices plugged into the virtual PCI bus?
>>>>
>>>> Well, we could use the subsystem id. But it's a hack, and may cause
>>>> incompatibilities with some drivers. Michael, any ideas?
>>>>
>>>>> What about the idea of having two virtual PCI buses on your system where
>>>>> one is always cache-coherent and uses for virtual devices, and the other
>>>>> is whatever the hardware is and used for passthrough devices?
>>>>
>>>> I think that was rejected before.
>>>
>>> Do you remember where? I just remember Catalin mentioning the idea to
>>> me verbally.
>>
>> In the last centithread on the subject. :)
>>
>> At least I and Peter disagreed. It's not about the heavy added use of
>> resources, it's more about it being really easy to misconfigure.
>>
>>> But I'm still not sure why UEFI/Linux currently sees our PCI bus as
>>> being non-coherent when in fact it is and we have no passthrough issues
>>> currently. Are all PCI controllers always non-coherent for some reason
>>> and therefore we model it as such too?
>>
>> Well, PCI BARs are generally MMIO resources, and hence should not be cached.
>>
>> As an optimization, OS drivers can mark them as cacheable or
>> write-combining or something like that, but in general it's a safe
>> default to leave them uncached---one would think.
>>
> ok, I guess this series makes sense then, assuming it works, and
> assuming we don't kill performance by going to RAM all the time when we
> don't have to...
The idea Paolo and I had discussed in the past is:
- Remove the kludge from UEFI, and map all MMIO BARs as uncached by
default. This should be a theoretically correct approach, and for
assigned devices, correct in practice too.
- At an appropriate place in the firmware (specifically, right before
this line: [1]), when PCI devices have been enumerated, but their
particular drivers (especially VGA) have not been connected yet,
check the subsystem id / vendor id / etc for each, and if we can tell
it's virtual, then set the attributes for all of its MMIO bars to
writeback.
It doesn't seem hard to implement, I've just been shying away from
actually coding it up because I'd like to see it make a difference for
an actual assigned device. That is, reproducing the current (statically
kludged) behavior wouldn't be hard, but I prefer not to write a new
patch until I can test it both ways. UC is broken and WB works for
virtual devices, fine; now let's see if the exact reverse holds for
assigned devices in reality.
... Testing of which will require someone to send a PCI card (NIC or
GPU) -- with an AARCH64 UEFI driver oprom on it -- to my place, so that
I can plug into my Mustang. ;)
Thanks
Laszlo
[1]
https://github.com/tianocore/edk2/blob/99d9ade85aad554a0fa08fff8586b0fd40570ac3/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c#L366
next prev parent reply other threads:[~2015-05-14 13:54 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-13 11:31 [Qemu-devel] [RFC/RFT PATCH v2 0/3] KVM: Introduce KVM_MEM_UNCACHED Andrew Jones
2015-05-13 11:31 ` [Qemu-devel] [RFC/RFT PATCH v2 1/3] arm/arm64: pageattr: add set_memory_nc Andrew Jones
2015-05-14 11:05 ` Christoffer Dall
2015-05-14 13:46 ` Andrew Jones
2015-05-15 14:51 ` Christoffer Dall
2015-05-18 15:53 ` Catalin Marinas
2015-05-19 10:03 ` Andrew Jones
2015-05-19 11:18 ` Catalin Marinas
2015-05-19 11:38 ` Andrew Jones
2015-05-20 10:01 ` Christoffer Dall
2015-05-20 11:24 ` Catalin Marinas
2015-05-23 1:08 ` Mario Smarduch
2015-05-25 17:11 ` Andrew Jones
2015-05-27 1:08 ` Mario Smarduch
2015-05-13 11:31 ` [Qemu-devel] [RFC/RFT PATCH v2 2/3] KVM: promote KVM_MEMSLOT_INCOHERENT to uapi Andrew Jones
2015-05-14 10:12 ` Paolo Bonzini
2015-05-14 10:34 ` Christoffer Dall
2015-05-13 11:31 ` [Qemu-devel] [RFC/RFT PATCH v2 3/3] arm/arm64: KVM: implement 'uncached' mem coherency Andrew Jones
2015-05-14 10:55 ` Christoffer Dall
2015-05-14 13:32 ` Andrew Jones
2015-05-15 15:02 ` Christoffer Dall
2015-05-15 17:04 ` Andrew Jones
2015-05-15 20:16 ` Jérémy Fanguède
2015-05-21 2:29 ` Mario Smarduch
2015-05-21 16:50 ` Andrew Jones
2015-05-14 10:30 ` [Qemu-devel] [RFC/RFT PATCH v2 0/3] KVM: Introduce KVM_MEM_UNCACHED Christoffer Dall
2015-05-14 11:09 ` Laszlo Ersek
2015-05-14 11:29 ` Christoffer Dall
2015-05-14 11:31 ` Paolo Bonzini
2015-05-14 11:36 ` Christoffer Dall
2015-05-14 11:38 ` Paolo Bonzini
2015-05-14 12:00 ` Christoffer Dall
2015-05-14 12:08 ` Paolo Bonzini
2015-05-14 12:24 ` Christoffer Dall
2015-05-14 12:28 ` Paolo Bonzini
2015-05-14 12:34 ` Christoffer Dall
2015-05-14 13:01 ` Laszlo Ersek [this message]
2015-05-14 12:38 ` Peter Maydell
2015-05-14 13:00 ` Andrew Jones
2015-05-14 13:32 ` Laszlo Ersek
2015-05-14 13:48 ` Michael S. Tsirkin
2015-05-14 14:19 ` Laszlo Ersek
2015-05-14 14:41 ` Michael S. Tsirkin
2015-05-15 9:00 ` Ard Biesheuvel
2015-05-14 10:31 ` Andrew Jones
2015-05-14 10:37 ` Peter Maydell
2015-05-14 13:03 ` Andrew Jones
2015-05-14 13:11 ` Peter Maydell
2015-05-14 13:33 ` Laszlo Ersek
2015-05-14 13:36 ` Andrew Jones
2015-05-15 15:09 ` Christoffer Dall
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=55549CAA.4020501@redhat.com \
--to=lersek@redhat.com \
--cc=agraf@suse.de \
--cc=ard.biesheuvel@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=christoffer.dall@linaro.org \
--cc=drjones@redhat.com \
--cc=j.fanguede@virtualopensystems.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=m.smarduch@samsung.com \
--cc=marc.zyngier@arm.com \
--cc=mst@redhat.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).