From patchwork Wed Sep 5 13:49:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10588875 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E70395A4 for ; Wed, 5 Sep 2018 13:49:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D59D02A1E6 for ; Wed, 5 Sep 2018 13:49:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C77D12A1DA; Wed, 5 Sep 2018 13:49:54 +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,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 636942A1DA for ; Wed, 5 Sep 2018 13:49:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7958A6E49F; Wed, 5 Sep 2018 13:49:53 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1E5D56E49E for ; Wed, 5 Sep 2018 13:49:52 +0000 (UTC) Received: by mail-wr1-x430.google.com with SMTP id o37-v6so7751018wrf.6 for ; Wed, 05 Sep 2018 06:49:52 -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:in-reply-to :references; bh=Dlym15nVUeycG9ypBhn/CsZVPRjVR0WjxTwlMOk9hqg=; b=CIuzoOIEr0CtX094kKniybGjyZNmYGg4bG6ngvAvYJnQb6ZpsAUFajozBv5T1PBLWs Ot0s5CA8g91jZzcG/7SQNY/GdxN0if9+odVUYv716TvW8OCqElJunJV1qXnnqgWm/Tt/ 8AGv6KO3piSis7dYbLy03IdpqJoc+FOZF0ovEg01KY0/y0kYrJQ+EnogcpoOyb41exiv dla2GWNIRLdGyPbpc6JW9eQozJEbu3fLQOxdUPkmUGakQ/GKX71rihzccOyMirYXTZMx //sm3WJdeNxEBLdZE6eldQ9YuKzO5S3MP7q5aHIPgK8izO9hvNG+OX51zXAWlbTpP/iV l72g== X-Gm-Message-State: APzg51D/zrz3sx7gQMKXF24ejJPuG03/LP9c3zR46D//Ezi6pmAMCY5f UOd/vn0Qr2s7zH4PJzIu+lhOdg== X-Google-Smtp-Source: ANB0VdaO8gSzVdSvTaDnvvvbavUrCUVBiiVEw7vqxEsXLHAjjhBudqUEUDEsMHsqPzKnPmoGH2Cmrw== X-Received: by 2002:a5d:6381:: with SMTP id p1-v6mr5325308wru.106.1536155390305; Wed, 05 Sep 2018 06:49:50 -0700 (PDT) Received: from localhost.localdomain ([95.144.165.37]) by smtp.gmail.com with ESMTPSA id j66-v6sm2701639wrj.28.2018.09.05.06.49.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Sep 2018 06:49:49 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Wed, 5 Sep 2018 14:49:32 +0100 Message-Id: <20180905134939.2942-7-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180905134939.2942-1-tvrtko.ursulin@linux.intel.com> References: <20180905134939.2942-1-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATH i-g-t 06/13] gem_wsim: Context priority support X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Intel-gfx@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Tvrtko Ursulin A new workload command ('P') is added which enables per context dynamic priority control. Signed-off-by: Tvrtko Ursulin --- benchmarks/gem_wsim.c | 48 +++++++++++++++++++++++++++++++++++++++++- benchmarks/wsim/README | 18 ++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c index fe9535df75c6..0c52ec567430 100644 --- a/benchmarks/gem_wsim.c +++ b/benchmarks/gem_wsim.c @@ -82,7 +82,8 @@ enum w_type THROTTLE, QD_THROTTLE, SW_FENCE, - SW_FENCE_SIGNAL + SW_FENCE_SIGNAL, + CTX_PRIORITY }; struct deps @@ -114,6 +115,7 @@ struct w_step int target; int throttle; int fence_signal; + int priority; }; /* Implementation details */ @@ -162,6 +164,7 @@ struct workload unsigned int nr_ctxs; struct { uint32_t id; + int priority; unsigned int static_vcs; } *ctx_list; @@ -342,6 +345,36 @@ parse_workload(struct w_arg *arg, unsigned int flags, struct workload *app_w) step.period = tmp; goto add_step; } + } else if (!strcmp(field, "P")) { + unsigned int nr = 0; + while ((field = strtok_r(fstart, ".", &fctx)) != + NULL) { + tmp = atoi(field); + if (tmp <= 0 && nr == 0) { + if (verbose) + fprintf(stderr, + "Invalid context at step %u!\n", + nr_steps); + return NULL; + } + + if (nr == 0) { + step.context = tmp; + } else if (nr == 1) { + step.priority = tmp; + } else { + if (verbose) + fprintf(stderr, + "Invalid priority format at step %u!\n", + nr_steps); + return NULL; + } + + nr++; + } + + step.type = CTX_PRIORITY; + goto add_step; } else if (!strcmp(field, "s")) { if ((field = strtok_r(fstart, ".", &fctx)) != NULL) { @@ -1806,6 +1839,19 @@ static void *run_workload(void *data) inc = cur_seqno - wrk->sync_seqno; sw_sync_timeline_inc(wrk->sync_timeline, inc); continue; + } else if (w->type == CTX_PRIORITY) { + if (w->priority != wrk->ctx_list[w->context].priority) { + struct drm_i915_gem_context_param param = { + .ctx_id = wrk->ctx_list[w->context].id, + .param = I915_CONTEXT_PARAM_PRIORITY, + .value = w->priority, + }; + + gem_context_set_param(fd, ¶m); + wrk->ctx_list[w->context].priority = + w->priority; + } + continue; } if (do_sleep || w->type == PERIOD) { diff --git a/benchmarks/wsim/README b/benchmarks/wsim/README index 01766d37564f..fd9bff3401af 100644 --- a/benchmarks/wsim/README +++ b/benchmarks/wsim/README @@ -3,6 +3,7 @@ Workload descriptor format ctx.engine.duration_us.dependency.wait,... ..[-].[/][...].<0|1>,... +P.. d|p|s|t|q|a.,... f @@ -22,6 +23,7 @@ Additional workload steps are also supported: 'q' - Throttle to n max queue depth. 'f' - Create a sync fence. 'a' - Advance the previously created sync fence. + 'P' - Context priority. Engine ids: RCS, BCS, VCS, VCS1, VCS2, VECS @@ -110,3 +112,19 @@ created at the second step. They are submitted ahead of time while still not runnable. When the second RCS batch completes the standalone fence is signaled which allows the two VCS batches to be executed. Finally we wait until the both VCS batches have completed before starting the (optional) next iteration. + +Context priority +---------------- + + P.1.-1 + 1.RCS.1000.0.0 + P.2.1 + 2.BCS.1000.-2.0 + +Context 1 is marked as low priority (-1) and then a batch buffer is submitted +against it. Context 2 is marked as high priority (1) and then a batch buffer +is submitted against it which depends on the batch from context 1. + +Context priority command is executed at workload runtime and is valid until +overriden by another (optional) same context priority change. Actual driver +ioctls are executed only if the priority level has changed for the context.