From patchwork Mon Jun 22 15:18:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11618153 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 C1143618 for ; Mon, 22 Jun 2020 15:19:08 +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 A90A7206FA for ; Mon, 22 Jun 2020 15:19:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A90A7206FA 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 277D96E1A8; Mon, 22 Jun 2020 15:19:08 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0066B6E1A8; Mon, 22 Jun 2020 15:19:00 +0000 (UTC) IronPort-SDR: DuXb7pnLdWZESqqo8995J8mXC/WTjbHh7FtvecLoBJZAtBlwtTbObSxrqLbxCN+7haDgpaaomz +BpSFJQqqHMw== X-IronPort-AV: E=McAfee;i="6000,8403,9659"; a="145296418" X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="145296418" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 08:19:00 -0700 IronPort-SDR: /OTNsklO1814bGWfmCJRkROQ+/lz6aYDyw+VrxJllujNTZDBPVy1ulNHr7j+/D+BifFzzi74E9 b1WEyDpHUQ1Q== X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="451871644" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 08:18:59 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Mon, 22 Jun 2020 17:18:38 +0200 Message-Id: <20200622151845.4520-2-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200622151845.4520-1-janusz.krzysztofik@linux.intel.com> References: <20200622151845.4520-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH i-g-t 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. 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 f9cfc8c3c..187168009 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -48,6 +48,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; @@ -67,9 +73,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); @@ -136,14 +142,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"); @@ -179,13 +185,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(); @@ -197,13 +203,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(); @@ -216,13 +222,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(); @@ -234,13 +240,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 15:18:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11618149 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 4388860D for ; Mon, 22 Jun 2020 15:19:05 +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 2BF81206FA for ; Mon, 22 Jun 2020 15:19:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2BF81206FA 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 225F86E82C; Mon, 22 Jun 2020 15:19:04 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 307116E82C; Mon, 22 Jun 2020 15:19:02 +0000 (UTC) IronPort-SDR: 1jP/WIfvYgTxyQiKsPdr6+B2LA00qcHZAWXoaydp0prgwttakBvBCPooCTu9/YVG5uaggWUTno cuq/c2LbUYow== X-IronPort-AV: E=McAfee;i="6000,8403,9659"; a="145296424" X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="145296424" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 08:19:02 -0700 IronPort-SDR: 8kYLAIsRxdBqRdzBk7J88VQdrwoe4/uD3+gscyJOTZkyeM928heghRcD8muYa0QeqKhAUwpT5/ BbYuB/FfC1IQ== X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="451871651" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 08:19:00 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Mon, 22 Jun 2020 17:18:39 +0200 Message-Id: <20200622151845.4520-3-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200622151845.4520-1-janusz.krzysztofik@linux.intel.com> References: <20200622151845.4520-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH i-g-t 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. 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 187168009..c7213d728 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -54,42 +54,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; @@ -123,7 +135,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; @@ -183,7 +195,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); @@ -201,7 +213,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); @@ -220,7 +232,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); @@ -238,7 +250,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 15:18:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11618151 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 4149160D for ; Mon, 22 Jun 2020 15:19: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 29D23206FA for ; Mon, 22 Jun 2020 15:19:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 29D23206FA 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 274C86E82F; Mon, 22 Jun 2020 15:19:06 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 74C666E829; Mon, 22 Jun 2020 15:19:03 +0000 (UTC) IronPort-SDR: a9+XUfVrrj3s4nfDdAMOCnNcwTmN1UxyKGDvs2vsM5ajQZ9FU3VKE6aH5OTWXX7ZVLtikTRGGf sCn2FH/mKJ0Q== X-IronPort-AV: E=McAfee;i="6000,8403,9659"; a="145296428" X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="145296428" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 08:19:03 -0700 IronPort-SDR: 6wzUq0f/+DqnQFqDv3HgEc8jb9nbm60AAK7bwVtB2nNTaLiW36nrmLAKBA1y1OxYdalbQpvfEE wJTY33BxAHNw== X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="451871657" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 08:19:02 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Mon, 22 Jun 2020 17:18:40 +0200 Message-Id: <20200622151845.4520-4-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200622151845.4520-1-janusz.krzysztofik@linux.intel.com> References: <20200622151845.4520-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH i-g-t 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. Signed-off-by: Janusz Krzysztofik --- 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 c7213d728..0b7c6006b 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -209,6 +209,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; @@ -288,14 +317,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 15:18:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11618155 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 F0B5E618 for ; Mon, 22 Jun 2020 15:19:09 +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 D93D3206FA for ; Mon, 22 Jun 2020 15:19:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D93D3206FA 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 8AEA06E832; Mon, 22 Jun 2020 15:19:08 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id B9B2B6E82E; Mon, 22 Jun 2020 15:19:04 +0000 (UTC) IronPort-SDR: NKCGJDXote4hg2fBlgam4BdRCfEijXW2awZySYLJjhuItVA+fF4usagEQ82MFe3myeJsc2Ml2H CoSl0OJw9vhQ== X-IronPort-AV: E=McAfee;i="6000,8403,9659"; a="145296432" X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="145296432" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 08:19:04 -0700 IronPort-SDR: 4raEmdLsABygTHbtaQuSZF3OhFIOmCePucibV92w3wrEccLz3miiUgznQEjfdS9CRL0bWPX16w vtlLjCQg0TdA== X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="451871670" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 08:19:03 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Mon, 22 Jun 2020 17:18:41 +0200 Message-Id: <20200622151845.4520-5-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200622151845.4520-1-janusz.krzysztofik@linux.intel.com> References: <20200622151845.4520-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH i-g-t 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. Signed-off-by: Janusz Krzysztofik --- 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 0b7c6006b..f736a991f 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -266,6 +266,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); @@ -275,7 +312,7 @@ static void hotunbind_lateclose(void) healthcheck(); } -static void hotunplug_lateclose(void) +static void hotreplug_lateclose(void) { struct hotunplug priv; @@ -338,17 +375,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 15:18:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11618159 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 86372618 for ; Mon, 22 Jun 2020 15:19:27 +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 6E11320716 for ; Mon, 22 Jun 2020 15:19:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6E11320716 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 CD4FC6E834; Mon, 22 Jun 2020 15:19:26 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5B0A96E829; Mon, 22 Jun 2020 15:19:25 +0000 (UTC) IronPort-SDR: rnrty4QKiVKN7cO+Vo9oPWQ0e0sBiJlkbJA+CDfwpvUvW2GHq4gG5mjoemiQg6QVvxgPRe5dUR GvSYt7OYT5zA== X-IronPort-AV: E=McAfee;i="6000,8403,9659"; a="145296438" X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="145296438" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 08:19:05 -0700 IronPort-SDR: S7GG25Tq9GwKbKtm84ZqjKihYVTr0MCGriiog0o80dpb/X06RaRwaB+wVV/lDd5G7GBcCXsp4H q6CvGuW7DOgg== X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="451871678" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 08:19:04 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Mon, 22 Jun 2020 17:18:42 +0200 Message-Id: <20200622151845.4520-6-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200622151845.4520-1-janusz.krzysztofik@linux.intel.com> References: <20200622151845.4520-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH i-g-t 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. Signed-off-by: Janusz Krzysztofik --- tests/core_hotunplug.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c index f736a991f..6d9f530b1 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -34,6 +34,8 @@ #include "igt_kmod.h" #include "igt_sysfs.h" +#include "i915/gem_vm.h" + IGT_TEST_DESCRIPTION("Examine behavior of a driver on device hot unplug"); struct hotunplug { @@ -330,6 +332,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 @@ -402,4 +427,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 15:18:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11618161 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 34B2860D for ; Mon, 22 Jun 2020 15:19:28 +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 1D1F4206FA for ; Mon, 22 Jun 2020 15:19:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D1F4206FA 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 0F59F6E830; Mon, 22 Jun 2020 15:19:27 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id A7F606E829; Mon, 22 Jun 2020 15:19:25 +0000 (UTC) IronPort-SDR: V+z73/p41QIqKaSt7LQTrP5DlPJ8vVtYsMMmoQfh9hs6PxG/9eQaDLTHI11g+cfaMQbWGDhLlm MJ78IxyPNWmg== X-IronPort-AV: E=McAfee;i="6000,8403,9659"; a="145296444" X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="145296444" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 08:19:07 -0700 IronPort-SDR: rrWVo3+gLBjMClGwGDJ+AVS1P+qj6NuHvdla8pN+zSm4jLfBcWlbHCOOMqY84EWoF26RAVbuja AtTVKGSE7nSQ== X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="451871682" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 08:19:06 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Mon, 22 Jun 2020 17:18:43 +0200 Message-Id: <20200622151845.4520-7-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200622151845.4520-1-janusz.krzysztofik@linux.intel.com> References: <20200622151845.4520-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH i-g-t 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. Signed-off-by: Janusz Krzysztofik --- tests/core_hotunplug.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c index 6d9f530b1..309d4efef 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -355,6 +355,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 @@ -434,4 +457,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 15:18:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11618163 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 2055060D for ; Mon, 22 Jun 2020 15:19:31 +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 090F620739 for ; Mon, 22 Jun 2020 15:19:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 090F620739 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 74B416E1E9; Mon, 22 Jun 2020 15:19:30 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 741C96E830; Mon, 22 Jun 2020 15:19:26 +0000 (UTC) IronPort-SDR: P+Pv97uRiwuLRvkkvrKXsapt21jfWKmIPlZnAeN2514bRlST84uvDr5R7F2kSvYJ9BPUQR7Oqa /2aUjEc7Ajxw== X-IronPort-AV: E=McAfee;i="6000,8403,9659"; a="145296445" X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="145296445" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 08:19:08 -0700 IronPort-SDR: W0Xk+73MKnAMEhrzBDYQrRkQQuJBRJJEEH+408mXbVct/3C4FZaCxIxx62/EHuyBSqCGM8y7aj 48cV1NK7030A== X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="451871686" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 08:19:07 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Mon, 22 Jun 2020 17:18:44 +0200 Message-Id: <20200622151845.4520-8-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200622151845.4520-1-janusz.krzysztofik@linux.intel.com> References: <20200622151845.4520-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH i-g-t 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. Signed-off-by: Janusz Krzysztofik --- tests/core_hotunplug.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c index 309d4efef..35a4fb13c 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -378,6 +378,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 @@ -464,4 +493,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 15:18:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11618165 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 AB62B161F for ; Mon, 22 Jun 2020 15:19:31 +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 94025206FA for ; Mon, 22 Jun 2020 15:19:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94025206FA 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 CA8F76E838; Mon, 22 Jun 2020 15:19:30 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 258286E835; Mon, 22 Jun 2020 15:19:27 +0000 (UTC) IronPort-SDR: V0NbtIi4JGMSleTAXyTKrJn/HuYtaCAkkOI0DAJAyL6jac1DCmbKtC3hm32LKMX5WbuGdInQ1U 6TN6AdmsKJ2Q== X-IronPort-AV: E=McAfee;i="6000,8403,9659"; a="145296447" X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="145296447" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 08:19:09 -0700 IronPort-SDR: 37CdtTqteV/WcaoNs7qzfWxbmXvwkDdw8lteX1Ix5h8vuWfLywkAZCWfrB2wB7AtFQMkVzytK8 94RL1z+LXphw== X-IronPort-AV: E=Sophos;i="5.75,267,1589266800"; d="scan'208";a="451871692" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2020 08:19:08 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Mon, 22 Jun 2020 17:18:45 +0200 Message-Id: <20200622151845.4520-9-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200622151845.4520-1-janusz.krzysztofik@linux.intel.com> References: <20200622151845.4520-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH i-g-t 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. 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 35a4fb13c..c8d7ec7e1 100644 --- a/tests/core_hotunplug.c +++ b/tests/core_hotunplug.c @@ -31,6 +31,7 @@ #include "igt.h" #include "igt_device_scan.h" +#include "igt_dummyload.h" #include "igt_kmod.h" #include "igt_sysfs.h" @@ -407,6 +408,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 @@ -500,4 +527,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); }