[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH RDMA support v3: 09/10] Move RAMBlock to cpu
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RFC PATCH RDMA support v3: 09/10] Move RAMBlock to cpu-common.h |
Date: |
Mon, 11 Mar 2013 15:07:34 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130219 Thunderbird/17.0.3 |
Il 11/03/2013 05:33, address@hidden ha scritto:
> From: "Michael R. Hines" <address@hidden>
>
> RDMA needs access to this structure by including cpu-common.h
> (Including cpu-all.h causes things to throw up on me).
>
> Signed-off-by: Michael R. Hines <address@hidden>
> ---
> include/exec/cpu-all.h | 27 ---------------------------
> include/exec/cpu-common.h | 29 +++++++++++++++++++++++++++++
> 2 files changed, 29 insertions(+), 27 deletions(-)
>
> diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
> index 249e046..02a2808 100644
> --- a/include/exec/cpu-all.h
> +++ b/include/exec/cpu-all.h
> @@ -480,33 +480,6 @@ extern ram_addr_t ram_size;
> /* RAM is pre-allocated and passed into qemu_ram_alloc_from_ptr */
> #define RAM_PREALLOC_MASK (1 << 0)
>
> -typedef struct RAMBlock {
> - struct MemoryRegion *mr;
> - uint8_t *host;
> - ram_addr_t offset;
> - ram_addr_t length;
> - uint32_t flags;
> - char idstr[256];
> - /* Reads can take either the iothread or the ramlist lock.
> - * Writes must take both locks.
> - */
> - QTAILQ_ENTRY(RAMBlock) next;
> -#if defined(__linux__) && !defined(TARGET_S390X)
> - int fd;
> -#endif
> -} RAMBlock;
> -
> -typedef struct RAMList {
> - QemuMutex mutex;
> - /* Protected by the iothread lock. */
> - uint8_t *phys_dirty;
> - RAMBlock *mru_block;
> - /* Protected by the ramlist lock. */
> - QTAILQ_HEAD(, RAMBlock) blocks;
> - uint32_t version;
> -} RAMList;
> -extern RAMList ram_list;
> -
> extern const char *mem_path;
> extern int mem_prealloc;
>
> diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
> index 2e5f11f..763cef3 100644
> --- a/include/exec/cpu-common.h
> +++ b/include/exec/cpu-common.h
> @@ -11,6 +11,7 @@
>
> #include "qemu/bswap.h"
> #include "qemu/queue.h"
> +#include "qemu/thread.h"
>
> /**
> * CPUListState:
> @@ -121,4 +122,32 @@ extern struct MemoryRegion io_mem_notdirty;
>
> #endif
>
> +typedef struct RAMBlock {
> + struct MemoryRegion *mr;
> + uint8_t *host;
> + ram_addr_t offset;
> + ram_addr_t length;
> + uint32_t flags;
> + char idstr[256];
> + /* Reads can take either the iothread or the ramlist lock.
> + * Writes must take both locks.
> + */
> + QTAILQ_ENTRY(RAMBlock) next;
> +#if defined(__linux__) && !defined(TARGET_S390X)
> + int fd;
> +#endif
> +} RAMBlock;
> +
> +typedef struct RAMList {
> + QemuMutex mutex;
> + /* Protected by the iothread lock. */
> + uint8_t *phys_dirty;
> + RAMBlock *mru_block;
> + /* Protected by the ramlist lock. */
> + QTAILQ_HEAD(, RAMBlock) blocks;
> + uint32_t version;
> +} RAMList;
> +
> +extern RAMList ram_list;
> +
> #endif /* !CPU_COMMON_H */
>
Only used in qemu_rdma_init_ram_blocks. Can you add instead an API like
qemu_ram_foreach_block(
void (*fn)(void *host_addr, ram_addr_t offset, ram_addr_t length,
void *opaque),
void *opaque)
?
BTW, please avoid arbitrary limits like RDMA_MAX_RAM_BLOCKS. Can you
use a list (see qemu-queue.h; it is the same as the BSD queue.h) instead
of current_index?
Paolo
- Re: [Qemu-devel] [RFC PATCH RDMA support v3: 09/10] Move RAMBlock to cpu-common.h,
Paolo Bonzini <=