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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37815E7B61B for ; Wed, 4 Oct 2023 13:58:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242734AbjJDN6e (ORCPT ); Wed, 4 Oct 2023 09:58:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242722AbjJDN6a (ORCPT ); Wed, 4 Oct 2023 09:58:30 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 765DFA1 for ; Wed, 4 Oct 2023 06:58:27 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A2DBC433BA; Wed, 4 Oct 2023 13:58:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696427907; bh=A2wSvAtglc0Xbc7LGJotQhQdmM583IU5oJ9LjFKKIu4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XMUoiT4+427ztGhRxk115JYCnj0NYYS5KaPouxlDY2jkbexB3TxuttvTRJ8xJh/RT REuqKr2zlup7x12KVOnxGLThyv0tmPRFlygQGe2NFUh+B9eVAbFC5BRZWdiWXpRcjS tQ4Geoh6wOC47VKnYt2qS+qKd+qlIZlXMnsu8U4BjrsZuri/VFpEG/OEjoY23qpb2V 8sJRMFNONtutiz+SNKVHVJIi5oOdncUphCJgUIMIA7+cNwJ05n1QXCEVbyOG/WBY3O o7ir1F2mKTRcqOBHMOrYUJ2Xvp1SvcgutbXAaIUguhkWrmMZHrVsv5f8G1DQEkaaj3 eR7jrU9emW33w== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.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 1qo2OO-0014oA-Fx; Wed, 04 Oct 2023 14:58:24 +0100 Date: Wed, 04 Oct 2023 14:58:22 +0100 Message-ID: <86h6n6o5fl.wl-maz@kernel.org> From: Marc Zyngier To: Catalin Marinas Cc: Kristina Martsenko , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, James Morse , Suzuki K Poulose , Zenghui Yu , Will Deacon , Vladimir Murzin , Colton Lewis , linux-kernel@vger.kernel.org, Oliver Upton 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> <87h6ndmixh.wl-maz@kernel.org> <0f99fa65-c8c1-5d5c-d9b0-5436b7592656@arm.com> <86ttr9nkey.wl-maz@kernel.org> 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/29.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: catalin.marinas@arm.com, 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, will@kernel.org, vladimir.murzin@arm.com, coltonlewis@google.com, linux-kernel@vger.kernel.org, oliver.upton@linux.dev X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 03 Oct 2023 15:29:42 +0100, Catalin Marinas wrote: > > The way the architecture works, either with or without Kristina's > single-step change, a debugger would get confused. At least for EL0, I > find the proposed (well, upstreamed) approach more predictable - it > always restarts from the prologue in case of migration between CPUs with > different MOPS implementation (which is not just theoretical AFAIK). > It's more like these three instructions are a bigger CISC one ;) (though > the CPU can step through its parts). > > A more transparent approach would have been to fully emulate the > instructions in the kernel and advance the PC as expected but I don't > think that's even possible. An implementation may decide to leave some > bytes to be copied by the epilogue but we can't know that in software, > it's a microarchitecture thing. > > There is the case of EL1 debugging itself (kgdb) and it triggers a MOPS > exception to EL2. It would look weird for the guest but I guess the only > other option is to disable MCE2 and let EL1 handle the mismatch MOPS > option itself (assuming it knows how to; it should be fine for Linux). I > think I still prefer Kristina's proposal for KVM as more generic, with > the downside of breaking less usual cases like the kernel > single-stepping itself. I don't disagree at all. My issue isn't with Kristina's patches, which are absolutely fine. It has more to do with the shape of the FEAT_MOPS extension itself, which exposes uarch details to SW instead of abstracting them. But I've now ranted about it for close to two weeks, and it is time for me to move on... ;-) M. -- Without deviation from the norm, progress is not possible.