Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp225488rwl; Wed, 29 Mar 2023 00:26:02 -0700 (PDT) X-Google-Smtp-Source: AKy350ZTReagV/LeZW/gqCuyHJK22oINuzPHzPvumx6pJKGMxcy3zGfiK0C8g3TnqJ2EwyZCNsOx X-Received: by 2002:a17:906:4bd7:b0:930:3840:1c4d with SMTP id x23-20020a1709064bd700b0093038401c4dmr19462032ejv.32.1680074761959; Wed, 29 Mar 2023 00:26:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680074761; cv=none; d=google.com; s=arc-20160816; b=U5T10zYnAoDBsvBuIVdcQCiYoG+zPOg6OKvJrZ0VpGI9g/ObYwcJ9y83C12398cA2M JtBf+A31oWIYq3A6/s4uUfm0EPuTEv8V8Lc9gO9C8oI7TLWI11NjjWxL6U9KhJtrRxMY /zKuo6nLUq2p5f+hReQAiH1HPomswka0wG06eBprWgl6+4Sa4CwRyjroMSNHk2/Uba10 NHdWHEbrePrLLAXs0Lz5FKqR1deNR8QRD8pvZHBlxTVtwUDp3TB8kxfS0VehoBjA105a zGLMdBErAmPukFweQlF+7IZSLCQcY/MsLOJLXj55pWDXsaUC0SwLXFWYm3nh4HgDIMBI jW6w== 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=yT5GZVOvhfnUIBY2ARE+vAtUXWQaZu9+y3E6YcXmSew=; b=BZVRAC+xbBKjZFDSpYeJijPxCVTyZAUaFnryfp7ZJjDfyUBHlDyBmm0xI9pkJHfcli C08ZySGhvu8GQuuSgtS27MoB/qx8FfUwakxI/j3kt7j+NbcSpcl1Pk0JJammPeJbIqG7 m8VQ7yR6/cP9RMF7hNfDCaTd44GrsYm26ZgYMm4SiYG0EOvbH+AFVC6GWE9QD0wR93jt T+FEs1AO6PTrYK8VkBSLeHRpTR3qI9Wlf6Ti8vwoVCApubcKOqzwuxXN/vvfF69jeDty 6cqYhm6EikftFaLWkuN/SRCSuy+SWvSqJ4noeomoFMdrBMQOHVnjhzsztMbGR4lOVMdL 3jpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dPLqZ93q; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d7-20020a1709064c4700b009332cc3b334si26811117ejw.59.2023.03.29.00.25.37; Wed, 29 Mar 2023 00:26:01 -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=@intel.com header.s=Intel header.b=dPLqZ93q; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229971AbjC2HYf (ORCPT + 99 others); Wed, 29 Mar 2023 03:24:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229972AbjC2HYR (ORCPT ); Wed, 29 Mar 2023 03:24:17 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9C081BF6 for ; Wed, 29 Mar 2023 00:24:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680074654; x=1711610654; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ggmwxoc7/dils5MWJi70ypc6lFx8cadwyL7s3JUR9cA=; b=dPLqZ93q/44tUma7uapeVHve6LICMIcBKF5uBV9No+MIZaMY/7Kwguj0 zxJdV1bm1dvtygN6+syq5BNVzJTnqqWoshA/d8lQHBCoxkrm0E+Vp2Al0 l5G466JquhoFlhKyKlOJ2JIQc5rKWk//QvyAbcE58PCPhKPTAKnBkLsLM dmMgxx/3YMU5HPHqpTK1XKYuLK+JFOe7XB+rITuyUVLp9LdQS4QCLPyoR XkV+bseLAtTbWbfGetBsWs1SVG2RwVZ0FAlvsvavdel1IpeZk1tF3nKAT F2hPPjiYUyCd+VMCsZQ1+E7wIkMTlzi9o4dpIbxJYv4MAnDZTBcxOYpdK w==; X-IronPort-AV: E=McAfee;i="6600,9927,10663"; a="405745830" X-IronPort-AV: E=Sophos;i="5.98,300,1673942400"; d="scan'208";a="405745830" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2023 00:24:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10663"; a="684160540" X-IronPort-AV: E=Sophos;i="5.98,300,1673942400"; d="scan'208";a="684160540" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.112]) by orsmga002.jf.intel.com with ESMTP; 29 Mar 2023 00:24:09 -0700 From: Zhao Liu To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Matthew Auld , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Nirmoy Das , Maarten Lankhorst , Chris Wilson , =?UTF-8?q?Christian=20K=C3=B6nig?= , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Ira Weiny , "Fabio M . De Francesco" , Zhenyu Wang , Zhao Liu Subject: [PATCH v2 0/9] drm/i915: Replace kmap_atomic() with kmap_local_page() Date: Wed, 29 Mar 2023 15:32:11 +0800 Message-Id: <20230329073220.3982460-1-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 From: Zhao Liu Hi list, Sorry for a long delay since v1 [1]. This patchset is based on 197b6b6 (Linux 6.3-rc4). Welcome and thanks for your review and comments! # Purpose of this patchset The purpose of this pacthset is to replace all uses of kmap_atomic() in i915 with kmap_local_page() because the use of kmap_atomic() is being deprecated in favor of kmap_local_page()[1]. And 92b64bd (mm/highmem: add notes about conversions from kmap{,_atomic}()) has declared the deprecation of kmap_atomic(). # Motivation for deprecating kmap_atomic() and using kmap_local_page() The main difference between atomic and local mappings is that local mappings doesn't disable page faults or preemption (the preemption is disabled for !PREEMPT_RT case, otherwise it only disables migration). With kmap_local_page(), we can avoid the often unwanted side effect of unnecessary page faults and preemption disables. # Patch summary Patch 1, 4-6 and 8-9 replace kamp_atomic()/kunmap_atomic() with kmap_local_page()/kunmap_local() directly. With thses local mappings, the page faults and preemption are allowed. Patch 2 and 7 use memcpy_from_page() and memcpy_to_page() to replace kamp_atomic()/kunmap_atomic(). These two variants of memcpy() are based on the local mapping, so page faults and preemption are also allowed in these two interfaces. Patch 3 replaces kamp_atomic()/kunmap_atomic() with kmap_local_page()/ kunmap_local() and also diable page fault since the for special handling (pls see the commit message). # Changes since v1 * Dropped hot plug related description in commit message since it has nothing to do with kmap_local_page(). * Emphasized the motivation for using kmap_local_page() in commit message. * Rebased patch 1 on f47e630 (drm/i915/gem: Typecheck page lookups) to keep the "idx" variable of type pgoff_t here. * Used memcpy_from_page() and memcpy_to_page() to replace kmap_local_page() + memcpy() in patch 2. # Reference [1]: https://lore.kernel.org/lkml/20221017093726.2070674-1-zhao1.liu@linux.intel.com/ [1]: https://lore.kernel.org/all/20220813220034.806698-1-ira.weiny@intel.com --- Zhao Liu (9): drm/i915: Use kmap_local_page() in gem/i915_gem_object.c drm/i915: Use memcpy_[from/to]_page() in gem/i915_gem_pyhs.c drm/i915: Use kmap_local_page() in gem/i915_gem_shmem.c drm/i915: Use kmap_local_page() in gem/selftests/huge_pages.c drm/i915: Use kmap_local_page() in gem/selftests/i915_gem_coherency.c drm/i915: Use kmap_local_page() in gem/selftests/i915_gem_context.c drm/i915: Use memcpy_from_page() in gt/uc/intel_uc_fw.c drm/i915: Use kmap_local_page() in i915_cmd_parser.c drm/i915: Use kmap_local_page() in gem/i915_gem_execbuffer.c drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 10 +++++----- drivers/gpu/drm/i915/gem/i915_gem_object.c | 8 +++----- drivers/gpu/drm/i915/gem/i915_gem_phys.c | 10 ++-------- drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 6 ++++-- drivers/gpu/drm/i915/gem/selftests/huge_pages.c | 6 +++--- .../gpu/drm/i915/gem/selftests/i915_gem_coherency.c | 12 ++++-------- .../gpu/drm/i915/gem/selftests/i915_gem_context.c | 8 ++++---- drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 5 +---- drivers/gpu/drm/i915/i915_cmd_parser.c | 4 ++-- 9 files changed, 28 insertions(+), 41 deletions(-) -- 2.34.1