From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MQjaC-0004o4-1W for qemu-devel@nongnu.org; Tue, 14 Jul 2009 11:06:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MQja7-0004kg-7p for qemu-devel@nongnu.org; Tue, 14 Jul 2009 11:06:15 -0400 Received: from [199.232.76.173] (port=39245 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MQja7-0004kS-35 for qemu-devel@nongnu.org; Tue, 14 Jul 2009 11:06:11 -0400 Received: from mail-qy0-f174.google.com ([209.85.221.174]:57622) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MQja6-0001uc-Nn for qemu-devel@nongnu.org; Tue, 14 Jul 2009 11:06:10 -0400 Received: by qyk4 with SMTP id 4so2345451qyk.4 for ; Tue, 14 Jul 2009 08:06:10 -0700 (PDT) Message-ID: <4A5C9EDF.3060705@codemonkey.ws> Date: Tue, 14 Jul 2009 10:06:07 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] monitor: Add port write command References: <4A5C3FBB.10306@siemens.com> In-Reply-To: <4A5C3FBB.10306@siemens.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Anthony Liguori , qemu-devel Jan Kiszka wrote: > Useful for testing hardware emulations or manipulating its state to > stress guest drivers. > > Signed-off-by: Jan Kiszka > Patch looks good. Makes me think of an idea I had a while ago. It's a rather radical change but I think we could target it for 0.12. Today, the vast majority of our save/restore code looks like: save: // version checks qemu_put_type(f, &field); ... load: // version checks qemu_get_type(f, &field); ... // optional depending on version qemu_get_type(f, &field); device_reset(s); We could convert this to something this to be largely data drive. For instance, SaveVMFields fields[] = { { offsetof(DeviceState, field), "field", TYPE, VERSION }, {}, }; SaveVMDescription desc = { .fields = fields, .version = CURRENT_VERSION, .reset = device_reset, }; What would be really cool about this change is that we could introduce a new set of commands to manipulate device state. We could save/restore individual device state and that would allow us to dump device state via the monitor and to manipulate individual fields of the device state. I think this could be pretty useful for debugging. I'm curious if anyone else is interested in this sort of change. Regards, Anthony Liguori