From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 2002:a17:907:1627:b0:8ed:b3f:fd98 with SMTP id hb39csp4720895ejc; Mon, 27 Feb 2023 07:11:41 -0800 (PST) X-Google-Smtp-Source: AK7set+Z5VkF+lv95ocAoSzEykqxE30NWsKR8cuB6VN+YA5T37jmAX2g8KECTwoP/YGgtLzSVThL X-Received: by 2002:a05:6214:248c:b0:56e:99f2:1b91 with SMTP id gi12-20020a056214248c00b0056e99f21b91mr41973350qvb.23.1677510701770; Mon, 27 Feb 2023 07:11:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677510701; cv=none; d=google.com; s=arc-20160816; b=wcU7QgVqtyzPZWGD/H7yY6iv787+0+cyinuSKhWbm9SAyhMjTHRQtoJI05upnEbYBr OopyDf2IqnrAtiA1BF5TKqJXZHJQMDR9jwYQ2kvsB51vViu5JGKP9Vx7oy0F9uM464CJ 9fpZL7ZJKAwoV/o03UW1+8p+fG2JPZM269tk02VeE1z9/3/6zUQwDHitdo8TGHGXyUw6 dHWmKv7pB0O+IdGLbfEJgCarJs0Rjpmpi/Ob5ds2R7sHl8viOWAdl/LCmwcNc0MWbInj GoI3Gj7pGjK/Gqug4HOEbYBWOaujlbj63ocFXv2irjoFZXpN0ZjEQt+zqti1VlUjfLT5 cWOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:user-agent:references:organization :in-reply-to:subject:cc:to:from:dkim-signature; bh=NVUY/CD/XYh7Ejxe1GNd/WPYDalUCINsIUkTkVEPc6Y=; b=gkNwNY6hvLUNTl2V8EPFuW8CZXGT2OSqhvE+E6r+RQsYKr7VAx1jJD5Fyxg4pqY8s0 uGqMWn/IxWiZoAwkJan0C2HBk4lErKoahwSXvMNtRQgtcsEfl98sjHHem2GNIF45kCTL 5VOSANeFJ6fYeugsTbu3DLpIHCK8YzfB8bRexfEjbm5CFpPp0gPD55ofCBflLSnS1pe4 NBpFw7E76bt6Y9pT6Urec0icIhigUflFTx++67aziItAFI1cioP8RKZfSebd5kdTDM6u 3Kla3Iuciwkmx5mlOicB2naMHUx/b4f2+scm2TJAK3blBLXkHUqlKeAZdd6iMLa6tkWr cSZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PJDmqLXU; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bp17-20020a05620a459100b0073441729bdfsi3840869qkb.469.2023.02.27.07.11.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Feb 2023 07:11:41 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PJDmqLXU; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWf9t-0000wQ-0i; Mon, 27 Feb 2023 10:11:21 -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 1pWf9k-0000sP-5d for qemu-arm@nongnu.org; Mon, 27 Feb 2023 10:11:14 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pWf9h-0005kn-Jd for qemu-arm@nongnu.org; Mon, 27 Feb 2023 10:11:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677510668; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NVUY/CD/XYh7Ejxe1GNd/WPYDalUCINsIUkTkVEPc6Y=; b=PJDmqLXU2evk2XXDh36Sdkiw9ZTTxry2WwAuCjilYLyGojbVeupke2cb9AmJu0iKe5mpIg UWssWTl/BSAgrR12oE33bTGXMBJAKRytbznV54UPhRGDmCCEcmPJbWiGhYsdeAcZh5FodO OUeAKdZDWy4vDVoNLPG20lutKSW8kdY= 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-228-XPL_wHSoNz6McJcezda3HQ-1; Mon, 27 Feb 2023 10:11:03 -0500 X-MC-Unique: XPL_wHSoNz6McJcezda3HQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EE0FF3C0E445; Mon, 27 Feb 2023 15:11:02 +0000 (UTC) Received: from localhost (unknown [10.45.226.217]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A81222166B2B; Mon, 27 Feb 2023 15:11:02 +0000 (UTC) From: Cornelia Huck To: Eric Auger , Richard Henderson , Peter Maydell , Thomas Huth , Laurent Vivier Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, kvm@vger.kernel.org, "Dr. David Alan Gilbert" , Juan Quintela , Gavin Shan , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Subject: Re: [PATCH v5 2/3] arm/kvm: add support for MTE In-Reply-To: Organization: Red Hat GmbH References: <20230203134433.31513-1-cohuck@redhat.com> <20230203134433.31513-3-cohuck@redhat.com> <14188fd3-6e97-3e00-7d54-7f76e53eeb22@linaro.org> User-Agent: Notmuch/0.37 (https://notmuchmail.org) Date: Mon, 27 Feb 2023 16:11:01 +0100 Message-ID: <874jr75eka.fsf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Received-SPF: pass client-ip=170.10.133.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-arm@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-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org X-TUID: Yaa2NA4Af85V On Wed, Feb 15 2023, Eric Auger wrote: > Hi Richard, > On 2/6/23 19:27, Richard Henderson wrote: >> On 2/6/23 03:32, Eric Auger wrote: >>>> +void kvm_arm_enable_mte(Error **errp) >>>> +{ >>>> +=C2=A0=C2=A0=C2=A0 static bool tried_to_enable =3D false; >>>> +=C2=A0=C2=A0=C2=A0 Error *mte_migration_blocker =3D NULL; >>> can't you make the mte_migration_blocker static instead? >>> >>>> +=C2=A0=C2=A0=C2=A0 int ret; >>>> + >>>> +=C2=A0=C2=A0=C2=A0 if (tried_to_enable) { >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * MTE on KVM is enab= led on a per-VM basis (and retrying >>>> doesn't make >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * sense), and we onl= y want a single migration blocker as well. >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 */ >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return; >>>> +=C2=A0=C2=A0=C2=A0 } >>>> +=C2=A0=C2=A0=C2=A0 tried_to_enable =3D true; >>>> + >>>> +=C2=A0=C2=A0=C2=A0 if ((ret =3D kvm_vm_enable_cap(kvm_state, KVM_CAP_= ARM_MTE, 0))) { >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 error_setg_errno(errp, -re= t, "Failed to enable >>>> KVM_CAP_ARM_MTE"); >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return; >>>> +=C2=A0=C2=A0=C2=A0 } >>>> + >>>> +=C2=A0=C2=A0=C2=A0 /* TODO: add proper migration support with MTE ena= bled */ >>>> +=C2=A0=C2=A0=C2=A0 error_setg(&mte_migration_blocker, >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 "Live migration disabled due to MTE enabled"); >>=20 >> Making the blocker static wouldn't stop multiple errors from >> kvm_vm_enable_cap. > Sorry I don't get what you mean. instead of checking tried_to_enable why > can't we check !mte_migration_blocker? [missed this one] Do you mean if (mte_migration_blocker) { return; } error_setg(&mte_migration_blocker, ...); if ((ret =3D kvm_vm_enable_cap(...))) { return; } if (migrate_add_blocker(...)) { error_free(mte_migration_blocker); // is mte_migration_blocker guaranteed !=3D NULL here? }