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 D70A3EB64DA for ; Tue, 18 Jul 2023 05:07:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7A85110E066; Tue, 18 Jul 2023 05:07:45 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3C31E10E066 for ; Tue, 18 Jul 2023 05:07:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689656863; x=1721192863; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=DlFtlVQnTlaSdLpMND6SfcD1nIM/7qPEBm5MYvkfPYw=; b=ceDY3E2LYw/RTdALDWIobtgdhC2drIaP8LuLHWwlnMX9B5EgncasNqVm tdJc+fQoo2CvoZALP1M5ly1YJItzHg1CvtqsG+XHDsdDA2MuBmB7Rz0Jx kfXoPds3f65X9ocT0+2814cdJS2paAz6cowoXG2bJ8jTdZujQeTpgrIhO sHjwu+R1b//IXKBBjP7u19dmR7vT/OwsGiiDtPc4UzodQEs1SdfBE08f1 sWLyXQcpKMEof4BC2Mu6kpr7DhGwPcnY/85zA71oVcigun90kFVtyNgZh CRHJRy9W7xLh+QunE4fta8gFW9/yb6+r8xlBLa1Svz1edPV8JcVYdFtI+ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="452488635" X-IronPort-AV: E=Sophos;i="6.01,213,1684825200"; d="scan'208";a="452488635" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2023 22:07:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="837134899" X-IronPort-AV: E=Sophos;i="6.01,213,1684825200"; d="scan'208";a="837134899" Received: from adixit-mobl.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.209.47.242]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2023 22:07:41 -0700 Date: Mon, 17 Jul 2023 22:07:41 -0700 Message-ID: <87ilahiz8i.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: "Iddamsetty, Aravind" In-Reply-To: <04ae6811-9bc1-c66d-6cb8-640bfd8a9c7b@intel.com> References: <20230627122113.1472532-1-aravind.iddamsetty@intel.com> <20230627122113.1472532-3-aravind.iddamsetty@intel.com> <87mt09daqu.wl-ashutosh.dixit@intel.com> <87a5w8cvmr.wl-ashutosh.dixit@intel.com> <04ae6811-9bc1-c66d-6cb8-640bfd8a9c7b@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/28.2 (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=US-ASCII Subject: Re: [Intel-xe] [PATCH v2 2/2] drm/xe/pmu: Enable PMU interface 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: , Cc: Bommu Krishnaiah , intel-xe@lists.freedesktop.org, Tvrtko Ursulin Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On Thu, 06 Jul 2023 20:53:47 -0700, Iddamsetty, Aravind wrote: > Hi Aravind, Back to this review. > >> On 06-07-2023 08:09, Dixit, Ashutosh wrote: > >>> On Tue, 27 Jun 2023 05:21:13 -0700, Aravind Iddamsetty wrote: > >> > >>>> +static u64 __engine_group_busyness_read(struct xe_gt *gt, u64 config) > >>>> +{ > >>>> + u64 val = 0; > >>>> + > >>>> + switch (config) { > >>>> + case XE_PMU_RENDER_GROUP_BUSY(0): > >>>> + val = xe_mmio_read32(gt, XE_OAG_RENDER_BUSY_FREE); > >>>> + break; > >>>> + case XE_PMU_COPY_GROUP_BUSY(0): > >>>> + val = xe_mmio_read32(gt, XE_OAG_BLT_BUSY_FREE); > >>>> + break; > >>>> + case XE_PMU_MEDIA_GROUP_BUSY(0): > >>>> + val = xe_mmio_read32(gt, XE_OAG_ANY_MEDIA_FF_BUSY_FREE); > >>>> + break; > >>>> + case XE_PMU_ANY_ENGINE_GROUP_BUSY(0): > >>>> + val = xe_mmio_read32(gt, XE_OAG_RC0_ANY_ENGINE_BUSY_FREE); > >>>> + break; > >>>> + default: > >>>> + drm_warn(>->tile->xe->drm, "unknown pmu event\n"); > >>>> + } > >>>> + > >>>> + return xe_gt_clock_interval_to_ns(gt, val * 16); > >>>> +} > >>> > >>> A few questions on just the above function first: > >>> > >>> 1. OK so these registers won't be available to VF's, but any idea what > >>> these counts are when VF's are active? > >> > >> VF's cannot access the registers but the counters will be incrementing > >> if respective engines are busy and can be monitored from PF and that > >> will be across all VFs. > > > > Ok, good. > > > >> > >>> > >>> 2. When would these 32 bit registers overflow? Let us say a group is > >>> continuously busy and we are running at 1 GHz, the registers would > >>> overflow in 4 seconds (max value 4G)? > >> > >> Based on BSPEC:52071 they use MHZ clock assuming the default 24MHz, it > >> would take around 5726 secs to overflow. > > > > OK, overflow should not be an issue then. Though I have seen 19.2 and 38.4 > > MHz in OA. Also, if these are OAG registers, OA timestamp freq can be > > different from CS timestamp freq, so not sure if that needs to be > > handled. See i915_perf_oa_timestamp_frequency() in i915. > > so that is handled by below calculation > >> > >>> > >>> 3. What is the multiplication by 16 (not factored above in 2.)? I don't see > >>> that in Bspec. > >> > >> These counters are incremented based on crystal clock frequency and we > >> need to convert to CS time base hence a 16x mul. BSPEC:52071 > > > > Hmm still don't see the 16x mul in BSPEC:52071. Anyway. > > lets say the frequency is 24MHz so the counter increments every > 1333.333ns(granularity) and corresponding cs timestamp base for this > frequency is 83.333ns, 1333.333/83.333 = 16 and this true for rest of > the frequency selections as well. hence we multiply the counter x 16. OK, I finally see in Bspec:71028: "Unit in GPMusec. Refer to Timestamp Bases for details" which is a pointer to Bspec: 52071. So the 16x multiply looks correct (and these registers are not running at OA freq otherwise we'd have to use i915_perf_oa_timestamp_frequency()). Hopefully it's correct. Thanks.