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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 030CCC433F5 for ; Fri, 19 Nov 2021 13:00: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 BDF9D6120E for ; Fri, 19 Nov 2021 13:00:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BDF9D6120E 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=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2DCBD6F568; Fri, 19 Nov 2021 13:00:19 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 52A1E6F564; Fri, 19 Nov 2021 13:00:16 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10172"; a="295222751" X-IronPort-AV: E=Sophos;i="5.87,247,1631602800"; d="scan'208";a="295222751" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2021 05:00:16 -0800 X-IronPort-AV: E=Sophos;i="5.87,247,1631602800"; d="scan'208";a="455769643" Received: from egedeon-mobl2.amr.corp.intel.com (HELO tursulin-mobl2.home) ([10.209.179.224]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2021 05:00:14 -0800 From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Fri, 19 Nov 2021 12:59:45 +0000 Message-Id: <20211119125945.55056-6-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211119125945.55056-1-tvrtko.ursulin@linux.intel.com> References: <20211119125945.55056-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Intel-gfx] [PATCH i-g-t 6/6] intel_gpu_top: Add a sanity check discovered busy metric is per engine 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" From: Tvrtko Ursulin Adding a cross-check with ABI config name space and not just relying on sysfs names. Signed-off-by: Tvrtko Ursulin Cc: Dmitry Rogozhkin --- tools/intel_gpu_top.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c index 41c59a72c09d..81c724d1fe1c 100644 --- a/tools/intel_gpu_top.c +++ b/tools/intel_gpu_top.c @@ -376,6 +376,12 @@ static struct engines *discover_engines(char *device) break; } + /* Double check config is an engine config. */ + if (engine->busy.config >= __I915_PMU_OTHER(0)) { + free((void *)engine->name); + continue; + } + engine->class = (engine->busy.config & (__I915_PMU_OTHER(0) - 1)) >> I915_PMU_CLASS_SHIFT; -- 2.32.0