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=-12.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 C7FEDC4743C for ; Fri, 4 Jun 2021 18:41:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6401060E0B for ; Fri, 4 Jun 2021 18:41:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6401060E0B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CACFF6B0036; Fri, 4 Jun 2021 14:41:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C837E6B006C; Fri, 4 Jun 2021 14:41:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B71FB6B006E; Fri, 4 Jun 2021 14:41:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0212.hostedemail.com [216.40.44.212]) by kanga.kvack.org (Postfix) with ESMTP id 877156B0036 for ; Fri, 4 Jun 2021 14:41:38 -0400 (EDT) Received: from smtpin33.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 0C18D906F for ; Fri, 4 Jun 2021 18:41:38 +0000 (UTC) X-FDA: 78216909876.33.F312CBC Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf20.hostedemail.com (Postfix) with ESMTP id D017D3955 for ; Fri, 4 Jun 2021 18:41:14 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id A2718613FA; Fri, 4 Jun 2021 18:32:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622831523; bh=toYWmlxb06/mNU78HOxdzQ44QGww5d7S2W69KZOeFNc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kubFuZWbGbVl0b4+QjRHZF0UW4RlhrWLkU/y/kmgZBPLWIPl6uofF9YvL82WaZ+VK 1QzFyOkJRmjk9PbIAzG+oDK/zbBQephHvoycluvrL75nrj4JM6mnMKvD9Oj3RtWYlr tUWz9tI7d9tf4zFyggluHvYKbkSdM3VZ0OyVcEZBiXbKMhL8LFgKTUX8u/inw2+wAZ WjyC7z47ttFcAXQZIw3Dfa+2/fSXxcDStyqrIqTHOn+Ash/EbYal4w+ncGrdJhnsC4 jnMXjh6P9ujxejnNtfyqGLO1dYZ8Y4WFr9z+H4kjgQZkLII++bzscs2hQ53ooiWfUk xnxK/pFYu1UZQ== Date: Fri, 4 Jun 2021 19:31:58 +0100 From: Will Deacon To: Andrew Morton Cc: Peter Collingbourne , Andrey Konovalov , Alexander Potapenko , Catalin Marinas , Vincenzo Frascino , Jann Horn , Evgenii Stepanov , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v6 0/4] arm64: improve efficiency of setting tags for user pages Message-ID: <20210604183157.GA3843@willie-the-truck> References: <20210602235230.3928842-1-pcc@google.com> <20210603200308.2a08d25db0dc92430a545b4c@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210603200308.2a08d25db0dc92430a545b4c@linux-foundation.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Stat-Signature: wsqrxojj46pfr5q699j6mp65uq7trgib X-Rspamd-Queue-Id: D017D3955 X-Rspamd-Server: rspam02 Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kubFuZWb; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf20.hostedemail.com: domain of will@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=will@kernel.org X-HE-Tag: 1622832074-484345 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 03, 2021 at 08:03:08PM -0700, Andrew Morton wrote: > On Wed, 2 Jun 2021 16:52:26 -0700 Peter Collingbourne wrote: > > > Currently we can end up touching PROT_MTE user pages twice on fault > > and once on unmap. On fault, with KASAN disabled we first clear data > > and then set tags to 0, and with KASAN enabled we simultaneously > > clear data and set tags to the KASAN random tag, and then set tags > > again to 0. On unmap, we poison the page by setting tags, but this > > is less likely to find a bug than poisoning kernel pages. > > > > This patch series fixes these inefficiencies by only touching the pages > > once on fault using the DC GZVA instruction to clear both data and > > tags, and avoiding poisoning user pages on free. > > > > ... > > > > arch/alpha/include/asm/page.h | 6 +-- > > arch/arm64/include/asm/mte.h | 4 ++ > > arch/arm64/include/asm/page.h | 10 +++-- > > arch/arm64/lib/mte.S | 20 ++++++++++ > > arch/arm64/mm/fault.c | 26 +++++++++++++ > > arch/arm64/mm/proc.S | 10 +++-- > > arch/ia64/include/asm/page.h | 6 +-- > > arch/m68k/include/asm/page_no.h | 6 +-- > > arch/s390/include/asm/page.h | 6 +-- > > arch/x86/include/asm/page.h | 6 +-- > > include/linux/gfp.h | 18 +++++++-- > > include/linux/highmem.h | 43 ++++++++------------- > > include/linux/kasan.h | 64 +++++++++++++++++++------------- > > include/linux/page-flags.h | 9 +++++ > > include/trace/events/mmflags.h | 9 ++++- > > mm/kasan/common.c | 4 +- > > mm/kasan/hw_tags.c | 32 ++++++++++++++++ > > mm/mempool.c | 6 ++- > > mm/page_alloc.c | 66 +++++++++++++++++++-------------- > > 19 files changed, 242 insertions(+), 109 deletions(-) > > This is more MMish than ARMish, but I expect it will get more exposure > in an ARM tree than in linux-next alone. > > I'll grab them for now, but in the hope that they will appear in -next > via an ARM tree so I get to drop them again. Sure thing, I'll queue this in a sec... Peter -- please cc me on patches touching arch/arm64 in future, that way I won't miss anything (or at least, you can yell at me if I do!). Cheers, Will