On Mon, Aug 13, 2018 at 07:37:33PM +0800, shilei.massclo...@gmx.com wrote: > On Monday, August 13, 2018 at 10:02 AM, Daniel P. Berrangé wrote: > >On Mon, Aug 13, 2018 at 02:32:17PM +0800, Shi Lei wrote: > >> Hi, everyone! > >> It's possible that the running-time of a command is long than its caller > >> expected. Perhaps, it's useful to provide timeout mode for virCommandRun or > >> virCommandRunAsync + virCommandWait. And The caller can restrict the > >> running time of the command if necessary. I introduce a new function > >> virCommandSetTimeout for that. > >> > >> And then, virKModLoad will get a default timeout of 3 seconds. I hope it > >> could solve the problem of "strange delay" as John mentioned. > > > >I'm not really see what this is hoping to solve. If something in libvirt > >is running virKModLoad, I cannot see how it will work better by not waiting > >for it to complete. > > Thanks for your quick reply! I hope I could explain my idea more clear:) > > The virKModLoad is used for loading external kernel modules which are not > under > the control of Libvirt. We cannot make sure they're always solid and strong > (especially for various pci drivers). If the INIT process of a module is > blocked > for some reasons, the caller of the virKModLoad will be blocked itself and > cannot known what happened internally and have no chance to handle it. > Most modules need only dozens of milliseconds to complete loading. > On my slow PC, module 'nbd' needs about 2 milliseconds to load and '8021q' > needs > about 30 milliseconds. And I will try to test other pci drivers. > If loading time is longer than a few seconds, we can presume there are some > exceptions > or errors in the loading process of the module. With timeout mode, > virKModLoad can > report it to the caller and the caller could decide how to handle it. > Timeout mode for virKModLoad is just an insurance which could avoid blocking > indefinitely.
virKModLoad is only used in two places, one to load the nbd module, and one place to load either pci-stub or pciback or vfio-pci. It is not used to load arbitrary external device specific kernel modules. So this still doesn't explain why a timeout is required here. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list