Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755061AbcDDVAa (ORCPT ); Mon, 4 Apr 2016 17:00:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42880 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752592AbcDDVA3 (ORCPT ); Mon, 4 Apr 2016 17:00:29 -0400 Message-ID: <1459803623.6219.28.camel@redhat.com> Subject: Re: [PATCH] kvm: x86: make lapic hrtimer pinned From: Rik van Riel To: Luiz Capitulino , kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com, mtosatti@redhat.com, bsd@redhat.com Date: Mon, 04 Apr 2016 17:00:23 -0400 In-Reply-To: <20160404164607.09e306fa@redhat.com> References: <20160404164607.09e306fa@redhat.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-nshsjscDPAyqcMkyoPO5" Mime-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 04 Apr 2016 21:00:28 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2191 Lines: 61 --=-nshsjscDPAyqcMkyoPO5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 2016-04-04 at 16:46 -0400, Luiz Capitulino wrote: > When a vCPU runs on a nohz_full core, the hrtimer used by > the lapic emulation code can be migrated to another core. > When this happens, it's possible to observe milisecond > latency when delivering timer IRQs to KVM guests. >=20 > The huge latency is mainly due to the fact that > apic_timer_fn() expects to run during a kvm exit. It > sets KVM_REQ_PENDING_TIMER and let it be handled on kvm > entry. However, if the timer fires on a different core, > we have to wait until the next kvm exit for the guest > to see KVM_REQ_PENDING_TIMER set. >=20 > This problem became visible after commit 9642d18ee. This > commit changed the timer migration code to always attempt > to migrate timers away from nohz_full cores. While it's > discussable if this is correct/desirable (I don't think > it is), it's clear that the lapic emulation code has > a requirement on firing the hrtimer in the same core > where it was started. This is achieved by making the > hrtimer pinned. Given that delivering a timer to a guest seems to involve trapping from the guest to the host, anyway, I don't see a downside to your patch. If that is ever changed (eg. allowing delivery of a timer interrupt to a VCPU without trapping to the host), we may want to revisit this. Until then... Acked-by: Rik van Riel --=20 All Rights Reversed. --=-nshsjscDPAyqcMkyoPO5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJXAtXoAAoJEM553pKExN6DD1AH/RVIZeYIeHnggl/OGKwkh/vR evYb0v/RnMnLgSZn0kueoumkwA7PxsJI5Lt9UGIBtHSER/MMJwkab4PpLAuGz838 pRaati97p1U4Mp/Gxi6vzQzTWgJicko8SKfBOZOof7V5uisUWNHrb4AGX2Cnspbc O1QIqVDOvdi9DFjnNKQwZGhVDYEh69XK5XYkg2P5zNcNogvqhnPjdpHeQORxuQac CZSpykwu6mnzsI38g+2+Yz6bj+ROVE5nsAlau7l5CdQHIPDbXvtMJhxcBMyX8ItP uGHDTLJs6QXVLPOo7e1mmJSGX3G1OYBMgUC3eyJuza990vAccsM9xmWVa+QETHM= =msvh -----END PGP SIGNATURE----- --=-nshsjscDPAyqcMkyoPO5--