From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXMHb-0004rc-E6 for qemu-devel@nongnu.org; Wed, 10 Aug 2016 01:42:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXMHZ-0001CK-7G for qemu-devel@nongnu.org; Wed, 10 Aug 2016 01:42:26 -0400 Received: from mail-oi0-x22f.google.com ([2607:f8b0:4003:c06::22f]:34029) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXMHZ-0001CF-1r for qemu-devel@nongnu.org; Wed, 10 Aug 2016 01:42:25 -0400 Received: by mail-oi0-x22f.google.com with SMTP id l203so46520713oib.1 for ; Tue, 09 Aug 2016 22:42:24 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Ashijeet Acharya Date: Wed, 10 Aug 2016 11:12:23 +0530 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] Dangling change state handler while hot unplugging ahci adapter List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: QEMU Developers On Tue, Aug 9, 2016 at 11:48 PM, John Snow wrote: > > > On 08/09/2016 01:16 PM, Ashijeet Acharya wrote: >> >> Hi again, >> I am still waiting for some guidance...Can I please get some help with >> this? >> >> Also.. I tried hotplugging an AHCI adapter but got the following error: >> Bus 'ahci.0' does not support hotplugging >> >> Steps I followed: >> >> 1. launch vm with ahci enabled >> 2. (qemu) drive_add 0 >> file=3Dtest.qcow2,cache=3Dnone,if=3Dnone,id=3Ddisk2,format=3Dqcow2 >> OK >> 3. (qemu) device_add ide-hd,bus=3Dahci.0,id=3Dahci-disk,drive=3Ddisk2 >> Bus 'ahci.0' does not support hotplugging >> >> What am I doing wrong? >> >> Thanks >> Ashijeet >> > > I think you are confusing hotplugging the AHCI adapter with hotplugging a= n > IDE drive into an AHCI adapter. > > IDE/ATA/PATA (A rose by any other name...) drives do not support hotplugg= ing > (hence "Bus 'ahci.0' does not support hotplugging"). > > SATA drives do in theory, but it hasn't been implemented yet. > > That's probably a little more involved than a Bite Sized Task, but it's > something that I'd be willing to review if you embarked upon such a task. > >> On Sat, Aug 6, 2016 at 11:21 PM, Ashijeet Acharya >> wrote: >>> >>> Hi, >>> >>> I was working on a patch regarding a device lifecycle bitesize task >>> and I wanted to clear my queries about what the task is exactly. >>> >>> Do I need to create a new function ahci_unrealize() in the >>> hw/ide/ahci.c file which calls for qemu_del_vm_change_state_handler() >>> to free the handler at the time of ahci hot unplug. >>> > > Sounds about right. grep around for other instances of > qemu_del_vm_change_state_handler and try to code by example. Alright..thanks! I found out that ahci_realize() calls for ide_register_restart_cb() which has qemu_add_vm_change_state_handler() but the returned value from qemu_add_vm_change_state_handler() does not get assigned to any VMChangeStateEntry pointer. This should lead (I guess..) to a memory leak! Maybe introducing a VMChangeStateEntry field in struct AHCIState help and can be used here. This later can also be passed to qemu_del_vm_change_state_handler() to free things up. > > >>> Please tell me if I am on the right path and correct me if I am wrong. >>> >>> Thanks >>> Ashijeet > > > -- > =E2=80=94js