Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp714467pxv; Thu, 15 Jul 2021 14:14:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzALsePzgDVD3d4QlvUy1EXtUTNLpXkz+KM+182NiyhDY8dW/i0GBTBTbMJ8WPV589eKbX X-Received: by 2002:a17:906:16cd:: with SMTP id t13mr7782854ejd.250.1626383644209; Thu, 15 Jul 2021 14:14:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626383644; cv=none; d=google.com; s=arc-20160816; b=UuQ9VYgmZ++ywnJYOXPdqoOplQiBaQzGxho2Cljg3y9G465LZ27BgrRA3ayRmEc2Mz 6hyAEgQnD/d4+dIi7fndEqHWbjmMvRWzDEsSRYeg7k2grTljIxj9XDkLYzmMQJUDHPri SFI+nqmlqJ/u5pK3qbrfAFyntJlf7AKOpgMdkfFMN4aMZ3RfTGn6Dy5vboGN+hIk5rv9 hKt/kKzqgpQOYpXvSBNrKjtROBSzg0XngqJL5Pd4OKIWuhtZJoWYxny0t/KoLUme7NtW 365Bq+PeUiAOYK4w5TamA/dyWiWdV4IvDrA5s0gn4nyJWeIDVs77pTPh5XG6d3utPLfA L3ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=foECYzcZ1dp4uRdcDSHJ1fwhbZ0XqN04ze420s8A980=; b=hhDUI6v4SOYGWJLBuPjfSeaC96BxFieCJQd0Q9QCHqGBVRAOi+okI8759DEvLEPAda AQxrG/w/Fh6Lu0cXw+IbcyDprV5VR3D4/cAbmdWqtd/EsrGvnhVq18/rUnYKv6+aenek my5COUHhH1bSgcQ3MOEVHoAeEXrkhfGZmR1zWygKMBYUhg+8xcDUhjjUKybPVPgXoWaq zDWEgPH/3YnaesIB0y8/PJcw3ajd9EF4DrG+eDVfkbQvVz0uApfkXscUr6Fas/vUyi7O 3o552/Z+kGhB5yOl9o8UtyWVBT7zsii4PGPmttED+8HRJXnZkx/DgsJUWKvcuFf39hh2 p4kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="j/f0Ka41"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id la20si10764903ejc.3.2021.07.15.14.13.41; Thu, 15 Jul 2021 14:14:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="j/f0Ka41"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243616AbhGOTcD (ORCPT + 99 others); Thu, 15 Jul 2021 15:32:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:46430 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243646AbhGOTJ7 (ORCPT ); Thu, 15 Jul 2021 15:09:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0FEDF61415; Thu, 15 Jul 2021 19:06:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375977; bh=cUqT5HGXumM4TBFcuqG8XVP4oJ3+IBDFlH7m3Z1t154=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j/f0Ka41V1pf4W8iOsWXVQZ8NG9iLnqCNbgL1wq53r05RS8GecDIY/TKmzLpWNSLN j+YlUSxNBioeUHlqjIN4oZ8v6U3uxs3oxHnTbmUwrkyTHzdyznTqyjEHENGaxqdlVS BaU+6epua5zL/2/3xzxMSOOFATejn2TTl+D9r1bs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Grodzovsky , =?UTF-8?q?Christian=20K=C3=B6nig?= , Sasha Levin Subject: [PATCH 5.13 033/266] drm/sched: Avoid data corruptions Date: Thu, 15 Jul 2021 20:36:28 +0200 Message-Id: <20210715182620.169774199@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrey Grodzovsky [ Upstream commit 0b10ab80695d61422337ede6ff496552d8ace99d ] Wait for all dependencies of a job to complete before killing it to avoid data corruptions. Signed-off-by: Andrey Grodzovsky Reviewed-by: Christian König Link: https://patchwork.freedesktop.org/patch/msgid/20210519141407.88444-1-andrey.grodzovsky@amd.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/scheduler/sched_entity.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c index cb58f692dad9..86a4209d8c77 100644 --- a/drivers/gpu/drm/scheduler/sched_entity.c +++ b/drivers/gpu/drm/scheduler/sched_entity.c @@ -222,11 +222,16 @@ static void drm_sched_entity_kill_jobs_cb(struct dma_fence *f, static void drm_sched_entity_kill_jobs(struct drm_sched_entity *entity) { struct drm_sched_job *job; + struct dma_fence *f; int r; while ((job = to_drm_sched_job(spsc_queue_pop(&entity->job_queue)))) { struct drm_sched_fence *s_fence = job->s_fence; + /* Wait for all dependencies to avoid data corruptions */ + while ((f = job->sched->ops->dependency(job, entity))) + dma_fence_wait(f, false); + drm_sched_fence_scheduled(s_fence); dma_fence_set_error(&s_fence->finished, -ESRCH); -- 2.30.2