From patchwork Tue Aug 14 15:05:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10565815 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 7ECB515A6 for ; Tue, 14 Aug 2018 15:05:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71CE92A05E for ; Tue, 14 Aug 2018 15:05:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6626C2A0E6; Tue, 14 Aug 2018 15:05: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,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 1E7A32A05E for ; Tue, 14 Aug 2018 15:05:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D0F6B6E288; Tue, 14 Aug 2018 15:05:32 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8E2846E284 for ; Tue, 14 Aug 2018 15:05:30 +0000 (UTC) Received: by mail-wr1-x435.google.com with SMTP id j5-v6so17494099wrr.8 for ; Tue, 14 Aug 2018 08:05: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:in-reply-to :references; bh=5PAr9+wsQg3+iKK2f3LNsUg4zL3ks4HgE5OktJj2SzI=; b=jdAMimwgLIVZq/6AgWyLXwnlziy4APIx5DujRUDXZp4+TY7mHU+CAKheRP9Kd49pYy IAedFajFh4Rj17wA6zKcpSh931YwisfkS6EqQwnctAyBLwYoy5krYrJ44tt7Oq1J7pyJ cRC3AVrI9TvMyf9pAaq2/CygwxldzlSkDV1fAM26A7rKeYmQhqjPxCc0ppkfRSi+dBkb CQwi1m1a8w1GtD8H2VxRlWWzPaFH0AcWe84RmhdFNVQUzhSIYjOE167y/8gxVBfgfCE1 pPhLeZCuBUax9e6EkIbd/ngYHFuKbwQThSzO7G+wNF/Qgxu1UoJD87EC9lftrNcXwgv0 yS6Q== X-Gm-Message-State: AOUpUlHldeBUsGlqUT5lnub163tkICh0DbAuOxvsIPmw8uAQ3jBSV/gM z10eDO0b3Q2o67L7LxHFUBK2Mq2cXXA= X-Google-Smtp-Source: AA+uWPwXt3jz9uTPtXLRKNDtYUlDpMgLT9NRwlTG13w6JAE070vrjBxvq0oJkP4f8CE1u5GtwYhCkA== X-Received: by 2002:adf:9aa3:: with SMTP id a32-v6mr13368557wrc.75.1534259129210; Tue, 14 Aug 2018 08:05:29 -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.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Aug 2018 08:05:28 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Tue, 14 Aug 2018 16:05:13 +0100 Message-Id: <20180814150519.20204-2-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 1/7] gem_wsim: Check sleep times 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 Notice in more places if we are running behind. Signed-off-by: Tvrtko Ursulin --- benchmarks/gem_wsim.c | 52 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c index 80f180829241..ead91b0f009b 100644 --- a/benchmarks/gem_wsim.c +++ b/benchmarks/gem_wsim.c @@ -1718,6 +1718,21 @@ static bool sync_deps(struct workload *wrk, struct w_step *w) return synced; } +static unsigned int measured_usleep(unsigned int usec) +{ + struct timespec ts = { }; + unsigned int slept; + + slept = igt_nsec_elapsed(&ts); + igt_assert(slept == 0); + do { + usleep(usec - slept); + slept = igt_nsec_elapsed(&ts) / 1000; + } while (slept < usec); + + return igt_nsec_elapsed(&ts); +} + static void *run_workload(void *data) { struct workload *wrk = (struct workload *)data; @@ -1739,7 +1754,7 @@ static void *run_workload(void *data) count++) { unsigned int cur_seqno = wrk->sync_seqno; - clock_gettime(CLOCK_MONOTONIC, &wrk->repeat_start); + igt_gettime(&wrk->repeat_start); for (i = 0, w = wrk->steps; wrk->run && (i < wrk->nr_steps); i++, w++) { @@ -1751,13 +1766,14 @@ static void *run_workload(void *data) } else if (w->type == PERIOD) { struct timespec now; - clock_gettime(CLOCK_MONOTONIC, &now); + igt_gettime(&now); do_sleep = w->period - elapsed_us(&wrk->repeat_start, &now); if (do_sleep < 0) { - if (verbose > 1) - printf("%u: Dropped period @ %u/%u (%dus late)!\n", - wrk->id, count, i, do_sleep); + if (verbose > 1 && + -do_sleep > 10 * w->period / 100) + printf("%u: Missed period @ %u/%u (%dus late)!\n", + wrk->id, count, i, -do_sleep); continue; } } else if (w->type == SYNC) { @@ -1793,7 +1809,31 @@ static void *run_workload(void *data) } if (do_sleep || w->type == PERIOD) { - usleep(do_sleep); + long slept = measured_usleep(do_sleep) / 1000; + + if ( w->type == PERIOD) { + struct timespec now; + + igt_gettime(&now); + + slept = elapsed_us(&wrk->repeat_start, + &now); + + if (verbose > 1 && + slept > (110 * w->period / 100)) + printf("%u: Overslept period by %ldus @ %u/%u! (%uus)\n", + wrk->id, + -slept, count, + i, w->period); + } else { + if (verbose > 1 && + slept > (110 * do_sleep / 100)) + printf("%u: Overslept by %ldus @ %u/%u! (%uus)\n", + wrk->id, + slept - do_sleep, count, + i, do_sleep); + } + continue; } From patchwork Tue Aug 14 15:05:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10565817 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 F05F6139A for ; Tue, 14 Aug 2018 15:05:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E29A22A05E for ; Tue, 14 Aug 2018 15:05:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6AD32A0E6; Tue, 14 Aug 2018 15:05:35 +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 8E2E72A05E for ; Tue, 14 Aug 2018 15:05:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 770896E28A; Tue, 14 Aug 2018 15:05:33 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 955056E284 for ; Tue, 14 Aug 2018 15:05:31 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id r16-v6so17485669wrt.11 for ; Tue, 14 Aug 2018 08:05:31 -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=AmQ4jUD/DCQG/DQqadHZ6xjUZKHhUw2VXBJ71AblBQ4=; b=cCkKn7yxift0aWX7QONmiG/oK9IFLz4TS/voKX4KYtGHVfnCKbGU/Ugbev04l760Id JdMHxIczfENMOkyvVdTrKcZpoFcNhEC0p9kf0ueo9P9CpeWuwmBrRh2eS0xPICiJyfXe 5LYP9dbOcNwQD3T/weGZCvA6YjT+FCdanlAQ/ZRQdZlDtKnnn5tCRFPRXvmk3CIJpEMb Zyxb8zgNErlB8GEwcmRorH/F+2t89C2t28epyS8UoRk9Yi3hvPsK6xJnelBBrIJWJekU HqbN2xVj5zU4l5xjckbKkWzG7umJ+uQWUD841FmWAEbwiCwmznAUghNuszq9ZET9v+Y3 Bzhw== X-Gm-Message-State: AOUpUlHZyILfFNcGxGhEWUyMT1oG9Wvf/aGpW8pe37b3l0YDVfU+dnKZ PbIqBy2amkj/hvqwwghn4qgMYQ== X-Google-Smtp-Source: AA+uWPz5UOwHIJ79KHLVVpqwhJWDcekRsdCbxvGLsOB+jrvMKSjIziXiv3IlXBbEzxKF4Q8S2nSKfw== X-Received: by 2002:a5d:4e92:: with SMTP id e18-v6mr14511659wru.32.1534259130328; Tue, 14 Aug 2018 08:05:30 -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.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Aug 2018 08:05:29 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Tue, 14 Aug 2018 16:05:14 +0100 Message-Id: <20180814150519.20204-3-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 2/7] gem_wsim: Make workload commands case sensitive 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 Need namespace for new commands and I never documented they are case insensitive so it is fine. Signed-off-by: Tvrtko Ursulin --- benchmarks/gem_wsim.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c index ead91b0f009b..e5eb1ef70a35 100644 --- a/benchmarks/gem_wsim.c +++ b/benchmarks/gem_wsim.c @@ -310,7 +310,7 @@ parse_workload(struct w_arg *arg, unsigned int flags, struct workload *app_w) if ((field = strtok_r(fstart, ".", &fctx)) != NULL) { fstart = NULL; - if (!strcasecmp(field, "d")) { + if (!strcmp(field, "d")) { if ((field = strtok_r(fstart, ".", &fctx)) != NULL) { tmp = atoi(field); @@ -326,7 +326,7 @@ parse_workload(struct w_arg *arg, unsigned int flags, struct workload *app_w) step.delay = tmp; goto add_step; } - } else if (!strcasecmp(field, "p")) { + } else if (!strcmp(field, "p")) { if ((field = strtok_r(fstart, ".", &fctx)) != NULL) { tmp = atoi(field); @@ -342,7 +342,7 @@ parse_workload(struct w_arg *arg, unsigned int flags, struct workload *app_w) step.period = tmp; goto add_step; } - } else if (!strcasecmp(field, "s")) { + } else if (!strcmp(field, "s")) { if ((field = strtok_r(fstart, ".", &fctx)) != NULL) { tmp = atoi(field); @@ -359,7 +359,7 @@ parse_workload(struct w_arg *arg, unsigned int flags, struct workload *app_w) step.target = tmp; goto add_step; } - } else if (!strcasecmp(field, "t")) { + } else if (!strcmp(field, "t")) { if ((field = strtok_r(fstart, ".", &fctx)) != NULL) { tmp = atoi(field); @@ -375,7 +375,7 @@ parse_workload(struct w_arg *arg, unsigned int flags, struct workload *app_w) step.throttle = tmp; goto add_step; } - } else if (!strcasecmp(field, "q")) { + } else if (!strcmp(field, "q")) { if ((field = strtok_r(fstart, ".", &fctx)) != NULL) { tmp = atoi(field); @@ -391,7 +391,7 @@ parse_workload(struct w_arg *arg, unsigned int flags, struct workload *app_w) step.throttle = tmp; goto add_step; } - } else if (!strcasecmp(field, "a")) { + } else if (!strcmp(field, "a")) { if ((field = strtok_r(fstart, ".", &fctx)) != NULL) { tmp = atoi(field); @@ -407,7 +407,7 @@ parse_workload(struct w_arg *arg, unsigned int flags, struct workload *app_w) step.target = tmp; goto add_step; } - } else if (!strcasecmp(field, "f")) { + } else if (!strcmp(field, "f")) { step.type = SW_FENCE; goto add_step; } 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. From patchwork Tue Aug 14 15:05:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10565821 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 020A715A6 for ; Tue, 14 Aug 2018 15:05:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA2602A05E for ; Tue, 14 Aug 2018 15:05:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DEB972A0E6; Tue, 14 Aug 2018 15:05:40 +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 A48CC2A05E for ; Tue, 14 Aug 2018 15:05:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 08CDF6E296; Tue, 14 Aug 2018 15:05:38 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id E57AC6E28B for ; Tue, 14 Aug 2018 15:05:33 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id l2-v6so10711102wme.1 for ; Tue, 14 Aug 2018 08:05:33 -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=DyTCtHWcjmTqTr9rxGi2AWp+M3htFbf3grYJurhYxnY=; b=ulkM6yBJq1vv0o8xviBgpIE4RVg6vdjwifMSqH8jdt1ICsIhHWA+w4lkF/DgrNTQrH VefpM4YmTbnwmQNsmeTRE9VwQMib0pw4iD1fQfRAFVYacf0rAoWlm+i+x2dBE52EX4L4 M3EhILQ/4zuleOcQYy71WPs9PBxRxHkS651YdZbBa6elqJXRqFDize1qlmqqpbI8cvsN oWYH5KGxyDruP+tR7v5AYTcvTbCzPd2wG6uKGNT0nzQwlmJ3NNdYavDJS07Ry0IlZA8s VB4gN6qydI9s3cDX1jDFwuFcJ8BEeLSYrto/8vYV0M6pUQkUfPwX2CrYNxg/vAAsE2TW tcIA== X-Gm-Message-State: AOUpUlEXnScXniLWfFKhJgBcCp6VUYRyqtMwGy6uBDI7rBXX1RmizCqs eHVlA7WeAId1MmROP0DRemBE+szrEL0= X-Google-Smtp-Source: AA+uWPwyUhCXAaR7aDOtyfGy9GdtMuxb8llWI1CL0kpXCe0egOTDgZ1fi2c9ZAtI/CACo/dxE3QNiA== X-Received: by 2002:a1c:2396:: with SMTP id j144-v6mr11047502wmj.26.1534259132559; Tue, 14 Aug 2018 08:05:32 -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.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Aug 2018 08:05:31 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Tue, 14 Aug 2018 16:05:16 +0100 Message-Id: <20180814150519.20204-5-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 4/7] gem_wsim: Stop keeping batches mapped 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 The reason, which I assume was there at some point, to keep the batches persistently memory mapped does not appear to be there. So unmap them after creation and remove the unused structure members. Signed-off-by: Tvrtko Ursulin --- benchmarks/gem_wsim.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c index 34758419254a..24f518a7770f 100644 --- a/benchmarks/gem_wsim.c +++ b/benchmarks/gem_wsim.c @@ -128,7 +128,6 @@ struct w_step struct drm_i915_gem_relocation_entry reloc[4]; unsigned long bb_sz; uint32_t bb_handle; - uint32_t *mapped_batch; uint32_t *seqno_value; uint32_t *seqno_address; uint32_t *rt0_value; @@ -136,7 +135,6 @@ struct w_step uint32_t *rt1_address; uint32_t *latch_value; uint32_t *latch_address; - unsigned int mapped_len; }; DECLARE_EWMA(uint64_t, rt, 4, 2) @@ -755,8 +753,7 @@ terminate_bb(struct w_step *w, unsigned int flags) *cs = bbe; - w->mapped_batch = ptr; - w->mapped_len = mmap_len; + munmap(ptr, mmap_len); } static const unsigned int eb_engine_map[NUM_ENGINES] = { From patchwork Tue Aug 14 15:05:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10565823 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 783AA139A for ; Tue, 14 Aug 2018 15:05:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69B432A05E for ; Tue, 14 Aug 2018 15:05:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E4E42A0E6; Tue, 14 Aug 2018 15:05:42 +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 0C4722A05E for ; Tue, 14 Aug 2018 15:05:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4AAE26E286; Tue, 14 Aug 2018 15:05:41 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3DD416E290 for ; Tue, 14 Aug 2018 15:05:35 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id c14-v6so12622470wmb.4 for ; Tue, 14 Aug 2018 08:05:35 -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=RRZjVA47k70BUzwT+og7Nq9jOxLrdD/F1jSfsVJykxA=; b=PLuT/ydPFPzLoMxtLX8hyucqrhQmEeKJK1HOvNh3kQex1vWG462rWSnGQQHTbMNFEW y+WkIDsNCWU7oiuLEe72pKuu1G3mOQnDZk6OdAJFc3pO7aYrQ2Q5ohcXzsFriWHil/ZA xKVZrhiXAxGwHzqYFkEsIGS37HQ+JRsngxlOYN32KM66N2gthuaHuxAuZ/1Zqed2gOU9 pk3i3l/8mdY1T5v7LpvTevXpoX39Q5VLUbUe1YLp15QNl9HohIg3WGDp0zBPuuh7Mv8P l8gTi+TChqufH8yW00TTHj4+xB1PO8sHz65T9F7UBUmuFOBW5myAn1ac2l0ftVjFW1Jc RuVQ== X-Gm-Message-State: AOUpUlHjCrjcMkRT3osoIBSSpuhRFHbB43DM/Zn0cIjRx58nWAylf0vS HKNXA0hriy1cKNOWPqgfw1jwqQ== X-Google-Smtp-Source: AA+uWPz7f+90fvsBO3vXtoeAXaRWU+AYBescDPnDyspg2QpFrCh3IkNt2J5i+CJ/j24L3NKKUh+RfA== X-Received: by 2002:a1c:dacb:: with SMTP id r194-v6mr10880697wmg.56.1534259133874; Tue, 14 Aug 2018 08:05:33 -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.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Aug 2018 08:05:32 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Tue, 14 Aug 2018 16:05:17 +0100 Message-Id: <20180814150519.20204-6-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 5/7] gem_wsim: Make batches preemptable by default 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 MI_NOOP cannot be preempted which means up to now gem_wsim workloads were preemptable on batch buffer granularity only. Add MI_ARB_CHK every 100us so the new default is mid-batch preemption. Signed-off-by: Tvrtko Ursulin --- benchmarks/gem_wsim.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c index 24f518a7770f..f60c086a3f1e 100644 --- a/benchmarks/gem_wsim.c +++ b/benchmarks/gem_wsim.c @@ -683,6 +683,25 @@ static unsigned long get_bb_sz(unsigned int duration) nop_calibration_us, sizeof(uint32_t)); } +static void +init_bb(struct w_step *w, unsigned int flags) +{ + /* Preemption point every 100us. */ + const unsigned int arb_period = get_bb_sz(100) / sizeof(uint32_t); + unsigned int i; + uint32_t *ptr; + + gem_set_domain(fd, w->bb_handle, + I915_GEM_DOMAIN_WC, I915_GEM_DOMAIN_WC); + + ptr = gem_mmap__wc(fd, w->bb_handle, 0, w->bb_sz, PROT_WRITE); + + for (i = arb_period; i < w->bb_sz / sizeof(uint32_t); i += arb_period) + ptr[i] = 0x5 << 23; /* MI_ARB_CHK */ + + munmap(ptr, w->bb_sz); +} + static void terminate_bb(struct w_step *w, unsigned int flags) { @@ -836,6 +855,7 @@ alloc_step_batch(struct workload *wrk, struct w_step *w, unsigned int flags) w->bb_sz = get_bb_sz(w->duration.max); w->bb_handle = w->obj[j].handle = gem_create(fd, w->bb_sz); + init_bb(w, flags); terminate_bb(w, flags); if (flags & SEQNO) { From patchwork Tue Aug 14 15:05:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10565825 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 66F4A139A for ; Tue, 14 Aug 2018 15:05:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 595B92A05E for ; Tue, 14 Aug 2018 15:05:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BD232A0E6; Tue, 14 Aug 2018 15:05:44 +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 CB4432A05E for ; Tue, 14 Aug 2018 15:05:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EAF876E29D; Tue, 14 Aug 2018 15:05:42 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 46FC56E294 for ; Tue, 14 Aug 2018 15:05:36 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id o11-v6so12569869wmh.2 for ; Tue, 14 Aug 2018 08:05:36 -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=HYWTPlXqjfhprrhG7nkoVNvwBeCh5ti9zY5Z4uIONrA=; b=EZxNWbO6ieGLqbZt0P8U4dsxGpRBCVH4UNg8/7Qawv00PtUz/r12h5GW44SzDBEeMi 5TA53pD8vLVsDRuKObR7mqRJjLEkcijgzK6KtZ9wNkUr9EgIkZRJtdbYGZA3WoRwu0VH JTdSHZBoYnqvIDI2dVmG8tZ8rhfeJdNSeIelF4VNwuf2XKu2k+zgIfsXeSSF4O9Ev+kL tERMAM3OEPkToBYkWD9iG4EbIy9pXJZzg5u4mndMaUNIHC6goF2Gthp5RotVGinnKDDo GmCmn9Gxh7HEL8ODzTdz2NRV5yz2bG6G7zfT2t95uyc+0rpMuJyKoskz4q8trskx4ZKY BaQQ== X-Gm-Message-State: AOUpUlFNJTfH/nIq+/cvdGb9SqjyFyVwQ+YNWBReS//DqhAy2ARVVAvW 70lL+eLhvNh3yQ9rF5Bzl3zWTA== X-Google-Smtp-Source: AA+uWPykxuhM3SUkDEI6fsBDy7hTBpPcgEBbTQKKVXfTIvJnfD37SK2OvwOz5e0fv1JHHZyxBd53Bw== X-Received: by 2002:a1c:2352:: with SMTP id j79-v6mr11159860wmj.124.1534259134780; Tue, 14 Aug 2018 08:05:34 -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.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Aug 2018 08:05:34 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Tue, 14 Aug 2018 16:05:18 +0100 Message-Id: <20180814150519.20204-7-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 6/7] gem_wsim: Per context preemption point control 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 Allow workloads to specify frequency of preemption points per context. New workload command ('X') is added to allow this. Signed-off-by: Tvrtko Ursulin --- benchmarks/gem_wsim.c | 84 ++++++++++++++++++++++++++++++++++++++++-- benchmarks/wsim/README | 18 ++++++++- 2 files changed, 98 insertions(+), 4 deletions(-) diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c index f60c086a3f1e..fd268b3ab456 100644 --- a/benchmarks/gem_wsim.c +++ b/benchmarks/gem_wsim.c @@ -83,7 +83,8 @@ enum w_type QD_THROTTLE, SW_FENCE, SW_FENCE_SIGNAL, - CTX_PRIORITY + CTX_PRIORITY, + PREEMPTION }; struct deps @@ -122,6 +123,7 @@ struct w_step unsigned int idx; struct igt_list rq_link; unsigned int request; + unsigned int preempt_us; struct drm_i915_gem_execbuffer2 eb; struct drm_i915_gem_exec_object2 *obj; @@ -441,6 +443,42 @@ parse_workload(struct w_arg *arg, unsigned int flags, struct workload *app_w) } else if (!strcmp(field, "f")) { step.type = SW_FENCE; goto add_step; + } else if (!strcmp(field, "X")) { + 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; + } else if (tmp < 0 && nr == 1) { + if (verbose) + fprintf(stderr, + "Invalid preemption period at step %u!\n", + nr_steps); + return NULL; + } + + if (nr == 0) { + step.context = tmp; + } else if (nr == 1) { + step.period = tmp; + } else { + if (verbose) + fprintf(stderr, + "Invalid preemption format at step %u!\n", + nr_steps); + return NULL; + } + + nr++; + } + + step.type = PREEMPTION; + goto add_step; } tmp = atoi(field); @@ -686,11 +724,14 @@ static unsigned long get_bb_sz(unsigned int duration) static void init_bb(struct w_step *w, unsigned int flags) { - /* Preemption point every 100us. */ - const unsigned int arb_period = get_bb_sz(100) / sizeof(uint32_t); + const unsigned int arb_period = + get_bb_sz(w->preempt_us) / sizeof(uint32_t); unsigned int i; uint32_t *ptr; + if (!arb_period) + return; + gem_set_domain(fd, w->bb_handle, I915_GEM_DOMAIN_WC, I915_GEM_DOMAIN_WC); @@ -965,6 +1006,41 @@ prepare_workload(unsigned int id, struct workload *wrk, unsigned int flags) } } + /* Record default preemption. */ + for (i = 0, w = wrk->steps; i < wrk->nr_steps; i++, w++) { + if (w->type == BATCH) + w->preempt_us = 100; + } + + /* + * Scan for contexts with modified preemption config and record their + * preemption period for the following steps belonging to the same + * context. + */ + for (i = 0, w = wrk->steps; i < wrk->nr_steps; i++, w++) { + struct w_step *w2; + int j; + + if (w->type != PREEMPTION) + continue; + + for (j = i + 1; j < wrk->nr_steps; j++) { + w2 = &wrk->steps[j]; + + if (w2->context != w->context) + continue; + else if (w2->type == PREEMPTION) + break; + else if (w2->type != BATCH) + continue; + + w2->preempt_us = w->period; + } + } + + /* + * Allocate batch buffers. + */ for (i = 0, w = wrk->steps; i < wrk->nr_steps; i++, w++) { unsigned int _flags = flags; enum intel_engine_id engine = w->engine; @@ -1869,6 +1945,8 @@ static void *run_workload(void *data) w->priority; } continue; + } else if (w->type == PREEMPTION) { + continue; } if (do_sleep || w->type == PERIOD) { diff --git a/benchmarks/wsim/README b/benchmarks/wsim/README index fd9bff3401af..205cd6c93afb 100644 --- a/benchmarks/wsim/README +++ b/benchmarks/wsim/README @@ -3,7 +3,7 @@ Workload descriptor format ctx.engine.duration_us.dependency.wait,... ..[-].[/][...].<0|1>,... -P.. +P|X.. d|p|s|t|q|a.,... f @@ -24,6 +24,7 @@ Additional workload steps are also supported: 'f' - Create a sync fence. 'a' - Advance the previously created sync fence. 'P' - Context priority. + 'X' - Context preemption control. Engine ids: RCS, BCS, VCS, VCS1, VCS2, VECS @@ -128,3 +129,18 @@ 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. + +Context preemption control +-------------------------- + + X.1.0 + 1.RCS.1000.0.0 + X.1.500 + 1.RCS.1000.0.0 + +Context 1 is marked as non-preemptable batches and a batch is sent against 1. +The same context is then marked to have batches which can be preempted every +500us and another batch is submitted. + +Same as with context priority, context preemption commands are valid until +optionally overriden by another preemption control change on the same context. From patchwork Tue Aug 14 15:05:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10565827 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 6C6F615A6 for ; Tue, 14 Aug 2018 15:05:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FB4B2A05E for ; Tue, 14 Aug 2018 15:05:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5428A2A0E6; Tue, 14 Aug 2018 15:05:45 +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 E60042A05E for ; Tue, 14 Aug 2018 15:05:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9BD6D6E299; Tue, 14 Aug 2018 15:05:43 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id DCDD86E290 for ; Tue, 14 Aug 2018 15:05:36 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id h10-v6so17497399wre.6 for ; Tue, 14 Aug 2018 08:05:36 -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=uLYvJ1PrB/lAfyOc19zGXsiIbrAOeVkZKpKB4WzQnqA=; b=fkaGxAZBGhUsyhqBEAfRhfV9HH2qpv65b5Tab6efnkN93yhR/+h5P3vem7AvyiQBfU F1o2f9u/CVPZZ8Rw6KHO3crBHz7UykVAVmyX7gyinNDKk7xRHdGKpXF57/zSemGlcfj2 eIXzaS2x+Nvz7u7+143o7ycuEGzf2ce7hB+7fjrrr1yEheNNFaaFKFsSiepKsqw8Y+2r P3GRJl2VVw0WlK4Oo+u01Vw3X4/5KY7qA6nTqlZ5f73h8TV2yBQvFdiPVi/G4AuuFwTx vuUtihzpm4dbq6CGlEcV76Mzegs24kdE+Nn+bLACcSvVMXvRfMHzdJFFwvocqrwyrFjd +AGw== X-Gm-Message-State: AOUpUlEQBO5C7ATjw5+lOX/8NN0glAalBAu0uVu4d4QK/pC7LAseR5Ij 3ZRkEzWpFnFMzCX2OyUx8ak8IA== X-Google-Smtp-Source: AA+uWPxTUHRj79ulWrECV/Yi1s9xPJZ7hObyEHtAJfRcr5f9UdBnb1oIQ70BoZbj96J5oFaXWoM9Vw== X-Received: by 2002:adf:f585:: with SMTP id f5-v6mr13346279wro.59.1534259135608; Tue, 14 Aug 2018 08:05:35 -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.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Aug 2018 08:05:35 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Tue, 14 Aug 2018 16:05:19 +0100 Message-Id: <20180814150519.20204-8-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 7/7] gem_wsim: Fix BCS usage under VCS2 remap warning 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 Need to check we actually are in VCS2 remapping mode! Signed-off-by: Tvrtko Ursulin --- benchmarks/gem_wsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c index fd268b3ab456..850c8972f6eb 100644 --- a/benchmarks/gem_wsim.c +++ b/benchmarks/gem_wsim.c @@ -661,7 +661,7 @@ add_step: } } - if (bcs_used && verbose) + if (bcs_used && (flags & VCS2REMAP) && verbose) printf("BCS usage in workload with VCS2 remapping enabled!\n"); return wrk;