qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: gleb@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCHv2 1/3] qemu: memory notifiers
Date: Mon, 18 Jan 2010 15:58:51 +0200	[thread overview]
Message-ID: <4B54691B.7090601@redhat.com> (raw)
In-Reply-To: <20100118135234.GC8317@redhat.com>

On 01/18/2010 03:52 PM, Michael S. Tsirkin wrote:
> On Mon, Jan 18, 2010 at 03:02:59PM +0200, Avi Kivity wrote:
>    
>> On 01/04/2010 09:49 PM, Michael S. Tsirkin wrote:
>>      
>>> This adds notifiers for phys memory changes: a set of callbacks that
>>> vhost can register and update kernel accordingly.  Down the road, kvm
>>> code can be switched to use these as well, instead of calling kvm code
>>> directly from exec.c as is done now.
>>>
>>>
>>> +
>>> +static void phys_page_for_each_in_l1_map(PhysPageDesc **phys_map,
>>> +                                         CPUPhysMemoryClient *client)
>>> +{
>>> +    PhysPageDesc *pd;
>>> +    int l1, l2;
>>> +
>>> +    for (l1 = 0; l1<   L1_SIZE; ++l1) {
>>> +        pd = phys_map[l1];
>>> +        if (!pd) {
>>> +            continue;
>>> +        }
>>> +        for (l2 = 0; l2<   L2_SIZE; ++l2) {
>>> +            if (pd[l2].phys_offset == IO_MEM_UNASSIGNED) {
>>> +                continue;
>>> +            }
>>> +            client->set_memory(client, pd[l2].region_offset,
>>> +                               TARGET_PAGE_SIZE, pd[l2].phys_offset);
>>> +        }
>>> +    }
>>> +}
>>> +
>>> +static void phys_page_for_each(CPUPhysMemoryClient *client)
>>> +{
>>> +#if TARGET_PHYS_ADDR_SPACE_BITS>   32
>>> +
>>> +#if TARGET_PHYS_ADDR_SPACE_BITS>   (32 + L1_BITS)
>>> +#error unsupported TARGET_PHYS_ADDR_SPACE_BITS
>>> +#endif
>>> +    void **phys_map = (void **)l1_phys_map;
>>> +    int l1;
>>> +    if (!l1_phys_map) {
>>> +        return;
>>> +    }
>>> +    for (l1 = 0; l1<   L1_SIZE; ++l1) {
>>> +        if (phys_map[l1]) {
>>> +            phys_page_for_each_in_l1_map(phys_map[l1], client);
>>> +        }
>>> +    }
>>> +#else
>>> +    if (!l1_phys_map) {
>>> +        return;
>>> +    }
>>> +    phys_page_for_each_in_l1_map(l1_phys_map, client);
>>> +#endif
>>> +}
>>>
>>>        
>> This looks pretty frightening.  What is it needed for?
>>      
> The point is that clients can be registered at any point.
>
> A client that registered when memory is present needs to
> be notified about it.
>    

It looks very expensive.  Maybe we mandate clients be registered at 
init-time?

Long term we need to move to a range based memory description.

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

  reply	other threads:[~2010-01-18 13:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1262634464.git.mst@redhat.com>
2010-01-04 19:49 ` [Qemu-devel] [PATCHv2 1/3] qemu: memory notifiers Michael S. Tsirkin
2010-01-18 13:02   ` Avi Kivity
2010-01-18 13:52     ` Michael S. Tsirkin
2010-01-18 13:58       ` Avi Kivity [this message]
2010-01-18 14:44         ` Michael S. Tsirkin
2010-01-18 14:52           ` Avi Kivity
2010-01-18 15:08             ` Michael S. Tsirkin
2010-01-18 15:45             ` Michael S. Tsirkin
2010-01-18 16:04               ` Avi Kivity
2010-01-18 16:08                 ` Michael S. Tsirkin
2010-01-18 16:15                   ` Avi Kivity
2010-01-04 19:49 ` [Qemu-devel] [PATCHv2 2/3] kvm: move kvm_set_phys_mem around Michael S. Tsirkin
2010-01-04 19:49 ` [Qemu-devel] [PATCHv2 3/3] kvm: move kvm to use memory notifiers Michael S. Tsirkin

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=4B54691B.7090601@redhat.com \
    --to=avi@redhat.com \
    --cc=gleb@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).