From patchwork Fri Jan 31 16:13:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jeff.mcgee@intel.com X-Patchwork-Id: 3563321 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 533439F381 for ; Fri, 31 Jan 2014 20:02:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7FE4B2024F for ; Fri, 31 Jan 2014 20:02:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A2A8B2024D for ; Fri, 31 Jan 2014 20:02:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4562CFBEE9; Fri, 31 Jan 2014 12:01:57 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 177A1F9F18 for ; Fri, 31 Jan 2014 08:06:43 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 31 Jan 2014 08:06:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,758,1384329600"; d="scan'208";a="473914371" Received: from jeffdesk.fso.intel.com ([10.5.53.1]) by fmsmga002.fm.intel.com with ESMTP; 31 Jan 2014 08:06:33 -0800 From: jeff.mcgee@intel.com To: intel-gfx@lists.freedesktop.org Date: Fri, 31 Jan 2014 10:13:52 -0600 Message-Id: <1391184833-10973-4-git-send-email-jeff.mcgee@intel.com> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1391184833-10973-1-git-send-email-jeff.mcgee@intel.com> References: <1391184833-10973-1-git-send-email-jeff.mcgee@intel.com> Subject: [Intel-gfx] [PATCH 3/4] pm_rps: Add variable load support to load helper X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jeff McGee The load helper can be set to HIGH or LOW. HIGH is the original mode of sending continuous dword store commands. LOW adds a pause between each command to reduce throughput. Signed-off-by: Jeff McGee --- tests/pm_rps.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/tests/pm_rps.c b/tests/pm_rps.c index 9277196..05b859c 100644 --- a/tests/pm_rps.c +++ b/tests/pm_rps.c @@ -146,6 +146,11 @@ static void dumpit(const int *freqs) #define dump(x) if (verbose) dumpit(x) #define log(...) if (verbose) printf(__VA_ARGS__) +enum load { + LOW, + HIGH +}; + static struct load_helper { int devid; int has_ppgtt; @@ -153,13 +158,17 @@ static struct load_helper { struct intel_batchbuffer *batch; drm_intel_bo *target_buffer; bool ready; + enum load load; bool exit; struct igt_helper_process igt_proc; } lh; static void load_helper_signal_handler(int sig) { - lh.exit = true; + if (sig == SIGUSR2) + lh.load = lh.load == LOW ? HIGH : LOW; + else + lh.exit = true; } static void emit_store_dword_imm(uint32_t val) @@ -190,21 +199,30 @@ static void emit_store_dword_imm(uint32_t val) } } -static void load_helper_run(void) +#define LOAD_HELPER_PAUSE_USEC 500 +static void load_helper_run(enum load load) { assert(!lh.igt_proc.running); igt_require(lh.ready == true); + lh.load = load; + igt_fork_helper(&lh.igt_proc) { uint32_t val = 0; signal(SIGUSR1, load_helper_signal_handler); + signal(SIGUSR2, load_helper_signal_handler); while (!lh.exit) { emit_store_dword_imm(val); intel_batchbuffer_flush_on_ring(lh.batch, 0); val++; + + /* Lower the load by pausing after every submitted + * write. */ + if (lh.load == LOW) + usleep(LOAD_HELPER_PAUSE_USEC); } /* Map buffer to stall for write completion */ @@ -215,6 +233,17 @@ static void load_helper_run(void) } } +static void load_helper_set_load(enum load load) +{ + assert(lh.igt_proc.running); + + if (lh.load == load) + return; + + lh.load = load; + kill(lh.igt_proc.pid, SIGUSR2); +} + static void load_helper_stop(void) { assert(lh.igt_proc.running); @@ -521,7 +550,7 @@ int main(int argc, char **argv) min_max_config(idle_check); igt_subtest("min-max-config-loaded") { - load_helper_run(); + load_helper_run(HIGH); min_max_config(loaded_check); load_helper_stop(); }