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 847CAC7EE2C for ; Thu, 25 May 2023 07:00:39 +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:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Tmk0zP2B/VQF/URP4MoX+oQIgn/djJHAZqOv/DjPWPE=; b=kWIwDLS9KHaetL 8XhjDjc/PF4dlY8sJd3Z2IN3WrncoG80yeRbF1pwQhq1v0YrSb9Y+CXKaLHYXofetmf1glZfLqt8T 18g+aifRkh3+lQ1l7e+V5skxiH8oGOeMkS07VR64VxWZooDWsrZXMxM8yUnxiK5Ff71zBelx+As+/ ng3LAtz3uUlVuzg1CDSGfWu2rewXf/5i+SNIACgfYIPrFl8UyVK6KZFVtHsnvCB/gIe0Tv3AE0DQL bsUzGF2YDa1yrkyapHlcE7qjFsTj9Wtd+YoTcRfe89GLHAbdsleBxp/3MpFc2OhExYhlsKWMvJ2GH qkMnygl8RZlUnMyLuahA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q24xM-00Fjf1-13; Thu, 25 May 2023 07:00:16 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q24xK-00Fje3-11 for linux-arm-kernel@lists.infradead.org; Thu, 25 May 2023 07:00:15 +0000 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 EEFAF1042; Thu, 25 May 2023 00:00:53 -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 1DB363F762; Thu, 25 May 2023 00:00:06 -0700 (PDT) Message-ID: <0b136cc3-c85e-1183-5ddc-ab99fd58c012@arm.com> Date: Thu, 25 May 2023 12:30:04 +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] arm64: mm: pass original fault address to handle_mm_fault() in PER_VMA_LOCK block Content-Language: en-US To: Jisheng Zhang , Catalin Marinas , Will Deacon Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20230524131238.2791-1-jszhang@kernel.org> From: Anshuman Khandual In-Reply-To: <20230524131238.2791-1-jszhang@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230525_000014_404876_0424A97B X-CRM114-Status: GOOD ( 19.35 ) 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 5/24/23 18:42, Jisheng Zhang wrote: > When reading the arm64's PER_VMA_LOCK support code, I found a bit > difference between arm64 and other arch when calling handle_mm_fault() > during VMA lock-based page fault handling: the fault address is masked > before passing to handle_mm_fault(). This is also different from the > usage in mmap_lock-based handling. I think we need to pass the > original fault address to handle_mm_fault() as we did in > commit 84c5e23edecd ("arm64: mm: Pass original fault address to > handle_mm_fault()"). > > If we go through the code path further, we can find that the "masked" > fault address can cause mismatched fault address between perf sw > major/minor page fault sw event and perf page fault sw event: > > do_page_fault > perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, ..., addr) // orig addr > handle_mm_fault > mm_account_fault > perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, ...) // masked addr > > Fixes: cd7f176aea5f ("arm64/mm: try VMA lock-based page fault handling first") > Signed-off-by: Jisheng Zhang LGTM Reviewed-by: Anshuman Khandual > --- > arch/arm64/mm/fault.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c > index cb21ccd7940d..6045a5117ac1 100644 > --- a/arch/arm64/mm/fault.c > +++ b/arch/arm64/mm/fault.c > @@ -600,8 +600,7 @@ static int __kprobes do_page_fault(unsigned long far, unsigned long esr, > vma_end_read(vma); > goto lock_mmap; > } > - fault = handle_mm_fault(vma, addr & PAGE_MASK, > - mm_flags | FAULT_FLAG_VMA_LOCK, regs); > + fault = handle_mm_fault(vma, addr, mm_flags | FAULT_FLAG_VMA_LOCK, regs); > vma_end_read(vma); > > if (!(fault & VM_FAULT_RETRY)) { _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel