Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp168066imu; Thu, 8 Nov 2018 06:40:01 -0800 (PST) X-Google-Smtp-Source: AJdET5c0U+n2X6QH+SywX3IGLMlEnVjKMnrL5imeFTNPxVN8bLqP+ers5OiH0PT/oOihBNjbr73Z X-Received: by 2002:a63:ba19:: with SMTP id k25mr3975497pgf.194.1541688001244; Thu, 08 Nov 2018 06:40:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541688001; cv=none; d=google.com; s=arc-20160816; b=j10hfSBK0n4pbAMSUx1X/D2fB3FQnyGYnOa2nhN1kNjI8exs1PylmJcc7MFE8EwvTp RnCplmmm0Ng4MxbLoC3Cast1+dnnuOvNIZqO3FBbTW9xe4QgQVfHNaBopk0p2DAbHHYm mkKG495u5+wzvuAbrUCywmmoIBqXnS5imeElsjsmB4nFR/PP6lBa2IP1rV1iEK7imvR/ 0a6+BrPq3FBtL3TU9BERJucN3FxbnNTcN/2NtSsu0tBW/sackR1hbKxPHXaePnQG3xJv rN31v1Pd+ST0ALlo0dxVjE+2SmJ/nsPRPJMbDLiinp5Wh5r42VfFggrYRSsTkeTyrj7V JhBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature; bh=YgxYL/otD3J6IANYJXOckMzLDWpELq85An6LxdjCHE8=; b=HbcHovWMBJkqzExjiGxyB1M2soNhVLvupoKoWpJUOrccs+YyiGnmx7Sadn1nxDActX aZ0+Zph8bvCbXRsDoY6+i6eDJL3OWktyxWN0j7bYHPTDlba/Utn3sBuPp4YbelszoqOy mXEcnfxlvbKgOUI+74j9Zw2T+tfYLnkb3fxYDo2LrHVolKzI8LcrVWS8vtjlsLSsTBJG tPktz332GRdmfz2v9zhnQJYEUIh3aAJwJ7GWEV3EYFkiQQgD4NEbnAgBQHPp3hMl/PFW moTTUCezCNvk7Iqng0tQ9A535GzLdXHUzfe8dXjoTJy5VHf/yXZIkoFmiSPKiOq7yVii AQzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Bq8s5GUR; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a4-v6si4451954pfo.97.2018.11.08.06.39.45; Thu, 08 Nov 2018 06:40:01 -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; dkim=pass header.i=@linaro.org header.s=google header.b=Bq8s5GUR; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727037AbeKIAOw (ORCPT + 99 others); Thu, 8 Nov 2018 19:14:52 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:44761 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726609AbeKIAOv (ORCPT ); Thu, 8 Nov 2018 19:14:51 -0500 Received: by mail-ot1-f68.google.com with SMTP id z33so18177801otz.11 for ; Thu, 08 Nov 2018 06:39:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=YgxYL/otD3J6IANYJXOckMzLDWpELq85An6LxdjCHE8=; b=Bq8s5GURcI+alhbv1MWJs00RrXOaq3AMgM9u5pnjr4l5k1P7e6PvC+KiTWTuyF/ohL KK5FWmVITRgbfRJkCfKDZ4QkwMQQEE+BCbbp57KSwXW6fWlVCmboPWhFa1It2RBycPhZ jz+gV6y72MERRocdkGqHdsERnzBeO9uPqjfco= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=YgxYL/otD3J6IANYJXOckMzLDWpELq85An6LxdjCHE8=; b=Ljsbq8NL9AZy+tC+rlooPHbD2sTsef651FDEm0MkEcivcmraEgAYpwpEmCvzZrG+ad AGhi3W5qmr9pGSeqzexMJ0YorOVlyW/qAgFIe0LLzSIpPNzLw6xMLILk1qdu4ha3WM2r 7DrPXMj1m1/EzOlZij18a3taDv2LefqjkFUxEc41k86Kff/6SRGF0ViJz3n2s4D984m8 NO92W5Rj9vD9P41PbuaW3lh9vi+zh/eLizBHzJKspU4JFLF5APKfMkpg8xK/uchwjnmi gFuSLD3GWk+ouPsUYDm+BPA0bLUVZQbc9xXJvONEEj6o6YAu0wBdPV75RAWMbv2eYNob 1XMg== X-Gm-Message-State: AGRZ1gI1CXD1zcZQwBdTB4fkzIbMT4RXnUCVql1NXuIKqT8YjCABejbT oXd4Xz1A+BSjdGQ3wUNQMLD71LyBotNDW8gI5sRkoA== X-Received: by 2002:a9d:5617:: with SMTP id e23mr2619379oti.151.1541687944071; Thu, 08 Nov 2018 06:39:04 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a9d:4b0e:0:0:0:0:0 with HTTP; Thu, 8 Nov 2018 06:38:43 -0800 (PST) In-Reply-To: <87pnvf63u2.fsf@linaro.org> References: <20181107171031.22573-1-alex.bennee@linaro.org> <20181107180120.urnvkcrkh46ytsdb@lakrids.cambridge.arm.com> <20181107180829.sex54bxhd5wyqvan@lakrids.cambridge.arm.com> <87r2fv68us.fsf@linaro.org> <20181108135122.llmfsel32dbe2q7o@lakrids.cambridge.arm.com> <87pnvf63u2.fsf@linaro.org> From: Peter Maydell Date: Thu, 8 Nov 2018 14:38:43 +0000 Message-ID: Subject: Re: [RFC PATCH] KVM: arm64: don't single-step for non-emulated faults To: =?UTF-8?B?QWxleCBCZW5uw6ll?= Cc: Mark Rutland , kvm-devel , Marc Zyngier , Catalin Marinas , Will Deacon , open list , Christoffer Dall , kvmarm@lists.cs.columbia.edu, arm-mail-list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8 November 2018 at 14:28, Alex Benn=C3=A9e wrot= e: > > Mark Rutland writes: >> One problem is that I couldn't spot when we advance the PC for an MMIO >> trap. I presume we do that in the kernel, *after* the MMIO trap, but I >> can't see where that happens. > > Nope it gets done before during decode_hsr in mmio.c: > > /* > * The MMIO instruction is emulated and should not be re-executed > * in the guest. > */ > kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); I think that this attempt to do the PC-advance early is probably an underlying problem that is not helping the code structure here. An enhancement that's been floated previously is that the MMIO emulation in userspace should be able to report back to KVM "nope, that access should generate a guest synchronous external abort (with ESR_EL1.EA =3D 0/1)". If we have that, then we definitely need to not advance the PC until after userspace has done the emulation and told us whether the memory access succeeded or not... thanks -- PMM