From patchwork Sat Aug 13 22:00:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 1666154 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=pP3UxetH; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=bgxIXp/x; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M4vcq5W4dz9sGG for ; Sun, 14 Aug 2022 08:00:57 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=qhTrBpRWoz6KCS+TWU905vi14bqQCbpJQTGv+sU84go=; b=pP3UxetHlzDT+V KJoPSSJuQ2WRzkvjp1a8Qo3aYOwmLAbXv7dM2S1r6znnVrnOKMtWt9kyXg2OX8NOxDw4MXKIhenBl cCqK9e0aQGMUyqbWxvanXTgWNnwHVSU1ybY+TveAoN/+VPv8l1l1n0sK1HspW9Nf2RrfNJiieH6aU I/RVT7O2qvnIeGru7tT99rYSo5N7kjrSuTGYBHFoahizZkOnvggMMj74XXesAD5xh0a8EpK3NkyXj l6TlDZtbFuQabRDQ9NpHHaiCzyZPPgrZMeF086cfIlzEk6nR1bT9FXr6ohZwFpKE+IwcD7k+aiBSw Jb5cn6TddGl7uaDFs16w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oMzBc-000TNc-Pd; Sat, 13 Aug 2022 22:00:52 +0000 Received: from mga14.intel.com ([192.55.52.115]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oMzBY-000TIE-MQ; Sat, 13 Aug 2022 22:00:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660428048; x=1691964048; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=J2stkkYmPik2bQMds1PPTKQFWYY4K6w3/+pjsawBn4I=; b=bgxIXp/xs6uqFfuM6aAWeTAoUIo1/VNWQ6sXhCQ1i4dMlgfFeE9h0qQB 5zs/rFahDROxg4W15UVWXO0hHmUrz8kHLF9CDRMc6hcafEqXJq1FyK+8m p+dXT1NlM83o/3eDKqDGK9MZ+6RLlClAGL2FNEJanAXecp4YmHZ0lC83Q QMs+bC97GQslZQouN58C80Ugw1tJEpcbNL42y/xHFOiE00cDvffvMJ2HZ VYTRsIPbu+aKBA1HtjsBeIKsJ/jgtdwj4JScBynUXhl2ycUHdS1VMUaZO Wg8VYDh3IwNX281LAoscoFBcV5GJCtyKch5RXH5u/h+mQIAv1UZj8e6tl A==; X-IronPort-AV: E=McAfee;i="6400,9594,10437"; a="291778709" X-IronPort-AV: E=Sophos;i="5.93,236,1654585200"; d="scan'208";a="291778709" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2022 15:00:42 -0700 X-IronPort-AV: E=Sophos;i="5.93,236,1654585200"; d="scan'208";a="635047705" Received: from tsaiyinl-mobl1.amr.corp.intel.com (HELO localhost) ([10.209.125.19]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2022 15:00:40 -0700 From: ira.weiny@intel.com To: Andy Whitcroft , Joe Perches Cc: Ira Weiny , Thomas Gleixner , "Fabio M . De Francesco" , Andrew Morton , linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, x86@kernel.org, linux-xtensa@linux-xtensa.org, keyrings@vger.kernel.org, linux-ide@vger.kernel.org, linux-block@vger.kernel.org, linux-crypto@vger.kernel.org, linux-media@vger.kernel.org, linux-edac@vger.kernel.org, linux1394-devel@lists.sourceforge.net, dri-devel@lists.freedesktop.org, dm-devel@redhat.com, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-rdma@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, nvdimm@lists.linux.dev, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, kgdb-bugreport@lists.sourceforge.net, iommu@lists.linux.dev, bpf@vger.kernel.org, kvm@vger.kernel.org Subject: [PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated list Date: Sat, 13 Aug 2022 15:00:34 -0700 Message-Id: <20220813220034.806698-1-ira.weiny@intel.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220813_150048_831036_70734D68 X-CRM114-Status: GOOD ( 12.91 ) X-Spam-Score: -5.4 (-----) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Ira Weiny kmap() and kmap_atomic() are being deprecated in favor of kmap_local_page(). There are two main problems with kmap(): (1) It comes with an overhead as mapping space is restricted and protected by a global lock for synchronization and (2) it also requires global TLB invalidatio [...] Content analysis details: (-5.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [192.55.52.115 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Ira Weiny kmap() and kmap_atomic() are being deprecated in favor of kmap_local_page(). There are two main problems with kmap(): (1) It comes with an overhead as mapping space is restricted and protected by a global lock for synchronization and (2) it also requires global TLB invalidation when the kmap’s pool wraps and it might block when the mapping space is fully utilized until a slot becomes available. kmap_local_page() is safe from any context and is therefore redundant with kmap_atomic() with the exception of any pagefault or preemption disable requirements. However, using kmap_atomic() for these side effects makes the code less clear. So any requirement for pagefault or preemption disable should be made explicitly. With kmap_local_page() the mappings are per thread, CPU local, can take page faults, and can be called from any context (including interrupts). It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore, the tasks can be preempted and, when they are scheduled to run again, the kernel virtual addresses are restored. Suggested-by: Thomas Gleixner Suggested-by: Fabio M. De Francesco Signed-off-by: Ira Weiny Reviewed-by: Chaitanya Kulkarni --- Suggested by credits. Thomas: Idea to keep from growing more kmap/kmap_atomic calls. Fabio: Stole some of his boiler plate commit message. Notes on tree-wide conversions: I've cc'ed mailing lists for subsystems which currently contains either kmap() or kmap_atomic() calls. As some of you already know Fabio and I have been working through converting kmap() calls to kmap_local_page(). But there is a lot more work to be done. Help from the community is always welcome, especially with kmap_atomic() conversions. To keep from stepping on each others toes I've created a spreadsheet of the current calls[1]. Please let me or Fabio know if you plan on tacking one of the conversions so we can mark it off the list. [1] https://docs.google.com/spreadsheets/d/1i_ckZ10p90bH_CkxD2bYNi05S2Qz84E2OFPv8zq__0w/edit#gid=1679714357 --- scripts/checkpatch.pl | 2 ++ 1 file changed, 2 insertions(+) base-commit: 4a9350597aff50bbd0f4b80ccf49d2e02d1111f5 diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 79e759aac543..9ff219e0a9d5 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -807,6 +807,8 @@ our %deprecated_apis = ( "rcu_barrier_sched" => "rcu_barrier", "get_state_synchronize_sched" => "get_state_synchronize_rcu", "cond_synchronize_sched" => "cond_synchronize_rcu", + "kmap" => "kmap_local_page", + "kmap_atomic" => "kmap_local_page", ); #Create a search pattern for all these strings to speed up a loop below