qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 728470: rdma: fix memory leak


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 728470: rdma: fix memory leak
Date: Tue, 07 Jul 2015 11:30:06 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 728470bea15b11ba7b3e3db54f0d9939908e0e65
      
https://github.com/qemu/qemu/commit/728470bea15b11ba7b3e3db54f0d9939908e0e65
  Author: Gonglei <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M migration/rdma.c

  Log Message:
  -----------
  rdma: fix memory leak

Variable "r" going out of scope leaks the storage
it points to in line 3268.

Signed-off-by: Gonglei <address@hidden>
Reviewed-by: Amit Shah <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>


  Commit: 1aca9a5f7d5a1ef9ee0233eac0fccc77ea6f0626
      
https://github.com/qemu/qemu/commit/1aca9a5f7d5a1ef9ee0233eac0fccc77ea6f0626
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M migration/savevm.c

  Log Message:
  -----------
  Only try and read a VMDescription if it should be there

The VMDescription section maybe after the EOF mark, the current code
does a 'qemu_get_byte' and either gets the header byte identifying the
description or an error (which it ignores).  Doing the 'get' upsets
RDMA which hangs on old machine types without the VMDescription.

Just avoid reading the VMDescription if we wouldn't send it.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>


  Commit: 24ec68ef84fdacd5dddb83f3b341165c4815e6d6
      
https://github.com/qemu/qemu/commit/24ec68ef84fdacd5dddb83f3b341165c4815e6d6
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M migration/rdma.c
    M trace-events

  Log Message:
  -----------
  rdma typos

A couple of typo fixes.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>


  Commit: 4fb5364b9096d6110c46604dbf1e19b7e766e757
      
https://github.com/qemu/qemu/commit/4fb5364b9096d6110c46604dbf1e19b7e766e757
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M migration/rdma.c
    M trace-events

  Log Message:
  -----------
  Store block name in local blocks structure

In a later patch the block name will be used to match up two views
of the block list.  Keep a copy of the block name with the local block
list.

(At some point it could be argued that it would be best just to let
migration see the innards of RAMBlock and avoid the need to use
foreach).

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Michael R. Hines <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>


  Commit: b12f7777981953b7d939496283014740bdd6de64
      
https://github.com/qemu/qemu/commit/b12f7777981953b7d939496283014740bdd6de64
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M migration/rdma.c

  Log Message:
  -----------
  Translate offsets to destination address space

The 'offset' field in RDMACompress and 'current_addr' field
in RDMARegister are commented as being offsets within a particular
RAMBlock, however they appear to actually be offsets within the
ram_addr_t space.

The code currently assumes that the offsets on the source/destination
match, this change removes the need for the assumption for these
structures by translating the addresses into the ram_addr_t space of
the destination host.

Note: An alternative would be to change the fields to actually
take the data they're commented for; this would potentially be
simpler but would break stream compatibility for those cases
that currently work.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>


  Commit: 632e3a5cd812d6bbd38fd2f3ffc189ff5ea51926
      
https://github.com/qemu/qemu/commit/632e3a5cd812d6bbd38fd2f3ffc189ff5ea51926
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M include/migration/migration.h
    M include/migration/qemu-file.h
    M migration/qemu-file.c
    M migration/ram.c
    M migration/rdma.c
    M trace-events

  Log Message:
  -----------
  Rework ram_control_load_hook to hook during block load

We need the names of RAMBlocks as they're loaded for RDMA,
reuse a slightly modified ram_control_load_hook:
  a) Pass a 'data' parameter to use for the name in the block-reg
     case
  b) Only some hook types now require the presence of a hook function.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>


  Commit: 03fcab38617ac9bcd6ed28cb1b6a0ecd8fb3bc82
      
https://github.com/qemu/qemu/commit/03fcab38617ac9bcd6ed28cb1b6a0ecd8fb3bc82
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M migration/rdma.c
    M trace-events

  Log Message:
  -----------
  Allow rdma_delete_block to work without the hash

In the next patch we remove the hash on the destination,
rdma_delete_block does two things with the hash which can be avoided:
  a) The caller passes the offset and rdma_delete_block looks it up
     in the hash; fixed by getting the caller to pass the block
  b) The hash gets recreated after deletion; fixed by making that
     conditional on the hash being initialised.

