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 5F959D3B985 for ; Tue, 9 Dec 2025 17:46:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E09D010E546; Tue, 9 Dec 2025 17:46:03 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="TaxDuu8O"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id C877810E546 for ; Tue, 9 Dec 2025 17:46:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1765302363; x=1796838363; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xZWfXos5aVuDAM9saUUbZ7wXBV0v58+KScNC/UjEYW0=; b=TaxDuu8OSG9ITEQYXuNhODc2ZOxfR49w4ylixGxh4TnRyuuWbZ0g/OiD piFW+fJP1NkrHE7c6hv5epLx3M6dJpPp9crAUVtGbTyKumh1epin1gRuH 1OTiLWdiGT9ee+BM+UF1K8cqa9VxgVIuO2o+qaD2NuDK5f5XaQljwoYzL 7HwZUgL8qE8uVUH9l+fSlmRtAKdCEui+7L4UozpP80eYrCpfUcGwxONoX AWGo05TrLp6rN2oAx3NfO71ZzTlaS2SR17mfsEys2SDKyH6ZCUWTMmfyY wFqkOesVfLgrYMCwHI60SGm2q11ibuRg/IuNK8qcTLKSTnUOsaaFAgs9B Q==; X-CSE-ConnectionGUID: 1c0ro3cYTxGblQeolN7R8Q== X-CSE-MsgGUID: FBY2b5YbTl2QRzldKmAZvw== X-IronPort-AV: E=McAfee;i="6800,10657,11637"; a="71127246" X-IronPort-AV: E=Sophos;i="6.20,262,1758610800"; d="scan'208";a="71127246" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2025 09:46:02 -0800 X-CSE-ConnectionGUID: bhhlaSYgTh+NK/4yzmnEGw== X-CSE-MsgGUID: CRRxe3y8QZq7hrr98QqN0A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.20,262,1758610800"; d="scan'208";a="197056913" Received: from psoham-nuc7i7bnh.iind.intel.com ([10.190.216.151]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2025 09:46:00 -0800 From: Soham Purkait To: igt-dev@lists.freedesktop.org, riana.tauro@intel.com, badal.nilawar@intel.com, kamil.konieczny@intel.com Cc: anshuman.gupta@intel.com, soham.purkait@intel.com, umesh.nerlige.ramappa@intel.com Subject: [PATCH i-g-t v1 1/2] tools/gputop/xe_gputop: Close card_fd after engine population in xe_populate_engines() Date: Tue, 9 Dec 2025 23:05:12 +0530 Message-Id: <20251209173513.4020947-2-soham.purkait@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251209173513.4020947-1-soham.purkait@intel.com> References: <20251209173513.4020947-1-soham.purkait@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" During the engine initialization for a specific device in GPUTOP, IGT helper functions need card_fd to access each engine and respective configs. These are required in obtaining the busyness of the respective engines through PMU in GPUTOP. But for KMS tests no other DRM client should run while it is running. So once the required configs and engines are obtained, the card_fd is closed as opened card_fd in xe_populate_engines() makes appear itself as DRM client. v1: - Initialize pmu_device_obj to null. Fixes: c8106465683f ("tools/gputop/xe_gputop: Add gputop support for xe specific devices") Signed-off-by: Soham Purkait --- tools/gputop/xe_gputop.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/gputop/xe_gputop.c b/tools/gputop/xe_gputop.c index bb2caa6ea..45cb5bf93 100644 --- a/tools/gputop/xe_gputop.c +++ b/tools/gputop/xe_gputop.c @@ -92,6 +92,7 @@ void xe_gputop_init(void *ptr, int index, obj = ((struct xe_gputop *)ptr) + index; obj->card = card; + obj->pmu_device_obj = NULL; } static int pmu_format_shift(int xe, const char *name) @@ -197,6 +198,8 @@ void *xe_populate_engines(const void *obj, int index) engines->num_engines++; } + close(card_fd); + if (!ret) { errno = ret; return NULL; @@ -263,11 +266,11 @@ int xe_pmu_init(const void *obj, int index) fd = _open_pmu(type, &engines->num_counters, &engine->engine_active_ticks, &engines->fd); if (fd < 0) - return -1; + return fd; fd = _open_pmu(type, &engines->num_counters, &engine->engine_total_ticks, &engines->fd); if (fd < 0) - return -1; + return fd; } return 0; } -- 2.34.1