Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1118931ybg; Thu, 4 Jun 2020 01:15:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYmskbiP6NZFe33nxguRvuvzNQQIrGDOE2uswjHDcEmdl+Mio0bFCg3n1LzTEiC9YXmoz4 X-Received: by 2002:a17:906:5e05:: with SMTP id n5mr2785965eju.278.1591258508998; Thu, 04 Jun 2020 01:15:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591258508; cv=none; d=google.com; s=arc-20160816; b=tYGy9j97ndOP1dwOJKKr6BAJiMHWsWRTbkfAteDCZTGdalwJzhK6kKJ1na/e1XkelG sqERYkhRnLBzQK/628hbIMxQPKB4ad3O63uMeR6Zq6OQf4H/6IYzlmPxXPdH8NdpKOCU n9bYpzw8bHyWWSyJXhWUEGacxSG4sypbMp7d49xiFETOaT50B2CPQbs8oRsYp9Phf5rK TUvOXn/tFWwFnmSkkkdsYekrwP4m/RpBM4e1Vb8QMEM4y0NWjOQ0C0VRzOB2z+zu27UU SIjxItu+G8+8pr+wmss2e8hBjBmPU66DS2UEZTR9WNYfbU4fRtbbd4ffA1+v6+yAa2aE ZPug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QpRcEBLBFti7+uwIPhFpaG5e28opFzcZsYVebGatC0I=; b=aaVayHh7huefjNtRHeffeQFBIsazN0HKj1azAsTjb/ObkaELLsQdlU7ptYKpWhBjWF U7q9pWQM1oXO+wpyRGPaAM5R9juwFcm6PBpQwuIEuzmAAfwbh1/GXsyRKltQYaTqRby6 /4CFP8v7GiwhYUQ9j7uw5SYuA6sPJpJc8Q1hBybjKuFeVv7iiYbbpr4pT8v589Qb/D2t Kqzkv7TKFjlaQH0HQDR6XS9wXewKzYAv4szdqGqgz/hCMNcSBDqsdsMcDiuLx2SV5Ms6 tcJ3T9mRfk26WmJpsjITCZKOmnmFY81LAZr0dlXtA/SHdo2faYH7dvYvk9OcvEdeZumD k1nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=IEeSF84M; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s9si1252402edi.380.2020.06.04.01.14.46; Thu, 04 Jun 2020 01:15:08 -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=@ffwll.ch header.s=google header.b=IEeSF84M; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727794AbgFDIMt (ORCPT + 99 others); Thu, 4 Jun 2020 04:12:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727085AbgFDIMp (ORCPT ); Thu, 4 Jun 2020 04:12:45 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9A55C03E96D for ; Thu, 4 Jun 2020 01:12:44 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id l26so4289494wme.3 for ; Thu, 04 Jun 2020 01:12:44 -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=QpRcEBLBFti7+uwIPhFpaG5e28opFzcZsYVebGatC0I=; b=IEeSF84MYGmRcfj4sMCd4J+zYZKwLXaJxMSpi3fUTEKdsfossRgSDuWbe+zZ21xpAx 3y3tAVuXjHWRsIi+zJrg554cTrk73ezXwhTX3+vOBsrV//Okft/By/0MmGxexiInifje DtXukw743V5Gql830qv9EKpT7CFp/fzcgsUTM= 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=QpRcEBLBFti7+uwIPhFpaG5e28opFzcZsYVebGatC0I=; b=s/bqFxIm7Klkg9TbCKfc6NlZYba9QLoSBVTA563KY1gg61m7zDPAjLs3VVHISdXBev XkuPdq3YN059q6OrIMx1OEvQJi2L4hNdoR1+4x9D+e6SnYtJr0xLu71d4eJpb66MXPEE ej5HKT6NA3KhO3ZApBvNo+BH4QkieeHyI2CU2X+/X4TFOInLP63caUdGtAlPFDmUuxC/ VCZ7rasGXun1hSHfpKtZz0LoB9LczjajUfD4h8Bd88r0GeKHeZZAztaZONSuTB9twuff 72gB6o41jsCrjTPvH9EIJC5DJQo0cuZ9xnvHLy6Y4dTRz6HQN9MjaeNxAmkoVKXsLq+q T1Yw== X-Gm-Message-State: AOAM530oqsfoeeZI2jwfJYFE+nWCtxtOvz/YzsX56gzh9zpwyhq+0zZ2 iXKsiBDepXoUhOwTUDzW6PSeyA== X-Received: by 2002:a1c:5502:: with SMTP id j2mr3075373wmb.56.1591258363614; Thu, 04 Jun 2020 01:12:43 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id f11sm6873305wrj.2.2020.06.04.01.12.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2020 01:12:42 -0700 (PDT) From: Daniel Vetter To: DRI Development Cc: Intel Graphics Development , LKML , linux-rdma@vger.kernel.org, amd-gfx@lists.freedesktop.org, Daniel Vetter , linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, Chris Wilson , Maarten Lankhorst , =?UTF-8?q?Christian=20K=C3=B6nig?= , Daniel Vetter Subject: [PATCH 09/18] drm/scheduler: use dma-fence annotations in main thread Date: Thu, 4 Jun 2020 10:12:15 +0200 Message-Id: <20200604081224.863494-10-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200604081224.863494-1-daniel.vetter@ffwll.ch> References: <20200604081224.863494-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the scheduler rt thread gets stuck on a mutex that we're holding while waiting for gpu workloads to complete, we have a problem. Add dma-fence annotations so that lockdep can check this for us. I've tried to quite carefully review this, and I think it's at the right spot. But obviosly no expert on drm scheduler. Cc: linux-media@vger.kernel.org Cc: linaro-mm-sig@lists.linaro.org Cc: linux-rdma@vger.kernel.org Cc: amd-gfx@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org Cc: Chris Wilson Cc: Maarten Lankhorst Cc: Christian König Signed-off-by: Daniel Vetter --- drivers/gpu/drm/scheduler/sched_main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index 2f319102ae9f..06a736e506ad 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -763,9 +763,12 @@ static int drm_sched_main(void *param) struct sched_param sparam = {.sched_priority = 1}; struct drm_gpu_scheduler *sched = (struct drm_gpu_scheduler *)param; int r; + bool fence_cookie; sched_setscheduler(current, SCHED_FIFO, &sparam); + fence_cookie = dma_fence_begin_signalling(); + while (!kthread_should_stop()) { struct drm_sched_entity *entity = NULL; struct drm_sched_fence *s_fence; @@ -823,6 +826,9 @@ static int drm_sched_main(void *param) wake_up(&sched->job_scheduled); } + + dma_fence_end_signalling(fence_cookie); + return 0; } -- 2.26.2