Received: by 10.213.65.68 with SMTP id h4csp1943563imn; Thu, 5 Apr 2018 06:31:10 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+W/6vOUpKVS2Z2mswh1+WZyDc4q0ueK+sn5Y1bqcD4Bnyj5wxv8r9y59WJxFX+iKRSSejb X-Received: by 10.99.150.2 with SMTP id c2mr14846176pge.352.1522935070669; Thu, 05 Apr 2018 06:31:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522935070; cv=none; d=google.com; s=arc-20160816; b=H5PQfkwQRJNz3U/narohHXW8WwW68K58BtqbUSiMC4julZKyoCbCH3proCFgnRscv+ s0QX2ohdVxQO8ZEbEwtz544+NR11fOHJ+Ievzl9DT0kuHycHbgR/do9nxqZ2CZOJ5ozt Lh9ZXM9b1PpOTlby8bx6Z2XHwm8aXx+1enMTo6XWrBWbcy61Ds0XihWIR9QsMkiHRk1A VSgh+ZA3L30T0Sexjj60RM6p+tXcSiUIPP2ioD+8C4A8AknmQ6eRg4wEzc6dbnt4E9HM Bv/MFyB2iFfzQGRCut8I3HsMfid8V2lb5JJQ8/CKrbskchSEnT5f6LqVvcMRbgSv/7NU U95w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=pb64jluSczqgMt8tXjCbXzTHA7edfunE04CEJpJTLWI=; b=Ayc90TvdfdgiUMCOt6VHzJmz+Xk41Vp2IDDsiG1L0nJF5uZeFj8ooFN8P52LbMnrVj NtSVYJS10dX1UEPheUSOOwX3DnYPifhnvmn+A/wzt6QT4uRyWIGhk9hIPS0uNaD4n6Q2 awe4wq+XoKN111g8sZd0W0q01yBsu7PvhYsj+0T4Dg5vRBpD4tY7VpqUYg4gpZS5tjwi 5uB7lFfTfu97budr7dvEW+bkM0izfgi+t/8FTBxMt8xYpzwkxsMKZhrJVG2blYYJt56y rsBvWVAlc4jpNM/stYVdqd8hWdguIN6AelXHBR3oR/LRX/xI0Jx8lnoYF0Iy+AjgXR9M dH0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=SQaI8Ewk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e8-v6si6385477pli.219.2018.04.05.06.30.56; Thu, 05 Apr 2018 06:31:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=SQaI8Ewk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751417AbeDEN3x (ORCPT + 99 others); Thu, 5 Apr 2018 09:29:53 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:52695 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751195AbeDEN3v (ORCPT ); Thu, 5 Apr 2018 09:29:51 -0400 Received: by mail-it0-f68.google.com with SMTP id f6-v6so2808428ita.2 for ; Thu, 05 Apr 2018 06:29:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=pb64jluSczqgMt8tXjCbXzTHA7edfunE04CEJpJTLWI=; b=SQaI8EwkL3Hxg1HG5L9CZLFuf8xCNoRwPubT/HW4ie7L5ufTkv5KrBLImjBwbkjSiE IX7GKYf9lXyTpAQpZd9cig+AZWewlyjmNthdKVxZ6oIIbCpCz4O+ouNNL8q0qNffhso5 CQuEaQzROS36/K7kyaH+iASZ1bTTxyHyhXp1Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=pb64jluSczqgMt8tXjCbXzTHA7edfunE04CEJpJTLWI=; b=CC0tgVeJAevUT/N/VQy4HO1vyb5pkQzB6+PDkOtP8c/Z4++x/31SDc6HCwX0HOwxLO JZoWX8dOkW7/LEPD4SGEbAjUw39FYOyhguajJoDkUVA7uf7IGVaVZ9MidomBZeoiiTpD 3MhD3VLe0PSNFXwC/p3cJMTzocK0zfR+4qlqzfYTS9n0bPJIqVVTex+YAYW5LfhEeRac tBxqvbPQfmV+xbtoae89nbR0zokrJPsedr5sJiBVGEtwtxYwfcH9SnmfBeNx5rQAnsuu saFa+3Wiv7ED1kdEHDtWc+NEYMgvdlaU4vjYou++JYwDijwOYJKYU3ZLXcYfe8rWVJ87 RJtw== X-Gm-Message-State: AElRT7GRkjI2YGVVmeTL3w1W9I8lGAQwT3BAvdRQxyNI4uRj8x23G2rj 7xnJ6nSm+Kjxii30gFtETW23G6B00smdutxU8IYfAw== X-Received: by 2002:a24:dd82:: with SMTP id t124-v6mr13651027itf.2.1522934985573; Thu, 05 Apr 2018 06:29:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.40.129 with HTTP; Thu, 5 Apr 2018 06:29:44 -0700 (PDT) X-Originating-IP: [212.51.149.109] In-Reply-To: References: <20180404223251.28449-1-eric@anholt.net> From: Daniel Vetter Date: Thu, 5 Apr 2018 15:29:44 +0200 X-Google-Sender-Auth: xUY5ZhPuOJjWDB35IIUoa8o8oi0 Message-ID: Subject: Re: [PATCH] drm/sched: Extend the documentation. To: Alex Deucher Cc: Eric Anholt , Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , dri-devel , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 5, 2018 at 3:27 PM, Alex Deucher wrote: > On Thu, Apr 5, 2018 at 2:16 AM, Daniel Vetter wrote: >> On Thu, Apr 5, 2018 at 12:32 AM, Eric Anholt wrote: >>> These comments answer all the questions I had for myself when >>> implementing a driver using the GPU scheduler. >>> >>> Signed-off-by: Eric Anholt >> >> Pulling all these comments into the generated kerneldoc would be >> awesome, maybe as a new "GPU Scheduler" chapter at the end of >> drm-mm.rst? Would mean a bit of busywork to convert the existing raw >> comments into proper kerneldoc. Also has the benefit that 0day will >> complain when you forget to update the comment when editing the >> function prototype - kerneldoc which isn't included anywhere in .rst >> won't be checked automatically. > > I was actually planning to do this myself, but Nayan wanted to do this > a prep work for his proposed GSoC project so I was going to see how > far he got first. Awesome. I'm also happy to help out with any kerneldoc questions and best practices. Technically ofc no clue about the scheduler :-) Cheers, Daniel > Alex > >> -Daniel >> >>> --- >>> include/drm/gpu_scheduler.h | 46 +++++++++++++++++++++++++++++++++---- >>> 1 file changed, 42 insertions(+), 4 deletions(-) >>> >>> diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h >>> index dfd54fb94e10..c053a32341bf 100644 >>> --- a/include/drm/gpu_scheduler.h >>> +++ b/include/drm/gpu_scheduler.h >>> @@ -43,10 +43,12 @@ enum drm_sched_priority { >>> }; >>> >>> /** >>> - * A scheduler entity is a wrapper around a job queue or a group >>> - * of other entities. Entities take turns emitting jobs from their >>> - * job queues to corresponding hardware ring based on scheduling >>> - * policy. >>> + * drm_sched_entity - A wrapper around a job queue (typically attached >>> + * to the DRM file_priv). >>> + * >>> + * Entities will emit jobs in order to their corresponding hardware >>> + * ring, and the scheduler will alternate between entities based on >>> + * scheduling policy. >>> */ >>> struct drm_sched_entity { >>> struct list_head list; >>> @@ -78,7 +80,18 @@ struct drm_sched_rq { >>> >>> struct drm_sched_fence { >>> struct dma_fence scheduled; >>> + >>> + /* This fence is what will be signaled by the scheduler when >>> + * the job is completed. >>> + * >>> + * When setting up an out fence for the job, you should use >>> + * this, since it's available immediately upon >>> + * drm_sched_job_init(), and the fence returned by the driver >>> + * from run_job() won't be created until the dependencies have >>> + * resolved. >>> + */ >>> struct dma_fence finished; >>> + >>> struct dma_fence_cb cb; >>> struct dma_fence *parent; >>> struct drm_gpu_scheduler *sched; >>> @@ -88,6 +101,13 @@ struct drm_sched_fence { >>> >>> struct drm_sched_fence *to_drm_sched_fence(struct dma_fence *f); >>> >>> +/** >>> + * drm_sched_job - A job to be run by an entity. >>> + * >>> + * A job is created by the driver using drm_sched_job_init(), and >>> + * should call drm_sched_entity_push_job() once it wants the scheduler >>> + * to schedule the job. >>> + */ >>> struct drm_sched_job { >>> struct spsc_node queue_node; >>> struct drm_gpu_scheduler *sched; >>> @@ -112,10 +132,28 @@ static inline bool drm_sched_invalidate_job(struct drm_sched_job *s_job, >>> * these functions should be implemented in driver side >>> */ >>> struct drm_sched_backend_ops { >>> + /* Called when the scheduler is considering scheduling this >>> + * job next, to get another struct dma_fence for this job to >>> + * block on. Once it returns NULL, run_job() may be called. >>> + */ >>> struct dma_fence *(*dependency)(struct drm_sched_job *sched_job, >>> struct drm_sched_entity *s_entity); >>> + >>> + /* Called to execute the job once all of the dependencies have >>> + * been resolved. This may be called multiple times, if >>> + * timedout_job() has happened and drm_sched_job_recovery() >>> + * decides to try it again. >>> + */ >>> struct dma_fence *(*run_job)(struct drm_sched_job *sched_job); >>> + >>> + /* Called when a job has taken too long to execute, to trigger >>> + * GPU recovery. >>> + */ >>> void (*timedout_job)(struct drm_sched_job *sched_job); >>> + >>> + /* Called once the job's finished fence has been signaled and >>> + * it's time to clean it up. >>> + */ >>> void (*free_job)(struct drm_sched_job *sched_job); >>> }; >>> >>> -- >>> 2.17.0 >>> >>> _______________________________________________ >>> dri-devel mailing list >>> dri-devel@lists.freedesktop.org >>> https://lists.freedesktop.org/mailman/listinfo/dri-devel >> >> >> >> -- >> Daniel Vetter >> Software Engineer, Intel Corporation >> +41 (0) 79 365 57 48 - http://blog.ffwll.ch >> _______________________________________________ >> dri-devel mailing list >> dri-devel@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch