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 1E3F9EE57CC for ; Wed, 13 Sep 2023 02:20:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 20F9F10E02E; Wed, 13 Sep 2023 02:20:28 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8A56810E02E for ; Wed, 13 Sep 2023 02:20:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694571625; x=1726107625; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=rCIjJC7HacO+GRQv1hu07WVden4Hm9lH1jruTHJBId4=; b=lAcr+reDcL1fR4wVXAmA/X+3SaWkO3l0FtQ+w7nztqq95BjyOasMjbue nCygA8kibYBJLtrU1sypdF0EfYmpzs4UTiD5H5MksH1rx3AOQ2s4fHskp r1GwhHYQjzBAISdkGujQPAqZr80yQQDtnRK9+IN3xoFV6duaWYnxLmyCJ ge4y06AsXo9U9YD0KAu5jK99w8rCho2lrlEiOzye84weUn4WQEH8bNDDb j9maklIkIqeFB9kD/5dYM6Jye7lyz9lW7s7Wqt8+ROgYGiaT6LAKbaTYr /HT/iCBx2WCE81yBAgZwb6KaPs/pC+N8O0NxCZD1kORkjY1iUySQsdRIO w==; X-IronPort-AV: E=McAfee;i="6600,9927,10831"; a="358819968" X-IronPort-AV: E=Sophos;i="6.02,142,1688454000"; d="scan'208";a="358819968" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2023 19:20:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10831"; a="1074778481" X-IronPort-AV: E=Sophos;i="6.02,142,1688454000"; d="scan'208";a="1074778481" Received: from adixit-mobl.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.212.225.156]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2023 19:20:20 -0700 Date: Tue, 12 Sep 2023 19:20:19 -0700 Message-ID: <87o7i6u84c.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Umesh Nerlige Ramappa In-Reply-To: References: <20230909011626.1643734-1-ashutosh.dixit@intel.com> <20230909011626.1643734-2-ashutosh.dixit@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.1 (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-gfx] [PATCH 1/3] drm/i915/perf: Subtract gtt_offset from hw_tail 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" On Tue, 12 Sep 2023 18:25:16 -0700, Umesh Nerlige Ramappa wrote: > Hi Umesh, > On Fri, Sep 08, 2023 at 06:16:24PM -0700, Ashutosh Dixit wrote: > > The code in oa_buffer_check_unlocked() is correct only if the OA buffer is > > 16 MB aligned (which seems to be the case today in i915). However when the > > 16 MB alignment is dropped, when we "Subtract partial amount off the tail", > > the "& (OA_BUFFER_SIZE - 1)" operation in OA_TAKEN() will result in an > > incorrect hw_tail value. > > > > Therefore hw_tail must be brought to the same base as head and read_tail > > prior to OA_TAKEN by subtracting gtt_offset from hw_tail. > > > > Signed-off-by: Ashutosh Dixit > > --- > > drivers/gpu/drm/i915/i915_perf.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c > > index 018f42fff4cc0..ec0fc2934045a 100644 > > --- a/drivers/gpu/drm/i915/i915_perf.c > > +++ b/drivers/gpu/drm/i915/i915_perf.c > > @@ -565,6 +565,7 @@ static bool oa_buffer_check_unlocked(struct i915_perf_stream *stream) > > partial_report_size %= report_size; > > > > /* Subtract partial amount off the tail */ > > + hw_tail -= gtt_offset; > > hw_tail = OA_TAKEN(hw_tail, partial_report_size); > > I see partial_report_size is a value in the 0 - report_size range and it > may not have the gtt_offset added to it, so I guess the OA_TAKEN may result > in a bad value, but I am not able to visualize what the specific issue > is. Can you please provide an example with numbers? > > Also, slightly confused about the need for this patch. Are we dropping the > 16 MB alignment for some reason? If not, I suggest we can add this patch > later with any series that drops it. I found this issue when porting i915 OA code to XE (which doesn't have 16 MB alignment), I had to make this fix in XE in order to get things to work. In any case, as you already pointed out, Patch 2 overrides Patch 1, so let's just drop Patch 1. Thanks. -- Ashutosh