Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1097221ybe; Fri, 6 Sep 2019 11:48:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqygz2lyCi4R0JebLfI5+2UhCN1QGwFhJNnzXS93yyesuy6uXCbPpQkNLI1jwKHasRHBRVZ7 X-Received: by 2002:a17:90a:f48f:: with SMTP id bx15mr11417292pjb.75.1567795722048; Fri, 06 Sep 2019 11:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567795722; cv=none; d=google.com; s=arc-20160816; b=SRvctsx3z1MsCQt/irCztXbo6gdG+tjbjCIwotJ3a0eqehGXdeLllwFjd44fcbqxmI rXe90RdYvjZoJnDgUmTHu2MN5fqAjNrfNjqByCjYgitBb9LXkJbGs9Oh06vCIA2250mi BrYQXBApJrg7eCFWVTborsuhMPgCbPdECDadMC/ufPwIZz2tdI38tsNRtSCBbn+6s8Jf +5fPFFoPBHAxW1G8TWOIlXO5X/OtzeVuN0vlcUHkKhAb9kCxhCw+8YOQfvnVk2W3tfEn gMdh7pdcrE3LniCVVXklP/a0zj2ja47dMVjalGb17QsSvdIml4XVH15e70bsJKlo6+Pc SwFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=2e7BdIjA7tp8BLDXeTA/WaYjf5EqoeihfbnfZF6VGmM=; b=UDOvIPg9cI0+2dJCbVNQzqszZSUocgdPi/DvTrI47trIUWj+2QTRgkd0qR1n2aEeef 46Uyn1tIWpuidQFUiSI7Cg9j80hneO04JPM1fNoUpu8hXYgRmNGXGJQfzGQiriRLPfbv M3bIMXEKDxxDqh+ZbjIEZ976uVl5i6roAZ3EICJsnBrBCel+FQueRSzrR/MMpxTc7Qnp /oFK1V0muabXYJYhbImcU28rVqFhnVqj3F1XzK7mANd4x+WW7L1rcKAXCaArz9VdEl1n cRNsahP743UYcAhBpeE5WXCG7xh2Y6iXr6EXVm0rLZzAKHZIs3dB/muxMRhkeHawgk3r fwxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PHfICUeS; 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 a24si6233930pfi.205.2019.09.06.11.48.26; Fri, 06 Sep 2019 11:48:42 -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; dkim=pass header.i=@linaro.org header.s=google header.b=PHfICUeS; 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 S2393323AbfIFNby (ORCPT + 99 others); Fri, 6 Sep 2019 09:31:54 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:45851 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388784AbfIFNby (ORCPT ); Fri, 6 Sep 2019 09:31:54 -0400 Received: by mail-ot1-f68.google.com with SMTP id 41so1920787oti.12 for ; Fri, 06 Sep 2019 06:31:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2e7BdIjA7tp8BLDXeTA/WaYjf5EqoeihfbnfZF6VGmM=; b=PHfICUeS2mGCEh2CUf3C4hLmGAZ/WIw5tAL4fbOBgvE0Y8Ltf9mXNE3/ktZvwiHkB/ dFroiYLtzUzJrSiZFcu/QpXoDOSrvwWUQ0H3FFFkdXSseWIf2bDhqlGbc2qbRZ9oAXuP MGgVx6djL4ok5HVHhvhpy0lUn0ocg2WuN1gW/IIFZ0ZI3Uw3w4gBtrrG1ljJIdFozS4J E3gb7oNUQcRxPkaKWpXR2gFZt3fZqSNRuQUOxJFDOyVR6ESPYtAdrOdZvsgasgM/e3uv S9KxhITdI8qURQHjP4qbzOcYpPXrElyuyt6BAQB+J1zNYBrAx+CQZoknoBo6x+/jcUvZ 5lYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2e7BdIjA7tp8BLDXeTA/WaYjf5EqoeihfbnfZF6VGmM=; b=tIE7zdQ2IagwjFCdnZRaNpJzqZlFOAGY+GniYi6k/r1y7LLT6R+8AAz7JinLf0gBPD i4aCILpJESEhWlaN5Wi2VNg0LpQob8orWhsROvxv2iGKjYVg7amoIYIG/aQcJ11gT5ut om6L1WBn3gquQHzhuNbCSFGiELJnd+MzH8GMgafDs+JrDl/IXQHrOEdGyGCXoYOz+pmS 5mrM+nBZhu/OHvFKbWsbp3mKyZRqjflnhnUnZqlzyiOJ6widy5Tjv5nahAQhn6evH5bT f+LrKBqk2rJqCNYKftJnRtsmn7FmGvKJ+Lu3CSESpwBsmWBWq6cNpbuI6eXcX1dKDwa+ aPbA== X-Gm-Message-State: APjAAAXk9sB0pTv86blkH9yla1XU6ztsi2WldiITLYYj6cJKxmsBoqJT 6ZlCzqiCJHqxMXQ2lTJvxBJd/nYkT8T03+IS8rDq5A== X-Received: by 2002:a9d:6a8a:: with SMTP id l10mr4739602otq.97.1567776713698; Fri, 06 Sep 2019 06:31:53 -0700 (PDT) MIME-Version: 1.0 References: <20190904180736.29009-1-xypron.glpk@gmx.de> <86r24vrwyh.wl-maz@kernel.org> <86mufjrup7.wl-maz@kernel.org> <20190905092223.GC4320@e113682-lin.lund.arm.com> <4b6662bd-56e4-3c10-3b65-7c90828a22f9@kernel.org> <20190906080033.GF4320@e113682-lin.lund.arm.com> <20190906131252.GG4320@e113682-lin.lund.arm.com> In-Reply-To: <20190906131252.GG4320@e113682-lin.lund.arm.com> From: Peter Maydell Date: Fri, 6 Sep 2019 14:31:42 +0100 Message-ID: Subject: Re: [PATCH 1/1] KVM: inject data abort if instruction cannot be decoded To: Christoffer Dall Cc: Alexander Graf , =?UTF-8?Q?Daniel_P=2E_Berrang=C3=A9?= , Marc Zyngier , lkml - Kernel Mailing List , Stefan Hajnoczi , Heinrich Schuchardt , kvmarm@lists.cs.columbia.edu, arm-mail-list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 6 Sep 2019 at 14:13, Christoffer Dall wrote: > I'd prefer leaving it to userspace to worry about, but I thought Peter > said that had been problematic historically, which I took at face value, > but I could have misunderstood. > > If QEMU, kvmtool, and whatever the crazy^H cool kids are using in > userspace these days are happy emulating the exception, then that's a > viable approach. The main concern I have with that is whether they'll > all get it right, and since we already have the code in the kernel to do > this, it might make sense to re-use the kernel logic for it. Well, for QEMU we've had code that in theory might do this but in practice it's never been tested. Essentially the problem is that nobody ever wants to inject an exception from userspace except in incredibly rare cases like "trying to use h/w breakpoints simultaneously inside the VM and also to debug the VM from outside" or "we're running on RAS hardware that just told us that the VM's RAM was faulty". There's no even vaguely commonly-used usecase for it today; and this ABI suggestion adds another "this is in practice almost never going to happen" case to the pile. The codepath is unreliable in QEMU because (a) it requires getting syncing of sysreg values to and from the kernel right -- this is about the only situation where userspace wants to modify sysregs during execution of the VM, as opposed to just reading them -- and (b) we try to reuse the code we already have that does TCG exception injection, which might or might not be a design mistake, and (c) as noted above it's a never-actually-used untested codepath... So I think if I were you I wouldn't commit to the kernel ABI until somebody had at least written some RFC-quality patches for QEMU and tested that they work and the ABI is OK in that sense. (For the avoidance of doubt, I'm not volunteering to do that myself.) I don't object to the idea in principle, though. PS: the other "injecting exceptions to the guest" oddity is that if the kernel *does* find the ISV information and returns to userspace for it to handle the MMIO, there's no way for userspace to say "actually that address is supposed to generate a data abort". thanks -- PMM