Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3988030rdh; Fri, 29 Sep 2023 08:06:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IENQgvjmRbH2po9JL25tVc+z51DzNFBKsCp2O4V9yWGaaVwGvXKbzy4SafNYItW3YJw6egG X-Received: by 2002:a17:90a:5647:b0:274:c622:78cc with SMTP id d7-20020a17090a564700b00274c62278ccmr4124393pji.30.1695999990225; Fri, 29 Sep 2023 08:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695999990; cv=none; d=google.com; s=arc-20160816; b=L2140npmbJQP4v6L1jExlYgjQmCltM1ToWwH7ygOEGIBOqnaFCQGPaV5+i0lt9ZIKF psSeKET5E9KZ/YXoFZV8kcaHnFw0CVbmJbBpB3oW+4hdb9HfeN6W5qFBscxzEOYq68Nc Iq12mHsd5+mnIUC7tzWtlkkPKpYogi1RqRCEtL3aetEzk9GhgVchql2SGvtxtVdxrbbY SLkiDa4AnKOTLUlfujJGrOn/cYBieM893g5qMUOENTXV7zF1RZ0IN0a9cQJGXErgzZR3 oa97ErEOoyYMLBTzzF53AWkOC69NQXFHBagrReqhX2z1c2O+KmzE0PjLSMJtKgHZxBbr qsrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=5PxjmbU9NfJXtIktMY8sS0UFA2WnW7Bn8myXOfRai8g=; fh=xtKxi4aPhMtx8CtEkspO/mpXB0ankYav1b2DMKgw+XM=; b=f0vfpnEV/7mYVjgJrhX/8GB7miR+H+YzottUM3NLKeVKRtpYQiuy0t6+IVmwYuv3xR KYCQksIZ1gMRznKuMbwIaFYR+AggXMlzedmTEiSSbn1gkX6f28wxaCdOgK9gtPVvmKgL RRwuaQpBXcJASaMpBuDYcHvoHebb7N5X2vT3OY1dp2wY2C5QxSeRdO3rQz2m6v7XIQ9g 4WCeKLFAyUL3eQAE4+Dz2uBKRwO3Jtfo7ResR3vSGhhwSRYmNl4czKRL/VFS4+iDuy38 pU4N7JnGT0ecXFg3d5/GWF2O1lKIC1l+8p64TkwUX/8bxN9aFQDnjBZM8SZqB+eWtCUc 11Hw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id o15-20020a17090ac70f00b00277507e8085si1664055pjt.55.2023.09.29.08.06.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 08:06:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 1AF358024569; Fri, 29 Sep 2023 07:52:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233499AbjI2Ow2 (ORCPT + 99 others); Fri, 29 Sep 2023 10:52:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233663AbjI2OwU (ORCPT ); Fri, 29 Sep 2023 10:52:20 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 22937172D for ; Fri, 29 Sep 2023 07:52:07 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2C5001FB; Fri, 29 Sep 2023 07:52:45 -0700 (PDT) Received: from [10.57.66.29] (unknown [10.57.66.29]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 819193F5A1; Fri, 29 Sep 2023 07:52:04 -0700 (PDT) Message-ID: Date: Fri, 29 Sep 2023 15:51:32 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v2 0/2] KVM: arm64: Support for Arm v8.8 memcpy instructions in KVM guests Content-Language: en-US To: Marc Zyngier Cc: Oliver Upton , 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 References: <20230922112508.1774352-1-kristina.martsenko@arm.com> <6687f58c-0da9-0583-2dc1-2089f292b745@arm.com> <87fs2xmiof.wl-maz@kernel.org> From: Kristina Martsenko In-Reply-To: <87fs2xmiof.wl-maz@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 29 Sep 2023 07:52:39 -0700 (PDT) On 29/09/2023 10:29, Marc Zyngier wrote: > On Thu, 28 Sep 2023 17:55:39 +0100, > Kristina Martsenko wrote: >> >> On 27/09/2023 07:00, Oliver Upton wrote: >>> >>> On Fri, Sep 22, 2023 at 12:25:06PM +0100, Kristina Martsenko wrote: >>>> Hi, >>>> >>>> This is v2 of the series to allow using the new Arm memory copy instructions >>>> in KVM guests. See v1 for more information [1]. >>> >>> >>> Thanks for sending out the series. I've been thinking about what the >>> architecture says for MOPS, and I wonder if what's currently in the >>> Arm ARM is clear enough for EL1 software to be written robustly. >>> >>> While HCRX_EL2.MCE2 allows the hypervisor to intervene on MOPS >>> exceptions from EL1, there's no such control for EL0. So when vCPU >>> migration occurs EL1 could get an unexpected MOPS exception, even for a >>> process that was pinned to a single (virtual) CPU implementation. >>> >>> Additionally, the wording of I_NXHPS seems to suggest that EL2 handling >>> of MOPS exceptions is only expected in certain circumstances where EL1 is >>> incapable of handling an exception. Is the unwritten expectation then >>> that EL1 software should tolerate 'unexpected' MOPS exceptions from EL1 >>> and EL0, even if EL1 did not migrate the PE context? >>> >>> Perhaps I'm being pedantic, but I'd really like for there to be some >>> documentation that suggests MOPS exceptions can happen due to context >>> migration done by a higher EL as that is the only option in the context >>> of virtualization. >> >> That's a good point. This shouldn't affect Linux guests as Linux is >> always able to handle a MOPS exception coming from EL0. But it would >> affect any non-Linux guest that pins all its EL0 tasks and doesn't >> implement a handler. It's not clear to me what the expectation for >> guests is, I'll ask the architects to clarify and get back to you. > > My understanding is that MCE2 should always be set if the hypervisor > can migrate vcpus across implementations behind EL1's back, and that > in this context, EL1 never sees such an exception. Notice that MCE2 only traps exceptions from EL1, not from EL0. Exceptions from EL0 always go to EL1. Even if MCE2 is always set, EL1 will see the exception when the hypervisor migrates the vcpu while the vcpu is executing a MOPS instruction in EL0. Thanks, Kristina