Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1253253rbb; Mon, 26 Feb 2024 03:58:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXIk54z8l6zyFCq/ON597R2K5U7gT7KZQzU4ycf4YnPccMuucyFigjekc8TfDsL3X8QrmdrQagFiCBbCQGjx54Aaojx4FlJXQERvs4QHg== X-Google-Smtp-Source: AGHT+IH3f/AO2KcrOouNEp+VZoXAT0d4hm1tQepgrpbaR4q2VZGHNxjEyGsxgd6zkFckWFjU93NW X-Received: by 2002:ae9:f70c:0:b0:785:98a6:a197 with SMTP id s12-20020ae9f70c000000b0078598a6a197mr6788807qkg.62.1708948690493; Mon, 26 Feb 2024 03:58:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708948690; cv=pass; d=google.com; s=arc-20160816; b=xDcDKs7kUJhivBtlxwi369p/rg/p4xCzmMlYCP2DDR4gVMzlCDKnvIThiJR7lxQ9Gz X71Rpcg45iHbI6ijvH1RZufrboM1OvjzKvDpBLDXHzKBogAwfuUvPxxXkMgV/eA9wwIS rRY5dSEfwYjDksv78WrIRuoZBKkDqkQo87BqSmnT7R4v8TskoFb5FFRAWmRRtCQwmiNI of4iWurt0eqzkBTPJ0xdhNf46nOkCK1jThLQseBufK0jPjrUOzxOjL/XBZL3gtbnuseg fgUCXE2hKRNxqrEOksqMXRZpIW+4fUAVpG7/vUqNfuz4ZSFSlIViYLEDrnEqOAH5duJ8 VZOQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=D0Cpl1dRF49bF8jEtTlvGAeloBKS8mPZTSqjERNiUkI=; fh=0BvvXtqJsa83OAKpgIROwifnRYUXsVtTln5ktBPwifw=; b=IbWAUk0b5ATrEgVWcEVjnnxO8uCqZADn4FtAIc2sv6YLRn3sXK/5FfMpevByMbqgyt ABm2tMP9tw+CH6mOT5XK/2X12vVZIZTwziee+q3f+D3CEwt20iK+Gay1NkXiLE5TH6Mg 7y/f1OfzkDG4p2W+0ylrBHuXIFhsd2ApELHIG1P/XTFzd51zmaiVcRHbpAatFyxh4bVc 3UEZyJ0jHJNOY0qHZzUInBjxwfOzjX5pjf2KqGfY/vioSBFStBoI9GRscHwqgShtSKBh JWzTb4Y6iAdqcILpcCx1LqwtNTRDl98AygtStBDzOzQNE9JNF3wy69ALqy5RqjDoHpX0 YiEg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=VqGhCwMT; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-81316-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81316-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f21-20020a05620a20d500b00787b7df206esi4724810qka.201.2024.02.26.03.58.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 03:58:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81316-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=VqGhCwMT; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-81316-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81316-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4314A1C25C52 for ; Mon, 26 Feb 2024 11:58:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 278935A7BB; Mon, 26 Feb 2024 11:57:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="VqGhCwMT" Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BE155A7B3 for ; Mon, 26 Feb 2024 11:57:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708948672; cv=none; b=TVXpzndNPtckRPigGxIA7oArlozUqAJRz9sXthOB3V/IfrlBa8T1gocWwequku3gaVBye+nhjShxuXtC6Gn5OifyzHl0lvva29xmer9mz+mtoftwP4qycqWOzSaYggFf+5Xm+XSwsolbonHndEwAxVkAXIpEziuJHzDDJwkVQF4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708948672; c=relaxed/simple; bh=REpuWPsYJOuAj2YEzPdny5TFtQbhyT34ijcZuqcWDi0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lrr3am1hfOktlHfOFRqFc65tCghQzi9xDpt4fnXF5NslS1642V1t8S2s4TGzYJCFAO6BrDxJ9FYG4Pq+tH1IMBKlGyz3qhegokLujnA7jfqLOuyU2lH2B/foxr+bfCaBTyWFxIuZ8nURbrouZJyw6fnc44w3dk36R2ZbCyblgTs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=VqGhCwMT; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <788c8a64-09ed-96fd-9878-ed126b09c683@huawei.com> Sender: Russell King (Oracle) 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!