[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 00/22] QAPI Round 1

From: Avi Kivity
Subject: Re: [Qemu-devel] [PATCH 00/22] QAPI Round 1
Date: Tue, 08 Mar 2011 13:12:43 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Thunderbird/3.1.7

On 03/07/2011 05:59 PM, Anthony Liguori wrote:

How do async commands work?  You mentioned them when talking about
QAPI but it's not obvious to me that there is any "native" support for
async commands?

Async commands are interesting..

Would there be anything in them other than starting each command in its own thread? If it then drops the right locks it can execute in parallel with other commands, if it doesn't, then it's synchronous (and presumably doesn't depend on external or guest events).

Generating async commands with QAPI is easy. Errors are propagated now so the callback would just need to take the return value and error type. It would need to be a special callback type for each function but that's easy with the code generator.

Async commands are problematic from the client perspective though. I think there are two relevant use-cases for client software. There's the probably most dominant, I don't really care about small pauses users who are going to be executing the RPCs synchronously either using libqmp or Python. They may use threading to have some parallelism but generally, the expectation is going to be that QEMU doesn't introduce too much delay in processing a given RPC.

It's more for intrinsically long-running commands like migration. These can be split into a start-migration and cancel-migration command (and it also helps for querying status, which doesn't follow naturally for an asychronous command).

OTOH, there are users that will be purely event driven that will treat every RPC asynchronously. In both cases, it's more or less all-or-nothing. Having some commands delay for really long periods of time means that you either force users to treat some commands specially, or you force all users into an event driven model.

And of course, if you have async commands, you need to cancel commands, and then the context is within a single QMP session which means that you need to figure out what to do if you drop the session while an async command is executing. For instance, if a management tool executes the migrate command, and it's implemented as an async command, if the management tool loses it's connection, should migration be automatically cancelled?

Sounds reasonable.  The rules could be:
- a command (all commands are async) takes a ref on the monitor context
- if the session is dropped, call the current command's cancel callback

as a result, a dropped session causes the command to either cancel or complete.

I'm really on the fence about async commands. At the moment, I'm leaning towards just not every implementing them.

Do we have a list of candidates for async commands?

error compiling committee.c: too many arguments to function

reply via email to

[Prev in Thread] Current Thread [Next in Thread]