From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D96E2CE7B1F for ; Fri, 29 Sep 2023 09:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WBOkZaGCQ4pmaTclg1vA05bTNzQ0mahaoVt4rcrVnIg=; b=vJ24b/eS2vypq9 cpiDbj0SkBQFqR9g2HCB+fKILvqG/7r9Mv5yYs68ZdI71i6VDXBBeu//YGjFDsm7/fBjFqI30QlG7 Tajwug/Nrb+X2pcKPDKHvgnHyLBaPXpLNI090AvTMlcS8AF10hVRU0RgBtcBkiWmzJFLJBTUyu8O/ EQdkd5e6FTqUeA7DWb+aa4rWP2gASLJu0RwESlhHvbbksdgTZWtcKcP/dUJd6ufVgbtZIqhoWVxRc BS9iFtIFloAhb/TVlpQjF7NZ0wBmgwtRSGTH5zRelTV4pJ+Oej2/D/rWBzh1ONiVM0THY+QvzvbDW EzQouxdRbDVdSC9bi2yQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qm9jC-007SQ3-2q; Fri, 29 Sep 2023 09:24:06 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qm9jA-007SPI-0q for linux-arm-kernel@lists.infradead.org; Fri, 29 Sep 2023 09:24:05 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id C2CC3B81AC7; Fri, 29 Sep 2023 09:23:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C499C433C8; Fri, 29 Sep 2023 09:23:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695979438; bh=QecFZbeAzr1CUj1OPKHsPsEg7gSJ5EihrrYlTpFlMbI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=u+6w+2oo5XFnb1UTRpG9dHyJSRqqHYjtrGMU9i8qjgeVeQ+zRjIr3wlRj/3ZQFCLA oMUR6yatFLC1puWfMi5iyy6SJpE9Ic1UUlb+/DK8grRrMhtnnUgx1B1bezmiQnhFeX b3+dt18EZ26AEtU9i/JWOUQ/5HeNx0e+4bmv+3MlRqCUX050rN4rruLp101ebeWxzU IX1vNSezAOWSJC8IWTQ0nBNPbwOOudxiG5q3UU/cbsKEm7Lh00y5MR4mO6wyxANvHW bCGcFwj8DtLqeQ552SUSria/pGIIocV8HfK4eopDXalliouOL9s4GAuWHn+f7ZjaHQ EVOKPILgo5iRQ== Received: from [85.255.233.37] (helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qm9j1-00HCbM-N5; Fri, 29 Sep 2023 10:23:55 +0100 Date: Fri, 29 Sep 2023 10:23:54 +0100 Message-ID: <87h6ndmixh.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: Kristina Martsenko , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Vladimir Murzin , Colton Lewis , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] KVM: arm64: Add handler for MOPS exceptions In-Reply-To: References: <20230922112508.1774352-1-kristina.martsenko@arm.com> <20230922112508.1774352-2-kristina.martsenko@arm.com> <87sf734ofv.wl-maz@kernel.org> <9f731870-ed36-d2e4-378b-f7fbf338ebd6@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 85.255.233.37 X-SA-Exim-Rcpt-To: oliver.upton@linux.dev, kristina.martsenko@arm.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, vladimir.murzin@arm.com, coltonlewis@google.com, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230929_022404_585754_5EB6D4BE X-CRM114-Status: GOOD ( 29.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 27 Sep 2023 09:28:20 +0100, Oliver Upton wrote: > > On Mon, Sep 25, 2023 at 04:16:06PM +0100, Kristina Martsenko wrote: > > [...] > > > > What is the rationale for advancing the state machine? Shouldn't we > > > instead return to the guest and immediately get the SS exception, > > > which in turn gets reported to userspace? Is it because we rollback > > > the PC to a previous instruction? > > > > Yes, because we rollback the PC to the prologue instruction. We advance the > > state machine so that the SS exception is taken immediately upon returning to > > the guest at the prologue instruction. If we didn't advance it then we would > > return to the guest, execute the prologue instruction, and then take the SS > > exception on the middle instruction. Which would be surprising as userspace > > would see the middle and epilogue instructions executed multiple times but not > > the prologue. > > I agree with Kristina that taking the SS exception on the prologue is > likely the best course of action. Especially since it matches the > behavior of single-stepping an EL0 MOPS sequence with an intervening CPU > migration. > > This behavior might throw an EL1 that single-steps itself for a loop, > but I think it is impossible for a hypervisor to hide the consequences > of vCPU migration with MOPS in the first place. > > Marc, I'm guessing you were most concerned about the former case where > the VMM was debugging the guest. Is there something you're concerned > about I missed? My concern is not only the VMM, but any userspace that perform single-stepping. Imagine the debugger tracks PC by itself, and simply increments it by 4 on a non-branch, non-fault instruction. Move the vcpu or the userspace around, rewind PC, and now the debugger is out of whack with what is executing. While I agree that there is not much a hypervisor can do about that, I'm a bit worried that we are going to break existing SW with this. Now the obvious solution is "don't do that"... M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel