Re: [RFC PATCH 5/6] savevm: Migrate RAM based on name/offset

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

 



* Alex Williamson (alex.williamson@xxxxxxxxxx) wrote:
> @@ -257,7 +272,7 @@ int ram_load(QEMUFile *f, void *opaque, int version_id)
>      ram_addr_t addr;
>      int flags;
>  
> -    if (version_id != 3) {
> +    if (version_id < 3) {
>          return -EINVAL;

Should we clamp to 3 and 4?

>      }
>  
> @@ -268,23 +283,89 @@ int ram_load(QEMUFile *f, void *opaque, int version_id)
>          addr &= TARGET_PAGE_MASK;
>  
>          if (flags & RAM_SAVE_FLAG_MEM_SIZE) {

Does it simplify anything to simply add a new flag?

> -            if (addr != ram_bytes_total()) {
> -                return -EINVAL;
> +            if (version_id == 3) {
> +                if (addr != ram_bytes_total()) {
> +                    return -EINVAL;
> +                }
> +            } else {
> +                /* Synchronize RAM block list */
> +                char name[64];
> +                ram_addr_t length;
> +                ram_addr_t total_ram_bytes = addr;
> +
> +                while (total_ram_bytes) {
> +                    RAMBlock *block;
> +                    qemu_get_buffer(f, (uint8_t *)name, sizeof(name));
> +                    length = qemu_get_be64(f);
> +
> +                    QLIST_FOREACH(block, &ram.blocks, next) {
> +                        if (!strncmp(name, block->name, sizeof(name))) {
> +                            if (block->length != length)
> +                                return -EINVAL;
> +                            break;
> +                        }
> +                    }
> +
> +                    if (!block) {
> +                        if (!qemu_ram_alloc(name, length))
> +                            return -ENOMEM;

Is there any usee to finding blocks in stream such that we simply allocate
them all dynamically?

thanks,
-chris
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux