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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33563EEAA62 for ; Thu, 14 Sep 2023 17:37:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C1A686B02DC; Thu, 14 Sep 2023 13:37:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BF10B6B02DD; Thu, 14 Sep 2023 13:37:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AB8396B02DF; Thu, 14 Sep 2023 13:37:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9BDE06B02DC for ; Thu, 14 Sep 2023 13:37:25 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4E91F80672 for ; Thu, 14 Sep 2023 17:37:25 +0000 (UTC) X-FDA: 81235909650.05.BB770B4 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf21.hostedemail.com (Postfix) with ESMTP id 95B751C000E for ; Thu, 14 Sep 2023 17:37:22 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf21.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694713043; h=from:from:sender: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=tTSFFCEklU3rymDjavG8uRpZ8kDhF1TBoipwhP4eAVs=; b=sWqOAW4ghVt7QkRNmgY1J9TwZn485OjfuzJvtw8dWNK2fPzqaWsiSoCprJWJLOFjUZi574 WK48YqrV54n6TDJHWYUTO3Q2RW38Bt8y8169XPIjMBV+JzgNBWoshb0sOtyrhKPCPmPXJV NHBsKou+3tgwrAcxdzvcGP+XFBRFELk= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf21.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694713043; a=rsa-sha256; cv=none; b=MITtatjLVk/fpZMYLW8OjVzp/6jF/X9Jet49Ti/dTArCQ89QsScwVNju0HZiL1YPLR0piQ 7h77dDzrsRyQcikzOFvHIqRjYsJ1Zny/oFoOHaJ/A+w+2PJ3Ldcyf429h1V3utpXuSHnzl jMXZ1aj+NlSO6g8GaNSKSmhKtJRY5Ls= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7DD5761E40; Thu, 14 Sep 2023 17:37:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B111C433C8; Thu, 14 Sep 2023 17:37:14 +0000 (UTC) Date: Thu, 14 Sep 2023 18:37:12 +0100 From: Catalin Marinas To: Kuan-Ying Lee =?utf-8?B?KOadjuWGoOepjik=?= Cc: "dietmar.eggemann@arm.com" , "hughd@google.com" , "peterz@infradead.org" , "maz@kernel.org" , "rostedt@goodmis.org" , "rppt@kernel.org" , "yuzenghui@huawei.com" , "james.morse@arm.com" , "vschneid@redhat.com" , "bristot@redhat.com" , "juri.lelli@redhat.com" , "alexandru.elisei@arm.com" , "suzuki.poulose@arm.com" , "mingo@redhat.com" , "akpm@linux-foundation.org" , "mhiramat@kernel.org" , "bsegall@google.com" , "mgorman@suse.de" , "arnd@arndb.de" , "oliver.upton@linux.dev" , "vincent.guittot@linaro.org" , "will@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-trace-kernel@vger.kernel.org" , Qun-wei Lin =?utf-8?B?KOael+e+pOW0tCk=?= , "linux-mm@kvack.org" , "hyesoo.yu@samsung.com" , "kcc@google.com" , "kvmarm@lists.linux.dev" , "david@redhat.com" , Casper Li =?utf-8?B?KOadjuS4reamrik=?= , "steven.price@arm.com" , Chinwen Chang =?utf-8?B?KOW8temMpuaWhyk=?= , "eugenis@google.com" , "linux-arm-kernel@lists.infradead.org" , "pcc@google.com" , "vincenzo.frascino@arm.com" , "linux-arch@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "anshuman.khandual@arm.com" Subject: Re: [PATCH RFC 00/37] Add support for arm64 MTE dynamic tag storage reuse Message-ID: References: <20230823131350.114942-1-alexandru.elisei@arm.com> <0dc2afaf8a976ef8eb9af711fd941f1bbfd71321.camel@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0dc2afaf8a976ef8eb9af711fd941f1bbfd71321.camel@mediatek.com> X-Rspamd-Queue-Id: 95B751C000E X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 1bk8i83wc66gufa39c8cm9zaubobfcm7 X-HE-Tag: 1694713042-139193 X-HE-Meta: U2FsdGVkX1+8RjRsxjvYuoJ7JV8e5RME4t7ooK+lH3PezPYuayD++CtPnox3PMdlb7PUeyiDCrPRcS+rrqwPRCVydiLunyJeAXumBpBCDVixsdcSJb01iRZBfGOsS3IDyDS0smHDoXQNdjerClx2H+9h4FU2DFGr73usgUCL7m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Y8sn5QmSMEKWNLfsdfyKj+iWdMcja0hREc4s+yd4rP5XHB6NV3tJ85NOMl8t1b+RtKBgoD0nun6xARR5aEGblT437kuij++QAA+uOa7lbDXqWgQZ+FEhkkaSsbzO2napsHKoR+TT4YyLww1roWGKT6WviW9cfgwBTFIPPxY+247ZpuGyyXNPFjRSZw1CvCHavlFPxnZO3urySYG0IbX1jlQHe9xAJ6rzfgrYRvtkHNCu5Jmru9dOW46+jxG/9a8Eq7yHcFIPYYYw1WA8N7EgdI= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Kuan-Ying, On Wed, Sep 13, 2023 at 08:11:40AM +0000, Kuan-Ying Lee (李冠穎) wrote: > On Wed, 2023-08-23 at 14:13 +0100, Alexandru Elisei wrote: > > diff --git a/arch/arm64/boot/dts/arm/fvp-base-revc.dts > > b/arch/arm64/boot/dts/arm/fvp-base-revc.dts > > index 60472d65a355..bd050373d6cf 100644 > > --- a/arch/arm64/boot/dts/arm/fvp-base-revc.dts > > +++ b/arch/arm64/boot/dts/arm/fvp-base-revc.dts > > @@ -165,10 +165,28 @@ C1_L2: l2-cache1 { > > }; > > }; > > > > - memory@80000000 { > > + memory0: memory@80000000 { > > device_type = "memory"; > > - reg = <0x00000000 0x80000000 0 0x80000000>, > > - <0x00000008 0x80000000 0 0x80000000>; > > + reg = <0x00 0x80000000 0x00 0x7c000000>; > > + }; > > + > > + metadata0: metadata@c0000000 { > > + compatible = "arm,mte-tag-storage"; > > + reg = <0x00 0xfc000000 0x00 0x3e00000>; > > + block-size = <0x1000>; > > + memory = <&memory0>; > > + }; > > + > > + memory1: memory@880000000 { > > + device_type = "memory"; > > + reg = <0x08 0x80000000 0x00 0x7c000000>; > > + }; > > + > > + metadata1: metadata@8c0000000 { > > + compatible = "arm,mte-tag-storage"; > > + reg = <0x08 0xfc000000 0x00 0x3e00000>; > > + block-size = <0x1000>; > > + memory = <&memory1>; > > }; > > > > AFAIK, the above memory configuration means that there are two region > of dram(0x80000000-0xfc000000 and 0x8_80000000-0x8_fc0000000) and this > is called PDD memory map. > > Document[1] said there are some constraints of tag memory as below. > > | The following constraints apply to the tag regions in DRAM: > | 1. The tag region cannot be interleaved with the data region. > | The tag region must also be above the data region within DRAM. > | > | 2.The tag region in the physical address space cannot straddle > | multiple regions of a memory map. > | > | PDD memory map is not allowed to have part of the tag region between > | 2GB-4GB and another part between 34GB-64GB. > > I'm not sure if we can separate tag memory with the above > configuration. Or do I miss something? > > [1] https://developer.arm.com/documentation/101569/0300/?lang=en > (Section 5.4.6.1) Good point, thanks. The above dts some random layout we picked as an example, it doesn't match any real hardware and we didn't pay attention to the interconnect limitations (we fake the tag storage on the model). I'll try to dig out how the mtu_tag_addr_shutter registers work and how the sparse DRAM space is compressed to a smaller tag range. But that's something done by firmware and the kernel only learns the tag storage location from the DT (provided by firmware). We also don't need to know the fine-grained mapping between 32 bytes of data and 1 byte (2 tags) in the tag storage, only the block size in the tag storage space that covers all interleaving done by the interconnect (it can be from 1 byte to something larger like a page; the kernel will then use the lowest common multiple between a page size and this tag block size to figure out how many pages to reserve). -- Catalin