All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: "Michel Dänzer" <michel.daenzer@mailbox.org>
Cc: shashank.sharma@amd.com, arvind.yadav@amd.com,
	arunpravin.paneerselvam@amd.com, nouveau@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org,
	Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>,
	amd-gfx@lists.freedesktop.org,
	linux-graphics-maintainer@vmware.com,
	dri-devel@lists.freedesktop.org, alexander.deucher@amd.com,
	christian.koenig@amd.com
Subject: Re: [PATCH] Change the meaning of the fields in the ttm_place structure from pfn to bytes
Date: Fri, 3 Mar 2023 16:39:13 +0100	[thread overview]
Message-ID: <20230303153913.GH3963532@linux.intel.com> (raw)
In-Reply-To: <da7e9be8-4a80-7166-d6f8-20f3acf8bf9c@mailbox.org>

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 <Amaranath.Somalapuram@amd.com>
> > 
> > [...]
> > 
> > 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

WARNING: multiple messages have this Message-ID (diff)
From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: "Michel Dänzer" <michel.daenzer@mailbox.org>
Cc: arvind.yadav@amd.com, arunpravin.paneerselvam@amd.com,
	nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>,
	amd-gfx@lists.freedesktop.org,
	linux-graphics-maintainer@vmware.com,
	dri-devel@lists.freedesktop.org, alexander.deucher@amd.com,
	christian.koenig@amd.com
Subject: Re: [Intel-gfx] [PATCH] Change the meaning of the fields in the ttm_place structure from pfn to bytes
Date: Fri, 3 Mar 2023 16:39:13 +0100	[thread overview]
Message-ID: <20230303153913.GH3963532@linux.intel.com> (raw)
In-Reply-To: <da7e9be8-4a80-7166-d6f8-20f3acf8bf9c@mailbox.org>

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 <Amaranath.Somalapuram@amd.com>
> > 
> > [...]
> > 
> > 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

WARNING: multiple messages have this Message-ID (diff)
From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: "Michel Dänzer" <michel.daenzer@mailbox.org>
Cc: shashank.sharma@amd.com, arvind.yadav@amd.com,
	arunpravin.paneerselvam@amd.com, nouveau@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org,
	Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>,
	amd-gfx@lists.freedesktop.org,
	linux-graphics-maintainer@vmware.com,
	dri-devel@lists.freedesktop.org, alexander.deucher@amd.com,
	christian.koenig@amd.com
Subject: Re: [Nouveau] [PATCH] Change the meaning of the fields in the ttm_place structure from pfn to bytes
Date: Fri, 3 Mar 2023 16:39:13 +0100	[thread overview]
Message-ID: <20230303153913.GH3963532@linux.intel.com> (raw)
In-Reply-To: <da7e9be8-4a80-7166-d6f8-20f3acf8bf9c@mailbox.org>

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 <Amaranath.Somalapuram@amd.com>
> > 
> > [...]
> > 
> > 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

  reply	other threads:[~2023-03-03 15:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-03  7:16 [PATCH] Change the meaning of the fields in the ttm_place structure from pfn to bytes Somalapuram Amaranath
2023-03-03  7:16 ` [Nouveau] " Somalapuram Amaranath
2023-03-03  7:16 ` [Intel-gfx] " Somalapuram Amaranath
2023-03-03  7:41 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork
2023-03-03 14:55 ` [PATCH] " Michel Dänzer
2023-03-03 14:55   ` [Intel-gfx] " Michel Dänzer
2023-03-03 14:55   ` [Nouveau] " Michel Dänzer
2023-03-03 15:39   ` Stanislaw Gruszka [this message]
2023-03-03 15:39     ` Stanislaw Gruszka
2023-03-03 15:39     ` [Intel-gfx] " Stanislaw Gruszka
2023-03-06  8:03 ` kernel test robot
2023-03-06  8:03   ` kernel test robot
2023-03-06  8:03   ` [Intel-gfx] " kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230303153913.GH3963532@linux.intel.com \
    --to=stanislaw.gruszka@linux.intel.com \
    --cc=Amaranath.Somalapuram@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=arunpravin.paneerselvam@amd.com \
    --cc=arvind.yadav@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-graphics-maintainer@vmware.com \
    --cc=michel.daenzer@mailbox.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=shashank.sharma@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.