<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 13, 2021 at 4:26 PM Dr. David Alan Gilbert <<a href="mailto:dgilbert@redhat.com">dgilbert@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">* Jiachen Zhang (<a href="mailto:zhangjiachen.jaycee@bytedance.com" target="_blank">zhangjiachen.jaycee@bytedance.com</a>) wrote:<br>
> Hi Stefan and Sebastien,<br>
> <br>
> I think I should give some background context from my perspective.<br>
> <br>
> For the virtiofsd crash reconnection (recovery) to QEMU, as said by<br>
> Stefan, we discussed the possible implementation on the bi-weekly virtio-fs<br>
> call. I had also sent an RFC patch to the virtio-fs mail-list (<br>
> <a href="https://patchwork.kernel.org/project/qemu-devel/cover/20201215162119.27360-1-zhangjiachen.jaycee@bytedance.com/" rel="noreferrer" target="_blank">https://patchwork.kernel.org/project/qemu-devel/cover/20201215162119.27360-1-zhangjiachen.jaycee@bytedance.com/</a>),<br>
> we also have some discussion on the further revision direction in that<br>
> mail.<br>
> <br>
> We also have some needs to support virtiofsd crash recovery when it is used<br>
> with cloud-hypervisor (<a href="https://github.com/cloud-hypervisor/cloud-hypervisor" rel="noreferrer" target="_blank">https://github.com/cloud-hypervisor/cloud-hypervisor</a>).<br>
> However, the virtiofsd crash reconnection RFC patch relies on<br>
> QEMU's vhost-user socket reconnection feature and QEMU's vhost-user<br>
> inflight I/O tracking feature, which are both not supported by<br>
> cloud-hypervisor.<br>
> <br>
> So I also issued an initial pull-request of cloud-hypervisor vhost-user<br>
> socket reconnection (<br>
> <a href="https://github.com/cloud-hypervisor/cloud-hypervisor/pull/2387" rel="noreferrer" target="_blank">https://github.com/cloud-hypervisor/cloud-hypervisor/pull/2387</a>), which is<br>
> reviewed by Sebastien. Based on vhost-user socket reconnection, we also<br>
> want to further develop vhost-user inflight I/O tracking feature for<br>
> cloud-hypervisor, and finally to support virtiofsd crash reconnection.<br>
> <br>
> I am sorry for the delayed patch-revision of the two patch sets. I hope I<br>
> can free up some time in these two months to make some further progress.<br>
<br>
I'm curious what your use case is for virtiofsd crash<br>
recovery/reconnection - is there some reason you expect the daemon to<br>
crash or need to be restarted more than the whole VM?<br>
<br>
In the case of vhost-user networking with dpdk I can see the case where<br>
there is a central networking switch process shared between many VMs; so<br>
wanting to restart that without restarting all the VMs makes sense to<br>
me; where each VM has it's own virtiofsd I don't understand the use as<br>
much.<br>
<br></blockquote><div><br></div><div>Hi Dave,</div><div><br></div><div>Yes, we want to restart virtiofsd without restarting the whole VM. One reason is to avoid I/O hang caused by virtiofs daemon crash. Another important reason to support virtiofsd live-upgrade for virtiofsd's bug or security fixes based on virtiofsd reconnection.</div><div><br></div><div>All the best,</div><div>Jiachen</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Dave<br>
<br>
> All the best,<br>
> Jiachen<br>
> <br>
> On Tue, May 11, 2021 at 11:02 PM Boeuf, Sebastien <<a href="mailto:sebastien.boeuf@intel.com" target="_blank">sebastien.boeuf@intel.com</a>><br>
> wrote:<br>
> <br>
> > Hi Stefan,<br>
> ><br>
> > Thanks for the explanation.<br>
> ><br>
> > So reconnection for vhost-user is not a well defined behavior,<br>
> > and QEMU is doing its best to retry when possible, depending<br>
> > on each device.<br>
> ><br>
> > The guest does not know about it, so it's never notified that<br>
> > the device needs to be reset.<br>
> ><br>
> > But what about the vhost-user backend initialization? Does<br>
> > QEMU go again through initializing memory table, vrings, etc...<br>
> > since it can't assume anything from the backend?<br>
> ><br>
> > Thanks,<br>
> > Sebastien<br>
> ><br>
> > ------------------------------<br>
> > *From:* Stefan Hajnoczi<br>
> > *Sent:* Tuesday, May 11, 2021 2:45 PM<br>
> > *To:* Boeuf, Sebastien<br>
> > *Cc:* <a href="mailto:virtio-fs@redhat.com" target="_blank">virtio-fs@redhat.com</a>; <a href="mailto:qemu-devel@nongnu.org" target="_blank">qemu-devel@nongnu.org</a><br>
> > *Subject:* vhost-user reconnection and crash recovery<br>
> ><br>
> > Hi Sebastien,<br>
> > On #virtio-fs IRC you asked:<br>
> ><br>
> >  I have a vhost-user question regarding disconnection/reconnection. How<br>
> >  should this be handled? Let's say the vhost-user backend disconnects,<br>
> >  and reconnects later on, does QEMU reset the virtio device by notifying<br>
> >  the guest? Or does it simply reconnects to the backend without letting<br>
> >  the guest know about what happened?<br>
> ><br>
> > The vhost-user protocol does not have a generic reconnection solution.<br>
> > Reconnection is handled on a case-by-case basis because device-specific<br>
> > and implementation-specific state is involved.<br>
> ><br>
> > The vhost-user-fs-pci device in QEMU has not been tested with<br>
> > reconnection as far as I know.<br>
> ><br>
> > The ideal reconnection behavior is to resume the device from its<br>
> > previous state without disrupting the guest. Device state must survive<br>
> > reconnection in order for this to work. Neither QEMU virtiofsd nor<br>
> > virtiofsd-rs implement this today.<br>
> ><br>
> > virtiofs has a lot of state, making it particularly difficult to support<br>
> > either DEVICE_NEEDS_RESET or transparent vhost-user reconnection. We<br>
> > have discussed virtiofs crash recovery on the bi-weekly virtiofs call<br>
> > (<a href="https://etherpad.opendev.org/p/virtiofs-external-meeting" rel="noreferrer" target="_blank">https://etherpad.opendev.org/p/virtiofs-external-meeting</a>). If you want<br>
> > to work on this then joining the call would be a good starting point to<br>
> > coordinate with others.<br>
> ><br>
> > One approach for transparent crash recovery is for virtiofsd to keep its<br>
> > state in tmpfs (e.g. inode/fd mappings) and open fds shared with a<br>
> > clone(2) process via CLONE_FILES. This way the virtiofsd process can<br>
> > terminate but its state persists in memory thanks to its clone process.<br>
> > The clone can then be used to launch the new virtiofsd process from the<br>
> > old state. This would allow the device to resume transparently with QEMU<br>
> > only reconnecting the vhost-user UNIX domain socket. This is an idea<br>
> > that we discussed in the bi-weekly virtiofs call.<br>
> ><br>
> > You mentioned device reset. VIRTIO 1.1 has the Device Status Field<br>
> > DEVICE_NEEDS_RESET flat that the device can use to tell the driver that<br>
> > a reset is necessary. This feature is present in the specification but<br>
> > not implemented in the Linux guest drivers. Again the reason is that<br>
> > handling it requires driver-specific logic for restoring state after<br>
> > reset...otherwise the device reset would be visible to userspace.<br>
> ><br>
> > Stefan<br>
> ><br>
> > ---------------------------------------------------------------------<br>
> > Intel Corporation SAS (French simplified joint stock company)<br>
> > Registered headquarters: "Les Montalets"- 2, rue de Paris,<br>
> > 92196 Meudon Cedex, France<br>
> > Registration Number:  302 456 199 R.C.S. NANTERRE<br>
> > Capital: 4,572,000 Euros<br>
> ><br>
> > This e-mail and any attachments may contain confidential material for<br>
> > the sole use of the intended recipient(s). Any review or distribution<br>
> > by others is strictly prohibited. If you are not the intended<br>
> > recipient, please contact the sender and delete all copies.<br>
> > _______________________________________________<br>
> > Virtio-fs mailing list<br>
> > <a href="mailto:Virtio-fs@redhat.com" target="_blank">Virtio-fs@redhat.com</a><br>
> > <a href="https://listman.redhat.com/mailman/listinfo/virtio-fs" rel="noreferrer" target="_blank">https://listman.redhat.com/mailman/listinfo/virtio-fs</a><br>
> ><br>
<br>
> _______________________________________________<br>
> Virtio-fs mailing list<br>
> <a href="mailto:Virtio-fs@redhat.com" target="_blank">Virtio-fs@redhat.com</a><br>
> <a href="https://listman.redhat.com/mailman/listinfo/virtio-fs" rel="noreferrer" target="_blank">https://listman.redhat.com/mailman/listinfo/virtio-fs</a><br>
<br>
-- <br>
Dr. David Alan Gilbert / <a href="mailto:dgilbert@redhat.com" target="_blank">dgilbert@redhat.com</a> / Manchester, UK<br>
<br>
</blockquote></div></div>