From patchwork Tue Aug 14 15:05:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10565819 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 ADEF415A6 for ; Tue, 14 Aug 2018 15:05:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F7392A05E for ; Tue, 14 Aug 2018 15:05:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 940BE2A0E6; Tue, 14 Aug 2018 15:05:38 +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 207CD2A05E for ; Tue, 14 Aug 2018 15:05:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 75AD76E290; Tue, 14 Aug 2018 15:05:37 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x22f.google.com (mail-wm0-x22f.google.com [IPv6:2a00:1450:400c:c09::22f]) by gabe.freedesktop.org (Postfix) with ESMTPS id D213F6E28A for ; Tue, 14 Aug 2018 15:05:32 +0000 (UTC) Received: by mail-wm0-x22f.google.com with SMTP id f21-v6so12628723wmc.5 for ; Tue, 14 Aug 2018 08:05:32 -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=pjvnTiKy10IaMbzG4agrXtVc3jr+0KvqpUSItTuJuzg=; b=ZAwfEQSlTqAyMcf2dTf4bulwUyoSI1JLHGork/Uvjez5+i5cu1arE4VKAdUM4/hGyv AkwasrxCtcwzBFkjt8vdM28vvX/YGa3uOP57hcXd/yIoqjGi3w2b24V+fngrAIPpoj8i 0oaryojuuiYzV3qlqulvid4WWH49woysvfCkP7o9TXTBHFJGZCPFLvjCq91kAxus+5YE 4XoO1xs19gTvhKrWppPXKMt8b8FuwSCmhw+FsC+OA6ARHoJGsl5ZhMWN2Ua8Ers+x4M6 0dCD9i/jMdY5sItgF06ZUFlsr0v1/UFm43Yt0zN1ekU3TJhv/2Ao8QLPLpzscSLEJ52V 9uFw== X-Gm-Message-State: AOUpUlGtXzGShVyqGrV8sCOct7/f6dv4axzVyMcmi2rljyWY1iEnvIjp nnJN/s85rsmgG3yjzYWBEGBs5g== X-Google-Smtp-Source: AA+uWPy+v6QNkv8tKkjNm7MKnEO1PRivw5n2lW9Am6f1UBxYYLe050xj2H3NBj4qFy7Ifd+DWyZXRw== X-Received: by 2002:a1c:ef0f:: with SMTP id n15-v6mr10556944wmh.116.1534259131447; Tue, 14 Aug 2018 08:05:31 -0700 (PDT) Received: from localhost.localdomain ([95.144.165.93]) by smtp.gmail.com with ESMTPSA id x82-v6sm39942383wmd.11.2018.08.14.08.05.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Aug 2018 08:05:30 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Tue, 14 Aug 2018 16:05:15 +0100 Message-Id: <20180814150519.20204-4-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180814150519.20204-1-tvrtko.ursulin@linux.intel.com> References: <20180814150519.20204-1-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH i-g-t 3/7] 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 e5eb1ef70a35..34758419254a 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.