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 AC783C36005 for ; Tue, 25 Mar 2025 21:53:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5C9C210E05A; Tue, 25 Mar 2025 21:53:14 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="FZajmEmW"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) by gabe.freedesktop.org (Postfix) with ESMTPS id BAA8610E05A for ; Tue, 25 Mar 2025 21:53:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742939593; x=1774475593; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version:content-transfer-encoding; bh=UBhytyLAiS8DMz5MnB4CzWLbkECHrBL0+Hn8pK+A+a0=; b=FZajmEmWL6C89sBRKIYznWwyBS29oMsTnp8DVy+2jvKLUR3YK9wRMMzm M8pTHZ0WENgp6oxU97BrTTHigkDA9HWXxBmO7cqhgB3kvVJub85lioEET TwcVf/iPKqbaq4WEZ8DV1XDuPwRYWhGFXhNnrWKzidAT7mkWuEbMG8pER +QCWAG8Ny3fPHvNvOlHoUvc+/167ODuZb0AORAnF3v5OWzrQurf85Sf+/ 0WI40GeVX4sAoNnEwzTu6N4qLaEBAnM8WDnoGBQ4999E8Dmzq9H6UqioV kenUa9o/gu18WFL+xuId8JCBNkOMomu8U2Ivw2mSm97mbPpvTpGts7kpe A==; X-CSE-ConnectionGUID: 3BqsGp5cQlSiNvTY0rjZZA== X-CSE-MsgGUID: O6G2vuwKTVSIcCq0+rPXmg== X-IronPort-AV: E=McAfee;i="6700,10204,11384"; a="44135010" X-IronPort-AV: E=Sophos;i="6.14,276,1736841600"; d="scan'208";a="44135010" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2025 14:53:12 -0700 X-CSE-ConnectionGUID: XPSkkZZ7RF6UDfyRT5xtXQ== X-CSE-MsgGUID: 0xmv/fZ/TqelS/xusBIvow== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,276,1736841600"; d="scan'208";a="161722216" Received: from ileong-mobl1.gar.corp.intel.com (HELO adixit-MOBL3.intel.com) ([10.125.91.160]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2025 14:53:12 -0700 Date: Tue, 25 Mar 2025 14:53:11 -0700 Message-ID: <87h63gixq0.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: "Belgaumkar, Vinay" Cc: , Riana Tauro , Lucas De Marchi , Rodrigo Vivi Subject: Re: [PATCH v4] drm/xe/pmu: Add GT frequency events In-Reply-To: <33ebfe1d-5ac5-4985-8c8d-c1996e5a6d14@intel.com> References: <20250324232402.46481-1-vinay.belgaumkar@intel.com> <87jz8e9d3h.wl-ashutosh.dixit@intel.com> <87jz8dhw0r.wl-ashutosh.dixit@intel.com> <33ebfe1d-5ac5-4985-8c8d-c1996e5a6d14@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.4 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On Tue, 25 Mar 2025 13:33:43 -0700, Belgaumkar, Vinay wrote: > > On 3/25/2025 10:15 AM, Dixit, Ashutosh wrote: > > On Mon, 24 Mar 2025 19:37:32 -0700, Belgaumkar, Vinay wrote: > > Hi Vinay, > > > >> On 3/24/2025 5:18 PM, Dixit, Ashutosh wrote: > >>> On Mon, 24 Mar 2025 16:24:02 -0700, Vinay Belgaumkar wrote: > >>>> @@ -266,11 +274,24 @@ static u64 __xe_pmu_event_read(struct perf_eve= nt *event) > >>>> case XE_PMU_EVENT_ENGINE_ACTIVE_TICKS: > >>>> case XE_PMU_EVENT_ENGINE_TOTAL_TICKS: > >>>> return read_engine_events(gt, event); > >>>> + case XE_PMU_EVENT_GT_ACTUAL_FREQUENCY: > >>>> + return xe_guc_pc_get_act_freq(>->uc.guc.pc); > >>>> + case XE_PMU_EVENT_GT_REQUESTED_FREQUENCY: > >>>> + if (!xe_guc_pc_get_cur_freq(>->uc.guc.pc, &cur_gt_freq)) > >>> This is unconditionally taking the forcewake and waking the card up j= ust to > >>> get the sample. Do we really want to do that? > >>> > >>> So if we don't do that, both the actual and requested freq will be 0 = if gt > >>> is in C6. > >> For actual frequency, the register(0xc60) does not belong to any fw do= main - > >> > >> GEN_FW_RANGE(0xc00, 0xfff, 0), > >> > >> HW will report 0 when GT is in C6. > > Yes, no issue about act_freq, see commit 22009b6dad66. I was referring = only > > to requested freq. > > > >> The requested freq register is a > >> shadowed register (0xa008), so that will not accrue fwake either. > >> > >> static const struct i915_range mtl_shadowed_regs[] =3D { > >> =A0=A0=A0=A0=A0=A0=A0 { .start =3D=A0=A0 0x2030, .end =3D=A0=A0 0x203= 0 }, > >> =A0=A0=A0=A0=A0=A0=A0 { .start =3D=A0=A0 0x2510, .end =3D=A0=A0 0x255= 0 }, > >> =A0=A0=A0=A0=A0=A0=A0 { .start =3D=A0=A0 0xA008, .end =3D=A0=A0 0xA00= C }, > > So this still doesn't make sense because: > > > > 1. The fact is that xe_guc_pc_get_cur_freq() *is* taking forcewake > > 2. And that is in accord with the following comment in i915/intel_un= core.c > > > > * Shadowing only applies to writes; forcewake > > * must still be acquired when reading from registers in these ran= ges. > > > > Also see intel_rps_read_punit_req() which is called from i915 PMU > > (frequency_sample()) and uses with_intel_runtime_pm_if_in_use(), so we'd > > need to do use the equivalent in xe. > > Hi Ashutosh, > > =A0 As part of a previous decision, in the Xe PMU implementation, we are > doing a runtime_get() during pmu_init for all PMU sessions. So, device is > going to be awake anyways. In this case, it does not make sense to just > read the register without a fwake. Even if that is ok... Let us take a completely idle device. What should the actual and requested freq's be for this case? Both should be zero, correct? Now, what are we going to show if we are taking fwake? At least the requested freq will be non-zero? Is that ok? Or the requested freq will show zero even if we take fwake? Thanks.