Message ID | 20221017093726.2070674-1-zhao1.liu@linux.intel.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1355303wrs; Mon, 17 Oct 2022 02:43:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6nJLmLBoihAg53HdeM190RJ/SRH7XNiVEXHpUrVnYoqj8o/WgsWQV7QLlHEx6c0i1p5lox X-Received: by 2002:a17:903:2c9:b0:182:c500:d93d with SMTP id s9-20020a17090302c900b00182c500d93dmr11324115plk.44.1665999832659; Mon, 17 Oct 2022 02:43:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665999832; cv=none; d=google.com; s=arc-20160816; b=Xvnhc7eVhBSkbe6U9UFCBARq9F781sdtCbLNDZ4253k/usVlxZOkJvgnFzOqvoVMOW F4dKMgXoqfz28IcdiThf4xm6M4fVO5FOm9TVh+ZeDXnS21M2zrd9RV5D68CjFMBblGY0 T8Dk58DwH/g1JxbkS94P7+LH1QK23mFJd7CESQ6/4Y/NrknJIbphw+JZLbwbl96KUOeH kfTsUHj4MgHcS+zbhumU8oMmY5b7X/GIFrjvIwZVevGrcCsRN0SjhPVOO5RI3dOf8GXD rgYT2Ea2DgjJBIDn0aPByahBhiL1qJETfl+Zkl7slBU/X82JUjGBFvAc+sKvImnY1Iiq bOGg== 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=uei0l8upO60NrsS563E6DY8NcUAZTlGT3Z5V/PfZgLI=; b=MeJYnRkxIO8EGbDd/X1l6kafFaaFfLEPwAUXNuKmOGHPeYk0DTAxdcrPWyNCz/6yBm QdBUaCU9r5LigdFjqNKW4kOjL1UkAOjqx9Ivyxejt8k0K1Hp8ojycSe9v0aicVe5ZW+a mtBlS6xS0PjZVSKKwKqpsEJUd/LT9eF2Is0DVOP/U/lndA3e1CiWe+aIDwW4BGXmeO5S QaTtkZYrnvywaa1fl0xfTwCzQHavMPuSMFVraMG3XbtpYLVLFik5w65bW+ofngzuYn30 xGVc65d7HeK8PC13BHpkmOnGZZ1I8JALyWCkKBOkJ/E39bonCJNLH+5PFLn8kBVfABRa JDJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=b7x7iaPy; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lw14-20020a17090b180e00b0020a6c8b4634si19866684pjb.153.2022.10.17.02.43.40; Mon, 17 Oct 2022 02:43:52 -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=b7x7iaPy; 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 S231238AbiJQJcb (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Mon, 17 Oct 2022 05:32:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230137AbiJQJc0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 17 Oct 2022 05:32:26 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E345347BAB for <linux-kernel@vger.kernel.org>; Mon, 17 Oct 2022 02:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665999143; x=1697535143; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=6ZU9PDhvVYa7AEOd0lamaGEe6sVuaqOTNJI83nJvfl8=; b=b7x7iaPyCtJSx9+o7AlKF5xK3Px7Gx7jozLoPsXofnr6plHJ4JRBXlaB QGQTYq0WMp8LQJ/It5058aZ5u0jiTOEFJuZVUoxogoRUY39Vgq4o+uO4u glZWzySRegqEkLDjQ7innXAUMcNeJ+Nl+uikWQ9FRrpDmb6Vx7jx3xA16 bbtedNMVAe6eQzEumktyJQuvwVlewAoyGf77Zlpx8RKAen5caVX1BAlcL X0Ng7SgdB2q66DexGPvTp/UZmKxvZPeLSoI/JOt7vVm1bw09wiryHxlpu UBQvD1cTZj5PWf48B3AQjUw1uy/y/Z0Hz2ylEyZFewBK0tvuxnEKvpVQS g==; X-IronPort-AV: E=McAfee;i="6500,9779,10502"; a="305741538" X-IronPort-AV: E=Sophos;i="5.95,191,1661842800"; d="scan'208";a="305741538" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2022 02:32:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10502"; a="717431199" X-IronPort-AV: E=Sophos;i="5.95,191,1661842800"; d="scan'208";a="717431199" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.132]) by FMSMGA003.fm.intel.com with ESMTP; 17 Oct 2022 02:32:19 -0700 From: Zhao Liu <zhao1.liu@linux.intel.com> To: Jani Nikula <jani.nikula@linux.intel.com>, Joonas Lahtinen <joonas.lahtinen@linux.intel.com>, Rodrigo Vivi <rodrigo.vivi@intel.com>, Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Matthew Auld <matthew.auld@intel.com>, =?utf-8?q?Thomas_Hellstr=C3=B6m?= <thomas.hellstrom@linux.intel.com>, Nirmoy Das <nirmoy.das@intel.com>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Chris Wilson <chris@chris-wilson.co.uk>, =?utf-8?q?Christian_K=C3=B6nig?= <christian.koenig@amd.com>, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Ira Weiny <ira.weiny@intel.com>, "Fabio M . De Francesco" <fmdefrancesco@gmail.com>, Zhenyu Wang <zhenyu.z.wang@intel.com>, Zhao Liu <zhao1.liu@intel.com> Subject: [PATCH 0/9] drm/i915: Replace kmap_atomic() with kmap_local_page() Date: Mon, 17 Oct 2022 17:37:16 +0800 Message-Id: <20221017093726.2070674-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=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746927440775777452?= X-GMAIL-MSGID: =?utf-8?q?1746927440775777452?= |
Series |
drm/i915: Replace kmap_atomic() with kmap_local_page()
|
|
Message
Zhao Liu
Oct. 17, 2022, 9:37 a.m. UTC
From: Zhao Liu <zhao1.liu@intel.com>
The use of kmap_atomic() is being deprecated in favor of
kmap_local_page()[1].
In the following patches, we can convert the calls of kmap_atomic() /
kunmap_atomic() to kmap_local_page() / kunmap_local(), which can
instead do the mapping / unmapping regardless of the context.
With kmap_local_page(), the mapping is per thread, CPU local and not
globally visible.
[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 kmap_local_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 | 8 ++++----
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, 30 insertions(+), 37 deletions(-)
Comments
On lunedì 17 ottobre 2022 11:37:16 CEST Zhao Liu wrote: > From: Zhao Liu <zhao1.liu@intel.com> > > The use of kmap_atomic() is being deprecated in favor of > kmap_local_page()[1]. Some words to explain why kmap_atomic was deprecated won't hurt. Many maintainers and reviewers, and also casual readers might not yet be aware of the reasons behind that deprecation. > In the following patches, we can convert the calls of kmap_atomic() / > kunmap_atomic() to kmap_local_page() / kunmap_local(), which can > instead do the mapping / unmapping regardless of the context. Readers are probably much more interested in what you did in the following patches and why you did it, instead of being informed about what "we can" do. I would suggest something like "The following patches convert the calls to kmap_atomic() to kmap_local_page() [the rest looks OK]". This could also be the place to say something about why we prefer kmap_local_page() to kmap_atomic(). Are you sure that the reasons that motivates your conversions are merely summarized to kmap_local_page() being able to do mappings regardless of context? I think you are missing the real reasons why. What about avoiding the often unwanted side effect of unnecessary page faults disables? > > With kmap_local_page(), the mapping is per thread, CPU local and not > globally visible. No news here. kmap_atomic() is "per thread, CPU local and not glocally visible". I cannot see any difference here between kmap_atomic() and kmap_local_page(). > > [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 kmap_local_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 | 8 ++++---- > 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, 30 insertions(+), 37 deletions(-) Thanks for helping with kmap_atomic() conversions to kmap_local_page(). Fabio
On Sat, Oct 29, 2022 at 09:12:27AM +0200, Fabio M. De Francesco wrote: > Date: Sat, 29 Oct 2022 09:12:27 +0200 > From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com> > Subject: Re: [PATCH 0/9] drm/i915: Replace kmap_atomic() with > kmap_local_page() Hi Fabio, thanks for your review!! (I'm sorry I missed the previous mails). > > On luned? 17 ottobre 2022 11:37:16 CEST Zhao Liu wrote: > > From: Zhao Liu <zhao1.liu@intel.com> > > > > The use of kmap_atomic() is being deprecated in favor of > > kmap_local_page()[1]. > > Some words to explain why kmap_atomic was deprecated won't hurt. Many > maintainers and reviewers, and also casual readers might not yet be aware of > the reasons behind that deprecation. > > > In the following patches, we can convert the calls of kmap_atomic() / > > kunmap_atomic() to kmap_local_page() / kunmap_local(), which can > > instead do the mapping / unmapping regardless of the context. > > Readers are probably much more interested in what you did in the following > patches and why you did it, instead of being informed about what "we can" do. > > I would suggest something like "The following patches convert the calls to > kmap_atomic() to kmap_local_page() [the rest looks OK]". > > This could also be the place to say something about why we prefer > kmap_local_page() to kmap_atomic(). > > Are you sure that the reasons that motivates your conversions are merely > summarized to kmap_local_page() being able to do mappings regardless of > context? I think you are missing the real reasons why. Thanks for your reminder, I'll emphasize the motivation here. > What about avoiding the often unwanted side effect of unnecessary page faults > disables? Good suggestion! I'll add this into this cover message. What I think is that we have two reasons to do the replacement work: 1. (main motication) Avoid unnessary pagefaulta and preemption disabling to gain performance benefits. 2. We are trying to deprecate the old kmap/kmap_atomic interface. Some maintainer said it's also a good reason especially for the case that the performance is not critical [1]. In addition, also from [1], I find in some case people chooses kmap_atomic() for the consideration that they want the atomic context. So, the explaination about why the atomic context is not needed is also a reasion? I understand that I need to make special explaination in each commit depending on the situation (In this case, it is not suitable to describe in the cover?). [1]: https://lore.kernel.org/lkml/YzRVaJA0EyfcVisW@liuwe-devbox-debian-v2/#t > > > > > With kmap_local_page(), the mapping is per thread, CPU local and not > > globally visible. > > No news here. kmap_atomic() is "per thread, CPU local and not glocally > visible". I cannot see any difference here between kmap_atomic() and > kmap_local_page(). What about the below description which refers to your doc? "kmap_atomic() in the kernel creates a non-preemptible section and disable pagefaults. This could be a source of unwanted latency. And kmap_local_page effectively overcomes this issue because it doesn't disable pagefault and preemption." Thanks, Zhao
Zhao Liu wrote: > From: Zhao Liu <zhao1.liu@intel.com> > > The use of kmap_atomic() is being deprecated in favor of > kmap_local_page()[1]. Zhao, Was there ever a v2 of this series? I'm not finding it on Lore. Thanks, Ira > > In the following patches, we can convert the calls of kmap_atomic() / > kunmap_atomic() to kmap_local_page() / kunmap_local(), which can > instead do the mapping / unmapping regardless of the context. > > With kmap_local_page(), the mapping is per thread, CPU local and not > globally visible. > > [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 kmap_local_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 | 8 ++++---- > 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, 30 insertions(+), 37 deletions(-) > > -- > 2.34.1 >
On Tue, Feb 14, 2023 at 08:25:08PM -0800, Ira Weiny wrote: > Date: Tue, 14 Feb 2023 20:25:08 -0800 > From: Ira Weiny <ira.weiny@intel.com> > Subject: Re: [PATCH 0/9] drm/i915: Replace kmap_atomic() with > kmap_local_page() > > Zhao Liu wrote: > > From: Zhao Liu <zhao1.liu@intel.com> > > > > The use of kmap_atomic() is being deprecated in favor of > > kmap_local_page()[1]. > > Zhao, > > Was there ever a v2 of this series? I'm not finding it on Lore. Sorry Ira, my delay is too long, I was busy with other patch work, I will refresh v2 soon, and push this forward! Best Regards, Zhao > > Thanks, > Ira > > > > > In the following patches, we can convert the calls of kmap_atomic() / > > kunmap_atomic() to kmap_local_page() / kunmap_local(), which can > > instead do the mapping / unmapping regardless of the context. > > > > With kmap_local_page(), the mapping is per thread, CPU local and not > > globally visible. > > > > [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 kmap_local_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 | 8 ++++---- > > 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, 30 insertions(+), 37 deletions(-) > > > > -- > > 2.34.1 > > > >
Zhao Liu wrote: > On Tue, Feb 14, 2023 at 08:25:08PM -0800, Ira Weiny wrote: > > Date: Tue, 14 Feb 2023 20:25:08 -0800 > > From: Ira Weiny <ira.weiny@intel.com> > > Subject: Re: [PATCH 0/9] drm/i915: Replace kmap_atomic() with > > kmap_local_page() > > > > Zhao Liu wrote: > > > From: Zhao Liu <zhao1.liu@intel.com> > > > > > > The use of kmap_atomic() is being deprecated in favor of > > > kmap_local_page()[1]. > > > > Zhao, > > > > Was there ever a v2 of this series? I'm not finding it on Lore. > > Sorry Ira, my delay is too long, I was busy with other patch work, > I will refresh v2 soon, and push this forward! Awesome! Thanks! Ira > > Best Regards, > Zhao