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 1F60BC54E49 for ; Mon, 26 Feb 2024 11:58:16 +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:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=w8udGnVZIsmqwlU5Ojkb3z2LBlb+gCsC2lpY3+ODaGE=; b=Rk0iXou+ptXAM+ ySVM/WgG/dHATkqd8VzPEFpwpYhrVgmUZfxbb/oqU2kYLrqNpRij/bEiQf2D7ZY0F7XoxLOiGBuUY MJy45kYOuRliimNUSDgQ0/8p0OvNYUgNzyDuyudcWLFK0CZhKFbNPCXuRKrTDBlfN1oX90wQ3GadJ TmGF1zNVsC/TTH65JN/BNugyo3Im/ZM+/UzmG+osDKoeatBiX5ZHILWHUYW9jbdoTMc2QXesqPlVY QozkDkmoJolHu8iFclM1oaReU7klPjFoUFZY7GPro8cHtpJgJj5mhqiGNixw7Jya4cBT+POVr0zWO nFU8NtlDexBnscb767RQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1reZcO-00000000RmU-2BbD; Mon, 26 Feb 2024 11:58:00 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1reZc9-00000000Rey-1o1X for linux-arm-kernel@lists.infradead.org; Mon, 26 Feb 2024 11:57:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=D0Cpl1dRF49bF8jEtTlvGAeloBKS8mPZTSqjERNiUkI=; b=VqGhCwMTOy09jD9FqIdHEICFAP Y5PagkXK2hMIYd6SnSIH/U9aQlTxUxJxMU2d3egO83lxj7sepDCuA00c/fKvSA7e2jMblT+8dh9An F9m/7M0itqVriXErD9Thk1g9dweTUBRT9Btt+aRiUF3fvPTaxBleOV5pcf74y9hL4ZmokLDY0eWJO +0If7KDRSnbayGQ2iCQ2q2D8v/WWVTwjy4pobsdLVYIdyXIMUz+SyRX5F0V+OFmJ8yS8R4OJdnTOV ZFL7yC8q3lo40V7SVun0GHEUAPEdnYdmlvV8TrDT/pyazaE9r7zf/r17/H6357AEIP0YjjCtKg7yv gSBKnS1A==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:37602) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1reZby-0003Cq-0H; Mon, 26 Feb 2024 11:57:34 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1reZbt-0006PH-St; Mon, 26 Feb 2024 11:57:29 +0000 Date: Mon, 26 Feb 2024 11:57:29 +0000 From: "Russell King (Oracle)" To: 20240223063608.2605736-1-liuyongqiang13@huawei.com Cc: liuyongqiang13@huawei.com, arnd@arndb.de, keescook@chromium.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, m.szyprowski@samsung.com, rppt@linux.ibm.com, sunnanyong@huawei.com, wangkefeng.wang@huawei.com, willy@infradead.org, yanaijie@huawei.com, zhangxiaoxu5@huawei.com Subject: Re: [PATCH v2] arm: flush: check if the folio is reserved for no-mapping addresses Message-ID: References: <20240223063608.2605736-1-liuyongqiang13@huawei.com> <788c8a64-09ed-96fd-9878-ed126b09c683@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <788c8a64-09ed-96fd-9878-ed126b09c683@huawei.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240226_035745_575711_8474D0B4 X-CRM114-Status: GOOD ( 13.44 ) 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 Mon, Feb 26, 2024 at 02:38:58PM +0800, Jinjiang Tu wrote: > Since some abuses of pfn_valid() have been reported, I check all the use of > pfn_valid(), and find some suspicious cases. I do get really tired of kernel interfaces migrating to become something different from what they were when code was originally written, and then having users of that interface labelled as "suspicious" or an "abuse". I don't follow MM stuff, so I can't comment on the rights or wrongs of this, but what I understood was that pfn_valid() is there to check that for a given PFN, pfn_to_page() would return a valid pointer to a struct page. Given that we only have struct page's for memory which the kernel is managing, this seems entirely correct. There may be other RAM in the system which is being managed via different mechanisms, and because those won't have a struct page associated with them, pfn_valid() should be returning false (which means memory carved out for e.g. other processors etc) won't be mapped cacheable. Or at least that's how things used to be - because 32-bit Arm's pfn_valid() was implemented by checking memblock for memory, and stolen memory _was_ removed from memblock.memory (see arm_memblock_steal) or quite simply these areas were not passed to the kernel as memory. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel