Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3906626rdg; Wed, 18 Oct 2023 09:12:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGHxbp0oSi5KSWqZVAWdpxFg3TjvnXNBiC4MwtIN7Lot2tl2MgVI4qnHnL01Vv0Gdo/YqKQ X-Received: by 2002:a05:6a21:7741:b0:174:f06:34dc with SMTP id bc1-20020a056a21774100b001740f0634dcmr5831632pzc.28.1697645556481; Wed, 18 Oct 2023 09:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697645556; cv=none; d=google.com; s=arc-20160816; b=cunhlAknKBDmz2ZUjFql2UKAXUv22ajLOPNZFLzMjjKzBSj7xL11WMHSwOWELZmnLJ Z/wAWRHJsElNK9VM16KkWYqMDAVPPF8ExM9Dw3X6CVsDYUdAcCwJJU9VfgyIjRx80X+P olBDBuGUkIgiqlJP0QYPLXiaoo9+tycdhM9nBsDVBgJnvbnauQqxaUqo4mjsjpGmg5Dv rNl8QsUjjyNLgovQvuBp6pzMycsIsnQzMcp99xpp105dCTpZT3t+6qjkIcJUPFmvCXTt gMNv/SWQpgIdzCqHTqkuqJ9v7Bm35r6VlSOV9EbTUxgXY/Zmwgr5KqW4yoxkUNIBUJfu ou9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=18vcYFaTk4tRnX3/JjP818LRISobJkLV1tPu4K7Zlcg=; fh=pJZGsbr66eD6pg/r8G0fdAgSmeeeKltPpp7QUvge7pU=; b=h3NJLbbsBJLNMUw9kk/bZS0h30zmrQNu8I1aRSq/HXO4wKkTef4hRHI8suUCB5SGXh zJpJ80hnhCb3qwSA5G0/4AcfmGbjzZGCbEMd6gRsD7pkGXIX9CzT5BvhiTlykRwngT3v p1qQS9utOO/ccLX3J4j8d8upI43sloBy8LJk4IdXsmons6btYmRL6kBpqMLkTwLBWJp3 xDTWvEpumwgykUZ7+lvi5PLFP3YDYKW9ufEc0avYp5mTqth9r+oADkEZTUeWuWbQCyAE 1pUz+CRWnf1nrFjRPF2c0Z4v2RDf5piJ3dgx6XIRLYByTlIXWEgODGiW2ziMefY4SqbW D5fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iKt0p5LR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id u185-20020a6385c2000000b005b7c45c7b8fsi2358102pgd.664.2023.10.18.09.12.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 09:12:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iKt0p5LR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id D84C4822B8D0; Wed, 18 Oct 2023 09:12:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230233AbjJRQMY (ORCPT + 99 others); Wed, 18 Oct 2023 12:12:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229946AbjJRQMX (ORCPT ); Wed, 18 Oct 2023 12:12:23 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBA5194 for ; Wed, 18 Oct 2023 09:12:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697645541; x=1729181541; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=nGqblrlxfU5rTc5M5fBrkYXS9WCT/h6zOCksAxopYT8=; b=iKt0p5LRuwtApZLneyUf3dhGhmh8cIeyjF2Eg39fcYjSLe0+prOiz9tS nijASFy9sDmu9ZvADtnYozN3EE2Su43wKXAcOAuq733nICOV83Uab8ytF b1Tv1bnarUP1xQh4wiQrKOpMy990MM50ip2RkJGYrzlVo0q/2QpJpm+2N HckzjuQmKxvye0OmiFxXLa9IGKquHEhEGLX3ulYR4BY502QQCvozRJ5lo f14/mqRXSfsjmGerPu1dmr72OUcRtvBLdU0kE06ICWf34lsshIre7dykl Fxm25T8+jKwg7NHOQxELqvqA2vIEvz08jPi90labJ49mahaYN7lKgauct w==; X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="452519831" X-IronPort-AV: E=Sophos;i="6.03,235,1694761200"; d="scan'208";a="452519831" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 09:08:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="822482667" X-IronPort-AV: E=Sophos;i="6.03,235,1694761200"; d="scan'208";a="822482667" Received: from liuzhao-optiplex-7080.sh.intel.com (HELO localhost) ([10.239.160.36]) by fmsmga008.fm.intel.com with ESMTP; 18 Oct 2023 09:07:57 -0700 Date: Thu, 19 Oct 2023 00:19:34 +0800 From: Zhao Liu To: Rodrigo Vivi , Tvrtko Ursulin Cc: Zhao Liu , "Fabio M. De Francesco" , Ira Weiny , Jani Nikula , Joonas Lahtinen , David Airlie , Daniel Vetter , Matthew Auld , Thomas =?utf-8?B?SGVsbHN0cu+/vW0=?= , Nirmoy Das , Maarten Lankhorst , Chris Wilson , Christian =?utf-8?B?S++/vW5pZw==?= , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Zhenyu Wang Subject: Re: [PATCH v2 9/9] drm/i915: Use kmap_local_page() in gem/i915_gem_execbuffer.c Message-ID: References: <20230329073220.3982460-1-zhao1.liu@linux.intel.com> <64265ef8725fe_375f7e294a@iweiny-mobl.notmuch> <2177327.1BCLMh4Saa@suse> <1b341218-f0e2-a613-2ac6-107064a813ca@linux.intel.com> <048d4dba-153f-5d32-75fc-d7e7144d1e9c@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 18 Oct 2023 09:12:34 -0700 (PDT) Hi Rodrigo and Tvrtko, It seems this series is missed in v6.5. This work should not be forgotten. Let me rebase and refresh the version. Regards, Zhao On Mon, Apr 17, 2023 at 10:53:28AM -0400, Rodrigo Vivi wrote: > Date: Mon, 17 Apr 2023 10:53:28 -0400 > From: Rodrigo Vivi > Subject: Re: [PATCH v2 9/9] drm/i915: Use kmap_local_page() in > gem/i915_gem_execbuffer.c > > On Mon, Apr 17, 2023 at 12:24:45PM +0100, Tvrtko Ursulin wrote: > > > > On 14/04/2023 11:45, Zhao Liu wrote: > > > Hi Tvrtko, > > > > > > On Wed, Apr 12, 2023 at 04:45:13PM +0100, Tvrtko Ursulin wrote: > > > > > > [snip] > > > > > > > > > > > > > [snip] > > > > > > However I am unsure if disabling pagefaulting is needed or not. Thomas, > > > > > > Matt, being the last to touch this area, perhaps you could have a look? > > > > > > Because I notice we have a fallback iomap path which still uses > > > > > > io_mapping_map_atomic_wc. So if kmap_atomic to kmap_local conversion is > > > > > > safe, does the iomap side also needs converting to > > > > > > io_mapping_map_local_wc? Or they have separate requirements? > > > > > > > > > > AFAIK, the requirements for io_mapping_map_local_wc() are the same as for > > > > > kmap_local_page(): the kernel virtual address is _only_ valid in the caller > > > > > context, and map/unmap nesting must be done in stack-based ordering (LIFO). > > > > > > > > > > I think a follow up patch could safely switch to io_mapping_map_local_wc() / > > > > > io_mapping_unmap_local_wc since the address is local to context. > > > > > > > > > > However, not being an expert, reading your note now I suspect that I'm missing > > > > > something. Can I ask why you think that page-faults disabling might be > > > > > necessary? > > > > > > > > I am not saying it is, was just unsure and wanted some people who worked on this code most recently to take a look and confirm. > > > > > > > > I guess it will work since the copying is done like this anyway: > > > > > > > > /* > > > > * This is the fast path and we cannot handle a pagefault > > > > * whilst holding the struct mutex lest the user pass in the > > > > * relocations contained within a mmaped bo. For in such a case > > > > * we, the page fault handler would call i915_gem_fault() and > > > > * we would try to acquire the struct mutex again. Obviously > > > > * this is bad and so lockdep complains vehemently. > > > > */ > > > > pagefault_disable(); > > > > copied = __copy_from_user_inatomic(r, urelocs, count * sizeof(r[0])); > > > > pagefault_enable(); > > > > if (unlikely(copied)) { > > > > remain = -EFAULT; > > > > goto out; > > > > } > > > > > > > > Comment is a bit outdated since we don't use that global "struct mutex" any longer, but in any case, if there is a page fault on the mapping where we need to recurse into i915 again to satisfy if, we seem to have code already to handle it. So kmap_local conversion I *think* can't regress anything. > > > > > > Thanks for your explanation! > > > > > > > > > > > Patch to convert the io_mapping_map_atomic_wc can indeed come later. > > > > > > Okay, I will also look at this. > > > > > > > > > > > In terms of logistics - if we landed this series to out branch it would be queued only for 6.5. Would that work for you? > > > > > > Yeah, it's ok for me. But could I ask, did I miss the 6.4 merge time? > > > > Yes, but just because we failed to review and merge in time, not because you > > did not provide patches in time. > > It is worth mentioning that under drm we close the merge window earlier. > Around -rc5. > > So, Linus' merge window for 6.4 didn't happen yet. But our drm-next that > is going to be sent there is already closed. > > > > > Regards, > > > > Tvrtko > >