From patchwork Mon Jun 22 16:44:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11618413 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 0E99390 for ; Mon, 22 Jun 2020 16:44:39 +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 EAD492076A for ; Mon, 22 Jun 2020 16:44:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAD492076A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.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 7E4CD6E182; Mon, 22 Jun 2020 16:44:38 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id ACCC66E182; Mon, 22 Jun 2020 16:44:37 +0000 (UTC) IronPort-SDR: l0lLoaI2CyotQdcnZKDbSOnUqFgMv0JabkoW8nhBC09INIEiEZO2F57WM4YOAZEb4b7mfeVXir Q7TOnRRd8qzg== X-IronPort-AV: E=McAfee;i="6000,8403,9660"; a="205294096" X-IronPort-AV: E=Sophos;i="5.75,268,1589266800"; d="scan'208";a="205294096" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 09:44:37 -0700 IronPort-SDR: C3IYksOCm0Xc4CkNLOB0zcO6fs5cUjPxgKZ0e2GziCSynM/zgPwps5JULKfxCStoXOMZZEaswl 1PPn5zDbS6IA== X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="422687523" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 09:44:33 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Mon, 22 Jun 2020 18:44:08 +0200 Message-Id: <20200622164415.30352-2-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200622164415.30352-1-janusz.krzysztofik@linux.intel.com> References: <20200622164415.30352-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH i-g-t v2 1/8] tests/core_hotunplug: Duplicate debug messages in dmesg X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 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 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The purpose of debug messages displayed by the test is to make identification of a subtest phase that fails more easy. Since issues exhibited by the test are mostly reported to dmesg, print those debug messages to /dev/kmsg as well. v2: rebase on upstream Signed-off-by: Janusz Krzysztofik --- tests/core_hotunplug.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c index e03f3b945..826645b1f 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -49,6 +49,12 @@ struct hotunplug { /* Helpers */ +#define local_debug(msg...) \ +({ \ + igt_debug("%s: %s\n", __func__, msg); \ + igt_kmsg(KMSG_DEBUG "%s: %s: %s\n", igt_test_name(), __func__, msg); \ +}) + static void prepare_for_unbind(struct hotunplug *priv, char *buf, int buflen) { int len; @@ -68,9 +74,9 @@ static void prepare_for_unbind(struct hotunplug *priv, char *buf, int buflen) close(priv->fd.sysfs_dev); } -static void prepare(struct hotunplug *priv, char *buf, int buflen) +static inline void prepare(struct hotunplug *priv, char *buf, int buflen) { - igt_debug("opening device\n"); + local_debug("opening device"); priv->fd.drm = __drm_open_driver(DRIVER_ANY); igt_assert(priv->fd.drm >= 0); @@ -137,14 +143,14 @@ static void bus_rescan(int fd_sysfs_bus) close(fd_sysfs_bus); } -static void healthcheck(void) +static inline void healthcheck(void) { int fd_drm; /* device name may have changed, rebuild IGT device list */ igt_devices_scan(true); - igt_debug("reopening the device\n"); + local_debug("reopening the device"); fd_drm = __drm_open_driver(DRIVER_ANY); igt_abort_on_f(fd_drm < 0, "Device reopen failure"); @@ -181,13 +187,13 @@ static void unbind_rebind(void) prepare(&priv, buf, sizeof(buf)); - igt_debug("closing the device\n"); + local_debug("closing the device"); close(priv.fd.drm); - igt_debug("unbinding the driver from the device\n"); + local_debug("unbinding the driver from the device"); driver_unbind(priv.fd.sysfs_drv, priv.dev_bus_addr); - igt_debug("rebinding the driver to the device\n"); + local_debug("rebinding the driver to the device"); driver_bind(priv.fd.sysfs_drv, priv.dev_bus_addr); healthcheck(); @@ -199,13 +205,13 @@ static void unplug_rescan(void) prepare(&priv, NULL, 0); - igt_debug("closing the device\n"); + local_debug("closing the device"); close(priv.fd.drm); - igt_debug("unplugging the device\n"); + local_debug("unplugging the device"); device_unplug(priv.fd.sysfs_dev); - igt_debug("recovering the device\n"); + local_debug("recovering the device"); bus_rescan(priv.fd.sysfs_bus); healthcheck(); @@ -218,13 +224,13 @@ static void hotunbind_lateclose(void) prepare(&priv, buf, sizeof(buf)); - igt_debug("hot unbinding the driver from the device\n"); + local_debug("hot unbinding the driver from the device"); driver_unbind(priv.fd.sysfs_drv, priv.dev_bus_addr); - igt_debug("rebinding the driver to the device\n"); + local_debug("rebinding the driver to the device"); driver_bind(priv.fd.sysfs_drv, priv.dev_bus_addr); - igt_debug("late closing the unbound device instance\n"); + local_debug("late closing the unbound device instance"); close(priv.fd.drm); healthcheck(); @@ -236,13 +242,13 @@ static void hotunplug_lateclose(void) prepare(&priv, NULL, 0); - igt_debug("hot unplugging the device\n"); + local_debug("hot unplugging the device"); device_unplug(priv.fd.sysfs_dev); - igt_debug("recovering the device\n"); + local_debug("recovering the device"); bus_rescan(priv.fd.sysfs_bus); - igt_debug("late closing the removed device instance\n"); + local_debug("late closing the removed device instance"); close(priv.fd.drm); healthcheck(); From patchwork Mon Jun 22 16:44:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11618415 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 BBF6590 for ; Mon, 22 Jun 2020 16:44:42 +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 A470B2073E for ; Mon, 22 Jun 2020 16:44:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A470B2073E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.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 D45FF6E141; Mon, 22 Jun 2020 16:44:41 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 683D76E286; Mon, 22 Jun 2020 16:44:39 +0000 (UTC) IronPort-SDR: 8RJ9ijd6wep0kaU3d3rmFu/4EyugT6M06dOuHYUatv7ZadAj44RhAGGtRJggM1huEk8ICGCYlz I6MkrizPof6g== X-IronPort-AV: E=McAfee;i="6000,8403,9660"; a="205294106" X-IronPort-AV: E=Sophos;i="5.75,268,1589266800"; d="scan'208";a="205294106" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 09:44:39 -0700 IronPort-SDR: jsQQ2LKhHttuJT5waXysv2Z5NmvWS47Nu9kvVYOJt0TP/9QK3AUy3N9qzpqxsmA7H0DOOKvB6u BtDZ/91MS15g== X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="422687535" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 09:44:37 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Mon, 22 Jun 2020 18:44:09 +0200 Message-Id: <20200622164415.30352-3-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200622164415.30352-1-janusz.krzysztofik@linux.intel.com> References: <20200622164415.30352-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH i-g-t v2 2/8] tests/core_hotunplug: Use PCI device sysfs entry, not DRM X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 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 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Future subtests may want to access PCI attributes of the device after driver unbind. Refactor prepare() helper. v2: rebase on upstream Signed-off-by: Janusz Krzysztofik --- tests/core_hotunplug.c | 68 +++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 28 deletions(-) diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c index 826645b1f..35eba9b8a 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -55,42 +55,54 @@ struct hotunplug { igt_kmsg(KMSG_DEBUG "%s: %s: %s\n", igt_test_name(), __func__, msg); \ }) -static void prepare_for_unbind(struct hotunplug *priv, char *buf, int buflen) +static inline int prepare_common(struct hotunplug *priv) { - int len; + int fd_sysfs_drm; + + local_debug("opening device"); + priv->fd.drm = __drm_open_driver(DRIVER_ANY); + igt_assert(priv->fd.drm >= 0); + + fd_sysfs_drm = igt_sysfs_open(priv->fd.drm); + igt_assert(fd_sysfs_drm >= 0); + + return fd_sysfs_drm; +} + +static inline void prepare_for_rebind(struct hotunplug *priv, + char *buf, int buflen) +{ + int fd_sysfs_drm, len; igt_assert(buflen); - priv->fd.sysfs_drv = openat(priv->fd.sysfs_dev, "device/driver", - O_DIRECTORY); - igt_assert(priv->fd.sysfs_drv >= 0); + fd_sysfs_drm = prepare_common(priv); + + priv->fd.sysfs_drv = openat(fd_sysfs_drm, "device/driver", O_DIRECTORY); - len = readlinkat(priv->fd.sysfs_dev, "device", buf, buflen - 1); + len = readlinkat(fd_sysfs_drm, "device", buf, buflen - 1); buf[len] = '\0'; priv->dev_bus_addr = strrchr(buf, '/'); - igt_assert(priv->dev_bus_addr++); - /* sysfs_dev no longer needed */ - close(priv->fd.sysfs_dev); + close(fd_sysfs_drm); + + igt_assert(priv->fd.sysfs_drv >= 0); + igt_assert(priv->dev_bus_addr++); } -static inline void prepare(struct hotunplug *priv, char *buf, int buflen) +static inline void prepare_for_rescan(struct hotunplug *priv) { - local_debug("opening device"); - priv->fd.drm = __drm_open_driver(DRIVER_ANY); - igt_assert(priv->fd.drm >= 0); + int fd_sysfs_drm = prepare_common(priv); - priv->fd.sysfs_dev = igt_sysfs_open(priv->fd.drm); - igt_assert(priv->fd.sysfs_dev >= 0); + priv->fd.sysfs_dev = openat(fd_sysfs_drm, "device", O_DIRECTORY); - if (buf) { - prepare_for_unbind(priv, buf, buflen); - } else { - /* prepare for bus rescan */ - priv->fd.sysfs_bus = openat(priv->fd.sysfs_dev, - "device/subsystem", O_DIRECTORY); - igt_assert(priv->fd.sysfs_bus >= 0); - } + priv->fd.sysfs_bus = openat(fd_sysfs_drm, "device/subsystem", + O_DIRECTORY); + + close(fd_sysfs_drm); + + igt_assert(priv->fd.sysfs_dev >= 0); + igt_assert(priv->fd.sysfs_bus >= 0); } static const char *failure; @@ -124,7 +136,7 @@ static void device_unplug(int fd_sysfs_dev) { failure = "Device unplug timeout!"; igt_set_timeout(60, failure); - igt_sysfs_set(fd_sysfs_dev, "device/remove", "1"); + igt_sysfs_set(fd_sysfs_dev, "remove", "1"); igt_reset_timeout(); failure = NULL; @@ -185,7 +197,7 @@ static void unbind_rebind(void) struct hotunplug priv; char buf[PATH_MAX]; - prepare(&priv, buf, sizeof(buf)); + prepare_for_rebind(&priv, buf, sizeof(buf)); local_debug("closing the device"); close(priv.fd.drm); @@ -203,7 +215,7 @@ static void unplug_rescan(void) { struct hotunplug priv; - prepare(&priv, NULL, 0); + prepare_for_rescan(&priv); local_debug("closing the device"); close(priv.fd.drm); @@ -222,7 +234,7 @@ static void hotunbind_lateclose(void) struct hotunplug priv; char buf[PATH_MAX]; - prepare(&priv, buf, sizeof(buf)); + prepare_for_rebind(&priv, buf, sizeof(buf)); local_debug("hot unbinding the driver from the device"); driver_unbind(priv.fd.sysfs_drv, priv.dev_bus_addr); @@ -240,7 +252,7 @@ static void hotunplug_lateclose(void) { struct hotunplug priv; - prepare(&priv, NULL, 0); + prepare_for_rescan(&priv); local_debug("hot unplugging the device"); device_unplug(priv.fd.sysfs_dev); From patchwork Mon Jun 22 16:44:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11618419 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 82AE890 for ; Mon, 22 Jun 2020 16:44:46 +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 6A2932073E for ; Mon, 22 Jun 2020 16:44:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6A2932073E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.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 529386E85C; Mon, 22 Jun 2020 16:44:44 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 021AE6E438; Mon, 22 Jun 2020 16:44:40 +0000 (UTC) IronPort-SDR: WnwdG2tdRqLuuYyf1PbaIEGzybdE/kFce+Iulpy2WkIKNJwm2q5umF5O+MfAgYFWVooCqnDYn8 Vag/vZTWg/Tw== X-IronPort-AV: E=McAfee;i="6000,8403,9660"; a="205294119" X-IronPort-AV: E=Sophos;i="5.75,268,1589266800"; d="scan'208";a="205294119" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 09:44:40 -0700 IronPort-SDR: nD+suEqzeUQyWgZw903E1LbiKaxsMPKqO0B+kHSABvKd7+LuZFo0eg8zp7plQcAz689eCwWl1a YBOOmwlb4UQw== X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="422687542" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 09:44:39 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Mon, 22 Jun 2020 18:44:10 +0200 Message-Id: <20200622164415.30352-4-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200622164415.30352-1-janusz.krzysztofik@linux.intel.com> References: <20200622164415.30352-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH i-g-t v2 3/8] tests/core_hotunplug: Add unbind-unplug-rescan variant X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 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 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Check if this 3-step procedure exhibits any issues with device recover after unplug. Such issues may indicate insufficient device hardware re-initialization performed by the device driver, or other kernel bugs outside the driver code. v2: rebase on upstream Signed-off-by: Janusz Krzysztofik Reviewed-by: Michał Winiarski --- tests/core_hotunplug.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c index 35eba9b8a..a4809720b 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -211,6 +211,35 @@ static void unbind_rebind(void) healthcheck(); } +static void unbind_unplug_rescan(void) +{ + struct hotunplug priv; + char buf[PATH_MAX]; + + /* prepare for unbind */ + prepare_for_rebind(&priv, buf, sizeof(buf)); + + /* also prepare for unplug */ + local_debug("closing the device"); + close(priv.fd.drm); + prepare_for_rescan(&priv); + + local_debug("closing the device"); + close(priv.fd.drm); + + local_debug("unbinding the driver from the device"); + driver_unbind(priv.fd.sysfs_drv, priv.dev_bus_addr); + close(priv.fd.sysfs_drv); + + local_debug("unplugging the device"); + device_unplug(priv.fd.sysfs_dev); + + local_debug("recovering the device"); + bus_rescan(priv.fd.sysfs_bus); + + healthcheck(); +} + static void unplug_rescan(void) { struct hotunplug priv; @@ -290,14 +319,21 @@ igt_main close(fd_drm); } - igt_describe("Check if the driver can be cleanly unbound from a device believed to be closed"); + igt_describe("Check if the driver can be cleanly unbound from a device believed to be closed, then rebound"); igt_subtest("unbind-rebind") unbind_rebind(); igt_fixture igt_abort_on_f(failure, "%s\n", failure); - igt_describe("Check if a device believed to be closed can be cleanly unplugged"); + igt_describe("Check if a device with the driver unbound from it can be cleanly recovered after being unplugged\n"); + igt_subtest("unbind-unplug-rescan") + unbind_unplug_rescan(); + + igt_fixture + igt_abort_on_f(failure, "%s\n", failure); + + igt_describe("Check if a device believed to be closed can be cleanly unplugged and recovered"); igt_subtest("unplug-rescan") unplug_rescan(); From patchwork Mon Jun 22 16:44:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11618417 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 05E6914B7 for ; Mon, 22 Jun 2020 16:44:45 +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 E25292073E for ; Mon, 22 Jun 2020 16:44:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E25292073E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.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 D7D866E438; Mon, 22 Jun 2020 16:44:43 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 041906E438; Mon, 22 Jun 2020 16:44:42 +0000 (UTC) IronPort-SDR: 0mOlxOVWBG4eH02xINI0yTh6NOYuWS7qYpdIb32PEHhRTtX9iV1402tHsLntdBtm7k97phuQJX N6Rv1Ix9y7SQ== X-IronPort-AV: E=McAfee;i="6000,8403,9660"; a="205294126" X-IronPort-AV: E=Sophos;i="5.75,268,1589266800"; d="scan'208";a="205294126" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 09:44:42 -0700 IronPort-SDR: ftbAc7zJ+m9Fpe6FRFGB9Q8CxIOa3d/k1Ih622LhxoyCJQcFtNEFKBMKgyS1Myob64FKnESO46 5r8POF/Et5jw== X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="422687549" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 09:44:41 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Mon, 22 Jun 2020 18:44:11 +0200 Message-Id: <20200622164415.30352-5-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200622164415.30352-1-janusz.krzysztofik@linux.intel.com> References: <20200622164415.30352-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH i-g-t v2 4/8] tests/core_hotunplug: Add 'lateclose before recover' variants X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 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 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" If a GPU gets wedged during driver rebind or device re-plug for some reason, current hotunbind/hotunplug test variants may time out before lateclose phase, resulting in incomplete CI reports. Let's rename those variants to more adequate hotrebind/hotreplug-lateclose and add new variants focused on exercising the lateclose phase regardless of potential rebind/re-plug issues under old names. v2: rebase on upstream Signed-off-by: Janusz Krzysztofik Reviewed-by: Michał Winiarski --- tests/core_hotunplug.c | 57 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c index a4809720b..0892e1927 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -268,6 +268,43 @@ static void hotunbind_lateclose(void) local_debug("hot unbinding the driver from the device"); driver_unbind(priv.fd.sysfs_drv, priv.dev_bus_addr); + local_debug("late closing the unbound device instance"); + close(priv.fd.drm); + + local_debug("rebinding the driver to the device"); + driver_bind(priv.fd.sysfs_drv, priv.dev_bus_addr); + + healthcheck(); +} + +static void hotunplug_lateclose(void) +{ + struct hotunplug priv; + + prepare_for_rescan(&priv); + + local_debug("hot unplugging the device"); + device_unplug(priv.fd.sysfs_dev); + + local_debug("late closing the removed device instance"); + close(priv.fd.drm); + + local_debug("recovering the device"); + bus_rescan(priv.fd.sysfs_bus); + + healthcheck(); +} + +static void hotrebind_lateclose(void) +{ + struct hotunplug priv; + char buf[PATH_MAX]; + + prepare_for_rebind(&priv, buf, sizeof(buf)); + + local_debug("hot unbinding the driver from the device"); + driver_unbind(priv.fd.sysfs_drv, priv.dev_bus_addr); + local_debug("rebinding the driver to the device"); driver_bind(priv.fd.sysfs_drv, priv.dev_bus_addr); @@ -277,7 +314,7 @@ static void hotunbind_lateclose(void) healthcheck(); } -static void hotunplug_lateclose(void) +static void hotreplug_lateclose(void) { struct hotunplug priv; @@ -340,17 +377,31 @@ igt_main igt_fixture igt_abort_on_f(failure, "%s\n", failure); - igt_describe("Check if the driver can be cleanly unbound from a still open device, then released"); + igt_describe("Check if the driver can be cleanly unbound from a still open device, then released and rebound"); igt_subtest("hotunbind-lateclose") hotunbind_lateclose(); igt_fixture igt_abort_on_f(failure, "%s\n", failure); - igt_describe("Check if a still open device can be cleanly unplugged, then released"); + igt_describe("Check if a still open device can be cleanly unplugged, then released and recovered"); igt_subtest("hotunplug-lateclose") hotunplug_lateclose(); igt_fixture igt_abort_on_f(failure, "%s\n", failure); + + igt_describe("Check if the driver can be cleanly unbound from an open device and rebound back, then released"); + igt_subtest("hotrebind-lateclose") + hotrebind_lateclose(); + + igt_fixture + igt_abort_on_f(failure, "%s\n", failure); + + igt_describe("Check if a still open device can be cleanly unplugged and recovered, then released"); + igt_subtest("hotreplug-lateclose") + hotreplug_lateclose(); + + igt_fixture + igt_abort_on_f(failure, "%s\n", failure); } From patchwork Mon Jun 22 16:44:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11618421 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 21FAE90 for ; Mon, 22 Jun 2020 16:44:48 +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 0AA562075A for ; Mon, 22 Jun 2020 16:44:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0AA562075A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.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 88E376E85D; Mon, 22 Jun 2020 16:44:47 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id BBE846E85E; Mon, 22 Jun 2020 16:44:44 +0000 (UTC) IronPort-SDR: YbXoMpBcZotH3sLsu9WszAPnO8FjoWIPFFeg/Vry+e+UJ/svrAIP3tQ5erPcbhvbR5e3Aa/k+/ qMGcyIhDS1eA== X-IronPort-AV: E=McAfee;i="6000,8403,9660"; a="205294135" X-IronPort-AV: E=Sophos;i="5.75,268,1589266800"; d="scan'208";a="205294135" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 09:44:44 -0700 IronPort-SDR: Z6fhAgXesqGl2lnj2q65f4YWibO9sv1/w+vqQMOweq/yjDFS0TB3Ph07mLD8iU/JkEMc2MCLLv C7OsWeC1+IVA== X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="422687553" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 09:44:43 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Mon, 22 Jun 2020 18:44:12 +0200 Message-Id: <20200622164415.30352-6-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200622164415.30352-1-janusz.krzysztofik@linux.intel.com> References: <20200622164415.30352-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH i-g-t v2 5/8] tests/core_hotunplug: Add 'GEM address space' variant X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 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 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Verify if an additional address space associated with an open device file descriptor is cleaned up correctly on device hotunplug. v2: rebase on upstream, update includes order Signed-off-by: Janusz Krzysztofik Reviewed-by: Michał Winiarski --- tests/core_hotunplug.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c index 0892e1927..18a963564 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -30,6 +30,7 @@ #include #include "i915/gem.h" +#include "i915/gem_vm.h" #include "igt.h" #include "igt_device_scan.h" #include "igt_kmod.h" @@ -332,6 +333,29 @@ static void hotreplug_lateclose(void) healthcheck(); } +static void vm_hotunplug_lateclose(void) +{ + struct hotunplug priv; + + prepare_for_rescan(&priv); + + gem_require_vm(priv.fd.drm); + + local_debug("creating additional GEM user address space"); + igt_ignore_warn(gem_vm_create(priv.fd.drm)); + + local_debug("hot unplugging the device"); + device_unplug(priv.fd.sysfs_dev); + + local_debug("late closing the removed device instance"); + close(priv.fd.drm); + + local_debug("recovering the device"); + bus_rescan(priv.fd.sysfs_bus); + + healthcheck(); +} + /* Main */ igt_main @@ -404,4 +428,11 @@ igt_main igt_fixture igt_abort_on_f(failure, "%s\n", failure); + + igt_describe("Check if a still open device with extra GEM address space can be cleanly unplugged, then released and recovered"); + igt_subtest("vm-hotunplug-lateclose") + vm_hotunplug_lateclose(); + + igt_fixture + igt_abort_on_f(failure, "%s\n", failure); } From patchwork Mon Jun 22 16:44:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11618423 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 7A6A890 for ; Mon, 22 Jun 2020 16:44:49 +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 629AF2073E for ; Mon, 22 Jun 2020 16:44:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 629AF2073E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.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 546D86E85E; Mon, 22 Jun 2020 16:44:48 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1FA496E85D; Mon, 22 Jun 2020 16:44:47 +0000 (UTC) IronPort-SDR: FxpDF3m1uHUih8nFuyAB9EX1IME66zpPmVH/1R0hkyUBlAU2lJhy0Ke+VndPs3DuY3sS3GavmG 3RChpXfj5nSA== X-IronPort-AV: E=McAfee;i="6000,8403,9660"; a="205294143" X-IronPort-AV: E=Sophos;i="5.75,268,1589266800"; d="scan'208";a="205294143" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 09:44:46 -0700 IronPort-SDR: xTW9+K7UjJANRI1M4tDjWnnTj6wu0b0TI+Yzwo5ZXs7YYXr5gc4WK68NK+MmS6WtWXcJH53tCm on5HxMFqsREg== X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="422687563" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 09:44:44 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Mon, 22 Jun 2020 18:44:13 +0200 Message-Id: <20200622164415.30352-7-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200622164415.30352-1-janusz.krzysztofik@linux.intel.com> References: <20200622164415.30352-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH i-g-t v2 6/8] tests/core_hotunplug: Add 'GEM object' variant X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 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 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" GEM objects belonging to user file descriptors still open on device hotunplug may exhibit still more driver issues. Add a subtest that implements this scenario. v2: rebase on upstream Signed-off-by: Janusz Krzysztofik Reviewed-by: Michał Winiarski --- tests/core_hotunplug.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c index 18a963564..c30d98a69 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -356,6 +356,29 @@ static void vm_hotunplug_lateclose(void) healthcheck(); } +static void gem_hotunplug_lateclose(void) +{ + struct hotunplug priv; + + prepare_for_rescan(&priv); + + igt_require_gem(priv.fd.drm); + + local_debug("creating a GEM user object"); + igt_ignore_warn(gem_create(priv.fd.drm, 4096)); + + local_debug("hot unplugging the device"); + device_unplug(priv.fd.sysfs_dev); + + local_debug("late closing the removed device instance"); + close(priv.fd.drm); + + local_debug("recovering the device"); + bus_rescan(priv.fd.sysfs_bus); + + healthcheck(); +} + /* Main */ igt_main @@ -435,4 +458,11 @@ igt_main igt_fixture igt_abort_on_f(failure, "%s\n", failure); + + igt_describe("Check if a device with a still open GEM object can be cleanly unplugged, then released and recovered"); + igt_subtest("gem-hotunplug-lateclose") + gem_hotunplug_lateclose(); + + igt_fixture + igt_abort_on_f(failure, "%s\n", failure); } From patchwork Mon Jun 22 16:44:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11618425 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 5446C90 for ; Mon, 22 Jun 2020 16:44:54 +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 3C8812075A for ; Mon, 22 Jun 2020 16:44:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C8812075A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.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 C07BE6E439; Mon, 22 Jun 2020 16:44:53 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 82CB06E861; Mon, 22 Jun 2020 16:44:51 +0000 (UTC) IronPort-SDR: DZ4ylYTz7mvUeo/m5mbRtE6010sLHox6YgWoF95ivAcAUAPlwhgb69m4ZvemUWhq/lgnTl3e9k WmemLD+4kvRg== X-IronPort-AV: E=McAfee;i="6000,8403,9660"; a="205294167" X-IronPort-AV: E=Sophos;i="5.75,268,1589266800"; d="scan'208";a="205294167" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 09:44:51 -0700 IronPort-SDR: b6CBttxRIrKZWpPuGvCPxhJyrnHzwQs1/fkuhfkO+7dsag5erLJTqXspSFh5xXQCqhWx3QLiuv 6kpnYhMefU9g== X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="422687577" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 09:44:47 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Mon, 22 Jun 2020 18:44:14 +0200 Message-Id: <20200622164415.30352-8-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200622164415.30352-1-janusz.krzysztofik@linux.intel.com> References: <20200622164415.30352-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH i-g-t v2 7/8] tests/core_hotunplug: Add 'PRIME handle' variant X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 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 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Even if all device file descriptors are closed on device hotunplug, PRIME exported objects may still exists, referenced by still open dma-buf file handles. Add a subtest that keeps such handle open on device hotunplug. v2: rebase on upstream Signed-off-by: Janusz Krzysztofik Reviewed-by: Michał Winiarski --- tests/core_hotunplug.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c index c30d98a69..7cb699cc2 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -379,6 +379,35 @@ static void gem_hotunplug_lateclose(void) healthcheck(); } +static void prime_hotunplug_lateclose(void) +{ + struct hotunplug priv; + uint32_t handle; + int dmabuf; + + prepare_for_rescan(&priv); + + igt_require_gem(priv.fd.drm); + + local_debug("creating and PRIME-exporting a GEM object"); + handle = gem_create(priv.fd.drm, 4096); + dmabuf = prime_handle_to_fd(priv.fd.drm, handle); + + local_debug("closing the device"); + close(priv.fd.drm); + + local_debug("hot unplugging the device"); + device_unplug(priv.fd.sysfs_dev); + + local_debug("late closing the PRIME file handle"); + close(dmabuf); + + local_debug("recovering the device"); + bus_rescan(priv.fd.sysfs_bus); + + healthcheck(); +} + /* Main */ igt_main @@ -465,4 +494,11 @@ igt_main igt_fixture igt_abort_on_f(failure, "%s\n", failure); + + igt_describe("Check if a device with a still open PRIME-exported object can be cleanly unplugged, then released and recovered"); + igt_subtest("prime-hotunplug-lateclose") + prime_hotunplug_lateclose(); + + igt_fixture + igt_abort_on_f(failure, "%s\n", failure); } From patchwork Mon Jun 22 16:44:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11618427 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 1294690 for ; Mon, 22 Jun 2020 16:44:55 +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 EF65C2075A for ; Mon, 22 Jun 2020 16:44:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EF65C2075A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.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 517746E861; Mon, 22 Jun 2020 16:44:54 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5BCAB6E439; Mon, 22 Jun 2020 16:44:53 +0000 (UTC) IronPort-SDR: krb5WrRvGEtavMDwZSUVtrZfMgrOtqJ2MuFNvnh4v6sb1bbAmJxVfdChmVb2BZNfYNIrNfGbwl 33hG6n8S2fUQ== X-IronPort-AV: E=McAfee;i="6000,8403,9660"; a="205294176" X-IronPort-AV: E=Sophos;i="5.75,268,1589266800"; d="scan'208";a="205294176" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 09:44:53 -0700 IronPort-SDR: O8iPxxtTaWBBZ9yjPnrlWQfIrpQHi/I8ARnJ4QZRKkAc80yTIpqDecLMOXenv8jxUPcDGgPI3t T5ZunOoqv7aw== X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="422687595" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 09:44:51 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Mon, 22 Jun 2020 18:44:15 +0200 Message-Id: <20200622164415.30352-9-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200622164415.30352-1-janusz.krzysztofik@linux.intel.com> References: <20200622164415.30352-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH i-g-t v2 8/8] tests/core_hotunplug: Add 'GEM batch' variant X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 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 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Verify if a device with a GEM batch job still running on a GPU can be hot-unplugged cleanly and released, then recovered. v2: rebase on upstream Signed-off-by: Janusz Krzysztofik --- tests/core_hotunplug.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c index 7cb699cc2..672ff661d 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -33,6 +33,7 @@ #include "i915/gem_vm.h" #include "igt.h" #include "igt_device_scan.h" +#include "igt_dummyload.h" #include "igt_kmod.h" #include "igt_sysfs.h" @@ -408,6 +409,32 @@ static void prime_hotunplug_lateclose(void) healthcheck(); } +static void batch_hotunplug_lateclose(void) +{ + struct hotunplug priv; + igt_spin_t *spin; + + prepare_for_rescan(&priv); + + igt_require_gem(priv.fd.drm); + + local_debug("running dummy load"); + spin = __igt_spin_new(priv.fd.drm, .flags = IGT_SPIN_POLL_RUN | + IGT_SPIN_NO_PREEMPTION); + igt_spin_busywait_until_started(spin); + + local_debug("hot unplugging the device"); + device_unplug(priv.fd.sysfs_dev); + + local_debug("late closing the removed device instance"); + close(priv.fd.drm); + + local_debug("recovering the device"); + bus_rescan(priv.fd.sysfs_bus); + + healthcheck(); +} + /* Main */ igt_main @@ -501,4 +528,11 @@ igt_main igt_fixture igt_abort_on_f(failure, "%s\n", failure); + + igt_describe("Check if a device with a still running batch can be cleanly unplugged, then released and recovered"); + igt_subtest("batch-hotunplug-lateclose") + batch_hotunplug_lateclose(); + + igt_fixture + igt_abort_on_f(failure, "%s\n", failure); }