Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp639296pxv; Thu, 15 Jul 2021 12:11:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjwQFLNj3rT13doEKo6GcBGFZ6ctrj74ah4KpOB6wn3EHQgYVYoeo59Xz+8PhBWfJr5E7X X-Received: by 2002:a05:6638:372c:: with SMTP id k44mr5415290jav.94.1626376261771; Thu, 15 Jul 2021 12:11:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626376261; cv=none; d=google.com; s=arc-20160816; b=pulJLfBs/j+xjXQ100iI5AIGkCrsDO1eltp6okD+/wTMH1o44kxrd1+lSGZoho88uA CPtnWQ5tC2f8Tthnv0pKfdCTuchODm/2EYHALUChrV+8+UJr0He1JybxRQXVvyzHjWgv YKrgMj0ePhy/jFdueKFBIvVObEa5MZxT3DhDU2ozYTp8+oOsT6+7S84QrBgu/PTMHWv0 55dBkili39b7dkl3ip4uMxr3tfA/v2nS+6A9USyVxI9Ma1U3fdqBMhjls/CivhrwdAMF dOEaGnVDak++rgXcvd31LDCcIdWMrVK1ajRUY1ieSZzcljEvtuToqyRIcAy+yGKHyFxo hcGg== 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=1DBqhYPn2gpCFN55dgX270dKZ7kA4kmvGIqGraA91U4=; b=j8scCy4qUu9ezPreItQu412ZsOa00Ue01sbs7fpBnCv9ExgMFM9NSS4D5y1wHRJPPL bcvL8bL+mKW+NYe0fdT1sOoBrUPfVByIPW/3vvtdPqN4+DI5sMcyRSQ0sPJgSMsJ84wJ B6hPBKtUsphuZIiSYMMTI9doYbmc5URgkNHIpo2olhHcPBLCNdlv5ZNq6Izt9HQR5o0d 1ixglh7qmMH7gu7TmnTDSq1c4fsC/pzgt7z2kzHpSD8C7Y1u6aO9Xt9qfsZ1MlsdN9Qf qz50m8ndFFRzRvPebKJ9x5ZhmHT5t8p3GhOhNaoXRTQogIUrZ5yDkwNd/wdS8aDQQNpJ BhYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bbg2M61v; 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 z10si8133392ioq.37.2021.07.15.12.10.49; Thu, 15 Jul 2021 12:11:01 -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=Bbg2M61v; 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 S242848AbhGOTLH (ORCPT + 99 others); Thu, 15 Jul 2021 15:11:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:35016 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242335AbhGOS7h (ORCPT ); Thu, 15 Jul 2021 14:59:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 613BD61158; Thu, 15 Jul 2021 18:56:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375393; bh=ntt+QbwwZjDylx63TgbvU9XSa74tzKkwq5pUAK4TrhE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bbg2M61v1FRJDBgfUX7R/eHdayvJycGzdavQ6QrSV4XphVny3etFBBDJEoJSN1YZF 7l7hBVONAJfYMgd7lBom1OOn02D26+U7PEbm3P1TneNhM3DNAUtIwhlx3cpLtA/9VL s+O5jkMBglh4z5crv58BjPcXsX4P0IGR6egTB75I= 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.12 026/242] drm/sched: Avoid data corruptions Date: Thu, 15 Jul 2021 20:36:28 +0200 Message-Id: <20210715182556.435460167@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@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 72c39608236b..1b2fdf7f3ccd 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