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 C74F6C7EE2D for ; Fri, 3 Mar 2023 15:39:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D211210E6C4; Fri, 3 Mar 2023 15:39:19 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id DE28210E6BE; Fri, 3 Mar 2023 15:39:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677857957; x=1709393957; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=PsLUt0hhdShhtqMCwP0MEZHkvWgjYOP7Rv4o2wUr3Dw=; b=CyyWU1r+LlqhNxKEekjbL6EM7dGmMucH7uKULqHrDuQ3GuSdcA4HhiPB SUQ2O4IxlbMnmIvvyFagFFEUreKUPHyqVtsbQFmsZckb0BMeFyOEM5LHy iswjgvX4WBK/xkWKMocqIHuzA8GS3Z/fQqf1oEZgvamnRO9Yyj9sIovIe +JS//rErl6kSsxb7gBPXbhTDCv6QugD0AtLIDIhdNHojl2eAwt77ktCg1 T8GIGucc69t9C5hpXlYBAXnGYKeZaK9A1VQbS+MzPQgBTA4mXZBUtqGpJ /2RowhY/VhcrgnbuSfJRGK9K6/PT36q0oKV5lfs2hY2dl7xw3cxXKsSvp Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10638"; a="332552244" X-IronPort-AV: E=Sophos;i="5.98,231,1673942400"; d="scan'208";a="332552244" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2023 07:39:17 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10638"; a="785294950" X-IronPort-AV: E=Sophos;i="5.98,231,1673942400"; d="scan'208";a="785294950" Received: from joe-255.igk.intel.com (HELO localhost) ([10.91.220.57]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2023 07:39:14 -0800 Date: Fri, 3 Mar 2023 16:39:13 +0100 From: Stanislaw Gruszka To: Michel =?iso-8859-1?Q?D=E4nzer?= Subject: Re: [PATCH] Change the meaning of the fields in the ttm_place structure from pfn to bytes Message-ID: <20230303153913.GH3963532@linux.intel.com> References: <20230303071659.1213074-1-Amaranath.Somalapuram@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: shashank.sharma@amd.com, arvind.yadav@amd.com, arunpravin.paneerselvam@amd.com, nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Somalapuram Amaranath , amd-gfx@lists.freedesktop.org, linux-graphics-maintainer@vmware.com, dri-devel@lists.freedesktop.org, alexander.deucher@amd.com, christian.koenig@amd.com Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" On Fri, Mar 03, 2023 at 03:55:56PM +0100, Michel Dänzer wrote: > On 3/3/23 08:16, Somalapuram Amaranath wrote: > > Change the ttm_place structure member fpfn, lpfn, mem_type to > > res_start, res_end, res_type. > > Change the unsigned to u64. > > Fix the dependence in all the DRM drivers and > > clean up PAGE_SHIFT operation. > > > > Signed-off-by: Somalapuram Amaranath > > > > [...] > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c > > index 44367f03316f..5b5104e724e3 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c > > @@ -131,11 +131,12 @@ static int amdgpu_gtt_mgr_new(struct ttm_resource_manager *man, > > goto err_free; > > } > > > > - if (place->lpfn) { > > + if (place->res_end) { > > spin_lock(&mgr->lock); > > r = drm_mm_insert_node_in_range(&mgr->mm, &node->mm_nodes[0], > > - num_pages, tbo->page_alignment, > > - 0, place->fpfn, place->lpfn, > > + num_pages, tbo->page_alignment, 0, > > + place->res_start << PAGE_SHIFT, > > + place->res_end << PAGE_SHIFT, > > DRM_MM_INSERT_BEST); > > This should be >> or no shift instead of <<, shouldn't it? Multiplying a value in bytes by the page size doesn't make sense. > > > I didn't check the rest of the patch in detail, but it's easy introduce subtle regressions with this kind of change. It'll require a lot of review & testing scrutiny. Also good justification. The changelog says only what is done, nothing about why the change is needed. Regards Stanislaw 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 2E0E3C7EE2F for ; Fri, 3 Mar 2023 15:39:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D837810E6C5; Fri, 3 Mar 2023 15:39:19 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id DE28210E6BE; Fri, 3 Mar 2023 15:39:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677857957; x=1709393957; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=PsLUt0hhdShhtqMCwP0MEZHkvWgjYOP7Rv4o2wUr3Dw=; b=CyyWU1r+LlqhNxKEekjbL6EM7dGmMucH7uKULqHrDuQ3GuSdcA4HhiPB SUQ2O4IxlbMnmIvvyFagFFEUreKUPHyqVtsbQFmsZckb0BMeFyOEM5LHy iswjgvX4WBK/xkWKMocqIHuzA8GS3Z/fQqf1oEZgvamnRO9Yyj9sIovIe +JS//rErl6kSsxb7gBPXbhTDCv6QugD0AtLIDIhdNHojl2eAwt77ktCg1 T8GIGucc69t9C5hpXlYBAXnGYKeZaK9A1VQbS+MzPQgBTA4mXZBUtqGpJ /2RowhY/VhcrgnbuSfJRGK9K6/PT36q0oKV5lfs2hY2dl7xw3cxXKsSvp Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10638"; a="332552244" X-IronPort-AV: E=Sophos;i="5.98,231,1673942400"; d="scan'208";a="332552244" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2023 07:39:17 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10638"; a="785294950" X-IronPort-AV: E=Sophos;i="5.98,231,1673942400"; d="scan'208";a="785294950" Received: from joe-255.igk.intel.com (HELO localhost) ([10.91.220.57]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2023 07:39:14 -0800 Date: Fri, 3 Mar 2023 16:39:13 +0100 From: Stanislaw Gruszka To: Michel =?iso-8859-1?Q?D=E4nzer?= Message-ID: <20230303153913.GH3963532@linux.intel.com> References: <20230303071659.1213074-1-Amaranath.Somalapuram@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Subject: Re: [Intel-gfx] [PATCH] Change the meaning of the fields in the ttm_place structure from pfn to bytes 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: arvind.yadav@amd.com, arunpravin.paneerselvam@amd.com, nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Somalapuram Amaranath , amd-gfx@lists.freedesktop.org, linux-graphics-maintainer@vmware.com, dri-devel@lists.freedesktop.org, alexander.deucher@amd.com, christian.koenig@amd.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Fri, Mar 03, 2023 at 03:55:56PM +0100, Michel Dänzer wrote: > On 3/3/23 08:16, Somalapuram Amaranath wrote: > > Change the ttm_place structure member fpfn, lpfn, mem_type to > > res_start, res_end, res_type. > > Change the unsigned to u64. > > Fix the dependence in all the DRM drivers and > > clean up PAGE_SHIFT operation. > > > > Signed-off-by: Somalapuram Amaranath > > > > [...] > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c > > index 44367f03316f..5b5104e724e3 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c > > @@ -131,11 +131,12 @@ static int amdgpu_gtt_mgr_new(struct ttm_resource_manager *man, > > goto err_free; > > } > > > > - if (place->lpfn) { > > + if (place->res_end) { > > spin_lock(&mgr->lock); > > r = drm_mm_insert_node_in_range(&mgr->mm, &node->mm_nodes[0], > > - num_pages, tbo->page_alignment, > > - 0, place->fpfn, place->lpfn, > > + num_pages, tbo->page_alignment, 0, > > + place->res_start << PAGE_SHIFT, > > + place->res_end << PAGE_SHIFT, > > DRM_MM_INSERT_BEST); > > This should be >> or no shift instead of <<, shouldn't it? Multiplying a value in bytes by the page size doesn't make sense. > > > I didn't check the rest of the patch in detail, but it's easy introduce subtle regressions with this kind of change. It'll require a lot of review & testing scrutiny. Also good justification. The changelog says only what is done, nothing about why the change is needed. Regards Stanislaw 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 C6BB6C77B7C for ; Thu, 4 May 2023 12:34:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AEB2110E4BD; Thu, 4 May 2023 12:33:52 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id DE28210E6BE; Fri, 3 Mar 2023 15:39:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677857957; x=1709393957; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=PsLUt0hhdShhtqMCwP0MEZHkvWgjYOP7Rv4o2wUr3Dw=; b=CyyWU1r+LlqhNxKEekjbL6EM7dGmMucH7uKULqHrDuQ3GuSdcA4HhiPB SUQ2O4IxlbMnmIvvyFagFFEUreKUPHyqVtsbQFmsZckb0BMeFyOEM5LHy iswjgvX4WBK/xkWKMocqIHuzA8GS3Z/fQqf1oEZgvamnRO9Yyj9sIovIe +JS//rErl6kSsxb7gBPXbhTDCv6QugD0AtLIDIhdNHojl2eAwt77ktCg1 T8GIGucc69t9C5hpXlYBAXnGYKeZaK9A1VQbS+MzPQgBTA4mXZBUtqGpJ /2RowhY/VhcrgnbuSfJRGK9K6/PT36q0oKV5lfs2hY2dl7xw3cxXKsSvp Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10638"; a="332552244" X-IronPort-AV: E=Sophos;i="5.98,231,1673942400"; d="scan'208";a="332552244" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2023 07:39:17 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10638"; a="785294950" X-IronPort-AV: E=Sophos;i="5.98,231,1673942400"; d="scan'208";a="785294950" Received: from joe-255.igk.intel.com (HELO localhost) ([10.91.220.57]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2023 07:39:14 -0800 Date: Fri, 3 Mar 2023 16:39:13 +0100 From: Stanislaw Gruszka To: Michel =?iso-8859-1?Q?D=E4nzer?= Message-ID: <20230303153913.GH3963532@linux.intel.com> References: <20230303071659.1213074-1-Amaranath.Somalapuram@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Mailman-Approved-At: Thu, 04 May 2023 12:31:35 +0000 Subject: Re: [Nouveau] [PATCH] Change the meaning of the fields in the ttm_place structure from pfn to bytes X-BeenThere: nouveau@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Nouveau development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: shashank.sharma@amd.com, arvind.yadav@amd.com, arunpravin.paneerselvam@amd.com, nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Somalapuram Amaranath , amd-gfx@lists.freedesktop.org, linux-graphics-maintainer@vmware.com, dri-devel@lists.freedesktop.org, alexander.deucher@amd.com, christian.koenig@amd.com Errors-To: nouveau-bounces@lists.freedesktop.org Sender: "Nouveau" On Fri, Mar 03, 2023 at 03:55:56PM +0100, Michel Dänzer wrote: > On 3/3/23 08:16, Somalapuram Amaranath wrote: > > Change the ttm_place structure member fpfn, lpfn, mem_type to > > res_start, res_end, res_type. > > Change the unsigned to u64. > > Fix the dependence in all the DRM drivers and > > clean up PAGE_SHIFT operation. > > > > Signed-off-by: Somalapuram Amaranath > > > > [...] > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c > > index 44367f03316f..5b5104e724e3 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c > > @@ -131,11 +131,12 @@ static int amdgpu_gtt_mgr_new(struct ttm_resource_manager *man, > > goto err_free; > > } > > > > - if (place->lpfn) { > > + if (place->res_end) { > > spin_lock(&mgr->lock); > > r = drm_mm_insert_node_in_range(&mgr->mm, &node->mm_nodes[0], > > - num_pages, tbo->page_alignment, > > - 0, place->fpfn, place->lpfn, > > + num_pages, tbo->page_alignment, 0, > > + place->res_start << PAGE_SHIFT, > > + place->res_end << PAGE_SHIFT, > > DRM_MM_INSERT_BEST); > > This should be >> or no shift instead of <<, shouldn't it? Multiplying a value in bytes by the page size doesn't make sense. > > > I didn't check the rest of the patch in detail, but it's easy introduce subtle regressions with this kind of change. It'll require a lot of review & testing scrutiny. Also good justification. The changelog says only what is done, nothing about why the change is needed. Regards Stanislaw