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.3 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,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 F2B9CC28CBC for ; Sun, 3 May 2020 15:29:15 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C029320757 for ; Sun, 3 May 2020 15:29:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ko9z/ZRa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C029320757 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+infradead-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=bombadil.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=HerVfMdXgd8Pma58qFBDuUpb6aS8sqz1F8fNWTDEZgo=; b=ko9z/ZRahxaOzc TZM2RW1BXCKiBfxa7Q5B0BVM5SOF8hdRZCWWB5z/TDWLwWHIKdyjSO5IYT0l/BWQj+VT5eKbxr3Ig x5dpl9x2VrMnboPoqxI9mY2iD1zNuxvM6N2TG8ABzFxdKJlPcVTUcCet8u5IYpLnCHU9efpd1DjTx /Fgg3UBlhW5NJSlN7Czheq+U+kApP4Hai8F7oItzkvdR7Cznu22mwSH/i5mOo/k8E8lQEj03xZJYA O6WGk1PvFxhTXNMiYSotMYAVlvLs8JkmP54dD+bh1s0JqVSe4sHot6Qtubwt7sB2QeiY3s7Qqven7 IBJzHqQPr1x52GtDx0Gw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVGYL-0001hN-Ut; Sun, 03 May 2020 15:29:13 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVGYJ-0001ge-Kd for linux-arm-kernel@lists.infradead.org; Sun, 03 May 2020 15:29:13 +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 C526630E; Sun, 3 May 2020 08:29:07 -0700 (PDT) Received: from gaia (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 78EC23F68F; Sun, 3 May 2020 08:29:06 -0700 (PDT) Date: Sun, 3 May 2020 16:29:00 +0100 From: Catalin Marinas To: Steven Price Subject: Re: [PATCH 3/4] arm64: mte: Enable swap of tagged pages Message-ID: <20200503152858.GA11959@gaia> References: <20200422142530.32619-1-steven.price@arm.com> <20200422142530.32619-4-steven.price@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200422142530.32619-4-steven.price@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200503_082911_720888_E2B15F0F X-CRM114-Status: GOOD ( 11.75 ) 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, Arnd Bergmann , Hugh Dickins , linux-mm@kvack.org, Andrew Morton , Vincenzo Frascino , Will Deacon , 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+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Apr 22, 2020 at 03:25:29PM +0100, Steven Price wrote: > diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h > index 39a372bf8afc..a4ad1b75a1a7 100644 > --- a/arch/arm64/include/asm/pgtable.h > +++ b/arch/arm64/include/asm/pgtable.h > @@ -80,6 +80,8 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; > #define pte_user_exec(pte) (!(pte_val(pte) & PTE_UXN)) > #define pte_cont(pte) (!!(pte_val(pte) & PTE_CONT)) > #define pte_devmap(pte) (!!(pte_val(pte) & PTE_DEVMAP)) > +#define pte_tagged(pte) (!!((pte_val(pte) & PTE_ATTRINDX_MASK) == \ > + PTE_ATTRINDX(MT_NORMAL_TAGGED))) > > #define pte_cont_addr_end(addr, end) \ > ({ unsigned long __boundary = ((addr) + CONT_PTE_SIZE) & CONT_PTE_MASK; \ > @@ -268,12 +270,17 @@ static inline void __check_racy_pte_update(struct mm_struct *mm, pte_t *ptep, > __func__, pte_val(old_pte), pte_val(pte)); > } > > +void mte_sync_tags(pte_t *ptep, pte_t pte); > + > static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, > pte_t *ptep, pte_t pte) > { > if (pte_present(pte) && pte_user_exec(pte) && !pte_special(pte)) > __sync_icache_dcache(pte); > > + if (system_supports_mte() && pte_tagged(pte)) > + mte_sync_tags(ptep, pte); I think this needs a pte_present() check as well, otherwise pte_tagged() could match some random swap entry. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel