Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5480556rdb; Wed, 13 Dec 2023 09:45:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFbw5YWTWrG1CSWe/1QeXCdPSb/ZJBcWFVe/J6EPiU16UbenoBQvRPgR20QG53kmS2Jympt X-Received: by 2002:a05:6a20:3ca3:b0:18b:ec94:deed with SMTP id b35-20020a056a203ca300b0018bec94deedmr4506238pzj.45.1702489551069; Wed, 13 Dec 2023 09:45:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702489551; cv=none; d=google.com; s=arc-20160816; b=Qdf34y+381LpbjJhsU7o9TMz3twVHkgpguLNwznd9IKtLNZn+RM1owLQyyklx7NjhK +9+X5pDoDr7rfH88PJ+2lgMt1662ykRvjyDk3ErnVonSZY/hwCzNiPbiKchSntN1Sz8O W3q6P9/nYuF9T5JSr1pEctFa3mI0KZC0giFW6DrZDXU9JEIX2lCZTKYmPGT+9Vcsjz3L ZeszP5d0rx8yUDPIm/PAQeEAnn8dSs5Qr+4oFdRDY9nZ96IYjpUnTmmT5JEj5hyLJqFO Q2sipniWTmFYw5AUUbr7iy02pKdCpz/5MOkeKMe7tEZok4TKqFA5l4KJqSk/LvpRP3e3 dNAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=WNIN1VfvADC8DO06/MCsIct8cmMSHkN7HmY76xZfJPU=; fh=Dxhchp7NF0DUA7FI7KVeniDzkjyix/d7ETvu1rPCCSM=; b=ffYkf0H3lrSfWA+0cI+pW1VlmHLtvRuotTlyv/5D7U0GlEoQS+k1MkRvSXT76DQook vPxfkRsggEPk6lkuigfTxn/xkDT1IfxvQH8pNHJ024J2vrG8Dcgn8Mu9RsLL9Dy7hHfs AH+WkFLAtM16LUMF2OufDPABNEJryDOdUEfWhw9jvLM2CvL7hAQzeTKfl49StvOLTZu8 Gz0wCYLYqLUPNF5mqKMUFPf2rn/DjntggT8A5HCh3XR76iMNjWmgCPpMAbXbWEtfsTXA gZG6oGP/ArWTMaxI+/9XPFUqTC/Ufzqrsl6WFvpXUq/6vh06NNOkuMI4P/+96vms5eGx mcVw== 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:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id v12-20020a65568c000000b0057942bfab4dsi9447980pgs.395.2023.12.13.09.45.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 09:45:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 00516807AC6B; Wed, 13 Dec 2023 09:45:09 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233264AbjLMRos (ORCPT + 99 others); Wed, 13 Dec 2023 12:44:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232094AbjLMRor (ORCPT ); Wed, 13 Dec 2023 12:44:47 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CF63193; Wed, 13 Dec 2023 09:44:53 -0800 (PST) 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 4703EC15; Wed, 13 Dec 2023 09:45:39 -0800 (PST) Received: from raptor (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 37DBF3F762; Wed, 13 Dec 2023 09:44:48 -0800 (PST) Date: Wed, 13 Dec 2023 17:44:37 +0000 From: Alexandru Elisei To: Rob Herring Cc: catalin.marinas@arm.com, will@kernel.org, oliver.upton@linux.dev, maz@kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, arnd@arndb.de, akpm@linux-foundation.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, mhiramat@kernel.org, rppt@kernel.org, hughd@google.com, pcc@google.com, steven.price@arm.com, anshuman.khandual@arm.com, vincenzo.frascino@arm.com, david@redhat.com, eugenis@google.com, kcc@google.com, hyesoo.yu@samsung.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org Subject: Re: [PATCH RFC v2 11/27] arm64: mte: Reserve tag storage memory Message-ID: References: <20231119165721.9849-1-alexandru.elisei@arm.com> <20231119165721.9849-12-alexandru.elisei@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Wed, 13 Dec 2023 09:45:10 -0800 (PST) On Wed, Dec 13, 2023 at 11:22:17AM -0600, Rob Herring wrote: > On Wed, Dec 13, 2023 at 8:51 AM Alexandru Elisei > wrote: > > > > Hi, > > > > On Wed, Dec 13, 2023 at 08:06:44AM -0600, Rob Herring wrote: > > > On Wed, Dec 13, 2023 at 7:05 AM Alexandru Elisei > > > wrote: > > > > > > > > Hi Rob, > > > > > > > > On Tue, Dec 12, 2023 at 12:44:06PM -0600, Rob Herring wrote: > > > > > On Tue, Dec 12, 2023 at 10:38 AM Alexandru Elisei > > > > > wrote: > > > > > > > > > > > > Hi Rob, > > > > > > > > > > > > Thank you so much for the feedback, I'm not very familiar with device tree, > > > > > > and any comments are very useful. > > > > > > > > > > > > On Mon, Dec 11, 2023 at 11:29:40AM -0600, Rob Herring wrote: > > > > > > > On Sun, Nov 19, 2023 at 10:59 AM Alexandru Elisei > > > > > > > wrote: > > > > > > > > > > > > > > > > Allow the kernel to get the size and location of the MTE tag storage > > > > > > > > regions from the DTB. This memory is marked as reserved for now. > > > > > > > > > > > > > > > > The DTB node for the tag storage region is defined as: > > > > > > > > > > > > > > > > tags0: tag-storage@8f8000000 { > > > > > > > > compatible = "arm,mte-tag-storage"; > > > > > > > > reg = <0x08 0xf8000000 0x00 0x4000000>; > > > > > > > > block-size = <0x1000>; > > > > > > > > memory = <&memory0>; // Associated tagged memory node > > > > > > > > }; > > > > > > > > > > > > > > I skimmed thru the discussion some. If this memory range is within > > > > > > > main RAM, then it definitely belongs in /reserved-memory. > > > > > > > > > > > > Ok, will do that. > > > > > > > > > > > > If you don't mind, why do you say that it definitely belongs in > > > > > > reserved-memory? I'm not trying to argue otherwise, I'm curious about the > > > > > > motivation. > > > > > > > > > > Simply so that /memory nodes describe all possible memory and > > > > > /reserved-memory is just adding restrictions. It's also because > > > > > /reserved-memory is what gets handled early, and we don't need > > > > > multiple things to handle early. > > > > > > > > > > > Tag storage is not DMA and can live anywhere in memory. > > > > > > > > > > Then why put it in DT at all? The only reason CMA is there is to set > > > > > the size. It's not even clear to me we need CMA in DT either. The > > > > > reasoning long ago was the kernel didn't do a good job of moving and > > > > > reclaiming contiguous space, but that's supposed to be better now (and > > > > > most h/w figured out they need IOMMUs). > > > > > > > > > > But for tag storage you know the size as it is a function of the > > > > > memory size, right? After all, you are validating the size is correct. > > > > > I guess there is still the aspect of whether you want enable MTE or > > > > > not which could be done in a variety of ways. > > > > > > > > Oh, sorry, my bad, I should have been clearer about this. I don't want to > > > > put it in the DT as a "linux,cma" node. But I want it to be managed by CMA. > > > > > > Yes, I understand, but my point remains. Why do you need this in DT? > > > If the location doesn't matter and you can calculate the size from the > > > memory size, what else is there to add to the DT? > > > > I am afraid there has been a misunderstanding. What do you mean by > > "location doesn't matter"? > > You said: > > Tag storage is not DMA and can live anywhere in memory. > > Which I took as the kernel can figure out where to put it. But maybe > you meant the h/w platform can hard code it to be anywhere in memory? > If so, then yes, DT is needed. Ah, I see, sorry for not being clear enough, you are correct: tag storage is a hardware property, and software needs a mechanism (in this case, the dt) to discover its properties. > > > At the very least, Linux needs to know the address and size of a memory > > region to use it. The series is about using the tag storage memory for > > data. Tag storage cannot be described as a regular memory node because it > > cannot be tagged (and normal memory can). > > If the tag storage lives in the middle of memory, then it would be > described in the memory node, but removed by being in reserved-memory > node. I don't follow. Would you mind going into more details? > > > Then there's the matter of the tag storage block size (explained in this > > commit message), and also knowing the memory range for which a tag storage > > region stores the tags. This is explained in the cover letter. > > Honestly, I just forgot about that part. I totally understand, there are a lot of things to consider at the same time. Thanks, Alex