From patchwork Fri Jul 13 09:51:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nayan Deshmukh X-Patchwork-Id: 10522907 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A80D1602B3 for ; Fri, 13 Jul 2018 09:51:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9844F2998C for ; Fri, 13 Jul 2018 09:51:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96321299E0; Fri, 13 Jul 2018 09:51:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4177029704 for ; Fri, 13 Jul 2018 09:51:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C30276F1D2; Fri, 13 Jul 2018 09:51:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-x243.google.com (mail-pf0-x243.google.com [IPv6:2607:f8b0:400e:c00::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7105C6E25B; Fri, 13 Jul 2018 09:51:30 +0000 (UTC) Received: by mail-pf0-x243.google.com with SMTP id s21-v6so22389303pfm.6; Fri, 13 Jul 2018 02:51:30 -0700 (PDT) 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; bh=277qC/GNDcYzZdo3spQ+mQFy+5nQqzMXp8EZn+qxRJc=; b=AUnAOce93eRnRP+UyOiOZMOQIT1U7MVzO/ObUslmdmhN03KFNO20KvcLEmWz1ZTN30 N7EkTzluk+XgF9cfGxmoLvkX5hzv0Sm9B6kLZNz1Wi8HG5OKvc4iYmsjeataSh3MNc7S gdNQOetIrAA+MT7aINWASWwYfjJQtd4VLew9wM3POsRxBl5LCnOW23/ssT8jfkxE17+4 zlBHTl9xKWrDgOw+kOuAjEhri2pq0H0LE+C95ngrSjlbg88c8iqx1almW+bON+exrTuS qtTDvcoYqb+y2NQ07I0yZY0jlqXvvx2rQ1YK1OYSS/THjOWmbz+6XcjGHy5v12yyPfSU G3/g== X-Gm-Message-State: AOUpUlELq0XSX1cWYM+yUG9ocVZOV7y2dJrUuaBImQm33eotlk0Eujr6 euvj0rtFF3KH/cbQf+22uofQnlaZ X-Google-Smtp-Source: AAOMgpcfgpaFTDD3T7IRZBHgXhuJtfrJAclO+Dr6IxpK/bKaIPF6NylsgTq/p3bU7Ljjqxe8b8Akjg== X-Received: by 2002:a63:2404:: with SMTP id k4-v6mr5377577pgk.191.1531475489750; Fri, 13 Jul 2018 02:51:29 -0700 (PDT) Received: from localhost.localdomain ([47.247.122.162]) by smtp.gmail.com with ESMTPSA id z11-v6sm25454189pff.162.2018.07.13.02.51.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Jul 2018 02:51:28 -0700 (PDT) From: Nayan Deshmukh To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 1/2] drm/scheduler: add a pointer to scheduler in the rq Date: Fri, 13 Jul 2018 15:21:13 +0530 Message-Id: <20180713095114.29211-1-nayan26deshmukh@gmail.com> X-Mailer: git-send-email 2.14.3 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nayan Deshmukh , amd-gfx@lists.freedesktop.org, christian.koenig@amd.com MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch is in preparation for a better load balancing in scheduler. It allows us to associate entities with the run queues instead of binding them to a scheduler. Signed-off-by: Nayan Deshmukh Reviewed-by: Christian König Acked-by: Eric Anholt --- drivers/gpu/drm/scheduler/gpu_scheduler.c | 6 ++++-- include/drm/gpu_scheduler.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c index 7d2560699b84..429b1328653a 100644 --- a/drivers/gpu/drm/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c @@ -69,11 +69,13 @@ static void drm_sched_process_job(struct dma_fence *f, struct dma_fence_cb *cb); * * Initializes a scheduler runqueue. */ -static void drm_sched_rq_init(struct drm_sched_rq *rq) +static void drm_sched_rq_init(struct drm_gpu_scheduler *sched, + struct drm_sched_rq *rq) { spin_lock_init(&rq->lock); INIT_LIST_HEAD(&rq->entities); rq->current_entity = NULL; + rq->sched = sched; } /** @@ -926,7 +928,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, sched->timeout = timeout; sched->hang_limit = hang_limit; for (i = DRM_SCHED_PRIORITY_MIN; i < DRM_SCHED_PRIORITY_MAX; i++) - drm_sched_rq_init(&sched->sched_rq[i]); + drm_sched_rq_init(sched, &sched->sched_rq[i]); init_waitqueue_head(&sched->wake_up_worker); init_waitqueue_head(&sched->job_scheduled); diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index 4214ceb71c05..43e93d6077cf 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h @@ -93,6 +93,7 @@ struct drm_sched_entity { * struct drm_sched_rq - queue of entities to be scheduled. * * @lock: to modify the entities list. + * @sched: the scheduler to which this rq belongs to. * @entities: list of the entities to be scheduled. * @current_entity: the entity which is to be scheduled. * @@ -102,6 +103,7 @@ struct drm_sched_entity { */ struct drm_sched_rq { spinlock_t lock; + struct drm_gpu_scheduler *sched; struct list_head entities; struct drm_sched_entity *current_entity; };