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=-14.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, 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 0C15BC4743C for ; Mon, 21 Jun 2021 12:08:26 +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 9D7F66112D for ; Mon, 21 Jun 2021 12:08:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D7F66112D 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 54C2889F4A; Mon, 21 Jun 2021 12:08:23 +0000 (UTC) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3B75B89F4A for ; Mon, 21 Jun 2021 12:08:22 +0000 (UTC) IronPort-SDR: KBFRmgniG04DRJfLFKjb8FfgTHG3hFpzhzg3FSd8UBu7KODu50jMVnToORZAfp1vr/12pyYZ5W s8bsTidPH7Jg== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="194139629" X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="194139629" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2021 05:08:04 -0700 IronPort-SDR: EjfKzpJXx2HzqUine2u4fccHJX/fTcuCVaNI6twyvYF1++SmRYoVyZI6ZPdUm2QPaxuM04yIl5 248f9Sdventg== X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="405941146" Received: from bchikkop-mobl.ger.corp.intel.com (HELO [10.213.238.150]) ([10.213.238.150]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2021 05:08:02 -0700 To: Maarten Lankhorst , intel-gfx@lists.freedesktop.org References: <20210621114123.3131534-1-maarten.lankhorst@linux.intel.com> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc Message-ID: <04424cbf-750a-4cb9-a99a-6a5a3671452f@linux.intel.com> Date: Mon, 21 Jun 2021 13:08:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210621114123.3131534-1-maarten.lankhorst@linux.intel.com> Content-Language: en-US Subject: Re: [Intel-gfx] [PATCH 1/3] drm/i915/gt: Do not allow setting ring size for legacy ring submission 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: Chris Wilson Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" I had some questions on the trybot mailing list, let me copy&paste.. On 21/06/2021 12:41, Maarten Lankhorst wrote: > It doesn't work for legacy ring submission, and is in the best case > ignored. Looks rejected instead of ignored: static int set_ringsize(struct i915_gem_context *ctx, struct drm_i915_gem_context_param *args) { if (!HAS_LOGICAL_RING_CONTEXTS(ctx->i915)) return -ENODEV; > > In the worst case we end up freeing engine->legacy.ring for all other > active engines, resulting in a use-after-free. Worst case is cloning because ring_context_alloc is not taking a reference to engine->legacy.ring, or something else? Regards, Tvrtko > > Signed-off-by: Maarten Lankhorst > Fixes: 88be76cdafc7 ("drm/i915: Allow userspace to specify ringsize on construction") > Cc: Chris Wilson > --- > drivers/gpu/drm/i915/gt/intel_context_param.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/i915/gt/intel_context_param.c b/drivers/gpu/drm/i915/gt/intel_context_param.c > index 65dcd090245d..412c36d1b1dd 100644 > --- a/drivers/gpu/drm/i915/gt/intel_context_param.c > +++ b/drivers/gpu/drm/i915/gt/intel_context_param.c > @@ -12,6 +12,9 @@ int intel_context_set_ring_size(struct intel_context *ce, long sz) > { > int err; > > + if (ce->engine->gt->submission_method == INTEL_SUBMISSION_RING) > + return 0; > + > if (intel_context_lock_pinned(ce)) > return -EINTR; > > _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx