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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 AAB25C54E67 for ; Wed, 27 Mar 2024 17:58:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vFuK2qryxCVzHq72SePyth6JxkhVZXXfZI8QLOVj3tw=; b=VcqbNkyZK+ZL+V xLlyMr9zmkYjkkYWAQGtMaHpmzkZeHwvwvsPPEJA42FA6Yfog/sJktFnlfbvF3fpiilpgG65YQBim 2wW3d75+WwMIYR8m0r/ZEZzxSrFaz91CSZaSbz/bnf6i3E3b2PWPHL8MkCDHG3DYwEKTL58i0LH3o 0eHHe/b7SZ3lz2pRQCGqM8l3nR7elONXLxmFf8hqXw4OsmBBwqTS1qjYsPvOa1OkGGtqcNvIRHg7D 3KEtG4G+rzlAByRhUH+kvPbGgIZYTPckWtizYRtJuqwMR2sZqQSw+f2wI8Y2h45qFVrLglD14LjhB BMGYpW1O+CQcS7ZuAHnw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpXXw-0000000AQae-29Hn; Wed, 27 Mar 2024 17:58:44 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpXXq-0000000AQW7-2zdG for linux-arm-kernel@lists.infradead.org; Wed, 27 Mar 2024 17:58:40 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1BA836162D; Wed, 27 Mar 2024 17:58:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07BE2C433C7; Wed, 27 Mar 2024 17:58:21 +0000 (UTC) Date: Wed, 27 Mar 2024 17:58:19 +0000 From: Catalin Marinas To: Ryan Roberts Cc: David Hildenbrand , Matthew Wilcox , Barry Song <21cnbao@gmail.com>, will@kernel.org, akpm@linux-foundation.org, hughd@google.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, chrisl@kernel.org, mark.rutland@arm.com, steven.price@arm.com, Barry Song , Kemeng Shi , Anshuman Khandual , Peter Collingbourne , Yosry Ahmed , Peter Xu , Lorenzo Stoakes , "Mike Rapoport (IBM)" , "Aneesh Kumar K.V" , Rick Edgecombe Subject: Re: [PATCH 1/1] arm64: mm: swap: support THP_SWAP on hardware with MTE Message-ID: References: <20240322114136.61386-1-21cnbao@gmail.com> <20240322114136.61386-2-21cnbao@gmail.com> <1006392c-c437-46c0-9a2e-e25e52236b67@redhat.com> <46ba09c5-4186-4e03-81cc-ca27c0301fef@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <46ba09c5-4186-4e03-81cc-ca27c0301fef@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240327_105838_839663_44F81C3C X-CRM114-Status: GOOD ( 24.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Mar 27, 2024 at 03:13:18PM +0000, Ryan Roberts wrote: > On 27/03/2024 14:57, David Hildenbrand wrote: > > On 27.03.24 15:53, Matthew Wilcox wrote: > >> On Sat, Mar 23, 2024 at 12:41:36AM +1300, Barry Song wrote: > >>> Commit d0637c505f8a1 ("arm64: enable THP_SWAP for arm64") brings up > >>> THP_SWAP on ARM64, but it doesn't enable THP_SWP on hardware with > >>> MTE as the MTE code works with the assumption tags save/restore is > >>> always handling a folio with only one page. > >>> > >>> The limitation should be removed as more and more ARM64 SoCs have > >>> this feature. Co-existence of MTE and THP_SWAP becomes more and > >>> more important. > >>> > >>> This patch makes MTE tags saving support large folios, then we don't > >>> need to split large folios into base pages for swapping out on ARM64 > >>> SoCs with MTE any more. > >> > >> Can we go further than this patch and only support PG_mte_tagged and > >> PG_mte_lock on folio->flags instead of page->flags?=A0 We're down to u= sing > > = > > I think we discussed that already and what I learned is that it "gets a= bit > > complicated". But I'm hoping we can get that discussion started again. > = > The original conversation starts here: > https://lore.kernel.org/linux-mm/fb34d312-1049-4932-8f2b-d7f33cfc297c@arm= .com/ > = > The issue is that you can have a large folio mapped to user space, and us= er > space only wants to activate MTE for a portion of it. So at that point, y= ou > either have to deal with only part of it being tagged (as we do today wit= h the > per-page flag) or you have to split the folio. It needs splitting since the PROT_MTE property ends up in the pte as a memory attribute. So we can't have a THP mapping with PROT_MTE but only specific pages tagged. I had an attempt last year to only keep the PG_mte_tagged flag in the head page but I recall folio_copy() got in the way since it was calling copy_highpage() on individual pages and the arm64 code was not seeing the head PG_mte_tagged. I think it can be worked around but I got distracted and forgot about this. -- = Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel