From patchwork Thu Jul 8 17:37:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 12365909 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=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 B1296C07E9E for ; Thu, 8 Jul 2021 17:38:20 +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 84DB561879 for ; Thu, 8 Jul 2021 17:38:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 84DB561879 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch 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 7A14E6E950; Thu, 8 Jul 2021 17:38:11 +0000 (UTC) Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by gabe.freedesktop.org (Postfix) with ESMTPS id 504E96E948 for ; Thu, 8 Jul 2021 17:38:08 +0000 (UTC) Received: by mail-wr1-x430.google.com with SMTP id r11so3268357wro.9 for ; Thu, 08 Jul 2021 10:38:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aF+7eqin7S19iz1UaMS7J3yDc/1YnzVl0I5fw9EWIlI=; b=bO/n1Zkb675oqo0/mqmxMsZGEJK5fHx8vO2Qdp6XWQ13sNT986eieB+8HgrxFISvmn w1Rg2Av3kA57wfsywQwdtHolMQMPVlv13pjJaqC/naOXaX43wj/vMN5FQNr36btAD5CL OdZWTJTB2cD03BzImT/2/TGvok0NVl7zi+XOg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aF+7eqin7S19iz1UaMS7J3yDc/1YnzVl0I5fw9EWIlI=; b=CFpmd+nAMgkymX7XAn+pDKN243Me/fdk2PlckmJg1HrEEycTCkcIhwbR6zur75ThIL hV444bDfcojFcAmJQ0KfoY8ek3uN7ldnfRkTn5/C4PJgTQEPy+HFbRGFaTrL5wJw00YA pFRAmrYSPomW4oI+M+Eild8axz3Rtk2jjseb4ImsXHuKh9+SeOAkskTZy3+bM3tQCtpK sp5UMPua/Fp7WDZ9vbFaNEW2yJ8xnDec+7JKc0qHQYm8YO8AxrvFlJwFZ75cck7oYlo7 bU7K17zWyv7slwQAD/6Qhu3nC9VfkKnBb/1x4tMlrx48EqoZ/WHCH+1aIHdJhjnR4X4I 4R2Q== X-Gm-Message-State: AOAM533pA/zii45z55ZYhYmZVNFY9xhG+EUFJZA0xWQdLLbojtg/xq06 lA5P52x9HwSItZNqngEcsfu52g== X-Google-Smtp-Source: ABdhPJwb5BeLFRcg8K4BNw7pXlR3MfrHpXzNoWjZEF/8JFh241KqjnY9I8YmGDoEPgePmuWZETl0ew== X-Received: by 2002:a5d:6ac4:: with SMTP id u4mr17670499wrw.166.1625765886972; Thu, 08 Jul 2021 10:38:06 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l4sm2521853wme.26.2021.07.08.10.38.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jul 2021 10:38:06 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Thu, 8 Jul 2021 19:37:35 +0200 Message-Id: <20210708173754.3877540-2-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210708173754.3877540-1-daniel.vetter@ffwll.ch> References: <20210708173754.3877540-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v3 01/20] drm/sched: entity->rq selection cannot fail 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: Andrey Grodzovsky , Jack Zhang , Daniel Vetter , Intel Graphics Development , Steven Price , Luben Tuikov , Daniel Vetter , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" If it does, someone managed to set up a sched_entity without schedulers, which is just a driver bug. We BUG_ON() here because in the next patch drm_sched_job_init() will be split up, with drm_sched_job_arm() never failing. And that's the part where the rq selection will end up in. Note that if having an empty sched_list set on an entity is indeed a valid use-case, we can keep that check in job_init even after the split into job_init/arm. Signed-off-by: Daniel Vetter Cc: "Christian König" Cc: Luben Tuikov Cc: Daniel Vetter Cc: Steven Price Cc: Andrey Grodzovsky Cc: Boris Brezillon Cc: Jack Zhang --- drivers/gpu/drm/scheduler/sched_entity.c | 2 +- drivers/gpu/drm/scheduler/sched_main.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c index 79554aa4dbb1..6fc116ee7302 100644 --- a/drivers/gpu/drm/scheduler/sched_entity.c +++ b/drivers/gpu/drm/scheduler/sched_entity.c @@ -45,7 +45,7 @@ * @guilty: atomic_t set to 1 when a job on this queue * is found to be guilty causing a timeout * - * Note: the sched_list should have at least one element to schedule + * Note: the sched_list must have at least one element to schedule * the entity * * Returns 0 on success or a negative error code on failure. diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index 33c414d55fab..01dd47154181 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -586,8 +586,7 @@ int drm_sched_job_init(struct drm_sched_job *job, struct drm_gpu_scheduler *sched; drm_sched_entity_select_rq(entity); - if (!entity->rq) - return -ENOENT; + BUG_ON(!entity->rq); sched = entity->rq->sched;