All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Li Qiang <liq3ea@gmail.com>
Cc: keith.busch@intel.com, kwolf@redhat.com, mreitz@redhat.com,
	qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] nvme: don't unref ctrl_mem when device unrealized
Date: Tue, 6 Nov 2018 16:58:29 +0100	[thread overview]
Message-ID: <20181106165829.4b9e6e36@redhat.com> (raw)
In-Reply-To: <1540794581-33578-2-git-send-email-liq3ea@gmail.com>

On Sun, 28 Oct 2018 23:29:40 -0700
Li Qiang <liq3ea@gmail.com> wrote:

> Currently, when hotplug/unhotplug nvme device, it will cause an
> assert in object.c. Following is the backtrack:
> 
> ERROR:qom/object.c:981:object_unref: assertion failed: (obj->ref > 0)
> 
> Thread 2 "qemu-system-x86" received signal SIGABRT, Aborted.
> [Switching to Thread 0x7fffcbd32700 (LWP 18844)]
> 0x00007fffdb9e4fff in raise () from /lib/x86_64-linux-gnu/libc.so.6
> (gdb) bt
> /lib/x86_64-linux-gnu/libglib-2.0.so.0
> /lib/x86_64-linux-gnu/libglib-2.0.so.0
> qom/object.c:981
> /home/liqiang02/qemu-upstream/qemu/memory.c:1732
> /home/liqiang02/qemu-upstream/qemu/memory.c:285
> util/qemu-thread-posix.c:504
> /lib/x86_64-linux-gnu/libpthread.so.0
> 
> This is caused by memory_region_unref in nvme_exit.
> 
> Remove it to make the PCIdevice refcount correct.
> 
> Signed-off-by: Li Qiang <liq3ea@gmail.com>
nvme device holds a reference to ctrl_mem MemoryRegion as a parent
so MemoryRegion will be destroyed later during destruction of
nvme object when its cildren are un-parented.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  hw/block/nvme.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/hw/block/nvme.c b/hw/block/nvme.c
> index fc7dacb816..359a06d0ad 100644
> --- a/hw/block/nvme.c
> +++ b/hw/block/nvme.c
> @@ -1331,9 +1331,6 @@ static void nvme_exit(PCIDevice *pci_dev)
>      g_free(n->namespaces);
>      g_free(n->cq);
>      g_free(n->sq);
> -    if (n->cmbsz) {
> -        memory_region_unref(&n->ctrl_mem);
> -    }
>  
>      msix_uninit_exclusive_bar(pci_dev);
>  }

  parent reply	other threads:[~2018-11-06 15:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-29  6:29 [Qemu-devel] [PATCH 0/2] nvme: fix two issues in nvme unhotplug Li Qiang
2018-10-29  6:29 ` [Qemu-devel] [PATCH 1/2] nvme: don't unref ctrl_mem when device unrealized Li Qiang
2018-11-05 14:57   ` Li Qiang
2018-11-06 15:58   ` Igor Mammedov [this message]
2018-10-29  6:29 ` [Qemu-devel] [PATCH 2/2] nvme: free cmbuf in nvme_exit Li Qiang
2018-10-29 12:32   ` Philippe Mathieu-Daudé
2018-11-07  9:54 ` [Qemu-devel] [PATCH 0/2] nvme: fix two issues in nvme unhotplug Kevin Wolf

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=20181106165829.4b9e6e36@redhat.com \
    --to=imammedo@redhat.com \
    --cc=keith.busch@intel.com \
    --cc=kwolf@redhat.com \
    --cc=liq3ea@gmail.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.