From patchwork Tue Apr 25 22:33:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lionel Landwerlin X-Patchwork-Id: 9699943 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5FFD6601D3 for ; Tue, 25 Apr 2017 22:34:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A09A284EE for ; Tue, 25 Apr 2017 22:34:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4EBC12857F; Tue, 25 Apr 2017 22:34:25 +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=-4.2 required=2.0 tests=BAYES_00, 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 3107D284EE for ; Tue, 25 Apr 2017 22:34:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 54A816E344; Tue, 25 Apr 2017 22:33:54 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 048106E618 for ; Tue, 25 Apr 2017 22:33:17 +0000 (UTC) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Apr 2017 15:33:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,251,1488873600"; d="scan'208";a="93787039" Received: from ezarza-mobl5.amr.corp.intel.com (HELO delly.amr.corp.intel.com) ([10.254.68.206]) by fmsmga005.fm.intel.com with ESMTP; 25 Apr 2017 15:33:12 -0700 From: Lionel Landwerlin To: intel-gfx@lists.freedesktop.org Date: Tue, 25 Apr 2017 15:33:01 -0700 Message-Id: <20170425223301.23733-30-lionel.g.landwerlin@intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170425223301.23733-1-lionel.g.landwerlin@intel.com> References: <20170425223301.23733-1-lionel.g.landwerlin@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 29/29] igt/perf: remove unused frequency functions X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Now that we've found that frequency changes happen mostly outside of our control and don't seem to be following our requests through sysfs, let's drop a bunch code/variables. Signed-off-by: Lionel Landwerlin --- tests/perf.c | 83 +++--------------------------------------------------------- 1 file changed, 3 insertions(+), 80 deletions(-) diff --git a/tests/perf.c b/tests/perf.c index 3d033b3a..7088d723 100644 --- a/tests/perf.c +++ b/tests/perf.c @@ -259,12 +259,9 @@ static int card = -1; static int n_eus; static uint64_t test_metric_set_id = UINT64_MAX; -static uint64_t gt_min_freq_mhz_saved = 0; -static uint64_t gt_max_freq_mhz_saved = 0; -static uint64_t gt_min_freq_mhz = 0; -static uint64_t gt_max_freq_mhz = 0; static uint64_t timestamp_frequency = 12500000; +static uint64_t gt_max_freq_mhz = 0; static enum drm_i915_oa_format test_oa_format; static bool *undefined_a_counters; static uint64_t oa_exp_1_millisec; @@ -377,16 +374,6 @@ sysfs_read(const char *file) return read_u64_file(buf); } -static void -sysfs_write(const char *file, uint64_t val) -{ - char buf[512]; - - snprintf(buf, sizeof(buf), "/sys/class/drm/card%d/%s", card, file); - - write_u64_file(buf, val); -} - static char * read_debugfs_record(int device, const char *file, const char *key) { @@ -1103,66 +1090,6 @@ init_sys_info(void) return try_read_u64_file(buf, &test_metric_set_id); } -static void -gt_frequency_range_save(void) -{ - gt_min_freq_mhz_saved = sysfs_read("gt_min_freq_mhz"); - gt_max_freq_mhz_saved = sysfs_read("gt_boost_freq_mhz"); - - gt_min_freq_mhz = gt_min_freq_mhz_saved; - gt_max_freq_mhz = gt_max_freq_mhz_saved; -} - -static void wait_freq_settle(void) -{ - struct timespec ts; - - /* FIXME: Lazy sleep without check. */ - ts.tv_sec = 0; - ts.tv_nsec = 20000; - clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL); -} - -static void -gt_frequency_pin(int gt_freq_mhz) -{ - igt_debug("requesting pinned GT freq = %dmhz\n", gt_freq_mhz); - - if (gt_freq_mhz > gt_max_freq_mhz) { - sysfs_write("gt_max_freq_mhz", gt_freq_mhz); - sysfs_write("gt_min_freq_mhz", gt_freq_mhz); - } else { - sysfs_write("gt_min_freq_mhz", gt_freq_mhz); - sysfs_write("gt_max_freq_mhz", gt_freq_mhz); - } - gt_min_freq_mhz = gt_freq_mhz; - gt_max_freq_mhz = gt_freq_mhz; - - wait_freq_settle(); -} - -static void -gt_frequency_range_restore(void) -{ - igt_debug("restoring GT frequency range: min = %dmhz, max =%dmhz, current: min=%dmhz, max=%dmhz\n", - (int)gt_min_freq_mhz_saved, - (int)gt_max_freq_mhz_saved, - (int)gt_min_freq_mhz, - (int)gt_max_freq_mhz); - - /* Assume current min/max are the same */ - if (gt_min_freq_mhz_saved > gt_max_freq_mhz) { - sysfs_write("gt_max_freq_mhz", gt_max_freq_mhz_saved); - sysfs_write("gt_min_freq_mhz", gt_min_freq_mhz_saved); - } else { - sysfs_write("gt_min_freq_mhz", gt_min_freq_mhz_saved); - sysfs_write("gt_max_freq_mhz", gt_max_freq_mhz_saved); - } - - gt_min_freq_mhz = gt_min_freq_mhz_saved; - gt_max_freq_mhz = gt_max_freq_mhz_saved; -} - static int i915_read_reports_until_timestamp(enum drm_i915_oa_format oa_format, uint8_t *buf, @@ -2155,8 +2082,6 @@ test_oa_exponents(void) igt_assert(n_time_delta_matches >= 9); } - gt_frequency_range_restore(); - load_helper_stop(); load_helper_deinit(); } @@ -4148,11 +4073,11 @@ igt_main igt_require(init_sys_info()); - gt_frequency_range_save(); - write_u64_file("/proc/sys/dev/i915/perf_stream_paranoid", 1); write_u64_file("/proc/sys/dev/i915/oa_max_sample_rate", 100000); + gt_max_freq_mhz = sysfs_read("gt_boost_freq_mhz"); + render_copy = igt_get_render_copyfunc(devid); igt_require_f(render_copy, "no render-copy function\n"); } @@ -4235,8 +4160,6 @@ igt_main write_u64_file("/proc/sys/dev/i915/oa_max_sample_rate", 100000); write_u64_file("/proc/sys/dev/i915/perf_stream_paranoid", 1); - gt_frequency_range_restore(); - close(drm_fd); } }