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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95B34C77B7C for ; Thu, 25 May 2023 02:23:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 178696B0078; Wed, 24 May 2023 22:23:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1282D6B007B; Wed, 24 May 2023 22:23:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01602900002; Wed, 24 May 2023 22:23:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E6A706B0078 for ; Wed, 24 May 2023 22:23:12 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id B3992808E4 for ; Thu, 25 May 2023 02:23:12 +0000 (UTC) X-FDA: 80827180224.12.69C4F98 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf10.hostedemail.com (Postfix) with ESMTP id CCC71C0011 for ; Thu, 25 May 2023 02:23:10 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf10.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684981391; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5W3oThRyWVjSYcdackMp/x+B8ZfT5uN40944pCrD/kY=; b=61Gu2FY4mIJ29z633uO/G168xTpLcoNjx5V5j9iMpGwjPMLrioHwCiEtU1YzKbfHC9IPsJ FfJtvytToovt7O1TSiE1fgYxsz7v+i5iAdZlVB8f+B0CED34Yth+xM0GFmKcv8/Q0RzJT4 3qLSv3knJQpkcTNV45LBQZWrpGVG+vI= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf10.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684981391; a=rsa-sha256; cv=none; b=Js8GvZfB1v8acECSsAVMpxgmO9nwnKHOPbgOGeXye3n+n2RUXxEmd/i3H4gA3VKoRlRg9G nu4SQf0p0F7wfI+Pbb+1DcbMa8FdYRL0fA+yEMjIfyVcGqSEgNN7KgjqC2ct1PKNuqe/Qq nmQvKucwYkCVGb/I+wS3ENEGQkT+/XU= 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 E95831042; Wed, 24 May 2023 19:23:54 -0700 (PDT) Received: from [10.162.43.6] (unknown [10.162.43.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 314993F762; Wed, 24 May 2023 19:23:07 -0700 (PDT) Message-ID: <44b2b627-7da1-19e8-2f58-0ad9003d5ded@arm.com> Date: Thu, 25 May 2023 07:53:05 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v4 02/36] mm: Add generic flush_icache_pages() and documentation Content-Language: en-US To: "Matthew Wilcox (Oracle)" , linux-arch@vger.kernel.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20230315051444.3229621-1-willy@infradead.org> <20230315051444.3229621-3-willy@infradead.org> From: Anshuman Khandual In-Reply-To: <20230315051444.3229621-3-willy@infradead.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: CCC71C0011 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 7wc4rw7crmodaefdc8ws3fm537yiin9a X-HE-Tag: 1684981390-361675 X-HE-Meta: U2FsdGVkX1+M14JQTxP2e6pfCAHdqb7WQ9mlVx4d9bHY8QXwWKZbou+hEVRZrq9WemNfWilE8OqE8+3RH4RzT8+oUfXdQIvzozP0gSbqDk3qvmPA+KH5HstL6s2GnN38VJ13itaXaPxkAJojO9byU0RkbHJAHtJlRqN4FG4Wl0gkeCUiAGtjxL71GhHcLP7arJ8RXdFHfXAht8CO18RlaNyEiGOPII+4rKEctlUcD6A78JOHrRRJR5vxmjblnU+E7iBrkhn8NETpAFfNtnaS6yPULb+cC4zVKtsW43XCEcSnaWf74AjbyKDcq0Li54COGrGU+FskIjlpHQynM4ksIjqxsnKrGHC98gdczvs75I3tR+ILKt5vT+y5kZAI+NHr+fCJKPy1W/vxJqpxtFknwJ37bpcORy+6ki4jyBohixaWOFkZ5myAU9vzW6WvlPmcrPogJdKADFNaNEz0NpbTPNlG+Bni4jxhKCEuK5jNm4sqKus7MpXn5kf9w74HX0MP7TQ9XHRU0MfNXG+03wNe3HFZPIsQH9c977n1YzFnCocxB5Kb5kUei0XONpq2/uU7XChbT3ml1ljm7MNMFUg6qU7P9PqqigpVAbVlzwV3Sr8WZDSNUrq+PaUUNq+NC2nyKYNPIerNVIa0LepqsMZiCp6VzgUQNV0oKh2oc0hDGSgB1i4Jn4SzMBEYqhtpYvXosJ0t0K0KyMWIK6GTz2deCXk6udU7QV2jMdAo1mjETXWY4U/HYRzh3IrwQjHjzbvf08RrHWRdR/IP1wKVSfREdaeU6bluHoE/dsNJLR2n70Q2mfUVAJHPbFtiXFn4dV3gJ7zQEVyBCFhU9lOhHCne0++cwn4BQWtYO0HWh2j5vNIF2nYWlgqqRdv1CuPk4Wcq5a2lA6Gkrzfa/LKVW5GClWjWnyRbAQooXd6tttn/wpg2u4RzwsQC91V1PxOjoNuMNlUxTfh+epfO0P0O0DC /6lfHcEP 2BwhvxGSPW+DK2zqF+1VukhmV/ZTuArRAHfEQvF7YDatofQGcoL0W1KKoeoDiPcw/VY0zUPttDYoWOaVW540MM3H5KusfWv/YekqGzOR6NctVeYiw8bMYRG9xIGygP3GXbwTHwWBxL8I9gczazcgvowuCRHHbXsaVhdFbPDgc0e36d8tx/1LuDjIFtPSg85h2qkfih4UayptrR0B9OavMoDLkt6Ic/lHkBVCFNNNcIGgoE35Q0nrxFtYPA4UDAVoZqjww/gX7iiPaZ6pX4E3GlsiroA== 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 3/15/23 10:44, Matthew Wilcox (Oracle) wrote: > flush_icache_page() is deprecated but not yet removed, so add > a range version of it. Change the documentation to refer to > update_mmu_cache_range() instead of update_mmu_cache(). > > Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Anshuman Khandual > --- > Documentation/core-api/cachetlb.rst | 35 +++++++++++++++-------------- > include/asm-generic/cacheflush.h | 5 +++++ > 2 files changed, 23 insertions(+), 17 deletions(-) > > diff --git a/Documentation/core-api/cachetlb.rst b/Documentation/core-api/cachetlb.rst > index 5c0552e78c58..d4c9e2a28d36 100644 > --- a/Documentation/core-api/cachetlb.rst > +++ b/Documentation/core-api/cachetlb.rst > @@ -88,13 +88,13 @@ changes occur: > > This is used primarily during fault processing. > > -5) ``void update_mmu_cache(struct vm_area_struct *vma, > - unsigned long address, pte_t *ptep)`` > +5) ``void update_mmu_cache_range(struct vm_area_struct *vma, > + unsigned long address, pte_t *ptep, unsigned int nr)`` > > - At the end of every page fault, this routine is invoked to > - tell the architecture specific code that a translation > - now exists at virtual address "address" for address space > - "vma->vm_mm", in the software page tables. > + At the end of every page fault, this routine is invoked to tell > + the architecture specific code that translations now exists > + in the software page tables for address space "vma->vm_mm" > + at virtual address "address" for "nr" consecutive pages. > > A port may use this information in any way it so chooses. > For example, it could use this event to pre-load TLB > @@ -306,17 +306,18 @@ maps this page at its virtual address. > private". The kernel guarantees that, for pagecache pages, it will > clear this bit when such a page first enters the pagecache. > > - This allows these interfaces to be implemented much more efficiently. > - It allows one to "defer" (perhaps indefinitely) the actual flush if > - there are currently no user processes mapping this page. See sparc64's > - flush_dcache_page and update_mmu_cache implementations for an example > - of how to go about doing this. > + This allows these interfaces to be implemented much more > + efficiently. It allows one to "defer" (perhaps indefinitely) the > + actual flush if there are currently no user processes mapping this > + page. See sparc64's flush_dcache_page and update_mmu_cache_range > + implementations for an example of how to go about doing this. > > - The idea is, first at flush_dcache_page() time, if page_file_mapping() > - returns a mapping, and mapping_mapped on that mapping returns %false, > - just mark the architecture private page flag bit. Later, in > - update_mmu_cache(), a check is made of this flag bit, and if set the > - flush is done and the flag bit is cleared. > + The idea is, first at flush_dcache_page() time, if > + page_file_mapping() returns a mapping, and mapping_mapped on that > + mapping returns %false, just mark the architecture private page > + flag bit. Later, in update_mmu_cache_range(), a check is made > + of this flag bit, and if set the flush is done and the flag bit > + is cleared. > > .. important:: > > @@ -369,7 +370,7 @@ maps this page at its virtual address. > ``void flush_icache_page(struct vm_area_struct *vma, struct page *page)`` > > All the functionality of flush_icache_page can be implemented in > - flush_dcache_page and update_mmu_cache. In the future, the hope > + flush_dcache_page and update_mmu_cache_range. In the future, the hope > is to remove this interface completely. > > The final category of APIs is for I/O to deliberately aliased address > diff --git a/include/asm-generic/cacheflush.h b/include/asm-generic/cacheflush.h > index f46258d1a080..09d51a680765 100644 > --- a/include/asm-generic/cacheflush.h > +++ b/include/asm-generic/cacheflush.h > @@ -78,6 +78,11 @@ static inline void flush_icache_range(unsigned long start, unsigned long end) > #endif > > #ifndef flush_icache_page > +static inline void flush_icache_pages(struct vm_area_struct *vma, > + struct page *page, unsigned int nr) > +{ > +} > + > static inline void flush_icache_page(struct vm_area_struct *vma, > struct page *page) > {