Skip to contentSkip to conversation

Make qemu_thread_create return a flag to indicate if it succeeded

Qemu-devel Achilles Benetopoulos 4 participants 4 messages Mar 16, 2017

lore
Share & tools
lore
#0 lore raw

I am interested in working on the BiteSized Task mentioned in the subject line. However, I have a question: Since the current behaviour of qemu_thread_create is to fail in the case of an error, then it seems logical to make the caller exit (in the patched version) if the return value of the call to qemu_thread_create indicates an error. Is this desirable? If so, how detailed should the error messages reported be? If not, then I'm guessing that the desired behaviour is a more graceful handling of the error on a case-by-case basis?

Achilles

#1 lore raw
Quoted 8 lines · Achilles Benetopoulos

I am interested in working on the BiteSized Task mentioned in the subject line. However, I have a question: Since the current behaviour of qemu_thread_create is to fail in the case of an error, then it seems logical to make the caller exit (in the patched version) if the return value of the call to qemu_thread_create indicates an error. Is this desirable? If so, how detailed should the error messages reported be? If not, then I'm guessing that the desired behaviour is a more graceful handling of the error on a case-by-case basis?

It will depend on a case-by-case basis. For example failing to create threads for a TCG vCPU don't really leave much for you to do expect complain loudly and exit. I assume the more graceful handling is for things like thread-pools where you can continue to run even without a fully populated pool.

--
Alex Bennée

#2 lore raw
Quoted 12 lines · * Alex Bennée ([email protected]) wrote:
Quoted 8 lines · Achilles Benetopoulos

I am interested in working on the BiteSized Task mentioned in the subject line. However, I have a question: Since the current behaviour of qemu_thread_create is to fail in the case of an error, then it seems logical to make the caller exit (in the patched version) if the return value of the call to qemu_thread_create indicates an error. Is this desirable? If so, how detailed should the error messages reported be? If not, then I'm guessing that the desired behaviour is a more graceful handling of the error on a case-by-case basis?

Quoted 5 lines

It will depend on a case-by-case basis. For example failing to create threads for a TCG vCPU don't really leave much for you to do expect complain loudly and exit. I assume the more graceful handling is for things like thread-pools where you can continue to run even without a fully populated pool.

Or on migration we can fail the migration but still leave the guest running in no worse state than it was before.

Dave

Quoted 3 lines

--
Alex Bennée

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#3 lore raw
In reply to Achilles Benetopoulos
Quoted 8 lines · Achilles Benetopoulos

I am interested in working on the BiteSized Task mentioned in the subject line. However, I have a question: Since the current behaviour of qemu_thread_create is to fail in the case of an error, then it seems logical to make the caller exit (in the patched version) if the return value of the call to qemu_thread_create indicates an error. Is this desirable? If so, how detailed should the error messages reported be? If not, then I'm guessing that the desired behaviour is a more graceful handling of the error on a case-by-case basis?

I imagine it would be a two stage conversion. First add an 'Error **errp' parameter ot the qemu_thread_create() API which gets set on failure. Have all the callers check this error & exit if set. This is the easy bit.

Second stage is to actually make the callers propagate the error back up their call stack, so we can avoid exiting QEMU entirely in appropriate cases. This takes a little more investigation to figure out optimal behaviour for each of the callers

eg, if we tried to add an I/O thread to an existing running guest, we don't want QEMU to exit. We just want the error reported back up to the monitor so the mgmt app can handle it.

Regards,
Daniel

Signature · 3 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|