Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1600136rdb; Wed, 31 Jan 2024 03:49:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFl2jrcwqYcicN4cpCexKFjFwGfv+lkZZ+7qAibdVabQEH988G30EeFWBiYn0QlrCknpq8U X-Received: by 2002:a17:902:edca:b0:1d6:fa0b:4949 with SMTP id q10-20020a170902edca00b001d6fa0b4949mr1441743plk.38.1706701756725; Wed, 31 Jan 2024 03:49:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706701756; cv=pass; d=google.com; s=arc-20160816; b=GkQMfCJKHMkwoJP1b3PTHpchoItfGFgKEWR7LfECD20kLEL6x0CyiKo2Z1hOE96v+U JD0KqGpX9oRTwjPpUrdU2J9n4vGYZ8/Iyl0+qKcxLnTYLPDYPwGARLx/LdMpyzJrxM+G WuJsru5cOk9T5sP0Qxc3ppE3X32eZkUVL6kItq69Tvc9vGFIF+qz2V++Lde80lsklewV Xzq1Ho9fODuw3fPwjaZAFcwQg+hJzZGxj1GNBTrBBx5DfrOAFTMhf/Vj5OFUClHzAJB5 UWDOjzK6GebCYk0AjzpsJxSnhixMwQbdzY23a6sq4BSlTvUkJSC02x6Zk0mECTALng/o NBnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:cc:to:from:date:references:in-reply-to:message-id :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:feedback-id:dkim-signature:dkim-signature; bh=jT9sL1YmAihadqrUHigLsBRY9XsxrsPNsnYd6WguPNA=; fh=U71/GqOGkshi67QSCd0RslhKY9OIouwmrYIiM7en7Ag=; b=i96L1WjyUEKTj3wFNzg1rFsqoF0gzPQ46AQl8y33/as2usjWltBAu0c4V7XXZUtuTa hTiBnauAYt86ep4D/MDZol8vFhyiPeJj2HC+KTmTQKE9KS8S9ImFrlPW3OnQRoS4BXne smsFyDWz2Nx5yi+e/QyJfEilQpCmH/xakMU7MgRw6LgZi7RMqWyRdQtiEhydAfktX2Wt zbbQNKpNkV5aBHFd9BmTj+R647fF+tD67R+lAL7IDLQpG6X5x7TZ79kBDXZ9TpbL1hAd m5CgiAA+Mn/DacpCyQMyjeBDD9K8NnhZ3eIHIfBO/2q0Z7kUo6x9YJhrPdhmuugCY1uR 1ELA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=c3ZpuaVm; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=g729DEvY; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-46379-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46379-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de X-Forwarded-Encrypted: i=1; AJvYcCWgGtwtQ0xWynCf83eE5W7QNfabKAD6iitv2StrC7Z2KJPTsHLRSb6yVg2VocRMcHsWXKZV2lMl47Qwh5U7DkW1YUTJ0aBKdWaksSviyg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i18-20020a170902c95200b001d9242fe885si1845580pla.62.2024.01.31.03.49.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 03:49:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46379-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=c3ZpuaVm; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=g729DEvY; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-46379-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46379-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id DD41D287AA0 for ; Wed, 31 Jan 2024 11:49:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C15C878683; Wed, 31 Jan 2024 11:49:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="c3ZpuaVm"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="g729DEvY" Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (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 0E9EA762CD; Wed, 31 Jan 2024 11:49:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.111.4.28 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706701743; cv=none; b=GYEcqHOGqcxQMmmAcNSUOSErICIsONQtPXJL5ODKKokd32rCxaaVi3mGIALWy1AcLpK6dnqMpqN01672HyKro6YAf7G6eQNzgyPxXC1P0IzwtEa2EL/5akAhquGQru1//gzqk9fuIhtbQdGdSMqCk0zawiyQlSJ6IOZQ1UbCdDA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706701743; c=relaxed/simple; bh=TRuURq3q59U4DW7sJNnHZgy5fStIIlr8tOaoqxV0LV0=; h=MIME-Version:Message-Id:In-Reply-To:References:Date:From:To:Cc: Subject:Content-Type; b=HlSK8NAAvrO8wyNzlohHGNtYVVdn3tIJmh3dbkuJMMDnHEgQ+fHT6GEDj8JSvLkevcZhfKX+ME/MzS0yKO6n+EG3gj4T3EHhbN9jNsT4Z/fF3/ONa4IrEej5dgDxiqBt02S4OOlsL2WT4A7Cp1pkmRII5fOe1jvElND1I461yrQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de; spf=pass smtp.mailfrom=arndb.de; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b=c3ZpuaVm; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=g729DEvY; arc=none smtp.client-ip=66.111.4.28 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arndb.de Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 12BB15C0159; Wed, 31 Jan 2024 06:49:00 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Wed, 31 Jan 2024 06:49:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1706701740; x=1706788140; bh=jT9sL1YmAi hadqrUHigLsBRY9XsxrsPNsnYd6WguPNA=; b=c3ZpuaVmDri3q/zgzFGGbYmnlr v5KtWlex5deya16dz2doLnWM2HemO/U/HByq33bviMR/T9HI0G4pZbgv4fujo9oD 4QK93CVIvQkIYCM8siJl8h9UENtfj2T1ztvpKQM9P6dWEW5DR5bkX+vQnUsf8tqT 0hNDIzLs6ENHxC/iAcdfHFMVWJCISYq5FVd+w6pLyPpqSTdLmQqlaiy5EqwSpLJ5 gNPLoYMEn10BUTsE94g26AlDSc2/488D23UFbD2R0/6gFfPYw9jPh7iZQMJjmQ+/ apB3+jOj6eIns2ECguBdY41z7tomKGgvuiWfN8rYTr4XqPCk6zLXwhYppZ3w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1706701740; x=1706788140; bh=jT9sL1YmAihadqrUHigLsBRY9Xsx rsPNsnYd6WguPNA=; b=g729DEvYgTEUVfuUErlIPFGRGtDR83GKuPIeKNPF5qqn uxdYFRuuSWq5zUBAu1MrgjdwaWnyLJ9PdmIyPfNtH5IW66LqliMwHzqIIXlDGrm0 Uya8VqEUYCW/lzuZU7AD4ecc8R896HXsmgWjAKdJGq0X2J6TCf31hka+6Y6YXWn8 MFJ82gEIkX3+5d7zGmCg9HtytLi6n3WSXSrlXmey5sF4m/S51mVDHvETHyBsv2Nk 41VDjckeTDlfGbJGSzxMphJ79B091QKB5nkLzz0A/TvXhKLIglD+l/2i9ajq8zOd XQ3PSA/Udf7DrrGQSiXZbNrTxpo7lMwZvEKqt3679Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrfedtledgfedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 270C7B6008D; Wed, 31 Jan 2024 06:48:59 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-144-ge5821d614e-fm-20240125.002-ge5821d61 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <5e55b5c0-6c8d-45b4-ac04-cf694bcb08d3@app.fastmail.com> In-Reply-To: <20240131055159.2506-1-yan.y.zhao@intel.com> References: <20240131055159.2506-1-yan.y.zhao@intel.com> Date: Wed, 31 Jan 2024 12:48:38 +0100 From: "Arnd Bergmann" To: "Yan Zhao" , "Linus Walleij" , guoren , "Brian Cain" , "Jonas Bonn" , "Stefan Kristiansson" , "Stafford Horne" Cc: Linux-Arch , linux-kernel@vger.kernel.org, "linux-csky@vger.kernel.org" , linux-hexagon@vger.kernel.org, "linux-openrisc@vger.kernel.org" Subject: Re: [PATCH 0/4] apply page shift to PFN instead of VA in pfn_to_virt Content-Type: text/plain On Wed, Jan 31, 2024, at 06:51, Yan Zhao wrote: > This is a tiny fix to pfn_to_virt() for some platforms. > > The original implementaion of pfn_to_virt() takes PFN instead of PA as the > input to macro __va, with PAGE_SHIFT applying to the converted VA, which > is not right under most conditions, especially when there's an offset in > __va. > > > Yan Zhao (4): > asm-generic/page.h: apply page shift to PFN instead of VA in > pfn_to_virt > csky: apply page shift to PFN instead of VA in pfn_to_virt > Hexagon: apply page shift to PFN instead of VA in pfn_to_virt > openrisc: apply page shift to PFN instead of VA in pfn_to_virt Nice catch, this is clearly a correct fix, and I can take the series through the asm-generic tree if we want to take this approach. I made a couple of interesting observations looking at this patch though: - this function is only used in architecture specific code on m68k, riscv and s390, though a couple of other architectures have the same definition. - There is another function that does the same thing called pfn_to_kaddr(), which is defined on arm, arm64, csky, loongarch, mips, nios2, powerpc, s390, sh, sparc and x86, as well as yet another pfn_va() on parisc. - the asm-generic/page.h file used to be included by h8300, c6x and blackfin, all of which are now gone. It has no users left and can just as well get removed, unless we find a new use for it. Since it looks like the four broken functions you fix don't have a single caller, maybe it would be better to just remove them all? How exactly did you notice the function being wrong, did you try to add a user somewhere, or just read through the code? Arnd