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 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF0CFC433E0 for ; Thu, 25 Jun 2020 12:11:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7D44C2065D for ; Thu, 25 Jun 2020 12:11:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D44C2065D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 275D56B0068; Thu, 25 Jun 2020 08:11:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 227CD6B006C; Thu, 25 Jun 2020 08:11:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 13D0C6B006E; Thu, 25 Jun 2020 08:11:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0072.hostedemail.com [216.40.44.72]) by kanga.kvack.org (Postfix) with ESMTP id F04776B0068 for ; Thu, 25 Jun 2020 08:11:09 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A3EED8245571 for ; Thu, 25 Jun 2020 12:11:09 +0000 (UTC) X-FDA: 76967618658.15.flock95_2d0163b26e4c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 9F15018023877 for ; Thu, 25 Jun 2020 12:09:54 +0000 (UTC) X-HE-Tag: flock95_2d0163b26e4c X-Filterd-Recvd-Size: 3790 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Thu, 25 Jun 2020 12:09:54 +0000 (UTC) Received: from gaia (unknown [2.26.170.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6109A20720; Thu, 25 Jun 2020 12:09:51 +0000 (UTC) Date: Thu, 25 Jun 2020 13:09:48 +0100 From: Catalin Marinas To: Steven Price Cc: Andrew Morton , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, Will Deacon , Dave P Martin , Vincenzo Frascino , Szabolcs Nagy , Kevin Brodsky , Andrey Konovalov , Peter Collingbourne Subject: Re: [PATCH v5 21/25] mm: Add arch hooks for saving/restoring tags Message-ID: <20200625120931.GB14812@gaia> References: <20200624175244.25837-1-catalin.marinas@arm.com> <20200624175244.25837-22-catalin.marinas@arm.com> <20200624114534.9520ba5ed235bc32bf1af3a2@linux-foundation.org> <40250ed8-50fe-3945-d7d3-331e03b2abe8@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40250ed8-50fe-3945-d7d3-331e03b2abe8@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: 9F15018023877 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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: On Thu, Jun 25, 2020 at 10:04:59AM +0100, Steven Price wrote: > On 24/06/2020 19:45, Andrew Morton wrote: > > On Wed, 24 Jun 2020 18:52:40 +0100 Catalin Marinas wrote: > > > > > From: Steven Price > > > > > > Arm's Memory Tagging Extension (MTE) adds some metadata (tags) to > > > every physical page, when swapping pages out to disk it is necessary to > > > save these tags, and later restore them when reading the pages back. > > > > > > Add some hooks along with dummy implementations to enable the > > > arch code to handle this. > > > > > > Three new hooks are added to the swap code: > > > * arch_prepare_to_swap() and > > > * arch_swap_invalidate_page() / arch_swap_invalidate_area(). > > > One new hook is added to shmem: > > > * arch_swap_restore_tags() > > > > > > ... > > > > > > --- a/include/linux/pgtable.h > > > +++ b/include/linux/pgtable.h > > > @@ -631,6 +631,29 @@ static inline int arch_unmap_one(struct mm_struct *mm, > > > } > > > #endif > > > +#ifndef __HAVE_ARCH_PREPARE_TO_SWAP > > > +static inline int arch_prepare_to_swap(struct page *page) > > > +{ > > > + return 0; > > > +} > > > +#endif > > > + > > > +#ifndef __HAVE_ARCH_SWAP_INVALIDATE > > > +static inline void arch_swap_invalidate_page(int type, pgoff_t offset) > > > +{ > > > +} > > > + > > > +static inline void arch_swap_invalidate_area(int type) > > > +{ > > > +} > > > +#endif > > > + > > > +#ifndef __HAVE_ARCH_SWAP_RESTORE_TAGS > > > +static inline void arch_swap_restore_tags(swp_entry_t entry, struct page *page) > > > +{ > > > +} > > > +#endif > > > > Presumably these three __HAVE_ARCH_ macros are to be defined in asm/pgtable.h? > > That would be the idea (see patch 22). However: > > Catalin - you've renamed __HAVE_ARCH_SWAP_RESTORE_TAGS in patch 22, but not > here! This was meant to be arch_swap_restore() and __HAVE_ARCH_SWAP_RESTORE (no tags suffix) and it was originally in include/asm-generic/pgtable.h. With Mike's recent reworking getting rid of this file, I messed up the conflict resolution during rebase and re-introduced this file in patch 22. I'll fix it up, it needs to be only in include/linux/pgtable.h. -- Catalin