While this function is currently only used during cleanup, Michael
asked that we keep it general for future dynamic block registration
work.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>


  Commit: 760ff4bebc86d08b252809e0da7261c986d022ff
      
https://github.com/qemu/qemu/commit/760ff4bebc86d08b252809e0da7261c986d022ff
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M migration/rdma.c

  Log Message:
  -----------
  Rework ram block hash

RDMA uses a hash from block offset->RAM Block; this isn't needed
on the destination, and it becomes harder to maintain after the next
patch in the series that sorts the block list.

Split the hash so that it's only generated on the source.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>


  Commit: e4d633207c129dc5b7d145240ac4a1997ef3902f
      
https://github.com/qemu/qemu/commit/e4d633207c129dc5b7d145240ac4a1997ef3902f
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M migration/rdma.c
    M trace-events

  Log Message:
  -----------
  Sort destination RAMBlocks to be the same as the source

Use the order of incoming RAMBlocks from the source to record
an index number; that then allows us to sort the destination
local RAMBlock list to match the source.

Now that the RAMBlocks are known to be in the same order, this
simplifies the RDMA Registration step which previously tried to
match RAMBlocks based on offset (which isn't guaranteed to match).

Looking at the existing compress code, I think it was erroneously
relying on an assumption of matching ordering, which this fixes.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>


  Commit: afcddefdbe75d0c20bf6e11b5512ba768ce0700c
      
https://github.com/qemu/qemu/commit/afcddefdbe75d0c20bf6e11b5512ba768ce0700c
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M migration/rdma.c

  Log Message:
  -----------
  Sanity check RDMA remote data

Perform some basic (but probably not complete) sanity checking on
requests from the RDMA source.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Michael R. Hines <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>


  Commit: ef4b722d19cab845eaa0d1f912018b09a9d8288b
      
https://github.com/qemu/qemu/commit/ef4b722d19cab845eaa0d1f912018b09a9d8288b
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M migration/rdma.c

  Log Message:
  -----------
  Fail more cleanly in mismatched RAM cases

If the number of RAMBlocks was different on the source from the
destination, QEMU would hang waiting for a disconnect on the source
and wouldn't release from that hang until the destination was manually
killed.

Mark the stream as being in error, this causes the destination to die
and the source to carry on.

(It still gets a whole bunch of warnings on the destination, and I've
not managed to complete another migration after the 1st one, still
progress).

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>


  Commit: ff14e817f6c5f110b77e22185b256a17a96aa881
      
https://github.com/qemu/qemu/commit/ff14e817f6c5f110b77e22185b256a17a96aa881
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M hw/ppc/spapr.c

  Log Message:
  -----------
  Fix older machine type compatibility on power with section footers

I forgot to add compatibility for Power when adding section footers.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>

Fixes: 37fb569c0198cba58e3e
Signed-off-by: Juan Quintela <address@hidden>


  Commit: 5e0f1940caf49f56e3bee123aa92e42a3f7fad20
      
https://github.com/qemu/qemu/commit/5e0f1940caf49f56e3bee123aa92e42a3f7fad20
  Author: Juan Quintela <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M include/sysemu/sysemu.h
    M vl.c

  Log Message:
  -----------
  runstate: Add runstate store

This allows us to store the current state to send it through migration.

Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>


  Commit: ca3fc39ea9045188e37b84c4f92ee79c7ed4b1c3
      
https://github.com/qemu/qemu/commit/ca3fc39ea9045188e37b84c4f92ee79c7ed4b1c3
  Author: Juan Quintela <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M vl.c

  Log Message:
  -----------
  runstate: migration allows more transitions now

Next commit would allow to move from incoming migration to error happening on 
source.

Should we add more states to this transition?  Luiz?

Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>


  Commit: df4b1024526cae3479da3492d6371fd4a7324a03
      
https://github.com/qemu/qemu/commit/df4b1024526cae3479da3492d6371fd4a7324a03
  Author: Juan Quintela <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M include/migration/migration.h
    M migration/migration.c
    M trace-events
    M vl.c

  Log Message:
  -----------
  migration: create new section to store global state

This includes a new section that for now just stores the current qemu state.

Right now, there are only one way to control what is the state of the
target after migration.

- If you run the target qemu with -S, it would start stopped.
- If you run the target qemu without -S, it would run just after migration 
finishes.

The problem here is what happens if we start the target without -S and
there happens one error during migration that puts current state as
-EIO.  Migration would ends (notice that the error happend doing block
IO, network IO, i.e. nothing related with migration), and when
migration finish, we would just "continue" running on destination,
probably hanging the guest/corruption data, whatever.

Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 13d16814d2058f10461e6987c8216950389c1310
      
https://github.com/qemu/qemu/commit/13d16814d2058f10461e6987c8216950389c1310
  Author: Juan Quintela <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M hw/i386/pc_piix.c
    M hw/i386/pc_q35.c
    M hw/ppc/spapr.c
    M include/migration/migration.h
    M migration/migration.c

  Log Message:
  -----------
  global_state: Make section optional

This section would be sent:

a- for all new machine types
b- for old machine types if section state is different form {running,paused}
   that were the only giving us troubles.

So, in new qemus: it is alwasy there.  In old qemus: they are only
there if it an error has happened, basically stoping on target.

Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>


  Commit: df8961522a3d6bc7bb60c2830ef59e7c6c67a928
      
https://github.com/qemu/qemu/commit/df8961522a3d6bc7bb60c2830ef59e7c6c67a928
  Author: Juan Quintela <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M include/migration/vmstate.h
    M migration/savevm.c
    M migration/vmstate.c
    M trace-events

  Log Message:
  -----------
  vmstate: Create optional sections

To make sections optional, we need to do it at the beggining of the code.

Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 61964c23e5ddd5a33f15699e45ce126f879e3e33
      
https://github.com/qemu/qemu/commit/61964c23e5ddd5a33f15699e45ce126f879e3e33
  Author: Juan Quintela <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M hw/i386/pc_piix.c
    M hw/i386/pc_q35.c
    M include/migration/migration.h
    M migration/savevm.c

  Log Message:
  -----------
  migration: Add configuration section

It needs to be the first one and it is not optional, that is the reason
why it is opencoded.  For new machine types, it is required that machine
type name is the same in both sides.

It is just done right now for pc's.

Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>


  Commit: a5c17b5f68ff7e37ce6e6e1f5457307fe07629e7
      
https://github.com/qemu/qemu/commit/a5c17b5f68ff7e37ce6e6e1f5457307fe07629e7
  Author: Juan Quintela <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M migration/migration.c

  Log Message:
  -----------
  migration: Use cmpxchg correctly

cmpxchg returns the old value

Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 656a233440e552230f9d1da016b94a81b86658dc
      
https://github.com/qemu/qemu/commit/656a233440e552230f9d1da016b94a81b86658dc
  Author: Juan Quintela <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M migration/migration.c

  Log Message:
  -----------
  migration: ensure we start in NONE state

Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 7844337d1efb2c47dc3f306d7621e1cafca8ba67
      
https://github.com/qemu/qemu/commit/7844337d1efb2c47dc3f306d7621e1cafca8ba67
  Author: Juan Quintela <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M migration/migration.c

  Log Message:
  -----------
  migration: Use always helper to set state

There were three places that were not using the migrate_set_state()
helper, just fix that.

Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>


  Commit: f2bb932491185a39922dff0514c4b08c092f3c35
      
https://github.com/qemu/qemu/commit/f2bb932491185a39922dff0514c4b08c092f3c35
  Author: Juan Quintela <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M migration/migration.c

  Log Message:
  -----------
  migration: No need to call trace_migrate_set_state()

We now use the helper everywhere, so no need to call this on this two
places.  See on previous commit that there were a place where we missed
to mark the trace.  Now all tracing is done in migrate_set_state().

Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 598cd2bda0845096d2f06500e45b4d0d399b384a
      
https://github.com/qemu/qemu/commit/598cd2bda0845096d2f06500e45b4d0d399b384a
  Author: Juan Quintela <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M docs/qmp/qmp-events.txt
    M migration/migration.c
    M qapi/event.json

  Log Message:
  -----------
  migration: create migration event

We have one argument that tells us what event has happened.

Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: b05dc72342b27585909d9e99d95d17fd3dfbb269
      
https://github.com/qemu/qemu/commit/b05dc72342b27585909d9e99d95d17fd3dfbb269
  Author: Juan Quintela <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M include/migration/migration.h
    M migration/migration.c
    M qapi-schema.json

  Log Message:
  -----------
  migration: Make events a capability

Make check fails with events.  THis is due to the parser/lexer that it
uses.  Just in case that they are more broken parsers, just only send
events when there are capabilities.

Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 7cf1fe6d68eb2ad3b77e2a89f097354db5d627e2
      
https://github.com/qemu/qemu/commit/7cf1fe6d68eb2ad3b77e2a89f097354db5d627e2
  Author: Juan Quintela <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M migration/migration.c

  Log Message:
  -----------
  migration: Add migration events on target side

We reuse the migration events from the source side, sending them on the
appropiate place.

Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>


  Commit: 59f39a47411ab6007a592555dc639aa9753f8d23
      
https://github.com/qemu/qemu/commit/59f39a47411ab6007a592555dc639aa9753f8d23
  Author: Dr. David Alan Gilbert <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M migration/savevm.c

  Log Message:
  -----------
  check_section_footers: Check the correct section_id

The section footers check was incorrectly checking the section_id
in the SaveStateEntry not the LoadStateEntry.  These can validly be different
if the two QEMU instances have instantiated their devices in a
different order.  The test only cares that we're finishing the same
section we started, and hence it's the LoadStateEntry that we care about.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reported-by: Christian Borntraeger <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>


  Commit: 2ff64038a59e8de2baa485806be0838f49f70b79
      
https://github.com/qemu/qemu/commit/2ff64038a59e8de2baa485806be0838f49f70b79
  Author: Li Zhijian <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M migration/ram.c

  Log Message:
  -----------
  migration: protect migration_bitmap

Signed-off-by: Li Zhijian <address@hidden>
Signed-off-by: Wen Congyang <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>


  Commit: dd63169766abd2b8dc33f4451dac5e778458a47c
      
https://github.com/qemu/qemu/commit/dd63169766abd2b8dc33f4451dac5e778458a47c
  Author: Li Zhijian <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M exec.c
    M include/exec/exec-all.h
    M migration/ram.c

  Log Message:
  -----------
  migration: extend migration_bitmap

Prevously, if we hotplug a device(e.g. device_add e1000) during
migration is processing in source side, qemu will add a new ram
block but migration_bitmap is not extended.
In this case, migration_bitmap will overflow and lead qemu abort
unexpectedly.

Signed-off-by: Li Zhijian <address@hidden>
Signed-off-by: Wen Congyang <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>


  Commit: 9861b71fd63f04175fddd1e93a417bae4a7808d7
      
https://github.com/qemu/qemu/commit/9861b71fd63f04175fddd1e93a417bae4a7808d7
  Author: Peter Maydell <address@hidden>
  Date:   2015-07-07 (Tue, 07 Jul 2015)

  Changed paths:
    M docs/qmp/qmp-events.txt
    M exec.c
    M hw/i386/pc_piix.c
    M hw/i386/pc_q35.c
    M hw/ppc/spapr.c
    M include/exec/exec-all.h
    M include/migration/migration.h
    M include/migration/qemu-file.h
    M include/migration/vmstate.h
    M include/sysemu/sysemu.h
    M migration/migration.c
    M migration/qemu-file.c
    M migration/ram.c
    M migration/rdma.c
    M migration/savevm.c
    M migration/vmstate.c
    M qapi-schema.json
    M qapi/event.json
    M trace-events
    M vl.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20150707' 
into staging

migration/next for 20150707

# gpg: Signature made Tue Jul  7 13:56:30 2015 BST using RSA key ID 5872D723
# gpg: Good signature from "Juan Quintela <address@hidden>"
# gpg:                 aka "Juan Quintela <address@hidden>"

* remotes/juanquintela/tags/migration/20150707: (28 commits)
  migration: extend migration_bitmap
  migration: protect migration_bitmap
  check_section_footers: Check the correct section_id
  migration: Add migration events on target side
  migration: Make events a capability
  migration: create migration event
  migration: No need to call trace_migrate_set_state()
  migration: Use always helper to set state
  migration: ensure we start in NONE state
  migration: Use cmpxchg correctly
  migration: Add configuration section
  vmstate: Create optional sections
  global_state: Make section optional
  migration: create new section to store global state
  runstate: migration allows more transitions now
  runstate: Add runstate store
  Fix older machine type compatibility on power with section footers
  Fail more cleanly in mismatched RAM cases
  Sanity check RDMA remote data
  Sort destination RAMBlocks to be the same as the source
  ...

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/f2562fbb7ac5...9861b71fd63f

reply via email to

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