From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f172.google.com (mail-dy1-f172.google.com [74.125.82.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC6153B7B75 for ; Fri, 8 May 2026 11:31:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778239865; cv=none; b=O38rBL9MZ9MNyTgmdL4NST2lqbZmX2jJbUushaIGi7Cwb0PmkJ9ixoopFZGLEJh+l0Kc7k7iS2o3S3ACJK8MNGAEQx7M+SkWXT4L3yUzKfuXaaWLWwyCQdLYZd1j3Cs5GGBbBNX4U6jdzP06N8vZBFZYol+5FwcWbn2xCOtMbdA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778239865; c=relaxed/simple; bh=BbxJFnwClrzpI9NJL8l2W8HPO2FxxlMcsmgLf6HUPsA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=D9P9WhnRa1JpyU0lM9nRXODqVJUPTi/yDMhRlO4hVGKAuklLqj/MQ+a/OfKDxc0Qux7mn8QBdO4uLTF44kwjKT/w5b0MNA0ApQOahcj1xhbOppTy0NQ9Td81dTyl4/3Jwz0C15yBcjlR25KTV6aO6AF+TTBU7OL/qYQSFLS36KI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=MyK0sl5Q; arc=none smtp.client-ip=74.125.82.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="MyK0sl5Q" Received: by mail-dy1-f172.google.com with SMTP id 5a478bee46e88-2f0ad52830cso2854108eec.1 for ; Fri, 08 May 2026 04:31:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1778239863; x=1778844663; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=BbxJFnwClrzpI9NJL8l2W8HPO2FxxlMcsmgLf6HUPsA=; b=MyK0sl5QfoWxORevjtZ2QeLcYcRFFfX2P5C+ZfNnPAcBwYAbrtrXFoK0pzeS0NUAfW +/VbZrkZfzJKq00pdEawB5wz0R2fcXAXLQWlMF7tpQy2OLnxumLpP268c4lR1L+eywxg 599ybL6qphAb4rV9TPc5k49qb9FuE03OAYYOT34bwjDUMjoCgaMm5PsbZg5gSXKGMWV6 78g2NDQqf7mD0X0/ZosXn8d9mao5sJwTXrBLvfmZs8/fo+YjlGil1bcHIAbvVC/C6CnK 5NLtt9E/0s8Bai2BLvzWWu2xZrs0J47Pb5StI/Hf4Y2WaggtTLeVPvM80p7Jl67faSm/ DU+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778239863; x=1778844663; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BbxJFnwClrzpI9NJL8l2W8HPO2FxxlMcsmgLf6HUPsA=; b=o04p9BMiQVdqHDcQf4o/zzygzmfJh8mHHUkd0CLcTXGM0bBMzZm/65cmVsstsDhj2+ fZqLi7/hLErs6tQKDCaDyVyeqZfbHriLwt8EoW6ml1pXwvz1N1ePCIt7ceN7byIz6bze mNZ07EPWABTR3FzV7MeKbLyMjhm3eIvcDgt7kojHhUZ0q67uMK6+gXx4ioxce+j9WuAW bmrCYv1A1BSUi1pUBIfhbWtdy6OOOYiI1VH7lD8rYHxxa+IyTVg5PXRsaihn4dn2ydoS gu6XN/L5iAMWfiglZlIYFV6XTfiI3/UGEI5hBHlGDZYTLf3BIMOz4NGz/AOhUcI1ktdx fmmA== X-Forwarded-Encrypted: i=1; AFNElJ/aX1hIg16ZAsnEPzTyTsI7rHU8MjRBCZpyNFP99BcAnhj1OF1g/dVbIQKnBrhSk/UGY6Cwd9MAkWPyxzg=@vger.kernel.org X-Gm-Message-State: AOJu0YxqQ4eddjGT5him72bJoChce2G1sN8FtfS36XHRHnLUSMFl7BAI VCsPRYpvTcSvDszlBTiNjMyvVnWO39bVQbB+sEncQ/LMZEweVj7GPsQXmNwsOHzRJXE= X-Gm-Gg: AeBDietRbBPrbb+h9K4d0noM8hQlf+0S7OPRHab6xoNvtQQ4l5xIZSaPffvoggHIIiG /iA2qD0yhnp8nF1Vs+ytllzhhuAsf/LaXJj4GGynTwR1QJylq2BEtJqitc0FtLUdx3gUGSXwADQ QZxvIqLw+o6rlBMU06FieBXUaRw3OyB96tBfNFeYKsLlBBdc/3zcnuVo3RYgLDhleET9oYvuMeG PpWd7Mb/GMJqEi7j5szVpokOml+2INfRGrsIitbABWzzRUF8AdltAubJEByD9Oc9+oajWyBQziN dcduMLR+5sAWLhEXlTfyn+GEhsKAb0C+sQ5qNW+hHSz0K2C+QJKlFLexTxG2q18pSzM/XdAptFy hgQc2h4rijsv1b2PezJOykWsxRoqqcdGc0f5DN16dhjQQ+fQAE4bnTo6CXdH6xEfBvi4C/bfF1b WNxSqykDkT X-Received: by 2002:a05:7022:1a83:b0:127:5c3d:bd95 with SMTP id a92af1059eb24-1318e919fcemr6049587c88.32.1778239862942; Fri, 08 May 2026 04:31:02 -0700 (PDT) Received: from ziepe.ca ([130.41.10.202]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-132781103e7sm2331622c88.1.2026.05.08.04.31.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2026 04:31:02 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wLJQ4-000000002Qs-3y7p; Fri, 08 May 2026 08:31:00 -0300 Date: Fri, 8 May 2026 08:31:00 -0300 From: Jason Gunthorpe To: Jianpeng Chang Cc: Robin Murphy , m.szyprowski@samsung.com, leon@kernel.org, kbusch@kernel.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] dma-mapping: remove bogus test for pfn_valid from dma_map_resource Message-ID: <20260508113100.GA9285@ziepe.ca> References: <20260507032120.4072283-1-jianpeng.chang.cn@windriver.com> <2dcc29d6-a4a9-4fdf-861d-312941ab0f07@arm.com> <89094011-fe78-40f9-9695-d50ee19167c5@windriver.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: <89094011-fe78-40f9-9695-d50ee19167c5@windriver.com> On Fri, May 08, 2026 at 06:01:01PM +0800, Jianpeng Chang wrote: > > As I said last time, I think pfn_valid() && !PageReserved(pfn_to_page()) > > would be enough for what we want here, although now it's strictly under > > CONFIG_DMA_API_DEBUG, perhaps the overhead of memblock_is_map_memory() > > might be less of an issue. Either way though, now that it's all > > channelled through the single dma_map_phys() path, it would probably > > make sense to consolidate any MMIO sanity-checking into > > dma_debug_map_phys() anyway :/ > Thanks for the suggestion. Move the check into debug_dma_map_phys() is > indeed better, and I will replace pfn_valid() with pfn_valid() && > !PageReserved() as you suggested. I'm not sure that is right. IIRC pfn_valid() is true for ZONE_DEVICE P2P pages that are used with map_phys but never with map_resource. PageReserved isn't enough to fix it. Jason