Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp481093pxm; Wed, 2 Mar 2022 02:26:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzUyqp9RmMMzuiof7us7z3RkTO8asMDNeQ19G9Bn8qaYlirBPsy4YDbl4tqzLADlYzQQ8FN X-Received: by 2002:a05:6402:524e:b0:410:dedd:ea37 with SMTP id t14-20020a056402524e00b00410deddea37mr11155758edd.260.1646216797821; Wed, 02 Mar 2022 02:26:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646216797; cv=none; d=google.com; s=arc-20160816; b=l+eQFfhwXdu7AeLaYXVJ0MqM6D9kb8uGWbIU+hotAijS6zdzRthdiq8J81okYq60Db CroGYpx1rEcYKgCav2C46UuXvl6UPeGT8iTm0KxNUI/2IN8y+mQdFaLaiFKJhxUNxBrT 9udtoB7MKJchtwK+8KlL7jzj9reixegfdZlsd9sIH1ghl21VS1pKqwUtdyPr4aCix7Yv yYe+EdTA6rBHO6Oh6zKp+wKz8IMmrFkYJaWyfY1ER9xIChef1EinhC24BrEIir97e8xC 21qzEB+dwL6Aq8LZ+rqs7Z8YPZMZ4ywIGhvKDJ7efsQ3w6+QS6vG8n8H5aE5B0CUmV8G Bgkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Je0uRp8727h1TTc3B25vlET4KVfYQCUUi3qPq6QSu/E=; b=je8BJVCrB30H+Vj6RA/GcQk6hBTKvuiQcAryVBf59thPUhIXbT+6eBBMBwM1iA9dvm gkGjoHkkVbjwF5gy77F1oqVmLYRV+gsVSN/UAGU18FnFidQPi5GOi+TheBk7MfxPNlLH uB6kU5VhdXW13TuZbP9sxNxo18aCnK4Z38D8/kHc8yndsA2fivg7gUQbydmbTwVNdcVI UWgouclDcpekD+wMO7V6RTZDCv1Oz3h3t/umnK5nz6Npd652sz7fout7oUrp2tcT1FzT JZl9/ZcVuxDoyznpBsB7I3e7lkR+rATD/md7qq5KvHpfFyl1BC6WepuyMncEsKQvsvfO Kiag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Mxd3Ju/5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 5-20020a508e45000000b00410c51a0b89si12621921edx.332.2022.03.02.02.26.12; Wed, 02 Mar 2022 02:26:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Mxd3Ju/5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238682AbiCAXmp (ORCPT + 99 others); Tue, 1 Mar 2022 18:42:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230088AbiCAXmn (ORCPT ); Tue, 1 Mar 2022 18:42:43 -0500 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64B42140EF for ; Tue, 1 Mar 2022 15:42:01 -0800 (PST) Received: by mail-lj1-x22e.google.com with SMTP id u11so24008263lju.4 for ; Tue, 01 Mar 2022 15:42:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Je0uRp8727h1TTc3B25vlET4KVfYQCUUi3qPq6QSu/E=; b=Mxd3Ju/57STaqFSUcoUHdzkEQamJj8Rs9AVQLfo4UBtN/aEjfV5IoqwLoG8ytsuQJ7 ir6gM8ycAelCJxTtCKwvyT1dvQxjxijkrqBZPqwyeTS4xaIsln9MhNWrmrkwjW0Txkdf UL/AX2mAZIYA5MmxmQmswds1EnKDAxrGAdipYhdFBagPN0kW6vjwwKfYBs9DVjLIohC2 9sHxfWJE/ZOZe1wibzi0vN6RWPVJY0XBw7AkeB3ccqsGVX932JcE/cMN7XJ+faOwqFpQ MERaNl5eAk+8sExq1oTLy7dPZ7+rnAv7QIHCFoKwmw3LR/WJuzf7oFkWUYIaAW0Yf62T fNRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Je0uRp8727h1TTc3B25vlET4KVfYQCUUi3qPq6QSu/E=; b=oi+iIXtEGRsawRhzryu8yfLylXp74lo2XsVwbGD7lPNNzaFnHExkFOKDj3MJcsWRcy w7NNJm/Wzj8sgZ6CwEYfWZnxQY2QQ9sU/zL6UUHpfZFRooGUVjZmMQ96YiUaiWFMo1L1 cgsh8MDTmvyhzv49YroMq+Usvtgi0XFL4UA6pzgev3qB9XAZsbIUKIKwLipURqwivC88 HQ6nzwRJa3SDdBvuQckfGW+x9VfvbwzWSvJBd8C/Le8ENIKb0k8+JD8lL21X437XJDfu +RwyDMZiXoUpfXd/cYhW6IEjcR82UffQVqxwjJqVp+xn0bSW6DjShULv+TwaAcWM0Nys zJ7w== X-Gm-Message-State: AOAM5302El+OKvZSWOUqr7/rBolodlEHNM0MfsoB9CI5k0OrSZ532Qqo dO6NAjkp0LJ4/cfH3/GMJlyCgCFMqKPnSA7yDBw= X-Received: by 2002:a05:651c:124d:b0:246:1a54:cc17 with SMTP id h13-20020a05651c124d00b002461a54cc17mr19022784ljh.301.1646178119102; Tue, 01 Mar 2022 15:41:59 -0800 (PST) MIME-Version: 1.0 References: <20220228181647.3794298-1-mwen@igalia.com> <9e288f3c-3251-f017-3541-d01ae6afe499@amd.com> In-Reply-To: <9e288f3c-3251-f017-3541-d01ae6afe499@amd.com> From: Melissa Wen Date: Tue, 1 Mar 2022 22:41:47 -0100 Message-ID: Subject: Re: [PATCH] drm/v3d: centralize error handling when init scheduler fails To: Andrey Grodzovsky Cc: Melissa Wen , Emma Anholt , David Airlie , Daniel Vetter , Jiawei.Gu@amd.com, Christian Konig , DRI Development , LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 28, 2022 at 8:21 PM Andrey Grodzovsky wrote: > > Acked-by: Andrey Grodzovsky > > Andrey Thanks. Applied to drm-misc-next. Melissa > > On 2022-02-28 13:16, Melissa Wen wrote: > > Remove redundant error message (since now it is very similar to what > > we do in drm_sched_init) and centralize all error handling in a > > unique place, as we follow the same steps in any case of failure. > > > > Signed-off-by: Melissa Wen > > --- > > drivers/gpu/drm/v3d/v3d_sched.c | 40 +++++++++++---------------------- > > 1 file changed, 13 insertions(+), 27 deletions(-) > > > > diff --git a/drivers/gpu/drm/v3d/v3d_sched.c b/drivers/gpu/drm/v3d/v3d_sched.c > > index 39459ae96f30..06238e6d7f5c 100644 > > --- a/drivers/gpu/drm/v3d/v3d_sched.c > > +++ b/drivers/gpu/drm/v3d/v3d_sched.c > > @@ -392,34 +392,24 @@ v3d_sched_init(struct v3d_dev *v3d) > > hw_jobs_limit, job_hang_limit, > > msecs_to_jiffies(hang_limit_ms), NULL, > > NULL, "v3d_bin", v3d->drm.dev); > > - if (ret) { > > - dev_err(v3d->drm.dev, "Failed to create bin scheduler: %d.", ret); > > + if (ret) > > return ret; > > - } > > > > ret = drm_sched_init(&v3d->queue[V3D_RENDER].sched, > > &v3d_render_sched_ops, > > hw_jobs_limit, job_hang_limit, > > msecs_to_jiffies(hang_limit_ms), NULL, > > NULL, "v3d_render", v3d->drm.dev); > > - if (ret) { > > - dev_err(v3d->drm.dev, "Failed to create render scheduler: %d.", > > - ret); > > - v3d_sched_fini(v3d); > > - return ret; > > - } > > + if (ret) > > + goto fail; > > > > ret = drm_sched_init(&v3d->queue[V3D_TFU].sched, > > &v3d_tfu_sched_ops, > > hw_jobs_limit, job_hang_limit, > > msecs_to_jiffies(hang_limit_ms), NULL, > > NULL, "v3d_tfu", v3d->drm.dev); > > - if (ret) { > > - dev_err(v3d->drm.dev, "Failed to create TFU scheduler: %d.", > > - ret); > > - v3d_sched_fini(v3d); > > - return ret; > > - } > > + if (ret) > > + goto fail; > > > > if (v3d_has_csd(v3d)) { > > ret = drm_sched_init(&v3d->queue[V3D_CSD].sched, > > @@ -427,27 +417,23 @@ v3d_sched_init(struct v3d_dev *v3d) > > hw_jobs_limit, job_hang_limit, > > msecs_to_jiffies(hang_limit_ms), NULL, > > NULL, "v3d_csd", v3d->drm.dev); > > - if (ret) { > > - dev_err(v3d->drm.dev, "Failed to create CSD scheduler: %d.", > > - ret); > > - v3d_sched_fini(v3d); > > - return ret; > > - } > > + if (ret) > > + goto fail; > > > > ret = drm_sched_init(&v3d->queue[V3D_CACHE_CLEAN].sched, > > &v3d_cache_clean_sched_ops, > > hw_jobs_limit, job_hang_limit, > > msecs_to_jiffies(hang_limit_ms), NULL, > > NULL, "v3d_cache_clean", v3d->drm.dev); > > - if (ret) { > > - dev_err(v3d->drm.dev, "Failed to create CACHE_CLEAN scheduler: %d.", > > - ret); > > - v3d_sched_fini(v3d); > > - return ret; > > - } > > + if (ret) > > + goto fail; > > } > > > > return 0; > > + > > +fail: > > + v3d_sched_fini(v3d); > > + return ret; > > } > > > > void