* hotplug issue of vhost-user-blk
@ 2020-04-08 2:25 Li Feng
2020-04-08 10:40 ` Igor Mammedov
2020-04-09 20:18 ` Michael S. Tsirkin
0 siblings, 2 replies; 4+ messages in thread
From: Li Feng @ 2020-04-08 2:25 UTC (permalink / raw)
To: Michael S. Tsirkin, Kevin Wolf, Max Reitz,
open list:Block layer core, open list:All patches CC here,
raphael.norwitz
Cc: Kyle Zhang
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?
How should I fix this issue?
I have tested that comment the qemu_chr_is_busy works well.
Thanks in advance.
Feng Li
--
The SmartX email address is only for business purpose. Any sent message
that is not related to the business is not authorized or permitted by
SmartX.
本邮箱为北京志凌海纳科技有限公司(SmartX)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: hotplug issue of vhost-user-blk
2020-04-08 2:25 hotplug issue of vhost-user-blk Li Feng
@ 2020-04-08 10:40 ` Igor Mammedov
2020-04-09 6:58 ` Li Feng
2020-04-09 20:18 ` Michael S. Tsirkin
1 sibling, 1 reply; 4+ messages in thread
From: Igor Mammedov @ 2020-04-08 10:40 UTC (permalink / raw)
To: Li Feng
Cc: Kevin Wolf, open list:Block layer core, Michael S. Tsirkin,
open list:All patches CC here, raphael.norwitz, Kyle Zhang,
Max Reitz
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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: hotplug issue of vhost-user-blk
2020-04-08 10:40 ` Igor Mammedov
@ 2020-04-09 6:58 ` Li Feng
0 siblings, 0 replies; 4+ messages in thread
From: Li Feng @ 2020-04-09 6:58 UTC (permalink / raw)
To: Igor Mammedov
Cc: Kevin Wolf, open list:Block layer core, Michael S. Tsirkin,
open list:All patches CC here, raphael.norwitz, Kyle Zhang,
Max Reitz
Thanks!
After waiting some seconds after device_del:
(qemu) device_del spdk_vhost_blk2
sleep 5
(qemu) chardev-remove spdk_vhost_blk2
Error: Chardev 'spdk_vhost_blk2' is busy
It works. However, I find some crashes about the vhost-user-blk.
I will send out the patches after all tests.
Thanks,
Feng Li
Igor Mammedov <imammedo@redhat.com> 于2020年4月8日周三 下午6:40写道:
>
> 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
> >
>
--
The SmartX email address is only for business purpose. Any sent message
that is not related to the business is not authorized or permitted by
SmartX.
本邮箱为北京志凌海纳科技有限公司(SmartX)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: hotplug issue of vhost-user-blk
2020-04-08 2:25 hotplug issue of vhost-user-blk Li Feng
2020-04-08 10:40 ` Igor Mammedov
@ 2020-04-09 20:18 ` Michael S. Tsirkin
1 sibling, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2020-04-09 20:18 UTC (permalink / raw)
To: Li Feng
Cc: Kevin Wolf, open list:Block layer core, Pan Nengyuan, jusual,
open list:All patches CC here, raphael.norwitz, Kyle Zhang,
Max Reitz
On Wed, Apr 08, 2020 at 10:25:42AM +0800, Li Feng 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
Pan Nengyuan (cc'd) fixed unplug recently so I expect it
worked for him after the patch ...
> 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?
>
> How should I fix this issue?
> I have tested that comment the qemu_chr_is_busy works well.
>
> Thanks in advance.
>
> Feng Li
>
> --
> The SmartX email address is only for business purpose. Any sent message
> that is not related to the business is not authorized or permitted by
> SmartX.
> 本邮箱为北京志凌海纳科技有限公司(SmartX)工作邮箱. 如本邮箱发出的邮件与工作无关,该邮件未得到本公司任何的明示或默示的授权.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-09 20:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-08 2:25 hotplug issue of vhost-user-blk Li Feng
2020-04-08 10:40 ` Igor Mammedov
2020-04-09 6:58 ` Li Feng
2020-04-09 20:18 ` Michael S. Tsirkin
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).