From patchwork Thu Jan 26 20:07:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 48878 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp469819wrn; Thu, 26 Jan 2023 12:26:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXvRJwyj0siGsubH9pd/Xz8YJzpB8w7wI/4AHBb5RN1I+Lu04C+meIHf+TtA/c5kAN3+/vAp X-Received: by 2002:a17:906:8618:b0:877:5772:25f with SMTP id o24-20020a170906861800b008775772025fmr34448366ejx.60.1674764787732; Thu, 26 Jan 2023 12:26:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674764787; cv=none; d=google.com; s=arc-20160816; b=JiKbBoE9+3lsW5/AkeIvw0rZiufBPW1iwuqh9MZoA8s3xkQz7334Idzi5gtP2el6Fk TX3sVTpKIK/G89drzkAyG0CFSUjUMekmGoqMOD9pbv/M0GYyq4X3rxhj/Hxq1zaH+Zwa Y3al5d1PlfGo5kg4++3zeCA4W4kbdLdFqAKkPkajqoPa6nDthHwA0bo6CC2EDR77qvC9 Q8qeYxwetXMoLfxsZv/QXJz+GWu8s0AKISmlqKbxUtadsz7vh4DDfXSR7fmRv7JdOFgL m96FWMqpt6W8yUXFhhL6y9hj99O8Aw0PlDmmlY+wDO/pB0EgvAJ8AcwnsnmstL3EPzwT LUKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=JzBJfIDuJxgLM6ciBuV8d8uL0pRgiX7zCopdrnYh1tA=; b=pvoydxuS/ycW9gIOl9IArkBcQ6v2CErV3i8JOEWHs1Vji1b0wVvm//OtDGQ6J3AOKu weDnUFoK3F+9GG8/5sVN0WOWx00jmvMHyiLUcHHs4/HuK1ESaUZCr0qwGqn888jPtXg2 cxUJiVm2vb1mnO09s4x5zlL9q9DHn8WbDf5EmAMrRI0EqdtXKmFJ7H4DYRsqOZjQ9kzs vE9fhX2Of+ovZON3hSF4HK6UzRVlrW53enlNznjQnRFU6wMLrwevcDWo+aRo6Bi9bWNr m99LCk1XgMaMfuZKdJiKEiudumD2x/WkP6a0TwLJXO7evvSssVradepBjB0aF2YnqCfn cJsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=aYC7folr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ms32-20020a170907622000b007d82520def9si2225617ejc.503.2023.01.26.12.26.04; Thu, 26 Jan 2023 12:26:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=aYC7folr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232556AbjAZUHm (ORCPT + 99 others); Thu, 26 Jan 2023 15:07:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbjAZUHk (ORCPT ); Thu, 26 Jan 2023 15:07:40 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66C262B0A4; Thu, 26 Jan 2023 12:07:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=JzBJfIDuJxgLM6ciBuV8d8uL0pRgiX7zCopdrnYh1tA=; b=aYC7folrZF7BT0AE63Id9B1VOq Yw4JMILcB6T9obNoUkplrvU80D5/ogqAhcrydQwJ7kDAhCjSIcRnolxUBjm6x4asbkR/X7k3xgbJr Jpaku2xxcRjq2J3ZaR6JUmSA4t/A7b2NA4w6+0kErP08/Eqb2zxIE4no73xKOY0/+cdLN0qsAH7ev bbpTIGbZ/edafMwk/seG2Fhow2nUmhjQJgO2K8/P3ziRBHF0I2o+BzApeiC3MMV2brjHmkME+5DYJ BOs6iKHNuSbp8tWtkaP6+piDDmMiTuDqyEF57n9aNxa0DezAGYPwCA1AIbnKI0VEdTxLVVXvVsJ6v gSP6QANw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pL8Wv-00738y-AQ; Thu, 26 Jan 2023 20:07:29 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton , "Fabio M. De Francesco" , Ira Weiny , linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , stable@vger.kernel.org Subject: [PATCH] highmem: Round down the address passed to kunmap_flush_on_unmap() Date: Thu, 26 Jan 2023 20:07:27 +0000 Message-Id: <20230126200727.1680362-1-willy@infradead.org> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756118161825429018?= X-GMAIL-MSGID: =?utf-8?q?1756118161825429018?= We already round down the address in kunmap_local_indexed() which is the other implementation of __kunmap_local(). The only implementation of kunmap_flush_on_unmap() is PA-RISC which is expecting a page-aligned address. This may be causing PA-RISC to be flushing the wrong addresses currently. Signed-off-by: Matthew Wilcox (Oracle) Fixes: 298fa1ad5571 ("highmem: Provide generic variant of kmap_atomic*") Cc: stable@vger.kernel.org Reviewed-by: Ira Weiny --- include/linux/highmem-internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/highmem-internal.h b/include/linux/highmem-internal.h index 034b1106d022..e098f38422af 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 } @@ -227,7 +227,7 @@ static inline void *kmap_atomic_pfn(unsigned long pfn) static inline void __kunmap_atomic(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 pagefault_enable(); if (IS_ENABLED(CONFIG_PREEMPT_RT))