From patchwork Thu Jul 19 16:37:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10534923 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 55DFA600D0 for ; Thu, 19 Jul 2018 16:38:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3215F29E90 for ; Thu, 19 Jul 2018 16:38:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2653129EAC; Thu, 19 Jul 2018 16:38:06 +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 D023929E90 for ; Thu, 19 Jul 2018 16:38:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E789E6EE18; Thu, 19 Jul 2018 16:38:04 +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 E642989FAD for ; Thu, 19 Jul 2018 16:38:02 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id c13-v6so8715329wrt.1 for ; Thu, 19 Jul 2018 09:38:02 -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; bh=Tg5/koiysnemdI2L8KsVfsnEEUKbAFEm3l6NuD5MIUg=; b=gx9sUMiPk8JWTU33geoIlwdSs1RcU7jDMQKFic1Tt/y8TB+CZuOBy+yrW61d7IZa6N Rl5Sh1dKVT1v3VN3wujGN7zk7Hu3lacAOWcCdQzjZy6pdsOEbp/Xo6n1x14sroDmB6mR KPM26yjA+ET/AeS+1abnmw/MqCNdq1Fb4ZJUUwR1Jl7+n2j4M630N0cstd4M/sVJeNef sJLBqkdqXsIDf8rAvDS0qIKIFTQEkqrRrBKOWoRVMLSohNRX7g2DCiFU1McWy/sEBb/P jdO7iCS/vYVjiq4W2WGrMAOuljbIx2m8VAhpnqxaJNi73Yu3GU3plLZdI8vz/u28d/x6 0Fnw== X-Gm-Message-State: AOUpUlHQcNr2T8Ag+4Oex6jUKcPleVbjcAUH7OtWpZaZ/UtQcE57G+uW QgOnAo9Oir3Bu5FS/EmDr8g62Q== X-Google-Smtp-Source: AAOMgpdMyR5AJV+y29Lc92ycpgpwGgLPv1XMLsHaVId19sFLAKQbrCLbHsr8uliLOAcSPO9CGX8Qyw== X-Received: by 2002:adf:d24a:: with SMTP id o10-v6mr8009888wri.229.1532018281538; Thu, 19 Jul 2018 09:38:01 -0700 (PDT) Received: from localhost.localdomain ([95.146.151.144]) by smtp.gmail.com with ESMTPSA id c13-v6sm4879855wrt.24.2018.07.19.09.38.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 09:38:01 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Thu, 19 Jul 2018 17:37:56 +0100 Message-Id: <20180719163756.15463-1-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.17.1 Subject: [Intel-gfx] [PATCH i-g-t] tests/perf_pmu: Restore runtime PM at subtest exit 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 Restore runtime PM state (via a newly added library function) when the test which sets it up exit. This was we avoid running all subsequent sub- tests in the aggressive runtime PM mode. Signed-off-by: Tvrtko Ursulin --- lib/igt_pm.c | 13 ++++++++++++- lib/igt_pm.h | 1 + tests/perf_pmu.c | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/igt_pm.c b/lib/igt_pm.c index 8ac132269d79..2e2eea5d3b2d 100644 --- a/lib/igt_pm.c +++ b/lib/igt_pm.c @@ -297,7 +297,13 @@ int pm_status_fd = -1; static char __igt_pm_runtime_autosuspend[64]; static char __igt_pm_runtime_control[64]; -static void __igt_pm_runtime_exit_handler(int sig) +/** + * igt_restore_runtime_pm: + * + * Restores the runtime PM configuration as it was before the call to + * igt_setup_runtime_pm. + */ +void igt_restore_runtime_pm(void) { int fd; @@ -326,6 +332,11 @@ static void __igt_pm_runtime_exit_handler(int sig) close(fd); } +static void __igt_pm_runtime_exit_handler(int sig) +{ + igt_restore_runtime_pm(); +} + /** * igt_setup_runtime_pm: * diff --git a/lib/igt_pm.h b/lib/igt_pm.h index eced39f8801a..10cc6794e4e7 100644 --- a/lib/igt_pm.h +++ b/lib/igt_pm.h @@ -47,6 +47,7 @@ enum igt_runtime_pm_status { }; bool igt_setup_runtime_pm(void); +void igt_restore_runtime_pm(void); enum igt_runtime_pm_status igt_get_runtime_pm_status(void); bool igt_wait_for_pm_status(enum igt_runtime_pm_status status); diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c index a1d36ac4fa9d..9a20abb6b95c 100644 --- a/tests/perf_pmu.c +++ b/tests/perf_pmu.c @@ -1441,6 +1441,9 @@ test_rc6(int gem_fd, unsigned int flags) close(fw); close(fd); + if (flags & TEST_RUNTIME_PM) + igt_restore_runtime_pm(); + assert_within_epsilon(busy - prev, 0.0, tolerance); }