From patchwork Fri Jun 7 11:51:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 10981553 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7E361398 for ; Fri, 7 Jun 2019 11:52:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C49DD28815 for ; Fri, 7 Jun 2019 11:52:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8B0A28BB4; Fri, 7 Jun 2019 11:52:31 +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 4DB4728815 for ; Fri, 7 Jun 2019 11:52:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C02A889D89; Fri, 7 Jun 2019 11:52:30 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6B12189D87; Fri, 7 Jun 2019 11:52:29 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jun 2019 04:52:28 -0700 Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.18]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jun 2019 04:52:23 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Fri, 7 Jun 2019 13:51:41 +0200 Message-Id: <20190607115142.32668-1-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v11 0/1] tests: Add a new test for device hot unplug 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: janusz.krzysztofik@intel.com, intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP The test should help resolving driver bugs which exhibit themselves when a device is unplugged / driver unbind from a device while the device is busy (different from simple module unload which requires device references being put first). A kernel patch resolving kernel panics on driver hot unbind [1] was verified on trybot with v10 of this test before it has been submitted upstream. Current version (v11) has also been tested on trybot with the kernel patch already included upstream. Hence, no kernel panics are expected, however some kernel WARNs and driver error messages may still need to be resolved before CI is happy with this new test. [1] https://cgit.freedesktop.org/drm/drm-tip/commit/?id=47bc28d7ee6d8378ba4451c43885cb3241302243 Janusz Krzysztofik (1): tests: Add a new test for device hot unplug tests/Makefile.sources | 1 + tests/core_hotunplug.c | 222 +++++++++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 3 files changed, 224 insertions(+) create mode 100644 tests/core_hotunplug.c Changelog: v10->v11: - fix typos in some comments, - use SPDX license identifier, - include a per-patch changelog in the commit message (Daniel). v9->v10 (submitted only to trybot): - rename variables and function arguments to something that indicates they're file descriptors (Daniel), - introduce a data structure that contains various file descriptors and a helper function to set them all (Daniel), - fix strange indenting (Daniel), - limit scope to first three subtests as the first set of tests to merge (Daniel). v8->v9: All changes after Daniel's comments - thanks! - flatten the code, don't try to create a midlayer, - provide mimimal subtests that even don't keep device open, - don't use driver unbind in more advanced subtests, - provide subtests with different level of resources allocated during device unplug, - provide subtests which check driver behavior after device hot unplug. v7->v8: - move workload functions back from fixture to subtests, - register different actions and different workloads in respective tables and iterate over those tables while enumerating subtests, - introduce new subtest flavors by simply omiting module unload step, - instead of simply requesting bus rescan or not, introduce action specific device recovery helpers, required specifically with those new subtests not touching the module, - split workload functions in two parts, one spawning the workload, the other waiting for its completion, - for the new subtests not requiring module unload, run workload functions directly from the test process and use new workload completion wait functions in place of subprocess completion wait, - take more control over logging, longjumps and exit codes in workload subprocesses, - add some debug messages for easy progress watching, - move function API descriptions on top of respective typedefs, - drop patch 2/2 with external workload command again, still nobody likes it. v6->v7: - add missing igt_exit() needed with the second patch. v5->v6 (third public submission, incorrectly marked as v5, sorry): - run workload inside an igt helper subprocess so resources consumed by the workload are cleaned up automatically on workload subprocess crash, without affecting test results, - move the igt helper with workload back from subtests to initial fixture so workload crash also does not affect test results, - re-add the second patch which extends the test with an option for using an external command as a workload, - other cleanups suggested by Kasia and Chris. v4->v5 (second public submission, marked as v2): - try to restore the device to a working state after each subtest (Petri, Daniel). v3->v4 (first public submission, not marked with any version number): - run dummy_load from inside subtests (Antonio). v2->v3 (internal submission): - run dummy_load from the test process directly (Antonio), - drop the patch for running external workload (Antonio). v1->v2 (internal submission): - run a subprocess with dummy_load instead of external command (Antonio), - keep use of external workload command as an option, move that to a separate patch.