Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1288464rwd; Thu, 25 May 2023 10:23:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ62cwA+v+r0u23Rb8HZohEPkDQiF4mSghLWnZtc9bAlzCSibR5PlT7oyDK99n8svqcWDvDI X-Received: by 2002:a05:6a20:c18c:b0:10c:ef18:746e with SMTP id bg12-20020a056a20c18c00b0010cef18746emr7743542pzb.58.1685035384840; Thu, 25 May 2023 10:23:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685035384; cv=none; d=google.com; s=arc-20160816; b=Xcz2Bql3X80Lq9GNukpDrKaubEe8qytmT378oDnaX4atQXrjFhr6GbOW/aJs42fLmj q1lMSISYzOnikSTZB4p/siWYcKlnpNvq8jNWCgryml3LAfwoNkZBWcaYfatod5dduyKh 1tckQtcVu31dVbtxYcQL9VvDTvDont6yCxdR4o3oxmLng3TIVcOyMycT5Q5PCRr1QBCn 5j0ONB5Wtiaz65NSWgEG1VF33tbAVaK6/ikNEYdBiZwBJceAZl1xit8yKlr8EUXTMF7W wl+MlADALlZTvzILAXwSxJsEM2DLpSxS1U9K1wZPQRMW4cRvHqSpB0hoqq839rjkFsUr EUpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=fYeb9lni1X5Ub8Vt93QjTf4CzWaLNkqeqCusbGuV1Hg=; b=n/ls5LCPKNVQxWIsrC6d/4uU7MDZ4i5M1IWr6hm4HRdZfYmdrIy1oVwF8j7OzoJOFA ZnBKFmpJyfSGL7mnKp16DFnMkl54CaDlOsk1N7jADvY4+7WEo58mUJ/DKmDm+jcMa4nR OQGXRbxHVsKcEVUb7wxRK9KlwntH2h6UEgL9ib3WXVd57yzwJVTEPYDaY3suYWtSSM5u eAoVjNL8/zADVaiCUu6AAMkioJhQ9hJ4D8/FIJXlZVb0GGclqPK+din1gXvlxxJrgIXy dbLQEAvff2D060zlGsSjt+BYmNLVxmGvbFEgl//bSgF/P8gYCS4NPvSji782j6XMxvhw Eh2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b3-20020a637143000000b0053477bf60e1si1537163pgn.630.2023.05.25.10.22.50; Thu, 25 May 2023 10:23:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240581AbjEYREH (ORCPT + 99 others); Thu, 25 May 2023 13:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240206AbjEYREF (ORCPT ); Thu, 25 May 2023 13:04:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B73B8189 for ; Thu, 25 May 2023 10:04:04 -0700 (PDT) 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 4CF4161489 for ; Thu, 25 May 2023 17:04:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF1ABC433EF; Thu, 25 May 2023 17:04:02 +0000 (UTC) Date: Thu, 25 May 2023 18:03:59 +0100 From: Catalin Marinas To: Jisheng Zhang Cc: Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Suren Baghdasaryan Subject: Re: [PATCH] arm64: mm: pass original fault address to handle_mm_fault() in PER_VMA_LOCK block Message-ID: References: <20230524131305.2808-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230524131305.2808-1-jszhang@kernel.org> X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 24, 2023 at 09:13:05PM +0800, 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 Acked-by: Catalin Marinas