qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Li Qiang <liq3ea@gmail.com>, qemu-devel@nongnu.org
Cc: Li Qiang <liqiang6-s@360.cn>
Subject: Re: [Qemu-devel] [PATCH 2/2] ide: ahci: call cleanup function in ahci unit
Date: Tue, 28 Feb 2017 19:42:31 -0500	[thread overview]
Message-ID: <0bd60e6f-913d-f9b3-eff9-71d00f674a17@redhat.com> (raw)
In-Reply-To: <9cda5c21-0022-fc56-5afa-d797088fe3d5@redhat.com>



On 02/28/2017 07:35 PM, John Snow wrote:
> 
> 
> On 02/09/2017 02:04 AM, Li Qiang wrote:
>> This can avoid memory leak when hotunplug the ahci device.
>>
>> Signed-off-by: Li Qiang <liqiang6-s@360.cn>
>> ---
>>  hw/ide/ahci.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
>> index 3c19bda..56f68a8 100644
>> --- a/hw/ide/ahci.c
>> +++ b/hw/ide/ahci.c
>> @@ -1485,6 +1485,14 @@ void ahci_realize(AHCIState *s, DeviceState *qdev, AddressSpace *as, int ports)
>>  
>>  void ahci_uninit(AHCIState *s)
>>  {
>> +    int i;
>> +
>> +    for (i = 0; i < s->ports; i++) {
>> +        AHCIDevice *ad = &s->dev[i];
>> +
>> +        ide_unregister_restart_cb(&ad->port);
>> +        ide_exit(&ad->port);
>> +    }
>>      g_free(s->dev);
>>  }
>>  
>>
> 
> I couldn't actually prove to myself that ahci_uninit runs on an unplug
> request. Did you observe improvements to the memory profile after
> introducing this patch?
> 
> I don't think anyone has taken the care to plumb AHCI to behave well
> when hotplugged.
> 

Ah, my mistake actually! It's just that it requires guest cooperation.
It works perfectly well as long as Linux is ready to cooperate with the
request.

--js

      reply	other threads:[~2017-03-01  0:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-09  7:04 [Qemu-devel] [PATCH 0/2] ide: ahci: fix memory leak in device unit Li Qiang
2017-02-09  7:04 ` [Qemu-devel] [PATCH 1/2] ide: core: add cleanup function Li Qiang
2017-02-09 19:42   ` John Snow
2017-02-10  1:22     ` Li Qiang
2017-02-14 23:30       ` John Snow
2017-02-15  9:26         ` Li Qiang
2017-02-15 19:53           ` John Snow
2017-03-01  0:47   ` John Snow
2017-03-01  1:03     ` Li Qiang
2017-03-01 20:20       ` John Snow
2017-03-06 18:14         ` Paolo Bonzini
2017-02-09  7:04 ` [Qemu-devel] [PATCH 2/2] ide: ahci: call cleanup function in ahci unit Li Qiang
2017-03-01  0:35   ` John Snow
2017-03-01  0:42     ` John Snow [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0bd60e6f-913d-f9b3-eff9-71d00f674a17@redhat.com \
    --to=jsnow@redhat.com \
    --cc=liq3ea@gmail.com \
    --cc=liqiang6-s@360.cn \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).