public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Alex Williamson <alex.williamson@redhat.com>,
	chrisw@redhat.com, kvm@vger.kernel.org, mst@redhat.com,
	qemu-devel@nongnu.org, blauwirbel@gmail.com, ddutile@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 2/2] RAM API: Make use of it for x86 PC
Date: Thu, 18 Nov 2010 18:18:06 +0200	[thread overview]
Message-ID: <4CE551BE.9020306@redhat.com> (raw)
In-Reply-To: <4CE54FB4.2010706@codemonkey.ws>

On 11/18/2010 06:09 PM, Anthony Liguori wrote:
>> That's what "two memory maps" mean.  If you have one cpu in SMM and 
>> another outside SMM, then those two maps are active simultaneously.
>
>
> I'm not sure if more modern memory controllers do special things here, 
> but for the i440fx, if any CPU asserts SMM mode, then any memory 
> access to that space is going to access SMRAM.

How does SMP work then?

> SMM Space Open (DOPEN). When DOPEN=1 and DLCK=0, SMM space DRAM is 
> made visible even
> when CPU cycle does not indicate SMM mode access via EXF4#/Ab7# 
> signal. This is intended to help
> BIOS initialize SMM space. Software should ensure that DOPEN=1 is 
> mutually exclusive with DCLS=1.
> When DLCK is set to a 1, DOPEN is set to 0 and becomes read only.

The words "cpu cycle does not indicate SMM mode" seem to say that SMM 
accesses are made on a per-transaction basis, or so my lawyers tell me.


>
>>>
>>> Alternatively, if the SMRAM register is activated, then the i440fx 
>>> will redirect 0xa0000 to RAM regardless of whether the CPU asserts 
>>> that signal.  That means that even without KVM supporting SMM, this 
>>> mode can happen.
>>
>> That's a single memory map that is modified under hardware control, 
>> it's no different than BARs and such.
>
> There is a single block of RAM.
>
> The memory controller may either forward an address unmodified to the 
> RAM block or it may forward the address to the PCI bus[1].  A non CPU 
> access goes through a controller hierarchy and may be modified while 
> it transverses the hierarchy.
>
> So really, we should have a big chunk of RAM that we associate with a 
> guest, with a list of intercepts that changes as the devices are 
> modified.  Instead of having that list dispatch directly to a device, 
> we should send all intercepted accesses to the memory controller and 
> let the memory controller propagate out the access to the appropriate 
> device.
>
> [1] The except is access to the local APIC.  That's handled directly 
> by the CPU (or immediately outside of the CPU before the access gets 
> to the memory controller if the local APIC is external to the CPU).
>

Agree.  However the point with SMM is that the dispatch is made not only 
based on the address, but also based on SMM mode (and, unfortunately, 
can also be different based on read vs write).

>>>> Things aren't that bad - a ram_addr_t and a physical address are 
>>>> already different things, so we already have one level of translation.
>>>
>>> Yeah, but ram_addr_t doesn't model anything meaningful IRL.  It's an 
>>> internal implementation detail.
>>>
>>
>> Does it matter?  We can say those are addresses on the memory bus.  
>> Since they are not observable anyway, who cares if the correspond 
>> with reality or not?
>
> It matters a lot because the life cycle of RAM is different from the 
> life cycle of ROM.
>
> For instance, the original goal was to madvise(MADV_DONTNEED) RAM on 
> reboot.  You can't do that to ROM because the contents matter.

I don't think you can do that to RAM either.

>
> But for PV devices, we can be loose in how we define the way the 
> devices interact with the rest of the system.  For instance, we can 
> say that virtio-pci devices are directly connected to RAM and do not 
> go through the memory controllers.  That means we could get stable 
> mappings of the virtio ring.

That wouldn't work once we have an iommu and start to assign them to 
nested guests.

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2010-11-18 16:18 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-29 16:38 [PATCH 0/2] Minimal RAM API support Alex Williamson
2010-10-29 16:39 ` [PATCH 1/2] " Alex Williamson
2010-10-29 19:57   ` [Qemu-devel] " Blue Swirl
2010-10-29 20:15     ` Alex Williamson
2010-11-01  2:17   ` Isaku Yamahata
2010-11-01  2:32     ` Alex Williamson
2010-10-29 16:39 ` [PATCH 2/2] RAM API: Make use of it for x86 PC Alex Williamson
2010-11-01 15:13 ` [PATCH v2 0/2] Minimal RAM API support Alex Williamson
2010-11-01 15:14   ` [PATCH v2 1/2] " Alex Williamson
2010-11-16 14:55     ` [Qemu-devel] " Anthony Liguori
2010-11-16 15:02       ` Alexander Graf
2010-11-16 15:08         ` Anthony Liguori
2010-11-01 15:14   ` [PATCH v2 2/2] RAM API: Make use of it for x86 PC Alex Williamson
2010-11-16 14:58     ` [Qemu-devel] " Anthony Liguori
2010-11-16 21:24       ` Alex Williamson
2010-11-17  9:31         ` Gleb Natapov
2010-11-17 23:42         ` Anthony Liguori
2010-11-18 15:22           ` Avi Kivity
2010-11-18 15:46             ` Anthony Liguori
2010-11-18 15:57               ` Avi Kivity
2010-11-18 16:09                 ` Anthony Liguori
2010-11-18 16:18                   ` Avi Kivity [this message]
2010-11-18 16:35                     ` Michael S. Tsirkin
2010-11-18 15:51           ` Gleb Natapov
2010-11-18 21:41   ` [PATCH v3 0/2] Minimal RAM API support Alex Williamson
2010-11-18 21:41     ` [PATCH v3 1/2] " Alex Williamson
2010-11-18 21:41     ` [PATCH v3 2/2] RAM API: Make use of it for x86 PC Alex Williamson

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=4CE551BE.9020306@redhat.com \
    --to=avi@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=blauwirbel@gmail.com \
    --cc=chrisw@redhat.com \
    --cc=ddutile@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --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