From patchwork Thu Jan 26 14:33:46 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: 13117238 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 E416FC61D97 for ; Thu, 26 Jan 2023 14:33:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7F6B58E0003; Thu, 26 Jan 2023 09:33:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7A74D8E0001; Thu, 26 Jan 2023 09:33:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 621B48E0003; Thu, 26 Jan 2023 09:33:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 543C98E0001 for ; Thu, 26 Jan 2023 09:33:55 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 2B61280B3F for ; Thu, 26 Jan 2023 14:33:55 +0000 (UTC) X-FDA: 80397194430.28.94D5930 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by imf01.hostedemail.com (Postfix) with ESMTP id 748604000E for ; Thu, 26 Jan 2023 14:33:52 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=K8lyNBOH; spf=pass (imf01.hostedemail.com: domain of fmdefrancesco@gmail.com designates 209.85.221.50 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=1674743632; 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=OU0yK45p3mXhnfdYpz2kyhhGW9zSC0f2qZ+tl7+B4NA=; b=0Qgqb7tvt6our+J5kl3p/A6FA20hi3qGEtvC5foliaJQ4Af4vKOuCWcyDXyKK8Lf1e6c+w A2rK3OEmbEsATCnTM70oQVJk6CQEngeucKMEvaW642ZN/Hvr0kk72bShG2UTmj7pSI53Uu MP4dZR6K6DwIW5JUj7atVWbR88AjV/M= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=K8lyNBOH; spf=pass (imf01.hostedemail.com: domain of fmdefrancesco@gmail.com designates 209.85.221.50 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=1674743632; a=rsa-sha256; cv=none; b=mhGM7XAE+3Hyn0N/Z3Vb8Od03gFPrqqFBtmj4I8ss9wFyiGn+qnjQfcBQEgZ5OrLTwze9O jXBZ1nPjZqCUDuc5tDOmY4WnfZWG41djtGkGDfo7N6M/CLIs+VcgyPIh9DYi3AkTPO9Kyi +rO7ES3P3cYBhiRM9u47z9ffsWwTQEg= Received: by mail-wr1-f50.google.com with SMTP id d14so1955382wrr.9 for ; Thu, 26 Jan 2023 06:33:52 -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=OU0yK45p3mXhnfdYpz2kyhhGW9zSC0f2qZ+tl7+B4NA=; b=K8lyNBOHqkrf2vgJW88yrJL4+R1oQty4S4zyqscLcPy+iA9vGJ23fLFevpsIMeJch+ gV37VHJqf4IW+K+jgSndXZLkBdnF5o4I+iDwG3tXMCGnMTpKmDurLvsbeTU/JUhwyVnp aJFqAsdhmgFS2pxTxya7/wBEkmHqYEVuaSbLDIzGsq2p+p93GPvQB87G4dnMSdh9gnTl DbiQF8ZuJK3K5LyYw0x7D4kSznOw8v8/Y16POmb2e6aP3l+2KNI5ZWutUbth2YWteDPV 90sO0xxk1XVrX0yMtLjoN/WX6iInxd2FoMrc4dqRfTLrDN9rCinOPMoF5gfzCjBNldyI FPIQ== 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=OU0yK45p3mXhnfdYpz2kyhhGW9zSC0f2qZ+tl7+B4NA=; b=PP4H9wg6jRmqSaVJk3TlvUFVGc+Dlbzve06v0F3x7PeQyfdRhJJW0A517X5cgyQLm3 iVWsk5jrja4u6EuA1jGdfkhQ3queE81Ca8PjNLmu7EgKeuLzuHZFr9S1vrfVe8feOCRl ZdHYaj7YYmszyx6+rb5Jl1+gM5Bxy3cQSIDoS6ZBQHhjIZun6zle+DA4XYO75f4qVi0W unr7oCX/DPree16wRtbamcLnLk+h0eQbd3/aQOC27EDWwod59eGYNRbIbt2FAIrf0xwC KYTjt48ZPbemkIXukxZJpgU9qDV6NFIMDAXQ+kTpk0d7CFfibf1ukTVauomryzdTWqTq 3N7Q== X-Gm-Message-State: AO0yUKUJY4ltENnU+1vwHPimGkIkCcGLIrQPpHKeekPLmzqaQD1EQD2j a6J/8afFSN/rq2Fw2iSdDT8= X-Google-Smtp-Source: AK7set9NjHQcnEL9ua4giABwR5bEHZl1aD/xwybU5Nl6QekCPubmYZmj0TbnlhTgoZjaRPbAocOgwA== X-Received: by 2002:adf:cf08:0:b0:2bf:bbd1:1db3 with SMTP id o8-20020adfcf08000000b002bfbbd11db3mr5498905wrj.44.1674743631087; Thu, 26 Jan 2023 06:33:51 -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 a5-20020adfeec5000000b002bfae6b17d2sm1469495wrp.55.2023.01.26.06.33.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 06:33:50 -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: Thomas Gleixner , 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:33:46 +0100 Message-Id: <20230126143346.12086-1-fmdefrancesco@gmail.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-Stat-Signature: jq9mts8g1a7s41r4cmdzw3qxfgg51bto X-Rspam-User: X-Rspamd-Queue-Id: 748604000E X-Rspamd-Server: rspam06 X-HE-Tag: 1674743632-655245 X-HE-Meta: U2FsdGVkX1+oSnQm/+Bg1Id1Zz0FILJclYpfMCYWIhCZ374VrQFpfr5I9/xQ80eLmb929OblDmJcjsgkdzfxzJ7zOKCrfeIsC6maX//wNI/jisNkmmUwOuPDxJUAKgfidI9NIU0hexGDvdKxDD+FI71TCnmtxdig4XJFB2h/9iJWdmTHpNDgXJAgzRObR01w47khMJVPyz9KtAvoALZ0j2EskdFInVwNAMA8V2yQJME0OPDVwbR/SR/xCAD06Hvj9dSsHij4rgYMDGBTjCiLA6dzgFKZzY2WJtev9BapredgbibwCvVlyBp1jXf04gAUf24RnPQTBqdCH7g6N9m38rLX0/ZYTxcI8G15MsYJsYwngWfvNYj4tZKZ1J5x0qYJHINf55f56oq5AdD/xKfL4aPI0PC/AKu2aJQggPEvmc3hxXDFOCDI0Vquk3xz1+gdR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Dexh16LYV/KqkUnYEiYb1vfqukaBvn7jo0d3fXuZCQAPD1rH4ebM5W9hGjQjO4xeD2xx23u8Yv1Q550+zaN8Wg3whpKDRAV/TSTACNVetlq2pBvxA/yQLrFMa2hA== 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 Cc: Thomas Gleixner 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 }