From patchwork Wed Sep 5 13:49:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10588881 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 1D2F215E9 for ; Wed, 5 Sep 2018 13:49:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D58C2A1DF for ; Wed, 5 Sep 2018 13:49:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01AB82A1ED; Wed, 5 Sep 2018 13:49:57 +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 B17132A1E7 for ; Wed, 5 Sep 2018 13:49:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A90286E4AD; Wed, 5 Sep 2018 13:49:54 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id A289F6E49E for ; Wed, 5 Sep 2018 13:49:52 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id n2-v6so7766511wrw.7 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=TW5YWU1Hbq+bnQz7QInybqVh9MytvhMzCZXRu8Toby4=; b=E+XyzY9cwRebZyRP7D4ZTR2CVgoTUV411PCqir3KIB9TJhKc2zJRpxS6PvDIsny7WY 820TZiCB4Zzg/KsEVZGRI4baKPxSNc0X3lSLA30N0G+6gxMPgQaKyWuj7HDCZjM5avLN aDtUQb3P447dDccK9pfPH4ejFSkTv9QFUjOJJX5EXI1cs32KO+CRVkssGIVCkkJ67E+9 IL2P1nzgTzOBjMyFEg7IoOY9bUzu0AA1PLsY5pLTel0fSogpzFTJ91kcuU8hIr06fKc7 4jfMUx3PeczUUIaEW16VE/gW+dJo9hX7JdFnhQpCX+E/yznLn1K3vjkUfAbzkLsrypJP ezIg== X-Gm-Message-State: APzg51AmQSBqmFhyg4CL6jNrQ8xgWyZiv0n9wX7bJravHiLX8xnXo6TO NIg2VVYImrxB1+wdupHY9L5AZvvnNXs= X-Google-Smtp-Source: ANB0VdYrDlXQO9UsutEh05mlBG+S2fctoiQKpTfEiZP47d2VCR3kTqLUENxLhqiB/GwXY4OxI67ltQ== X-Received: by 2002:adf:b243:: with SMTP id y3-v6mr26924693wra.90.1536155391205; Wed, 05 Sep 2018 06:49:51 -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.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Sep 2018 06:49:50 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Wed, 5 Sep 2018 14:49:33 +0100 Message-Id: <20180905134939.2942-8-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 07/13] 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 0c52ec567430..7f2d0c83a0e7 100644 --- a/benchmarks/gem_wsim.c +++ b/benchmarks/gem_wsim.c @@ -685,6 +685,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) { @@ -839,6 +858,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) {