From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3180CD2E014 for ; Wed, 23 Oct 2024 04:55:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E336A10E730; Wed, 23 Oct 2024 04:55:35 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="elzKWrEo"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id B09FA10E731 for ; Wed, 23 Oct 2024 04:55:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729659335; x=1761195335; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TkMn1e4HGF/iQ5+nsP5dwxZd9Mp6YwyMz6av3JqK6wU=; b=elzKWrEoYGsM+bD4uRxiSPnSPXuKUU8l38sDzz2xnZVV8rFBZxtxRfbh oCHtPbXcj0KQNmedJ+RZXjahnts9Whs6Vo3pWeHQT7/9QKSkGWV66MUjn kqNmayOqFbB/GaU9fXg7waAb/LySc1TZ9aZWDm0GBtcT32U1+NYGtmHBz ZUS7quEwPkXmklnM5oTOgfNOVPO7r4ix33IAKI3IFdYdklqpD9eARgq6G 0cZgNnPuRcROINRcTRc4SmjAot6P1ErtLHcpCUbzY3G41fZxx2z+8jU+a CYRqpnIKasgSqGN0BTjWTt/iuTROtOaVw+5ZNKaykIosY5WUoozt7cAuL A==; X-CSE-ConnectionGUID: Np7VK6Q9TnSLVJ0Qr3aaug== X-CSE-MsgGUID: vRP5aEw4TQO0OXnt3ByyCw== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="29009109" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="29009109" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2024 21:55:34 -0700 X-CSE-ConnectionGUID: xyldUHvXT4yXT8aGyhy+xA== X-CSE-MsgGUID: 2XhTDzclTIi+eb1wsgh3cA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,225,1725346800"; d="scan'208";a="84061625" Received: from lucas-s2600cw.jf.intel.com ([10.165.21.196]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2024 21:55:33 -0700 From: Lucas De Marchi To: igt-dev@lists.freedesktop.org Cc: Lucas De Marchi Subject: [CI 2/2] tests/intel/perf_pmu: Migrate to unbind + unload Date: Tue, 22 Oct 2024 21:55:11 -0700 Message-ID: <20241023045511.3047422-3-lucas.demarchi@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241023045511.3047422-1-lucas.demarchi@intel.com> References: <20241023045511.3047422-1-lucas.demarchi@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" There isn't much point in testing we can't remove the module directly after removing *some* known dependencies. The point in this test is to make sure that if the HW vanishes, driver still behaves. That is currently not true, as it will cause perf to explode. Signed-off-by: Lucas De Marchi --- tests/intel/perf_pmu.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/intel/perf_pmu.c b/tests/intel/perf_pmu.c index bfa2d501a..6eb4f09d1 100644 --- a/tests/intel/perf_pmu.c +++ b/tests/intel/perf_pmu.c @@ -2282,7 +2282,6 @@ static void test_unload(unsigned int num_engines) int fd[4 + num_engines * 3], i; uint64_t *buf; int count = 0, ret; - char *who = NULL; int i915; i915 = __drm_open_driver(DRIVER_INTEL); @@ -2337,23 +2336,26 @@ static void test_unload(unsigned int num_engines) igt_debug("Read %d events from perf and trial unload\n", count); pmu_read_multi(fd[0], count, buf); - ret = __igt_i915_driver_unload(&who); - igt_debug("__igt_i915_driver_unload: ret %d who %s\n", ret, who); - igt_assert(ret != 0 && !strcmp(who, "i915")); - free(who); - pmu_read_multi(fd[0], count, buf); - igt_debug("Close perf\n"); + /* + * We can't unload the module with perf event registered, but + * we can make the HW go away by unbinding it from the driver. + */ + ret = igt_kmod_unbind("i915"); + igt_assert_eq(ret, 0); + igt_debug("Close perf\n"); for (i = 0; i < count; i++) close(fd[i]); + igt_debug("Final unload\n"); + /* After perf is closed, we should be able to remove the module */ + ret = igt_i915_driver_unload(); + igt_assert_eq(ret, 0); + free(buf); } igt_waitchildren(); - - igt_debug("Final unload\n"); - igt_assert_eq(__igt_i915_driver_unload(NULL), 0); } static void pmu_read(int i915) -- 2.47.0