qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Michael.R.Hines.mrhines@linux.vnet.ibm.com
Cc: aliguori@us.ibm.com, mst@redhat.com, qemu-devel@nongnu.org,
	owasserm@redhat.com, abali@us.ibm.com, mrhines@us.ibm.com,
	gokul@us.ibm.com
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	[thread overview]
Message-ID: <513DE526.80108@redhat.com> (raw)
In-Reply-To: <1362976414-21396-10-git-send-email-mrhines@us.ibm.com>

Il 11/03/2013 05:33, Michael.R.Hines.mrhines@linux.vnet.ibm.com ha scritto:
> From: "Michael R. Hines" <mrhines@us.ibm.com>
> 
> 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 <mrhines@us.ibm.com>
> ---
>  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

  parent reply	other threads:[~2013-03-11 14:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1362976414-21396-1-git-send-email-mrhines@us.ibm.com>
     [not found] ` <1362976414-21396-4-git-send-email-mrhines@us.ibm.com>
2013-03-11 11:51   ` [Qemu-devel] [RFC PATCH RDMA support v3: 03/10] documentation of RDMA protocol in docs/rdma.txt Michael S. Tsirkin
2013-03-11 16:24     ` Michael R. Hines
2013-03-11 17:05       ` Michael S. Tsirkin
2013-03-11 17:17         ` Michael R. Hines
2013-03-11 17:19           ` Michael S. Tsirkin
2013-03-11 17:35             ` Michael R. Hines
     [not found] ` <1362976414-21396-3-git-send-email-mrhines@us.ibm.com>
2013-03-11 13:35   ` [Qemu-devel] [RFC PATCH RDMA support v3: 02/10] Link in new migration-rdma.c and rmda.c files Paolo Bonzini
2013-03-11 16:25     ` Michael R. Hines
     [not found] ` <1362976414-21396-9-git-send-email-mrhines@us.ibm.com>
2013-03-11 13:40   ` [Qemu-devel] [RFC PATCH RDMA support v3: 08/10] Introduce QEMUFileRDMA Paolo Bonzini
2013-03-11 16:26     ` Michael R. Hines
2013-03-11 16:26     ` Michael R. Hines
     [not found] ` <1362976414-21396-6-git-send-email-mrhines@us.ibm.com>
2013-03-11 13:41   ` [Qemu-devel] [RFC PATCH RDMA support v3: 05/10] RDMA connection establishment (migration-rdma.c) Paolo Bonzini
2013-03-11 16:28     ` Michael R. Hines
2013-03-11 20:20     ` Michael R. Hines
     [not found] ` <1362976414-21396-7-git-send-email-mrhines@us.ibm.com>
2013-03-11 13:49   ` [Qemu-devel] [RFC PATCH RDMA support v3: 06/10] Introduce 'max_iterations' and Call out to migration-rdma.c when requested Paolo Bonzini
2013-03-11 16:30     ` Michael R. Hines
     [not found] ` <1362976414-21396-8-git-send-email-mrhines@us.ibm.com>
2013-03-11 13:59   ` [Qemu-devel] [RFC PATCH RDMA support v3: 07/10] Send the actual pages over RDMA Paolo Bonzini
2013-03-11 16:31     ` Michael R. Hines
     [not found] ` <1362976414-21396-11-git-send-email-mrhines@us.ibm.com>
2013-03-11 14:00   ` [Qemu-devel] [RFC PATCH RDMA support v3: 10/10] Parse RDMA host/port out of the QMP string Paolo Bonzini
2013-03-11 16:32     ` Michael R. Hines
     [not found] ` <1362976414-21396-10-git-send-email-mrhines@us.ibm.com>
2013-03-11 14:07   ` Paolo Bonzini [this message]
2013-03-11 16:34     ` [Qemu-devel] [RFC PATCH RDMA support v3: 09/10] Move RAMBlock to cpu-common.h Michael R. Hines

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=513DE526.80108@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=Michael.R.Hines.mrhines@linux.vnet.ibm.com \
    --cc=abali@us.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=gokul@us.ibm.com \
    --cc=mrhines@us.ibm.com \
    --cc=mst@redhat.com \
    --cc=owasserm@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).