qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Li Feng <fengli@smartx.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	"open list:Block layer core" <qemu-block@nongnu.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"open list:All patches CC here" <qemu-devel@nongnu.org>,
	raphael.norwitz@nutanix.com, Kyle Zhang <kyle@smartx.com>,
	Max Reitz <mreitz@redhat.com>
Subject: Re: hotplug issue of vhost-user-blk
Date: Wed, 8 Apr 2020 12:40:35 +0200	[thread overview]
Message-ID: <20200408124035.41c1d242@redhat.com> (raw)
In-Reply-To: <CAHckoCzojVSHLAwBP2QhFx3Gw6j9DVPRwNSML9D4GQMzKr9Y3g@mail.gmail.com>

On Wed, 8 Apr 2020 10:25:42 +0800
Li Feng <fengli@smartx.com> wrote:

> Hi all,
> 
> Hotplug of vhost-user-blk doesn't not work in qemu master branch and
> all previous version.
> 
> The action I insert a vhost-user-blk disk is:
> (qemu) chardev-add socket,id=spdk_vhost_blk2,path=/vhost-blk.0,reconnect=1
> (qemu) device_add
> vhost-user-blk-pci,chardev=spdk_vhost_blk2,id=spdk_vhost_blk2,num-queues=4
> 
> Until here, it's well.
> 
> Then I unplug it from qemu:
> (qemu) device_del spdk_vhost_blk2
> (qemu) chardev-remove spdk_vhost_blk2
> Error: Chardev 'spdk_vhost_blk2' is busy
> 
> The related code is here:
> qmp_chardev_remove
>     -> qemu_chr_is_busy
>     -> object_unparent(OBJECT(chr));  
> 
>  330 static bool qemu_chr_is_busy(Chardev *s)
>  331 {
>  332     if (CHARDEV_IS_MUX(s)) {
>  333         MuxChardev *d = MUX_CHARDEV(s);
>  334         return d->mux_cnt >= 0;
>  335     } else {
>  336         return s->be != NULL;
>  337     }
>  338 }
> 
> My question is:
> 1. s->be is set to NULL when qemu_chr_fe_deinit is called.
> However, the qmp_chardev_remove is blocked at qemu_chr_is_busy check,
> then the object_unparent will not be called.
> 2. Is there a path that device_del will trigger the s->be that been set to NULL?

device_del is request for guest to eject device and once it's done backend
could be removed. 

what's you command line? (so I could point out entry point where ejection happens
for you to troubleshoot it further)

> 
> How should I fix this issue?
> I have tested that comment the qemu_chr_is_busy works well.
> 
> Thanks in advance.
> 
> Feng Li
> 



  reply	other threads:[~2020-04-08 10:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-08  2:25 hotplug issue of vhost-user-blk Li Feng
2020-04-08 10:40 ` Igor Mammedov [this message]
2020-04-09  6:58   ` Li Feng
2020-04-09 20:18 ` Michael S. Tsirkin

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=20200408124035.41c1d242@redhat.com \
    --to=imammedo@redhat.com \
    --cc=fengli@smartx.com \
    --cc=kwolf@redhat.com \
    --cc=kyle@smartx.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=raphael.norwitz@nutanix.com \
    /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).