From patchwork Fri Nov 22 01:19:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuansheng Liu X-Patchwork-Id: 11257119 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 08A4A14C0 for ; Fri, 22 Nov 2019 01:20:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E45AF2067D for ; Fri, 22 Nov 2019 01:20:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E45AF2067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DC0B16E108; Fri, 22 Nov 2019 01:20:04 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 22A756E108; Fri, 22 Nov 2019 01:20:04 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Nov 2019 17:20:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,228,1571727600"; d="scan'208";a="205257519" Received: from cliu38-mobl3.sh.intel.com (HELO 4879514205f2.sh.intel.com) ([10.239.147.26]) by fmsmga008.fm.intel.com with ESMTP; 21 Nov 2019 17:20:02 -0800 From: Chuansheng Liu To: igt-dev@lists.freedesktop.org Date: Fri, 22 Nov 2019 01:19:34 +0000 Message-Id: <20191122011934.29606-1-chuansheng.liu@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [Intel-gfx] [PATCH i-g-t v3] i915/pm_rps: install SIGTERM handler for load_helper process 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" Reference: https://bugs.freedesktop.org/show_bug.cgi?id=112126 The issue we hit is the GPU keeps very high load after running the subtest min-max-config-loaded. Some background of the issue: Currently the rps is not fully enabled yet on TGL, and running the subtest min-max-config-loaded will hit below assertion: == (i915_pm_rps:1261) CRITICAL: Test assertion failure function loaded_check, file ../tests/i915/i915_pm_rps.c:505: (i915_pm_rps:1261) CRITICAL: Failed assertion: freqs[MAX] <= freqs[CUR] (i915_pm_rps:1261) CRITICAL: Last errno: 2, No such file or directory == with igt stress test, we find the GT keeps busy after running this subtest, it is due to the igt_spin_end() is not called randomly. The root cause analysis is: When the main process i915_pm_rps for running the subtest min-max-config-loaded hits the assertion, the main process will try to send signal SIGTERM to the child process loader_helper which is created by main process for starting GT load, then the main process itself will exit. The SIGTERM handler for loader_helper is the default one, which will cause the loader_helper exits directly. That is unsafe, we always expect the igt_spin_end() is called before loader_helper process exits, which is used to stop the load of GT. Furthermore, in normal scenario, before main process exits, it will send SIGUSR1 to child process for stopping GT loading in safe way. So here we install the proper handler for signal SIGTERM in the similar way. Without this patch, the GT may keep busy after running this subtest. Enabling rps should be tracked on the other side. V3: As suggested by Chris, s/SIGUSR1/SIGTERM, since both signals take the same function. Signed-off-by: Chuansheng Liu --- tests/i915/i915_pm_rps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/i915/i915_pm_rps.c b/tests/i915/i915_pm_rps.c index ef627c0b..51605f29 100644 --- a/tests/i915/i915_pm_rps.c +++ b/tests/i915/i915_pm_rps.c @@ -250,7 +250,7 @@ static void load_helper_run(enum load load) bool prev_load; uint32_t handle; - signal(SIGUSR1, load_helper_signal_handler); + signal(SIGTERM, load_helper_signal_handler); signal(SIGUSR2, load_helper_signal_handler); igt_debug("Applying %s load...\n", lh.load ? "high" : "low"); @@ -320,7 +320,7 @@ static void load_helper_run(enum load load) static void load_helper_stop(void) { - kill(lh.igt_proc.pid, SIGUSR1); + kill(lh.igt_proc.pid, SIGTERM); igt_assert(igt_wait_helper(&lh.igt_proc) == 0); }