Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2903197ybi; Mon, 17 Jun 2019 12:23:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGkKxBMN+Y/nSzctH19iijn73deicuRnqY1nYYs76GNTbMBKtV+Fa9RyUsSDAT51RO+XeQ X-Received: by 2002:a17:902:8bc1:: with SMTP id r1mr17559268plo.42.1560799437965; Mon, 17 Jun 2019 12:23:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560799437; cv=none; d=google.com; s=arc-20160816; b=DDbvi4uu8RO9KhE1lQPlpzUVTz2xJ9N8mygTMt1/fnCSM/xR0QOf/0ax5sw4ALpXGn N+3UdoWaITK+hyHIb3lg2vUrfq0DJTrqfbqLvGSZ9T6qvNf/6+K5I5VlFYpW6eydpJhG Qseu2+6nV/6ZcGedm4gDHaq8UoYbfClnprJ26+b7Y6XeEwzr4GFtlTksL7SyKi48DSRD iAs7nDMDHtmruE/hPMbVWDtuo5j97NLbkPcuO1HTFqQdm6kowipMeDFZZ7GdfhHCbRQJ FRt1ujbPRajGPlxXvbdKcMJhWF2P1Ng9PDKLea/OI6DeStWMhzZ/QD5Vpdehq7XANUkR lrgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=oqQCze4hCJbskDy/NHGyEqvaWZumge9igOwx4kdODRw=; b=mLH6VaeDcQ7MnaQFwhc4JPUTvu6kWM8SgMI5HVoTAKpZBgWGvZjr9Da3qdNj3ja4uO FV2wPeh0QRjXQOuSIo96qEOGSIWy1XnvULzOEXxG8DKZuDVatUM6nLeEXObG0JFCvgrk JHQZR7mZrKgMz6F6gJMqwLmER6DuKF2MyaBugsQ52/AVke35NLCw7h4GbYwrz6bEpUn8 WCTdXnhEILu+z8pG04gALxRYYPY+d+VTuzDcy5a3vglu+W4hb6ysds9uaajfRY/QE2qG rXPBdxMKi2EAzXy+uuTvok5XfXD0J/Gg2DJnzAC/JtA9RY10+DUSALolwOxPnBpC9EaQ bj+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y21si10878605pfe.116.2019.06.17.12.23.42; Mon, 17 Jun 2019 12:23:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728741AbfFQTXZ (ORCPT + 99 others); Mon, 17 Jun 2019 15:23:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53175 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725497AbfFQTXY (ORCPT ); Mon, 17 Jun 2019 15:23:24 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 490ECC07410F; Mon, 17 Jun 2019 19:23:24 +0000 (UTC) Received: from flask (unknown [10.43.2.199]) by smtp.corp.redhat.com (Postfix) with SMTP id 6AE1A783BB; Mon, 17 Jun 2019 19:23:19 +0000 (UTC) Received: by flask (sSMTP sendmail emulation); Mon, 17 Jun 2019 21:23:18 +0200 Date: Mon, 17 Jun 2019 21:23:18 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH v2] KVM: x86: clean up conditions for asynchronous page fault handling Message-ID: <20190617192318.GA13948@flask> References: <1560446532-22494-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1560446532-22494-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 17 Jun 2019 19:23:24 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2019-06-13 19:22+0200, Paolo Bonzini: > Even when asynchronous page fault is disabled, KVM does not want to pause > the host if a guest triggers a page fault; instead it will put it into > an artificial HLT state that allows running other host processes while > allowing interrupt delivery into the guest. > > However, the way this feature is triggered is a bit confusing. > First, it is not used for page faults while a nested guest is > running: but this is not an issue since the artificial halt > is completely invisible to the guest, either L1 or L2. Second, > it is used even if kvm_halt_in_guest() returns true; in this case, > the guest probably should not pay the additional latency cost of the > artificial halt, and thus we should handle the page fault in a > completely synchronous way. > > By introducing a new function kvm_can_deliver_async_pf, this patch > commonizes the code that chooses whether to deliver an async page fault > (kvm_arch_async_page_not_present) and the code that chooses whether a > page fault should be handled synchronously (kvm_can_do_async_pf). > > Signed-off-by: Paolo Bonzini > --- Reviewed-by: Radim Krčmář