From patchwork Thu Jan 26 14:11:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fabio M. De Francesco" X-Patchwork-Id: 13117181 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5E89C54E94 for ; Thu, 26 Jan 2023 14:11:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 066A46B0071; Thu, 26 Jan 2023 09:11:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 016566B0072; Thu, 26 Jan 2023 09:11:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E20A56B0073; Thu, 26 Jan 2023 09:11:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D03546B0071 for ; Thu, 26 Jan 2023 09:11:54 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 883C3A075B for ; Thu, 26 Jan 2023 14:11:54 +0000 (UTC) X-FDA: 80397138948.12.FC9A3AC Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by imf04.hostedemail.com (Postfix) with ESMTP id 2D0724001D for ; Thu, 26 Jan 2023 14:11:50 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=KgkGYKmz; spf=pass (imf04.hostedemail.com: domain of fmdefrancesco@gmail.com designates 209.85.128.42 as permitted sender) smtp.mailfrom=fmdefrancesco@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674742311; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=+b5T9XrtD/RFlpp0uwB7/1Pl9LZdmUTgBTpWnQxQNg0=; b=UO64LNRANThzkHSRtIvAgiH1I7Y/30dUXlZm6jOzpDEO9JJ/9XDjWUc3rgSM9WrQbSKeqO 6ELb7p9XMTNnLUVHVcb9hQrlctJf6XqJV/Yj/mNXwKgMbsMcSCL55znDWGMNYvF0qDBaGv s7k5t77HNoJLRIm0U5Q9C1Jun5ykjQ4= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=KgkGYKmz; spf=pass (imf04.hostedemail.com: domain of fmdefrancesco@gmail.com designates 209.85.128.42 as permitted sender) smtp.mailfrom=fmdefrancesco@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674742311; a=rsa-sha256; cv=none; b=tkg7EZFbsBYVPgd/fpz9jGG7kvUl/tCBGj2FZ/1+59y08bIPTFhBRBA5Ss1CBZWI40PnMb C5n0BETUINc9np0t8VMpvvdxaI6++kKzQK9SnnM76zgOE75OFpcfoYjyG2UcInSyy/h1KJ LhYfMJyyy3scM4LKR8wLPo00FtM95qY= Received: by mail-wm1-f42.google.com with SMTP id q10-20020a1cf30a000000b003db0edfdb74so4016751wmq.1 for ; Thu, 26 Jan 2023 06:11:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+b5T9XrtD/RFlpp0uwB7/1Pl9LZdmUTgBTpWnQxQNg0=; b=KgkGYKmzHk+umIchVB+AffMuOBKKGy11miVrlbRmgjBYfNUc1d29XbltzlN0TUmmoG AOKE3A8VxQeffJ5oKoZ1OSSAz70K7j5AEHM0TjF/s5NOjKf+czL0ikMaOu/4oEQd7wS1 x3/OT0g7gbMfgnKjL0edCYs00EMHlyGGdd4TsAIFxfyb1O2gKjEUvvn/aBaTaWh+iQ7a Bd/bZtN7MzwfJgplXlEAtYHuc6WkrJlRnBW8aF3kqTqNcoauGSxVytMD+NRcoaVfYzkZ aAmS3dNgmakfOBGkTV0wWMxPMvZpDbv6S7ZdGpTButK1VL8S58TDTNlYo9cyn0E7IVlE FWVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+b5T9XrtD/RFlpp0uwB7/1Pl9LZdmUTgBTpWnQxQNg0=; b=I1qqBgUTsbEcHZIwoO0jELpgsIBZCMbrWXOdwrOWhegWw7kI6Fvx8AGLPahoUCo6WS 99DV4Y+bs2mvuZbERZlCg9Mq5URh6w9WWdwuME03UGjzoWynGEzhGOten2hZbphQFDZC quXOPiordo2vhjeN+lSgIo9EikBkr5lNEZafqrtaCIv+ct6GzG9vpDW8wof2ggEYmSso H7V3VpGg0jXeB7K7g5sqzcrP3yNZGcLG+6QQobsMQnadk/fI3cJOjePwrohYm3OC2Rku KC1c9mmAG7HHp80d71MFeG+Mv10xVrSOexQI5ccU04eK2poRFx8NZ9YojMdiNG/tKCh1 7DTg== X-Gm-Message-State: AFqh2krduPOmTl1pktgzE76Ba7tpVfKxUsGwkqu829oOybsPViJE6GUn OO4lMlYzcRYdvwyIecnZnT8= X-Google-Smtp-Source: AMrXdXs25gZoS2pK9ThpGF3J8OGsM8W2ixFAUZ2vWOac6jb6rx2vYC15dLav7KyTjl9KgCtCZ4aLeg== X-Received: by 2002:a05:600c:5390:b0:3d9:a145:4d1a with SMTP id hg16-20020a05600c539000b003d9a1454d1amr32611789wmb.34.1674742309470; Thu, 26 Jan 2023 06:11:49 -0800 (PST) Received: from localhost.localdomain (host-79-44-17-213.retail.telecomitalia.it. [79.44.17.213]) by smtp.gmail.com with ESMTPSA id e38-20020a05600c4ba600b003db11dfc687sm1532413wmp.36.2023.01.26.06.11.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 06:11:48 -0800 (PST) From: "Fabio M. De Francesco" To: Andrew Morton , "Fabio M. De Francesco" , Ira Weiny , Sebastian Andrzej Siewior , Alexander Potapenko , Andrey Konovalov , Tony Luck , Bagas Sanjaya , David Sterba , Kees Cook , "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Al Viro , Helge Deller Subject: [PATCH] mm/highmem: Align-down to page the address for kunmap_flush_on_unmap() Date: Thu, 26 Jan 2023 15:11:44 +0100 Message-Id: <20230126141144.11042-1-fmdefrancesco@gmail.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-Stat-Signature: j4dfxhwmw1614bfik9suxcdxx3kmykoj X-Rspam-User: X-Rspamd-Queue-Id: 2D0724001D X-Rspamd-Server: rspam06 X-HE-Tag: 1674742310-858627 X-HE-Meta: U2FsdGVkX1+DEgxjVcZD49iT/agbmQxLfIzvSBsFN2wwKwJbFArye4zAewZkEWjdAwyu7mNWgcPWKYovgTsvO0F5vXzIcJ9tmQTwRxYC9MwgsxVIs4Ya9xovakQTB+9oHUVSfn9okzbI/LVuORXSpibTeY8+tXozodxcWfn5+GGE4BeQIVdmhvX/pgWwHwknDVqk8U+BsmcNFy6JlMoGMpHihBabxwSFG0Gooxw7QXqGozWmHWwk/G+muBvPXM/5fWNkzqHKDlnH72MdZw3QHCxMdLgTX/qoC2B8kzpxzhlc98F71IPrFKgF2V7pNcX61E3VP3nySLGQZdwkKmAKbFjVAR+ltIggXvEhwkHqU0q3z/ibyYf+4f15f7wN0sM1DA/Jr1xWw6/XUjFnZ2EMkrZs43mtRbxrZbQ30swkbRrhqgodkMvgp8KcKx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zVdtrKFG+LUgLxsexUH5Le61Gv5QJWPtMu3R9raE2tCtFf45K4SPsxn3RBvuzhMcdEg9wU6BGgJFQ02nsEHf6KzpJphot6Vfd/gsHyuZg31/4Lr5jVNkX+Y7hg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: If ARCH_HAS_FLUSH_ON_KUNMAP is defined (PA-RISC case), __kunmap_local() calls kunmap_flush_on_unmap(). The latter currently flushes the wrong address (as confirmed by Matthew Wilcox and Helge Deller). Al Viro proposed to call kunmap_flush_on_unmap() on an aligned-down to page address in order to fix this issue. Consensus has been reached on this solution. Therefore, if ARCH_HAS_FLUSH_ON_KUNMAP is defined, call kunmap_flush_on_unmap() on an aligned-down to page address computed with the PTR_ALIGN_DOWN() macro. Cc: Ira Weiny Suggested-by: Al Viro Confirmed-by: Helge Deller Confirmed-by: Matthew Wilcox Fixes: f3ba3c710ac5 ("mm/highmem: Provide kmap_local*") Signed-off-by: Fabio M. De Francesco --- I have (at least) two problems with this patch... 1) checkpatch.pl complains about the use of the non-standard "Confirmed-by" tags. I don't know how else I can give credit to Helge and Matthew. However, this is not the first time that I see non-standard tags in patches applied upstream (I too had a non-standard "Analysed-by" tag in patch which fixes a SAC bug). Any objections? 2) I'm not sure whether or not the "Fixes" tag is appropriate in this patch. Can someone either confirm or deny it? include/linux/highmem-internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/highmem-internal.h b/include/linux/highmem-internal.h index 034b1106d022..e247c9ac4583 100644 --- a/include/linux/highmem-internal.h +++ b/include/linux/highmem-internal.h @@ -200,7 +200,7 @@ static inline void *kmap_local_pfn(unsigned long pfn) static inline void __kunmap_local(const void *addr) { #ifdef ARCH_HAS_FLUSH_ON_KUNMAP - kunmap_flush_on_unmap(addr); + kunmap_flush_on_unmap(PTR_ALIGN_DOWN(addr, PAGE_SIZE)); #endif }