[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 11/16] memory: Add address_space_init_shareable(
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 11/16] memory: Add address_space_init_shareable() |
Date: |
Mon, 9 Nov 2015 11:55:29 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 05/11/2015 19:15, Peter Maydell wrote:
> +AddressSpace *address_space_init_shareable(MemoryRegion *root, const char
> *name)
> +{
> + AddressSpace *as;
> +
> + QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) {
> + if (root == as->root) {
> + as->ref_count++;
> + return as;
> + }
> + }
> +
> + as = g_malloc0(sizeof *as);
> + address_space_init(as, root, name);
> + as->malloced = true;
> + return as;
> }
You shouldn't return a non-shareable address space here, I think,
because it might be contained into another object and that object might
disappear. I haven't thought this through very much, but adding an " &&
as->malloced" to the conditional seems easy and safe.
Paolo
>
> void address_space_destroy(AddressSpace *as)
> {
> MemoryRegion *root = as->root;
>
> + as->ref_count--;
> + if (as->ref_count) {
> + return;
> + }
> /* Flush out anything from MemoryListeners listening in on this */
> memory_region_transaction_begin();
> as->root = NULL;
>
- Re: [Qemu-devel] [PATCH 03/16] tlb_set_page_with_attrs: Take argument specifying AddressSpace to use, (continued)
[Qemu-devel] [PATCH 14/16] hw/arm/virt: Wire up memory region to CPUs explicitly, Peter Maydell, 2015/11/05
[Qemu-devel] [PATCH 11/16] memory: Add address_space_init_shareable(), Peter Maydell, 2015/11/05
[Qemu-devel] [PATCH 09/16] target-arm: Support multiple address spaces in page table walks, Peter Maydell, 2015/11/05
- Re: [Qemu-devel] [PATCH 09/16] target-arm: Support multiple address spaces in page table walks, Edgar E. Iglesias, 2015/11/06
- Re: [Qemu-devel] [PATCH 09/16] target-arm: Support multiple address spaces in page table walks, Paolo Bonzini, 2015/11/09
- Re: [Qemu-devel] [PATCH 09/16] target-arm: Support multiple address spaces in page table walks, Peter Maydell, 2015/11/09
- Re: [Qemu-devel] [PATCH 09/16] target-arm: Support multiple address spaces in page table walks, Paolo Bonzini, 2015/11/09
- Re: [Qemu-devel] [PATCH 09/16] target-arm: Support multiple address spaces in page table walks, Peter Maydell, 2015/11/09
- Re: [Qemu-devel] [PATCH 09/16] target-arm: Support multiple address spaces in page table walks, Paolo Bonzini, 2015/11/09
- Re: [Qemu-devel] [PATCH 09/16] target-arm: Support multiple address spaces in page table walks, Peter Maydell, 2015/11/09