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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 C0E97C64EC7 for ; Wed, 1 Mar 2023 10:18:31 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXJX1-0003lD-Cc; Wed, 01 Mar 2023 05:17:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXJWw-0003kH-T0 for qemu-devel@nongnu.org; Wed, 01 Mar 2023 05:17:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXJWt-000831-T7 for qemu-devel@nongnu.org; Wed, 01 Mar 2023 05:17:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677665865; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8r3Y4Afs6nDzR97mneU0Nx74HX2j2HXQLqk/fLNz+hc=; b=A19+H00cXKT07H8fDSQfdGrHpXHCDbwFtZWhudV7lpuNzr5TG7Km9z9M/fqaS/1dnnUrB7 DOHo6G7wu459mgBRHMPs0UjpBo92IdLsQ3T9/cV+OJPDwgV8g+N/ww+qUQ0we8G9HijQlY zGkPwwObWOBiqIUnf6Bt//xY71Taoeg= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-283-6mHCLBv4PmGmk4Ky9GErJA-1; Wed, 01 Mar 2023 05:17:42 -0500 X-MC-Unique: 6mHCLBv4PmGmk4Ky9GErJA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D5C7D3C0F195; Wed, 1 Mar 2023 10:17:41 +0000 (UTC) Received: from localhost (dhcp-192-239.str.redhat.com [10.33.192.239]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 88AB42026D4B; Wed, 1 Mar 2023 10:17:41 +0000 (UTC) From: Cornelia Huck To: Andrea Bolognani Cc: Peter Maydell , Thomas Huth , Laurent Vivier , qemu-arm@nongnu.org, qemu-devel@nongnu.org, kvm@vger.kernel.org, Eric Auger , "Dr. David Alan Gilbert" , Juan Quintela , Gavin Shan , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Richard Henderson Subject: Re: [PATCH v6 1/2] arm/kvm: add support for MTE In-Reply-To: Organization: Red Hat GmbH References: <20230228150216.77912-1-cohuck@redhat.com> <20230228150216.77912-2-cohuck@redhat.com> User-Agent: Notmuch/0.37 (https://notmuchmail.org) Date: Wed, 01 Mar 2023 11:17:40 +0100 Message-ID: <874jr4dbcr.fsf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Received-SPF: pass client-ip=170.10.129.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On Tue, Feb 28 2023, Andrea Bolognani wrote: > On Tue, Feb 28, 2023 at 04:02:15PM +0100, Cornelia Huck wrote: >> Introduce a new cpu feature flag to control MTE support. To preserve >> backwards compatibility for tcg, MTE will continue to be enabled as >> long as tag memory has been provided. >> >> If MTE has been enabled, we need to disable migration, as we do not >> yet have a way to migrate the tags as well. Therefore, MTE will stay >> off with KVM unless requested explicitly. >> >> Signed-off-by: Cornelia Huck >> --- >> docs/system/arm/cpu-features.rst | 21 ++++++ >> hw/arm/virt.c | 2 +- >> target/arm/cpu.c | 18 ++--- >> target/arm/cpu.h | 1 + >> target/arm/cpu64.c | 110 +++++++++++++++++++++++++++++++ >> target/arm/internals.h | 1 + >> target/arm/kvm.c | 29 ++++++++ >> target/arm/kvm64.c | 5 ++ >> target/arm/kvm_arm.h | 19 ++++++ >> target/arm/monitor.c | 1 + >> 10 files changed, 194 insertions(+), 13 deletions(-) > > I've given a quick look with libvirt integration in mind, and > everything seem fine. > > Specifically, MTE is advertised in the output of qom-list-properties > both for max-arm-cpu and the latest virt-X.Y-machine, which means > that libvirt can easily and reliably figure out whether MTE support > is available. Great, thanks for having a look! > >> +MTE CPU Property >> +================ >> + >> +The ``mte`` property controls the Memory Tagging Extension. For TCG, it requires >> +presence of tag memory (which can be turned on for the ``virt`` machine via >> +``mte=on``). For KVM, it requires the ``KVM_CAP_ARM_MTE`` capability; until >> +proper migration support is implemented, enabling MTE will install a migration >> +blocker. > > Is it okay to use -machine virt,mte=on unconditionally for both KVM > and TCG guests when MTE support is requested, or will that not work > for the former? QEMU will error out if you try this with KVM (basically, same behaviour as before.) Is that a problem for libvirt, or merely a bit inconvinient? > >> +If not specified explicitly via ``on`` or ``off``, MTE will be available >> +according to the following rules: >> + >> +* When TCG is used, MTE will be available if and only if tag memory is available; >> + i.e. it preserves the behaviour prior to the introduction of the feature. >> + >> +* When KVM is used, MTE will default to off, so that migration will not >> + unintentionally be blocked. This might change in a future QEMU version. > > If and when this changes, we should ensure that the new default > behavior doesn't affect existing machine types, otherwise we will > break guest ABI for existing VMs. Nod, such a change would need proper compat handling. It's not quite clear yet if we'll ever flip it, though.