Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp939733rwe; Thu, 1 Sep 2022 09:50:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR71PVc7BDJHjwvUst00hAx3oVr41yrNR3NMefvZfqz2mMo70kJlBQ2fqX1p2/4nfyJFMsaa X-Received: by 2002:a05:6402:1d55:b0:440:7104:240c with SMTP id dz21-20020a0564021d5500b004407104240cmr30270726edb.207.1662051009157; Thu, 01 Sep 2022 09:50:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662051009; cv=none; d=google.com; s=arc-20160816; b=VpE2cwItU2n8jIhDjGa8PC8BsKpswE8i/EpXeKdwstY5iwkGJbcVHokD0UsIsUthEf z0CUVfKlnV1DBhao16scohbfdWT0CvUMnscf52bqnMw1sQFALiqR4XU+LILmiOiUVnyC 8Bk5yYUemETYdAyI1IC3Z8eJr2E0eYThNh+LiJkDvYRaTlq2rxIwzevEfwH2rDrIoCwn tLxnOwEWzJEI4VBRCEeHDN2PYBTsjy2uiK/T7xBwtj6/QpNvF116lT+ySAT851pfRD4o leNLqPTu1LG1H3fRt0vfc8FmQm69DjiHEFrnMZOtq6c/IUAtgqVA2iDnttPULLWJvUyA fSDA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sm81rFnMC95UT/sLYUuNGPmK2vB2Ge/WfYCIgeR1caI=; b=AZLcWRjIpxFu90+WB7Efoe1DhHUN7jcHzGKJaC32XZaz5XM5O95XEZm1zEu2SM370u pB56rZWJ/L6U+3EYRsLit4lIOvXGXMBAOkVKgZ7wDKbsQ+cRsdCpnwddtSVNPs+VUw3H Ppb0VM91Qy6M8wu0mwNL6kgv2V79k0u1ROGFZUE96e57xc/XRrSc8BOPrBohB8qCy7UJ uXdcfgAcZDB4LAEtdq1hl3Gy+KBckTZQsGQP9/z1PLBOTui0H7cDI70+yU050puN90fv bU6ryhX+ihgdDX1RSMTT0//7g2/xi55mJsTIY4oZgGUxpJ12yCvipAyp9TbTFmXiB9iU akqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZYilaImc; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb19-20020a170907961300b0073d6a7e6662si14308020ejc.798.2022.09.01.09.49.42; Thu, 01 Sep 2022 09:50:09 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b=ZYilaImc; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234655AbiIAPoj (ORCPT + 99 others); Thu, 1 Sep 2022 11:44:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234406AbiIAPo1 (ORCPT ); Thu, 1 Sep 2022 11:44:27 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 924D78B2C1 for ; Thu, 1 Sep 2022 08:44:19 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id qh18so15290948ejb.7 for ; Thu, 01 Sep 2022 08:44:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=sm81rFnMC95UT/sLYUuNGPmK2vB2Ge/WfYCIgeR1caI=; b=ZYilaImcLXiDpt5s0mImwJWlARkse5J910Tiofph6MltZYXKQN+QY5OWEAsC9WnOQx IOoU5OHcy8IC2Lk+jlGxguZCXy3mfuc61+dekre9oc0ZN+IBf1WTqLcoH3ceNiQB9VWA WqTqjz7HdtHkOIDrtlmnmcmEToZh+aMxB/3iT5wuzhPn+jiq238dTs797RjbgHmz2aJN BQndNJsOK+FEQMQQSxAK8x6AiJR6lG2wHyZzJedKE+vTh8nlQzU8UUbcvJoGJPvQguiD m7FQpPE7Ua+WtHbr8Y+sVX1bob9c2JBnOc4Mr4AkVuC3k7pq5bR4/abFDmZh97uWgxZm bL+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=sm81rFnMC95UT/sLYUuNGPmK2vB2Ge/WfYCIgeR1caI=; b=DdXIhdvd9qC3M/+WNlaM8JdI9xiGh4nistk7TavYnkWdwUnLgIyfQnU7cdDPJ2yqeA rY9f6+MPPq9Tq8yiLXDc2xT8zWOMOZ8/avRMinq7RP4ENwlZ5cxq17EBIornR/dQ+75w t7eCELIOl9p4Sq+bXBsPecrv8xvgMeZe/CLh65oRHMwFGpj5kAwkX3DU55tMMUfEJ57N 7yMRMY29w/bsgUjZ0ewas5GDjfp9bsJS2vPRb2vWDDDY/p/i/odoLSMmKSVYoHZLS9Hi oNi+LN03hveJnhvj7dKnNtHdcgvuI5ky3C7/vR12d/PvQSctoEmM6N9gnqsflDmR0sv/ mpYw== X-Gm-Message-State: ACgBeo0aPRQfVvLbeKt4pnMiFClxq6lQJRyxv1mDbCgw5XpouGLb9Q5C I651PC5/QTFpXq76G6Gy1jE= X-Received: by 2002:a17:907:7283:b0:731:60a5:5fc9 with SMTP id dt3-20020a170907728300b0073160a55fc9mr23798439ejc.51.1662047058085; Thu, 01 Sep 2022 08:44:18 -0700 (PDT) Received: from localhost.localdomain (host-87-1-103-238.retail.telecomitalia.it. [87.1.103.238]) by smtp.gmail.com with ESMTPSA id g6-20020a170906198600b0073dc6def190sm8576682ejd.158.2022.09.01.08.44.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Sep 2022 08:44:16 -0700 (PDT) From: "Fabio M. De Francesco" To: Derek Kiernan , Dragan Cvetic , Arnd Bergmann , Greg Kroah-Hartman , Michal Simek , Ira Weiny , "Venkataramanan, Anirudh" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: "Fabio M. De Francesco" Subject: [PATCH 2/2] misc/xilinx_sdfec: Replace kmap() with kmap_local_page() Date: Thu, 1 Sep 2022 17:44:08 +0200 Message-Id: <20220901154408.23984-3-fmdefrancesco@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220901154408.23984-1-fmdefrancesco@gmail.com> References: <20220901154408.23984-1-fmdefrancesco@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 kmap() is being deprecated in favor of kmap_local_page(). There are two main problems with kmap(): (1) It comes with an overhead as the 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. 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 and still valid. Since its use in xilinx_sdfec.c is safe, replace kmap()i / kunmap() with kmap_local_page() / kunmap_local(). Cc: "Venkataramanan, Anirudh" Suggested-by: Ira Weiny Signed-off-by: Fabio M. De Francesco --- drivers/misc/xilinx_sdfec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c index 4b1d82ae7312..cb9506f9cbd0 100644 --- a/drivers/misc/xilinx_sdfec.c +++ b/drivers/misc/xilinx_sdfec.c @@ -636,7 +636,7 @@ static int xsdfec_table_write(struct xsdfec_dev *xsdfec, u32 offset, } for (i = 0; i < nr_pages; i++) { - addr = kmap(pages[i]); + addr = kmap_local_page(pages[i]); do { xsdfec_regwrite(xsdfec, base_addr + ((offset + reg) * @@ -645,7 +645,7 @@ static int xsdfec_table_write(struct xsdfec_dev *xsdfec, u32 offset, reg++; } while ((reg < len) && ((reg * XSDFEC_REG_WIDTH_JUMP) % PAGE_SIZE)); - kunmap(pages[i]); + kunmap_local(addr); unpin_user_page(pages[i]); } return 0; -- 2.37.2