From patchwork Thu Feb 20 15:36:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas De Marchi X-Patchwork-Id: 13984179 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 BCBFFC021B3 for ; Thu, 20 Feb 2025 16:07:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 561AE10E19D; Thu, 20 Feb 2025 16:07:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="amMmghih"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6D42710E19D; Thu, 20 Feb 2025 16:07:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1740067657; x=1771603657; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=KXd6HmaYWSKCdFUWjFo6dbjbrQlIxzPrhqN2Q+aeBeg=; b=amMmghihAq5onKg3B87q7bYUFs31/A/oAfVDZdoPOmKSOqdiUJYhQLyk tI3eXEKTVFmpahgzbOZdvUorJBo8VjDdqWwd5H5T6JWxJcismRS2orlW0 OK86hrbWV7xDVGhj6WOe9iLIceFDddvkNLEP9flfWI730fJz3QqjODuck 6TlzKwyd3XBWahk7C8v8czHBLxrp3pEW/q6/cJ9bKBjOfrPr3XOew0MQg 1cvq7j5+NJC54FyjmW0PqQ3/iyYnSS5lztOeKWErRVbpDYhMtxjKNTENm 4g1tQNEJXcF6vh+xU2JOsDw6eEdCs2Oy+afAjKL0cyVFYJvbn8ZA4DUpY Q==; X-CSE-ConnectionGUID: xPwDtDpXQEi9VvShGRePtg== X-CSE-MsgGUID: xea0uw4ZR/6Lk0+Z3UCNAg== X-IronPort-AV: E=McAfee;i="6700,10204,11351"; a="40041573" X-IronPort-AV: E=Sophos;i="6.13,302,1732608000"; d="scan'208";a="40041573" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Feb 2025 08:07:37 -0800 X-CSE-ConnectionGUID: P9rw0PJMQPOjnB73mf/YRg== X-CSE-MsgGUID: yoaCzzJdTf6r8NYE7bT8Mg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="152268814" Received: from lucas-s2600cw.jf.intel.com ([10.165.21.196]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Feb 2025 08:07:36 -0800 From: Lucas De Marchi To: linux-perf-users@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org Cc: dave.hansen@linux.intel.com, Zhang Rui , Kan Liang , Peter Zijlstra , Ingo Molnar , Lucas De Marchi , Ulisses Furquim , intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Subject: [PATCH] perf/x86/rapl: Fix PP1 event for Intel Meteor/Lunar Lake Date: Thu, 20 Feb 2025 07:36:30 -0800 Message-ID: <20250220153857.2593704-6-lucas.demarchi@intel.com> X-Mailer: git-send-email 2.48.1 MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On some boots the read of MSR_PP1_ENERGY_STATUS msr returns 0, causing perf_msr_probe() to make the power/events/energy-gpu event non-visible. When that happens, the msr always read 0 until the graphics module (i915 for Meteor Lake, xe for Lunar Lake) is loaded. Then it starts returning something different and re-loading the rapl module "fixes" it. This is tested on the following platforms with the fail rates before this patch: Alder Lake S 0/20 Arrow Lake H 0/20 Lunar Lake M 8/20 Meteor Lake U 6/20 Raptor Lake P 4/20 Raptor Lake S 0/20 For those platforms failing, use a separate msr list with .no_check set so it doesn't check the runtime value to create the event - it will just return 0 until the i915/xe module initializes the GPU. The issue https://github.com/ulissesf/qmassa/issues/4 is workarounded by reading the MSR directly since it works after xe is loaded, but the issue with not having the perf event is still there. Closes: https://github.com/ulissesf/qmassa/issues/4 Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/4241 Signed-off-by: Lucas De Marchi