Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1321958rwd; Thu, 18 May 2023 10:31:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7T9D5PKl6MRjerh3YzQByOSFye19+y1sIme896Yji6wsRWAF8K6IIkNXaEmMNbV4B3Y3fJ X-Received: by 2002:a17:902:e80c:b0:1a1:cb18:7f99 with SMTP id u12-20020a170902e80c00b001a1cb187f99mr3247706plg.30.1684431061782; Thu, 18 May 2023 10:31:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684431061; cv=none; d=google.com; s=arc-20160816; b=u8ALhIh9MzcgbbEmhvHGlDUqG5F1+HsXzsuylJe9WSs7kFZwaM7bQOf6Jp/e8imiuz 8MpBnmWRvd/BdTlR98z6OIwErhn30rKR6I4bVfbmscpaTYEKD762hEDg+ZG1/vDidJLF 3Wbvq8FPKOjt6oYSpnbgENMwWC/SYfK4BimwUEBkOpaNW2GCF1y+F+VyJX0HdxAGVoLP eWNUOTSshB9KMsj1xl+2D06vfKxHG1yE7CjK+sgkUVs19Z5ZYzXXVzYxa7D4Y1bxozp+ Dzf7MSrDL5QAs805Ja+hHwp4kFaZVpm6I9SKJZJZv0nHRkQsGSaLgih2dFDRx81OITRe m/EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vvjvSXt0pYLeqo0akHop2f4MtqN/i57G+mwvTTI7Yvo=; b=chC4PD8y4FfLRUQ7WqyhflHAkUfUkyy3mngJqmBbJjVNM7/NukTx/uAQZjKkYdEyhH Zsy6KMNIuOH4BIlpKafomH1WyvFQ3hdVtrwF9RZQrvGQV2xC2lSyPCC3GC7nD4lKh4IR 5V4TI28h+Z1MgQeX/8fZ1gmWB7FtxMAWpbEl7ZqlXoI+/P0EyQsi433fOtxiHV7F6ElJ oSJJ10uKPonTUnWGqfQ1HZ4zzPFg32NgsR3NGBad0YyYCpfypgjxo7itlPDnTXoL9UAU 2gDEQDUNZjxt0YTwV7R/DDU4+tQgfgSDPy9IOnA+NnZtFeetqeZTnOI9aAqv4+EznyyM pVXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Cu3GH6B/"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a10-20020a170902ee8a00b001aae5ec6ac9si1673535pld.547.2023.05.18.10.30.43; Thu, 18 May 2023 10:31:01 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Cu3GH6B/"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229910AbjERRWR (ORCPT + 99 others); Thu, 18 May 2023 13:22:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229907AbjERRWQ (ORCPT ); Thu, 18 May 2023 13:22:16 -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 A6E7EE40 for ; Thu, 18 May 2023 10:22:14 -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 1CC0F643A8 for ; Thu, 18 May 2023 17:22:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95EF7C433EF; Thu, 18 May 2023 17:22:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684430533; bh=OZgSrTfO4ThuInBExHzNs7TMmFHDdgXi7iQ9bpEIZA4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cu3GH6B/ShuAcPKltcQ4hxgZZVxbP8UZl0y4WcWeK3QhLDBZdN214TOVxev71vZXh syOW2/1dCV1I17xeAO0gV3hQPb96EBSv5e+hpv3qDJrhW+mbidSxkWbQN+mIBMqx8N Zkt/Md3dzX/R9AS2d84ruUZEuGhQ8UAbbfoeI1jfpbsSYbLsikeTr9oURt9a36ivMh gVjCuNfypMRZ2xcVNnxJcRYBV1GVmv6AEeKREAuE159PbAzmhVNNPYlrgdlTmLv4oF bHLVCqz/JTUBinIaYL0DJk2gya2wmJYMzG6O2h74U0rzHRO8lWENqTRSFW3eD2Isxd mFhryDZ+wvqEQ== From: SeongJae Park To: Ryan Roberts Cc: Andrew Morton , SeongJae Park , Christoph Hellwig , "Matthew Wilcox (Oracle)" , "Kirill A. Shutemov" , Lorenzo Stoakes , Uladzislau Rezki , Zi Yan , linux-kernel@vger.kernel.org, linux-mm@kvack.org, damon@lists.linux.dev, kernel test robot Subject: Re: [PATCH v2 5/5] mm: ptep_deref() conversion Date: Thu, 18 May 2023 17:22:11 +0000 Message-Id: <20230518172211.84101-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230518110727.2106156-6-ryan.roberts@arm.com> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Thu, 18 May 2023 12:07:27 +0100 Ryan Roberts wrote: > Convert all instances of direct pte_t* dereferencing to instead use > ptep_deref() helper. By default, the helper does a direct dereference as > before, but it can (and will) be overridden by the architecture to fully > encapsulate the contents of the pte. Arch code is deliberately not > converted, as the arch code knows best. > > Conversion was done using Coccinelle: > > ---- > > // $ make coccicheck \ > // COCCI=ptepderef.cocci \ > // SPFLAGS="--include-headers" \ > // MODE=patch > > virtual patch > > @ depends on patch @ > pte_t *v; > @@ > > - *v > + ptep_deref(v) > > ---- > > Then reviewed and hand-edited to avoid multiple unnecessary calls to > ptep_deref(), instead opting to store the result of a single in a > variable, where it is correct to do so. This will benefit arch-overrides > that may be more complex than a simple (optimizable) pointer > dereference. > > Included is a fix for an issue in an earlier version of this patch that > was pointed out by kernel test robot. The issue arose because config > MMU=n elides definition of the ptep helper functions, including > ptep_deref(). HUGETLB_PAGE=n configs still define a simple > huge_ptep_clear_flush() for linking purposes, which dereferences the > ptep. So when both configs are disabled, this caused a build error > because ptep_deref() is not defined. Fix by continuing to do a direct > dereference when MMU=n. This is safe because for this config the arch > code cannot be trying to virtualize the ptes because none of the ptep > helpers are defined. > > Reported-by: kernel test robot > Link: https://lore.kernel.org/oe-kbuild-all/202305120142.yXsNEo6H-lkp@intel.com/ > Signed-off-by: Ryan Roberts [...] > mm/damon/ops-common.c | 2 +- > mm/damon/paddr.c | 2 +- > mm/damon/vaddr.c | 10 +- For above mm/damon/ part, Reviewed-by: SeongJae Park Thanks, SJ