[Top][All Lists]

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

[PATCH v5 0/4] delay timer_new from init to realize to fix memleaks.

From: Pan Nengyuan
Subject: [PATCH v5 0/4] delay timer_new from init to realize to fix memleaks.
Date: Sat, 14 Mar 2020 16:47:26 +0800

This series delay timer_new from init into realize to avoid memleaks when we 
call 'device_list_properties'.
And do timer_free only in s390x_cpu_finalize because it's hotplugable. However, 
mos6522_realize is never called
at all due to the incorrect creation of it. So we fix the incorrect creation in 
mac_via/cuda/pmu first, then 
move the timer_new to mos6522_realize().

   - Delay timer_new() from init() to realize() to fix memleaks.
   - Similarly to other cleanups, move timer_new into realize in 
target/s390x/cpu.c (Suggested by Philippe Mathieu-Daudé).
   - Send these two patches as a series instead of send each as a single patch 
but with wrong subject in v1.
   - It's not valid in mos6522 if we move timer_new from init to realize, 
because it's never called at all.
     Thus, we remove null check in reset, and add calls to mos6522_realize() in 
mac_via_realize to make this move to be valid.
   - split patch by device to make it more clear.
   - Also do timer_free on the error path in realize() and fix some coding 
style. Then use device_class_set_parent_unrealize to declare unrealize.
   - split the mos6522 patch into two, one to fix incorrect creation of 
mos6522, the other to fix memleak.

   - Fix two other places where we create mos6522's subclasses but forgot to 
realize it(macio/cuda,macio/pmu). 
     Otherwise, this will cause SEGVs during make check-qtest-ppc64.
   - Remove timer_del on the error path of s390x_cpu_realize() and simply use 
errp instead a temporary variable.

Pan Nengyuan (4):
  s390x: fix memleaks in cpu_finalize
  mac_via: fix incorrect creation of mos6522 device in mac_via
  hw/misc/macio: fix incorrect creation of mos6522's subclasses
  hw/misc/mos6522: move timer_new from init() into realize() to avoid

 hw/misc/mac_via.c      | 40 +++++++++++++++++++++++++++-------------
 hw/misc/macio/cuda.c   | 11 +++++++++--
 hw/misc/macio/pmu.c    | 11 +++++++++--
 hw/misc/mos6522.c      |  6 ++++++
 target/s390x/cpu-qom.h |  1 +
 target/s390x/cpu.c     | 30 ++++++++++++++++++++++++++----
 6 files changed, 78 insertions(+), 21 deletions(-)


reply via email to

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