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=-10.4 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 658C2C43461 for ; Mon, 14 Sep 2020 16:45:25 +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 DC367217BA for ; Mon, 14 Sep 2020 16:45:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DC367217BA 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 0AA8E6E4E6; Mon, 14 Sep 2020 16:45:21 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6B40A6E4DE; Mon, 14 Sep 2020 16:45:19 +0000 (UTC) IronPort-SDR: nVKKkbPNkSiRXna/tWofZFavsoYsLUdLldfFoJDT9GU7Crbp/aayxl732M4uddfNcvxCG7jnvY z56craFeoF7w== X-IronPort-AV: E=McAfee;i="6000,8403,9744"; a="243942489" X-IronPort-AV: E=Sophos;i="5.76,426,1592895600"; d="scan'208";a="243942489" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2020 09:45:15 -0700 IronPort-SDR: Q1puHls1IccRwMKDmUtPGqXO9BU+sBJUwBdtnEPqyHMVSgXoGdyM5FGTZMGcMwNb8Q5FNOFXqE aYjUIcI43dVw== X-IronPort-AV: E=Sophos;i="5.76,426,1592895600"; d="scan'208";a="306240559" Received: from matancoh-mobl2.ger.corp.intel.com (HELO [10.255.198.45]) ([10.255.198.45]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2020 09:45:13 -0700 To: Chris Wilson , intel-gfx@lists.freedesktop.org References: <20200723172119.17649-1-chris@chris-wilson.co.uk> <20200723172119.17649-3-chris@chris-wilson.co.uk> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc Message-ID: <5e7f2c00-c72e-46ff-defe-404b5a847a02@linux.intel.com> Date: Mon, 14 Sep 2020 17:45:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200723172119.17649-3-chris@chris-wilson.co.uk> Content-Language: en-US Subject: Re: [Intel-gfx] [PATCH 3/3] drm/i915/gem: Serialise debugfs i915_gem_objects with ctx->mutex 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: , Cc: Daniel Vetter , dri-devel@lists.freedesktop.org, stable@vger.kernel.org, "Nikunj A. Dadhania" 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 23/07/2020 18:21, Chris Wilson wrote: > Since the debugfs may peek into the GEM contexts as the corresponding > client/fd is being closed, we may try and follow a dangling pointer. > However, the context closure itself is serialised with the ctx->mutex, > so if we hold that mutex as we inspect the state coupled in the context, > we know the pointers within the context are stable and will remain valid > as we inspect their tables. > > Signed-off-by: Chris Wilson > Cc: CQ Tang > Cc: Daniel Vetter > Cc: stable@vger.kernel.org > --- > drivers/gpu/drm/i915/i915_debugfs.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c > index 784219962193..ea469168cd44 100644 > --- a/drivers/gpu/drm/i915/i915_debugfs.c > +++ b/drivers/gpu/drm/i915/i915_debugfs.c > @@ -326,6 +326,7 @@ static void print_context_stats(struct seq_file *m, > } > i915_gem_context_unlock_engines(ctx); > > + mutex_lock(&ctx->mutex); > if (!IS_ERR_OR_NULL(ctx->file_priv)) { > struct file_stats stats = { > .vm = rcu_access_pointer(ctx->vm), > @@ -346,6 +347,7 @@ static void print_context_stats(struct seq_file *m, > > print_file_stats(m, name, stats); > } > + mutex_unlock(&ctx->mutex); > > spin_lock(&i915->gem.contexts.lock); > list_safe_reset_next(ctx, cn, link); > Hm this apparently never got it's r-b and so got re-discovered in the field. +Nikunj Reviewed-by: Tvrtko Ursulin Regards, Tvrtko _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx