qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate
Date: Thu, 23 May 2013 11:59:18 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6

Il 23/05/2013 09:09, liu ping fan ha scritto:
>> >  void address_space_rw(AddressSpace *as, hwaddr addr, uint8_t *buf,
>> >                        int len, bool is_write)
>> >  {
>> > -    AddressSpaceDispatch *d = as->dispatch;
>> > -    int l;
>> > +    hwaddr l;
>> >      uint8_t *ptr;
>> >      uint32_t val;
>> > -    hwaddr page;
>> > +    hwaddr addr1;
>> >      MemoryRegionSection *section;
>> >
>> >      while (len > 0) {
>> > -        page = addr & TARGET_PAGE_MASK;
>> > -        l = (page + TARGET_PAGE_SIZE) - addr;
>> > -        if (l > len)
>> > -            l = len;
>> > -        section = phys_page_find(d, page >> TARGET_PAGE_BITS);
>> > +        l = len;
>> > +        section = address_space_translate(as, addr, &addr1, &l, is_write);
>> >
> Jan's "Rework sub-page handling" patch broke the tlb_set_page
> (anything else?)  But I think we still need a function based on
> address_space_translate to wrap the subpage logic inside and ease the
> incoming RCU style.

The idea is that address_space_translate gets a ref to the MemoryRegion,
and the ref is then released by the caller of address_space_translate.

That means that the actual memory accesses can run outside the RCU
critical section.

But I'm not sure how that is related to subpage logic.  Subpages are
simply MemoryRegions that only exist in the phys page map, rather than
within an AddressSpace.  Their destruction will be delayed anyway by
doing call_rcu on the old phys page map.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]