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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2421BC433FE for ; Thu, 6 Jan 2022 10:30:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237983AbiAFKaT (ORCPT ); Thu, 6 Jan 2022 05:30:19 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49860 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237940AbiAFKaS (ORCPT ); Thu, 6 Jan 2022 05:30:18 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8990161B14; Thu, 6 Jan 2022 10:30:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B35ADC36AE3; Thu, 6 Jan 2022 10:30:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641465017; bh=AEUEKRvg76KMQjAE75Y8qZ3DdjJA0ls98F6fkt74Q3Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BgnoiHBfsRG62UCju9J4NqZLmn02Wcr/KkvJ8+Qf3PIMVLGW1rTDjMgOoshmufJtb W8GLzzI7B47KdR1gK4b6ElugYeccp2hnOJQ+3ppmP8p/uRK+Jpl6lwB09dZ0u6rTLQ xHAjldNujXTEDHk56AuI1kPFjWIlSGL55ns/UUxslkW3G8wAVGKympfcAbxpxDkNFe Q6x5Q2+AOEUdO8vFybJ+IrbBQTjVCH6bKRUsxEluX/jgsGPQvNqCCFpTmTZqatEh7r LGHdpEDt91JbfoBEkQy64onOX3vlxqcmYkeqQZdDesILBsuvT011Rb3T0JEaOzdRiM hXvXxlvbomx4A== Date: Thu, 6 Jan 2022 10:30:09 +0000 From: Will Deacon To: Yu Zhao Cc: Andrew Morton , Linus Torvalds , Andi Kleen , Catalin Marinas , Dave Hansen , Hillf Danton , Jens Axboe , Jesse Barnes , Johannes Weiner , Jonathan Corbet , Matthew Wilcox , Mel Gorman , Michael Larabel , Michal Hocko , Rik van Riel , Vlastimil Babka , Ying Huang , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, page-reclaim@google.com, x86@kernel.org, Konstantin Kharlamov Subject: Re: [PATCH v6 1/9] mm: x86, arm64: add arch_has_hw_pte_young() Message-ID: <20220106103009.GA4420@willie-the-truck> References: <20220104202227.2903605-1-yuzhao@google.com> <20220104202227.2903605-2-yuzhao@google.com> <20220105104526.GA3015@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 05, 2022 at 01:47:08PM -0700, Yu Zhao wrote: > On Wed, Jan 05, 2022 at 10:45:26AM +0000, Will Deacon wrote: > > On Tue, Jan 04, 2022 at 01:22:20PM -0700, Yu Zhao wrote: > > > diff --git a/arch/arm64/tools/cpucaps b/arch/arm64/tools/cpucaps > > > index 870c39537dd0..56e4ef5d95fa 100644 > > > --- a/arch/arm64/tools/cpucaps > > > +++ b/arch/arm64/tools/cpucaps > > > @@ -36,6 +36,7 @@ HAS_STAGE2_FWB > > > HAS_SYSREG_GIC_CPUIF > > > HAS_TLB_RANGE > > > HAS_VIRT_HOST_EXTN > > > +HW_AF > > > HW_DBM > > > KVM_PROTECTED_MODE > > > MISMATCHED_CACHE_TYPE > > > > As discussed in the previous threads, we really don't need the complexity > > of the additional cap for the arm64 part. Please can you just use the > > existing code instead? It's both simpler and, as you say, it's equivalent > > for existing hardware. > > > > That way, this patch just ends up being a renaming exercise and we're all > > good. > > No, renaming alone isn't enough. A caller needs to disable preemption > before calling system_has_hw_af(), and I don't think it's reasonable > to ask this caller to do it on x86 as well. > > It seems you really prefer not to have HW_AF. So the best I can > accommodate, considering other potential archs, e.g., risc-v (I do > plan to provide benchmark results on risc-v, btw), is: > > static inline bool arch_has_hw_pte_young(bool local) > { > bool hw_af; > > if (local) { > WARN_ON(preemptible()); > return cpu_has_hw_af(); > } > > preempt_disable(); > hw_af = system_has_hw_af(); > preempt_enable(); > > return hw_af; > } > > Or please give me something else I can call without disabling > preemption, sounds good? Sure thing, let me take a look. Do you have your series on a public git tree someplace? Cheers, Will 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 4A397C433F5 for ; Thu, 6 Jan 2022 10:31:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc: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=7YnjBw5Wijmcf1C43OHj6uPP5dU1rL0C/pwtU8AwOyk=; b=eSs+Nq3JOy+ODE vY1IgL1Qjss2ai823a8sJeyzKYW61CJJrNs3VyF8q5RCcrhPPwjzGAkzCp7Vh1WLCMEls4+axl0ln wEGBgcUkXXtyuxBAHZjuNyyWJefvqmB6Pp30JuIrMyRy2fal9nRlxbuPOlW7n4oaN0EbQH2/lZ4WV roqgw4gyyQmFRGiw4YAMJZmgN2kbIp9IJpSLBEQ/beCv6t9ReykcOfvYJQM6lMAhardIthfcaYU6/ 6d42CCZejBGQ4LT5w2FlLIEqYkJPLXB3PSrs7jTWkrO9l0Nq6bUNzLQehoSuetOQgYCbDNzTFqL27 TYBO9e+/5ReCZCIREY0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5Q2I-00HLmj-TT; Thu, 06 Jan 2022 10:30:23 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5Q2E-00HLlG-Vd for linux-arm-kernel@lists.infradead.org; Thu, 06 Jan 2022 10:30:20 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7E15861B0E; Thu, 6 Jan 2022 10:30:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B35ADC36AE3; Thu, 6 Jan 2022 10:30:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641465017; bh=AEUEKRvg76KMQjAE75Y8qZ3DdjJA0ls98F6fkt74Q3Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BgnoiHBfsRG62UCju9J4NqZLmn02Wcr/KkvJ8+Qf3PIMVLGW1rTDjMgOoshmufJtb W8GLzzI7B47KdR1gK4b6ElugYeccp2hnOJQ+3ppmP8p/uRK+Jpl6lwB09dZ0u6rTLQ xHAjldNujXTEDHk56AuI1kPFjWIlSGL55ns/UUxslkW3G8wAVGKympfcAbxpxDkNFe Q6x5Q2+AOEUdO8vFybJ+IrbBQTjVCH6bKRUsxEluX/jgsGPQvNqCCFpTmTZqatEh7r LGHdpEDt91JbfoBEkQy64onOX3vlxqcmYkeqQZdDesILBsuvT011Rb3T0JEaOzdRiM hXvXxlvbomx4A== Date: Thu, 6 Jan 2022 10:30:09 +0000 From: Will Deacon To: Yu Zhao Cc: Andrew Morton , Linus Torvalds , Andi Kleen , Catalin Marinas , Dave Hansen , Hillf Danton , Jens Axboe , Jesse Barnes , Johannes Weiner , Jonathan Corbet , Matthew Wilcox , Mel Gorman , Michael Larabel , Michal Hocko , Rik van Riel , Vlastimil Babka , Ying Huang , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, page-reclaim@google.com, x86@kernel.org, Konstantin Kharlamov Subject: Re: [PATCH v6 1/9] mm: x86, arm64: add arch_has_hw_pte_young() Message-ID: <20220106103009.GA4420@willie-the-truck> References: <20220104202227.2903605-1-yuzhao@google.com> <20220104202227.2903605-2-yuzhao@google.com> <20220105104526.GA3015@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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-20220106_023019_128893_B0E6695F X-CRM114-Status: GOOD ( 25.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Wed, Jan 05, 2022 at 01:47:08PM -0700, Yu Zhao wrote: > On Wed, Jan 05, 2022 at 10:45:26AM +0000, Will Deacon wrote: > > On Tue, Jan 04, 2022 at 01:22:20PM -0700, Yu Zhao wrote: > > > diff --git a/arch/arm64/tools/cpucaps b/arch/arm64/tools/cpucaps > > > index 870c39537dd0..56e4ef5d95fa 100644 > > > --- a/arch/arm64/tools/cpucaps > > > +++ b/arch/arm64/tools/cpucaps > > > @@ -36,6 +36,7 @@ HAS_STAGE2_FWB > > > HAS_SYSREG_GIC_CPUIF > > > HAS_TLB_RANGE > > > HAS_VIRT_HOST_EXTN > > > +HW_AF > > > HW_DBM > > > KVM_PROTECTED_MODE > > > MISMATCHED_CACHE_TYPE > > > > As discussed in the previous threads, we really don't need the complexity > > of the additional cap for the arm64 part. Please can you just use the > > existing code instead? It's both simpler and, as you say, it's equivalent > > for existing hardware. > > > > That way, this patch just ends up being a renaming exercise and we're all > > good. > > No, renaming alone isn't enough. A caller needs to disable preemption > before calling system_has_hw_af(), and I don't think it's reasonable > to ask this caller to do it on x86 as well. > > It seems you really prefer not to have HW_AF. So the best I can > accommodate, considering other potential archs, e.g., risc-v (I do > plan to provide benchmark results on risc-v, btw), is: > > static inline bool arch_has_hw_pte_young(bool local) > { > bool hw_af; > > if (local) { > WARN_ON(preemptible()); > return cpu_has_hw_af(); > } > > preempt_disable(); > hw_af = system_has_hw_af(); > preempt_enable(); > > return hw_af; > } > > Or please give me something else I can call without disabling > preemption, sounds good? Sure thing, let me take a look. Do you have your series on a public git tree someplace? Cheers, Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel