From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35506) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9VXC-0007p7-Hc for qemu-devel@nongnu.org; Fri, 09 Jan 2015 04:07:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y9VX8-0007FK-HE for qemu-devel@nongnu.org; Fri, 09 Jan 2015 04:07:10 -0500 Received: from mail-wg0-x235.google.com ([2a00:1450:400c:c00::235]:57277) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9VX8-0007FA-9O for qemu-devel@nongnu.org; Fri, 09 Jan 2015 04:07:06 -0500 Received: by mail-wg0-f53.google.com with SMTP id x13so6941776wgg.12 for ; Fri, 09 Jan 2015 01:07:05 -0800 (PST) Sender: Paolo Bonzini Message-ID: <54AF9A34.9090207@redhat.com> Date: Fri, 09 Jan 2015 10:07:00 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1420711408-15766-1-git-send-email-pbonzini@redhat.com> <20150109021046.GA6087@fam-t430.nay.redhat.com> In-Reply-To: <20150109021046.GA6087@fam-t430.nay.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 0/4] qemu-timer: introduce usable pointer-free API List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-devel@nongnu.org On 09/01/2015 03:10, Fam Zheng wrote: > On Thu, 01/08 11:03, Paolo Bonzini wrote: >> The current pointer free API for timers is very low level. Introduce >> a new API that matches timer_new_ns/us/ms and also a new API timer_deinit >> that can be used instead of timer_free. >> >> Finally, mechanically change timer macro names in vmstate, to make it >> clear that they accept a pointer. >> >> This prepares for conversion of timers from QEMUTimer * to QEMUTimer. > > Novice question: what's the advantage, please? No need to free them, so no memory leaks. From a quick look I found two (hw/net/pcnet.c and hw/char/serial.c). Also it matches more recent device model APIs like memory regions or throttling. Paolo > Fam > >> >> Paolo >> >> Paolo Bonzini (4): >> qemu-timer: rename timer_init to timer_init_tl >> qemu-timer: add timer_init and timer_init_ns/us/ms >> qemu-timer: introduce timer_deinit >> vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR* >> >> hw/acpi/ich9.c | 2 +- >> hw/acpi/piix4.c | 2 +- >> hw/arm/stellaris.c | 2 +- >> hw/block/fdc.c | 2 +- >> hw/char/cadence_uart.c | 2 +- >> hw/char/serial.c | 4 +- >> hw/core/ptimer.c | 2 +- >> hw/dma/pl330.c | 2 +- >> hw/input/lm832x.c | 2 +- >> hw/intc/armv7m_nvic.c | 2 +- >> hw/isa/vt82c686.c | 2 +- >> hw/misc/macio/cuda.c | 2 +- >> hw/net/pcnet.c | 2 +- >> hw/sd/sdhci.c | 4 +- >> hw/timer/a9gtimer.c | 2 +- >> hw/timer/arm_mptimer.c | 2 +- >> hw/timer/hpet.c | 2 +- >> hw/timer/mc146818rtc.c | 4 +- >> hw/usb/hcd-ehci.c | 2 +- >> hw/usb/hcd-ohci.c | 2 +- >> hw/usb/hcd-uhci.c | 2 +- >> hw/usb/hcd-xhci.c | 2 +- >> hw/usb/redirect.c | 2 +- >> hw/watchdog/wdt_i6300esb.c | 2 +- >> hw/watchdog/wdt_ib700.c | 2 +- >> include/block/aio.h | 2 +- >> include/migration/vmstate.h | 18 +++++++-- >> include/qemu/timer.h | 94 ++++++++++++++++++++++++++++++++++++++++++--- >> qemu-timer.c | 20 +++++++--- >> target-arm/machine.c | 4 +- >> 30 files changed, 149 insertions(+), 45 deletions(-) >> >> -- >> 2.1.0 >> >> > >