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.5 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=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 66D9BC433FE for ; Wed, 9 Dec 2020 18:46:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0143423C85 for ; Wed, 9 Dec 2020 18:46:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0143423C85 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 44D278D003B; Wed, 9 Dec 2020 13:46:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3FCF28D0031; Wed, 9 Dec 2020 13:46:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 313858D003B; Wed, 9 Dec 2020 13:46:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0153.hostedemail.com [216.40.44.153]) by kanga.kvack.org (Postfix) with ESMTP id 18CFD8D0031 for ; Wed, 9 Dec 2020 13:46:51 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id CCC4B824999B for ; Wed, 9 Dec 2020 18:46:50 +0000 (UTC) X-FDA: 77574625380.13.order30_5c04198273f1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id ADDAF18140B60 for ; Wed, 9 Dec 2020 18:46:50 +0000 (UTC) X-HE-Tag: order30_5c04198273f1 X-Filterd-Recvd-Size: 3114 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Wed, 9 Dec 2020 18:46:50 +0000 (UTC) Date: Wed, 9 Dec 2020 18:46:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1607539609; bh=sUy8zuiil22aMl2/aya4Ll0+5gUQS/Rh6dRvPnqxLcE=; h=From:To:Cc:Subject:References:In-Reply-To:From; b=Ln8pQQFlioSAMr7gY5t45IpDlGO7ZDz1ZNTK+hQZVBzLQx1z8ULe1JbEw+GktEtOg eZNky1psifTOoJY0c9pxE6xEIwWX4L9AZS1gjejXskx8JuXVyszVY4QAb/yUZHV+bw ikuSNodGLtY81zbVjPHINsdhk2fLyjn4Z7KBKzaQiLpZCNtyTMFTPQRLzXj7Dcp2k/ VMuV0YJ19VzYurr2a8HFmYkMxblpoQKrDvybJSX0NFouQyexpP1K/RvSsitatmCQIf p2fAFzlPdRQ+iT6kXqlqlD6dJ0PwblRO5LjXStqrH/vdtvhQK9OuLE/KUjaPI9QLnT joVQLNKb6IXwg== From: Will Deacon To: Catalin Marinas Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, Jan Kara , Minchan Kim , Andrew Morton , "Kirill A . Shutemov" , Linus Torvalds , Vinayak Menon , kernel-team@android.com Subject: Re: [PATCH 2/2] arm64: mm: Implement arch_wants_old_faultaround_pte() Message-ID: <20201209184643.GB8778@willie-the-truck> References: <20201209163950.8494-1-will@kernel.org> <20201209163950.8494-3-will@kernel.org> <20201209183509.GH13566@gaia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201209183509.GH13566@gaia> User-Agent: Mutt/1.10.1 (2018-07-13) 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 Wed, Dec 09, 2020 at 06:35:09PM +0000, Catalin Marinas wrote: > On Wed, Dec 09, 2020 at 04:39:50PM +0000, Will Deacon wrote: > > diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h > > index da250e4741bd..3424f5881390 100644 > > --- a/arch/arm64/include/asm/cpufeature.h > > +++ b/arch/arm64/include/asm/cpufeature.h > > @@ -764,6 +764,18 @@ static inline bool cpu_has_hw_af(void) > > ID_AA64MMFR1_HADBS_SHIFT); > > } > > > > +static inline bool system_has_hw_af(void) > > +{ > > + u64 mmfr1; > > + > > + if (!IS_ENABLED(CONFIG_ARM64_HW_AFDBM)) > > + return false; > > + > > + mmfr1 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR1_EL1); > > + return cpuid_feature_extract_unsigned_field(mmfr1, > > + ID_AA64MMFR1_HADBS_SHIFT); > > +} > > Could we not add a new system-wide cpu feature that checks for hardware > AF? This read_sanitised_ftr_reg() does a binary search on each > invocation. I posted a diff [1] which would allow removing the binary search for cases where we can pass the register coding as a constant (like this), but honestly, it's not like we have many ID registers so I doubt it really matters in the grand scheme of things. That said, I'm spinning a v2 anyway so I can include it for comments since I haven't posted it as a proper patch before. Will [1] https://lore.kernel.org/r/20201202172727.GC29813@willie-the-truck