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=-9.8 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 B06BEC433E0 for ; Mon, 3 Aug 2020 20:18:00 +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 5626422B40 for ; Mon, 3 Aug 2020 20:18:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RhZiLPJR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5626422B40 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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 B50FF6E321; Mon, 3 Aug 2020 20:17:59 +0000 (UTC) Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2AC5C6E0DC for ; Mon, 3 Aug 2020 20:17:58 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id c19so719101wmd.1 for ; Mon, 03 Aug 2020 13:17:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wMtWe8HLd6qhGo0uyNBhMlZkLAgDLyE6yKYxPU9nn14=; b=RhZiLPJRHXyOnx+U2VYZmcRIja9AItS2UQD+LQHX2A4ETJDMs4P3kigTqzlhK2x0y3 VjKzL/H1T7BjZyWoj/IsTUmk/ufZZ3mHZbPa7ohfZbRfC0rcqUCvzkr6Si2+ZCHhdWxr Ufu+PRBOMOgigKDXW7bnnuF0w4YkeHWYRZNeqpaDGiLgulw1BDLlRVLK/wUSd7C24oYB iZ1P3XKNgJM0wnUjtV3O3UygsmfrvPMkyUt02Ucrcqt7900VmFIbtd4FbuRlXd2jwH4x vprDtuhtaeJU/VoogbeBxdEJJksJCzaSjmgxs3ViLU/AsnGHBoILn6LR9FPhG0sOuazM HLmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wMtWe8HLd6qhGo0uyNBhMlZkLAgDLyE6yKYxPU9nn14=; b=cl532CbDtaNEvAq3nB+A4XexzwMNAqS61hmONmYTQIj/OF+Y+weZwXT+RF9k+kVv1k LT5t/6h688RvCr3P4aac45Kr8xmNbgdT3mubAwefTn8osOAh1jsGMdGgiYRPZ/jBKqCo GZNm1wu+/ODVnzo9FExBgAK7zgPyKB2ftV0E2Ud355eRmPSnjYerAhC+vMQmTlMM7K5E 2/ZomrXPxp54ZRaLqOaGvUlRnHbQnB9b0kVbYAhrSlVJkQx86Pi8sQTo4v2G9/nXF0ry GyZ2L23pForSkY+RnYJRZ27PRh6Wr5Gtww19pHBNbywx4fZz9q8jXSQeMsN2/opVPOPj lGhQ== X-Gm-Message-State: AOAM531Rl6N0hnfSQwAQWghFX9K3sClZPCzcnGEc2rYh7/1Q0ymSCVAG SKFT57v+Pb0K3nbhUtBCSiZyjchtzizVBok2z6RnXWsu X-Google-Smtp-Source: ABdhPJzGWVbDEEim3BKO1WnIy/VdT5/yItpHCJ8I+NsGGUF7UCuiCsgCz8RvFbDGnhpBdqd/YVVOiuw3PDRkdIh1uB4= X-Received: by 2002:a1c:b785:: with SMTP id h127mr831347wmf.100.1596485876739; Mon, 03 Aug 2020 13:17:56 -0700 (PDT) MIME-Version: 1.0 References: <20200710115757.290984-1-matthew.auld@intel.com> <20200710115757.290984-35-matthew.auld@intel.com> In-Reply-To: From: Lucas De Marchi Date: Mon, 3 Aug 2020 13:17:44 -0700 Message-ID: To: Matthew Auld , Chris Wilson Subject: Re: [Intel-gfx] [RFC 34/60] drm/i915: introduce kernel blitter_context 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: Intel Graphics Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" +Chris Wilson On Mon, Aug 3, 2020 at 12:59 PM Lucas De Marchi wrote: > > On Fri, Jul 10, 2020 at 5:00 AM Matthew Auld wrote: > > > > We may be without a context to perform various internal blitter > > operations, for example when performing object migration. Piggybacking > > off the kernel_context is probably a bad idea, since it has other uses. > > > > Signed-off-by: Matthew Auld > > Cc: Joonas Lahtinen > > Cc: Abdiel Janulgue > > --- > > drivers/gpu/drm/i915/gt/intel_engine_cs.c | 30 +++++++++++++++++--- > > drivers/gpu/drm/i915/gt/intel_engine_types.h | 1 + > > 2 files changed, 27 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c > > index dd1a42c4d344..1df94e82550f 100644 > > --- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c > > +++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c > > @@ -792,6 +792,7 @@ create_kernel_context(struct intel_engine_cs *engine) > > int err; > > > > ce = intel_context_create(engine); > > + > > if (IS_ERR(ce)) > > return ce; > > > > @@ -845,16 +846,32 @@ static int engine_init_common(struct intel_engine_cs *engine) > > return PTR_ERR(ce); > > > > ret = measure_breadcrumb_dw(ce); > > - if (ret < 0) > > - goto err_context; > > + if (ret < 0) { > > + intel_context_put(ce); > > I think it's easier to follow the code if the error handling is in one > place. Since you have to put the context. > And since create_kernel_context() pins it, don't we have to > intel_context_unpin() like we are doing > in intel_engine_cleanup_common()? Which would also mean to probably > factor out a `destroy_kernel_context()` > to always do it, and call from here and from intel_engine_cleanup_common(). We actually had a destroy_kernel_context() and the unpin, but that got dropped by e6ba76480299 ("drm/i915: Remove i915->kernel_context") . Wouldn't we hit a GEM_BUG_ON() in the destroy function if we don't unpin it ? Lucas De Marchi _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx