From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH v5 07/16] apic: Open-code timer save/restore Date: Tue, 20 Dec 2011 02:24:40 +0100 Message-ID: <4EEFE3D8.5010704@web.de> References: <61e59db37279bb3834b996c84e9a0523638f5e35.1323952403.git.jan.kiszka@siemens.com> <4EEFB8FB.3030105@codemonkey.ws> <4EEFCC92.9030300@web.de> <4EEFD767.2050703@codemonkey.ws> <4EEFD7FA.9010407@web.de> <4EEFDC7C.3020606@codemonkey.ws> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigDF6E89C956E0FBDB28C84482" Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , qemu-devel , Blue Swirl , Avi Kivity To: Anthony Liguori Return-path: In-Reply-To: <4EEFDC7C.3020606@codemonkey.ws> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org List-Id: kvm.vger.kernel.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigDF6E89C956E0FBDB28C84482 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 2011-12-20 01:53, Anthony Liguori wrote: > 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-kern= el >>>>> apic? >>>>> >>>>> Can you fix this up in a pre-save routine (put QEMUTimer into a sta= te >>>>> 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 QEMUTime= r >>>> 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. >=20 > I think you misunderstood my comments. >=20 > 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. Correct, it's just kept up to date. >=20 > 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. >=20 > 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. >=20 > Is this correct? Almost. timer_expiry is calculated on get_apic_state based on the APIC registers. And it is initialized on reset. But it is never saved into the kernel nor does it otherwise affect the in-kernel model. It is really just a compatibility field for potential user space apic usage. Jan --------------enigDF6E89C956E0FBDB28C84482 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7v49gACgkQitSsb3rl5xQdHACgzePj4z7qSnyriTpwX9Ho+Y/C UucAnj77NyCTV30zx7Y0JeN4CJQEpudu =dDDN -----END PGP SIGNATURE----- --------------enigDF6E89C956E0FBDB28C84482--