From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, HK_RANDOM_FROM,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E32AC433E0 for ; Thu, 2 Jul 2020 12:35:48 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 08C9720874 for ; Thu, 2 Jul 2020 12:35:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 08C9720874 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A8ED06E0A6; Thu, 2 Jul 2020 12:35:47 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id E70816E0A6 for ; Thu, 2 Jul 2020 12:35:46 +0000 (UTC) IronPort-SDR: Ln0l+c5nh4zJsrWNZysPnnwTaEU2HTzeNSbYLGmxwkyEW6ZKaKNCxc8o9KrCGZy2f/3sXaaMMS /ULMHOPPPXww== X-IronPort-AV: E=McAfee;i="6000,8403,9669"; a="144393265" X-IronPort-AV: E=Sophos;i="5.75,304,1589266800"; d="scan'208";a="144393265" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2020 05:35:46 -0700 IronPort-SDR: aUOMEcMHxcBVRI/jTKRR7PWoch8lhg0NVq+E303fJ3NOHkdDFvxrWiPcnPtJ8Eo+UGP+r+Z7vH ZxsmXVU8/6oQ== X-IronPort-AV: E=Sophos;i="5.75,304,1589266800"; d="scan'208";a="481986374" Received: from dandoron-mobl.ger.corp.intel.com (HELO [10.214.212.30]) ([10.214.212.30]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2020 05:35:45 -0700 To: Chris Wilson , intel-gfx@lists.freedesktop.org References: <20200702083225.20044-1-chris@chris-wilson.co.uk> <20200702083225.20044-4-chris@chris-wilson.co.uk> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc Message-ID: Date: Thu, 2 Jul 2020 13:35:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200702083225.20044-4-chris@chris-wilson.co.uk> Content-Language: en-US Subject: Re: [Intel-gfx] [PATCH 04/23] drm/i915/gem: Only revoke mmap handlers if active X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 02/07/2020 09:32, Chris Wilson wrote: > Avoid waking up the device and taking stale locks if we know that the > object is not currently mmapped. This is particularly useful as not many > object are actually mmapped and so we can destroy them without waking > the device up, and gives us a little more freedom of workqueue ordering > during shutdown. > > Signed-off-by: Chris Wilson > --- > drivers/gpu/drm/i915/gem/i915_gem_mman.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c > index fe27c5b344e3..522ca4f51b53 100644 > --- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c > +++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c > @@ -516,8 +516,11 @@ void i915_gem_object_release_mmap_offset(struct drm_i915_gem_object *obj) > */ > void i915_gem_object_release_mmap(struct drm_i915_gem_object *obj) > { > - i915_gem_object_release_mmap_gtt(obj); > - i915_gem_object_release_mmap_offset(obj); > + if (obj->userfault_count) > + i915_gem_object_release_mmap_gtt(obj); > + > + if (!RB_EMPTY_ROOT(&obj->mmo.offsets)) > + i915_gem_object_release_mmap_offset(obj); > } > > static struct i915_mmap_offset * > Both conditions will need explaining why they are not racy. First should normally be done under the ggtt->mutex, second under obj->mmo.lock. Regards, Tvrtko _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx