From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NSbtl-0002Ln-8l for qemu-devel@nongnu.org; Wed, 06 Jan 2010 14:50:29 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NSbtg-0002Ep-DP for qemu-devel@nongnu.org; Wed, 06 Jan 2010 14:50:28 -0500 Received: from [199.232.76.173] (port=34676 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NSbtg-0002EU-6Z for qemu-devel@nongnu.org; Wed, 06 Jan 2010 14:50:24 -0500 Received: from mail-yx0-f188.google.com ([209.85.210.188]:65214) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NSbtf-000702-Sj for qemu-devel@nongnu.org; Wed, 06 Jan 2010 14:50:23 -0500 Received: by yxe26 with SMTP id 26so16974411yxe.4 for ; Wed, 06 Jan 2010 11:50:22 -0800 (PST) Message-ID: <4B44E97D.5090806@codemonkey.ws> Date: Wed, 06 Jan 2010 13:50:21 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCHv3] add "info ioapic" monitor command References: <20100106163502.GQ4905@redhat.com> In-Reply-To: <20100106163502.GQ4905@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gleb Natapov Cc: qemu-devel@nongnu.org, lcapitulino@redhat.com On 01/06/2010 10:35 AM, Gleb Natapov wrote: > Knowing ioapic configuration is very useful for the poor soles > how need to debug guest occasionally. > This needs to be implemented in terms of VMState. There is no reason for it not to be. I've just gone through the code in great detail. You just need to implement a vmstate_get_field that looks up a field given an instance name and instance id. You then need to add a to_str callback in VMStateInfo. The vmstate_get_field code will look very much like the vmstate_save code except it calls to_str(). The new monitor command should be 'device_info name [instance_id] [field]'. For the ioapic, you can introduce a new VMStateInfo type that duplicates the vmstate_info_uint64 type except it has a different to_str callback that decodes the apic fields. It's just then a matter of a few macros and updating the VMState description for the ioapic. It's the same or less code than your current patch and it lays the ground work for a consistent command to look up arbitrary device info. Regards, Anthony Liguori