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 B71F5ECAAD3 for ; Fri, 9 Sep 2022 04:52:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F3BB8D0003; Fri, 9 Sep 2022 00:52:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A4168D0002; Fri, 9 Sep 2022 00:52:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 392238D0003; Fri, 9 Sep 2022 00:52:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 29FF78D0002 for ; Fri, 9 Sep 2022 00:52:01 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 08C6F140435 for ; Fri, 9 Sep 2022 04:52:01 +0000 (UTC) X-FDA: 79891324842.26.555FD06 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf08.hostedemail.com (Postfix) with ESMTP id 81848160083 for ; Fri, 9 Sep 2022 04:51:59 +0000 (UTC) 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 B9102153B; Thu, 8 Sep 2022 21:52:04 -0700 (PDT) Received: from [10.162.41.8] (unknown [10.162.41.8]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 918713F73D; Thu, 8 Sep 2022 21:51:46 -0700 (PDT) Message-ID: Date: Fri, 9 Sep 2022 10:21:44 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v3 3/4] mm: rmap: Extend tlbbatch APIs to fit new platforms Content-Language: en-US To: Yicong Yang , akpm@linux-foundation.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, catalin.marinas@arm.com, will@kernel.org, linux-doc@vger.kernel.org Cc: corbet@lwn.net, peterz@infradead.org, arnd@arndb.de, linux-kernel@vger.kernel.org, darren@os.amperecomputing.com, yangyicong@hisilicon.com, huzhanyuan@oppo.com, lipeifeng@oppo.com, zhangshiming@oppo.com, guojian@oppo.com, realmz6@gmail.com, linux-mips@vger.kernel.org, openrisc@lists.librecores.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, Barry Song <21cnbao@gmail.com>, wangkefeng.wang@huawei.com, xhao@linux.alibaba.com, prime.zeng@hisilicon.com, Barry Song , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Nadav Amit , Mel Gorman References: <20220822082120.8347-1-yangyicong@huawei.com> <20220822082120.8347-4-yangyicong@huawei.com> From: Anshuman Khandual In-Reply-To: <20220822082120.8347-4-yangyicong@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf08.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=1662699119; a=rsa-sha256; cv=none; b=BCOYpDcVWTv6QCTEO3xFqlmWST63ZpkTrMvYTNOuNlYPsB1CW5B0IOuXiI9o3VpzoEi1GW Zzy/1p6lRPT46n1et2UrdaXJTnPphaovZlo2acVkHaHBvkQ2wz2qFto6timaawUqaEZY+2 MqY4PqtIrR8OsuixiK1WTb4zj/xrdK0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662699119; 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=TqH0sxh0GxSqDTYPjrAbwAWQ+CnDueRzNUq9bNCiIYI=; b=dG1OUMqR72o2KL1nEE74wh+q1kyOrMpdOxmwr60Z8oLzxo/OT9LZJCCiCFKfrq/pVJG3MR xGKQXQ+jeMrEKmDJStRGBoNUWoXgXcuyuNxDW+cCS0rwnleI/dRg5l8EgZzrY8tXZRqeZU z4X4yCR7jZUtdgqGXUWhzt5i/d1Lx38= Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf08.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com X-Rspam-User: X-Rspamd-Server: rspam01 X-Stat-Signature: c477bett3cu5ehc3gpp3yiss4whueg48 X-Rspamd-Queue-Id: 81848160083 X-HE-Tag: 1662699119-270643 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 8/22/22 13:51, Yicong Yang wrote: > From: Barry Song > > Add uaddr to tlbbatch APIs so that platforms like ARM64 are I guess 'uaddr' refers to a virtual address from the process address space itself ? Please be more specific. > able to apply this on their specific hardware features. For > ARM64, this could be sending tlbi into hardware queues for > the page with this particular uaddr. This subject line and commit message here are misleading. The patch adds an address argument to arch callback arch_tlbbatch_add_mm() as arm64 platform could use that to perform the TLB flush batching ? This patch can be folded into the next one, so that the requirement for an additional argument 'uaddr' in the arch callback will be self evident. OR if this is going to be a preparatory patch, then it must explain how 'uaddr' argument is helpful on platforms like arm64 while performing TLB flush batching. But TBH, just folding it to next patch explains the context better. > > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: Dave Hansen > Cc: "H. Peter Anvin" > Cc: Nadav Amit > Cc: Mel Gorman > Tested-by: Xin Hao > Signed-off-by: Barry Song > Signed-off-by: Yicong Yang > --- > arch/x86/include/asm/tlbflush.h | 3 ++- > mm/rmap.c | 10 ++++++---- > 2 files changed, 8 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h > index 8a497d902c16..5bd78ae55cd4 100644 > --- a/arch/x86/include/asm/tlbflush.h > +++ b/arch/x86/include/asm/tlbflush.h > @@ -264,7 +264,8 @@ static inline u64 inc_mm_tlb_gen(struct mm_struct *mm) > } > > static inline void arch_tlbbatch_add_mm(struct arch_tlbflush_unmap_batch *batch, > - struct mm_struct *mm) > + struct mm_struct *mm, > + unsigned long uaddr) > { > inc_mm_tlb_gen(mm); > cpumask_or(&batch->cpumask, &batch->cpumask, mm_cpumask(mm)); > diff --git a/mm/rmap.c b/mm/rmap.c > index a17a004550c6..7187a72b63b1 100644 > --- a/mm/rmap.c > +++ b/mm/rmap.c > @@ -642,12 +642,13 @@ void try_to_unmap_flush_dirty(void) > #define TLB_FLUSH_BATCH_PENDING_LARGE \ > (TLB_FLUSH_BATCH_PENDING_MASK / 2) > > -static void set_tlb_ubc_flush_pending(struct mm_struct *mm, bool writable) > +static void set_tlb_ubc_flush_pending(struct mm_struct *mm, bool writable, > + unsigned long uaddr) > { > struct tlbflush_unmap_batch *tlb_ubc = ¤t->tlb_ubc; > int batch, nbatch; > > - arch_tlbbatch_add_mm(&tlb_ubc->arch, mm); > + arch_tlbbatch_add_mm(&tlb_ubc->arch, mm, uaddr); > tlb_ubc->flush_required = true; > > /* > @@ -725,7 +726,8 @@ void flush_tlb_batched_pending(struct mm_struct *mm) > } > } > #else > -static void set_tlb_ubc_flush_pending(struct mm_struct *mm, bool writable) > +static void set_tlb_ubc_flush_pending(struct mm_struct *mm, bool writable, > + unsigned long uaddr) > { > } > > @@ -1587,7 +1589,7 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma, > */ > pteval = ptep_get_and_clear(mm, address, pvmw.pte); > > - set_tlb_ubc_flush_pending(mm, pte_dirty(pteval)); > + set_tlb_ubc_flush_pending(mm, pte_dirty(pteval), address); > } else { > pteval = ptep_clear_flush(vma, address, pvmw.pte); > }