Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3422347imu; Wed, 7 Nov 2018 10:04:55 -0800 (PST) X-Google-Smtp-Source: AJdET5dWOOtwveCaJkKbEmuTbiH+/AemKIdkGL3GQQhKDmeaCP1k7Fc0SazWHU38chjqwFZwie3f X-Received: by 2002:a17:902:b286:: with SMTP id u6-v6mr1216520plr.89.1541613895747; Wed, 07 Nov 2018 10:04:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541613895; cv=none; d=google.com; s=arc-20160816; b=bXIujO/P4nkbZENnc3/XFntFjGHuB0bbH1nJwOmZOeFKdHfuHzvClMgNVpbZqWykUe O1G52rz6aeYlmtZLGiAMZ6/R1PlOotwRMubdUE51Qf2RB6TKuTRhlDEU5z/cLXDGvfpq 2eXtpkSNcFA5r2QczI66NKHYndh5myylesogHRmu2C/qjCSnvWFDepe6GM4j2feziqv4 vlbxAaTSjrAo22g3ngKK3F/6oJGsvaVXU/Oc15+pYGsBIzqcmhWbIP1ozBgNPb0bRu3k 0oLVuCQFXKdx05JK+8clQMFMO1lK2+ujh9mV0w6b1eW+9DUsUN737TKxheRmPxiFH8NE r61g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=b0vFFJBtuPvNHkEdaPdcMV2yszNC+almxExNufFoedI=; b=t4iea8iVlhKxczwTZdyiBmx9C2YY/33VFzS8iP4lzOo3JB4adMTCcP40GYnFME7m+B DPJrzScWv9MfBh+tsSb2Pa1ZmIrOA0dPfFa3cVw4LDQXCctAUxHLk7X1IIoqABB7eAcE wUPx1CBVDuxODT13tvhntGtZXPmvB+FGKpSgakRMuQfEhl4twlAKT+Wxi0HLxxdGjp10 iuOMDhMm9rwV74Zp5ihoAyjiV5BWMHP0V2jwL7sf7PK0wdauAr65eLPEL7l9KkYhW4Vu lfWvfKOTxCq4yLOkL42IrjlI0aZkI4Hfz3RQgLeo5mxmKYYCxKOWMOlHyxtHRtnMURh4 edOQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q22-v6si1125458pgb.368.2018.11.07.10.04.39; Wed, 07 Nov 2018 10:04:55 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731575AbeKHDc6 (ORCPT + 99 others); Wed, 7 Nov 2018 22:32:58 -0500 Received: from foss.arm.com ([217.140.101.70]:56066 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727168AbeKHDc5 (ORCPT ); Wed, 7 Nov 2018 22:32:57 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 43FB315AB; Wed, 7 Nov 2018 10:01:28 -0800 (PST) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 771C13F5C0; Wed, 7 Nov 2018 10:01:26 -0800 (PST) Date: Wed, 7 Nov 2018 18:01:20 +0000 From: Mark Rutland To: Alex =?utf-8?Q?Benn=C3=A9e?= Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, marc.zyngier@arm.com, Christoffer Dall , Catalin Marinas , Will Deacon , open list Subject: Re: [RFC PATCH] KVM: arm64: don't single-step for non-emulated faults Message-ID: <20181107180120.urnvkcrkh46ytsdb@lakrids.cambridge.arm.com> References: <20181107171031.22573-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20181107171031.22573-1-alex.bennee@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 07, 2018 at 05:10:31PM +0000, Alex Bennée wrote: > Not all faults handled by handle_exit are instruction emulations. For > example a ESR_ELx_EC_IABT will result in the page tables being updated > but the instruction that triggered the fault hasn't actually executed > yet. We use the simple heuristic of checking for a changed PC before > seeing if kvm_arm_handle_step_debug wants to claim we stepped an > instruction. > > Signed-off-by: Alex Bennée > --- > arch/arm64/kvm/handle_exit.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c > index e5e741bfffe1..b8252e72f882 100644 > --- a/arch/arm64/kvm/handle_exit.c > +++ b/arch/arm64/kvm/handle_exit.c > @@ -214,6 +214,7 @@ static exit_handle_fn kvm_get_exit_handler(struct kvm_vcpu *vcpu) > static int handle_trap_exceptions(struct kvm_vcpu *vcpu, struct kvm_run *run) > { > int handled; > + unsigned long old_pc = *vcpu_pc(vcpu); > > /* > * See ARM ARM B1.14.1: "Hyp traps on instructions > @@ -233,7 +234,8 @@ static int handle_trap_exceptions(struct kvm_vcpu *vcpu, struct kvm_run *run) > * kvm_arm_handle_step_debug() sets the exit_reason on the kvm_run > * structure if we need to return to userspace. > */ > - if (handled > 0 && kvm_arm_handle_step_debug(vcpu, run)) > + if (handled > 0 && *vcpu_pc(vcpu) != old_pc && This doesn't work if the emulation is equivalent to a branch-to-self, so I don't think that we want to do this. When are we failing to advance the single-step state machine correctly? Thanks, Mark. > + kvm_arm_handle_step_debug(vcpu, run)) > handled = 0; > > return handled; > -- > 2.17.1 >