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=-5.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 3CDC1C433E0 for ; Thu, 25 Jun 2020 12:01:47 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 09F522067D for ; Thu, 25 Jun 2020 12:01:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="skYxiJXN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 09F522067D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject: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=c4QrdAa6ga62pdPVu6HDK7Oe6GhSkfCBdYAIp128wVU=; b=skYxiJXNeNQAyNxIdVIpVJnhn RE/QwEU8F7eENuhV3xiw9xq/ZxwybDUdHlB5nicOYZSpIXdGmTCwklJ/q929uz9EPE2f5JjZ6t6wP Kb68+p/KVNk27LsMU+f30bncNQRv86kGCOQwZE+EzR3B/TwBIEeWfr3drhqtbthjAeemJ6QdN+YeW cCEgDiEqlg/tZbvVBSEuljgggZPLIqMv3eYqEpPmpERjoEGtmij14zjv+2oZQ3ks/VNSGZr0R39ib a3e1g+Uap2q0hN+BTk0Cx/z6N5C+D1czxYfmsMTwNcsUtdY/WThWEFEB/wC5IMDhpdJQ7K/DtV3t4 /DS5wgrSA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1joQXO-00061m-NQ; Thu, 25 Jun 2020 11:59:26 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1joQXM-00061U-Uy for linux-arm-kernel@lists.infradead.org; Thu, 25 Jun 2020 11:59:25 +0000 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 25CF71FB; Thu, 25 Jun 2020 04:59:22 -0700 (PDT) Received: from gaia (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7BA443F73C; Thu, 25 Jun 2020 04:59:20 -0700 (PDT) Date: Thu, 25 Jun 2020 12:59:10 +0100 From: Catalin Marinas To: Steven Price Subject: Re: [PATCH v5 22/25] arm64: mte: Enable swap of tagged pages Message-ID: <20200625115909.GA14812@gaia> References: <20200624175244.25837-1-catalin.marinas@arm.com> <20200624175244.25837-23-catalin.marinas@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Szabolcs Nagy , Andrey Konovalov , Kevin Brodsky , Peter Collingbourne , linux-mm@kvack.org, Andrew Morton , Vincenzo Frascino , Will Deacon , Dave P Martin , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jun 25, 2020 at 12:37:40PM +0100, Steven Price wrote: > On 24/06/2020 18:52, Catalin Marinas wrote: > > diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c > > index 3e08aea56e7a..1712c504df15 100644 > > --- a/arch/arm64/kernel/mte.c > > +++ b/arch/arm64/kernel/mte.c > > @@ -10,6 +10,8 @@ > > #include > > #include > > #include > > +#include > > +#include > > #include > > #include > > @@ -18,15 +20,30 @@ > > #include > > #include > > +static void mte_sync_page_tags(struct page *page, pte_t *ptep, bool check_swap) > > +{ > > + pte_t old_pte = READ_ONCE(*ptep); > > + > > + if (check_swap && is_swap_pte(old_pte)) { > > + swp_entry_t entry = pte_to_swp_entry(old_pte); > > + > > + if (!non_swap_entry(entry) && mte_restore_tags(entry, page)) > > + return; > > + } > > + > > + mte_clear_page_tags(page_address(page)); > > +} > > + > > void mte_sync_tags(pte_t *ptep, pte_t pte) > > { > > struct page *page = pte_page(pte); > > long i, nr_pages = compound_nr(page); > > + bool check_swap = nr_pages == 0; > > /* if PG_mte_tagged is set, tags have already been initialised */ > > for (i = 0; i < nr_pages; i++, page++) { > > This is broken - for check_swap to be true, nr_pages==0, which means we > never enter the loop and nothing happens... > > Except I don't believe compound_nr() will return 0 - it's defined as: > > static inline unsigned long compound_nr(struct page *page) > { > return 1UL << compound_order(page); > } > > Changing it to nr_pages==1 works for me. Ah, I had it as compound_order() and changes to compound_nr() but left the 0 check. Fixed locally. Thanks. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel