From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:38083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RcnxJ-0005C2-9T for qemu-devel@nongnu.org; Mon, 19 Dec 2011 19:53:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RcnxI-0004Sl-1N for qemu-devel@nongnu.org; Mon, 19 Dec 2011 19:53:21 -0500 Received: from mail-yw0-f45.google.com ([209.85.213.45]:51553) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RcnxH-0004Se-Tv for qemu-devel@nongnu.org; Mon, 19 Dec 2011 19:53:20 -0500 Received: by yhgg71 with SMTP id g71so5113803yhg.4 for ; Mon, 19 Dec 2011 16:53:19 -0800 (PST) Message-ID: <4EEFDC7C.3020606@codemonkey.ws> Date: Mon, 19 Dec 2011 18:53:16 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <61e59db37279bb3834b996c84e9a0523638f5e35.1323952403.git.jan.kiszka@siemens.com> <4EEFB8FB.3030105@codemonkey.ws> <4EEFCC92.9030300@web.de> <4EEFD767.2050703@codemonkey.ws> <4EEFD7FA.9010407@web.de> In-Reply-To: <4EEFD7FA.9010407@web.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v5 07/16] apic: Open-code timer save/restore List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , qemu-devel , Blue Swirl , Avi Kivity On 12/19/2011 06:34 PM, Jan Kiszka wrote: > On 2011-12-20 01:31, Anthony Liguori wrote: >> On 12/19/2011 05:45 PM, Jan Kiszka wrote: >>> On 2011-12-19 23:21, Anthony Liguori wrote: >>>> On 12/15/2011 06:33 AM, Jan Kiszka wrote: >>>>> To enable migration between accelerated and non-accelerated APIC >>>>> models, >>>>> we will need to handle the timer saving and restoring specially and can >>>>> no longer rely on the automatics of VMSTATE_TIMER. Specifically, >>>>> accelerated model will not start any QEMUTimer. >>>>> >>>>> This patch therefore factors out the generic bits into apic_next_timer >>>>> and introduces a post-load callback that can be implemented differently >>>>> by both models. >>>>> >>>>> Signed-off-by: Jan Kiszka >>>> >>>> So you basically want the timer to be a dummy field for the in-kernel >>>> apic? >>>> >>>> Can you fix this up in a pre-save routine (put QEMUTimer into a state >>>> where there isn't an event pending)? >>> >>> It is not a dummy field, it contains the proper state in both cases. We >>> just need to convert it to an open-coded state to avoid the QEMUTimer >>> restoration magic in the in-kernel case (where there must be no >>> QEMUTimer). >> >> So the state gets fed into the kernel instead of userspace? > > Nope. It's kept for eventual use by a user space model. I think you misunderstood my comments. When you are using the in-kernel APIC, the is no implementation for the post_load hook. As far as I can tell, the state isn't used. I know it's used by the user space model but from what I can tell, the value is essentially sync with the in-kernel APIC almost immediately as it happens during KVM_RUN. So it's a QEMUTimer in the userspace model, but it's just an integer when used in the in-kernel APIC as the timer never fires. It is just saved/restored from and to the kernel. Is this correct? Regards, Anthony Liguori