drm/amdgpu: implement cgs gpu memory callbacks

Zhou, David(ChunMing) David1.Zhou at amd.com
Mon Aug 24 19:07:21 PDT 2015


Inline...[DZ]

> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter at oracle.com]
> Sent: Tuesday, August 25, 2015 3:51 AM
> To: Zhou, David(ChunMing)
> Cc: dri-devel at lists.freedesktop.org
> Subject: Re: drm/amdgpu: implement cgs gpu memory callbacks
> 
> On Mon, Aug 24, 2015 at 07:09:15AM +0000, Zhou, David(ChunMing) wrote:
> > Hi Dan,
> > Thanks for figuring out that.
> > >    274          min_offset = obj->placements[0].fpfn << PAGE_SHIFT;
> > >    275          max_offset = obj->placements[0].lpfn << PAGE_SHIFT;
> > Maybe should be:
> > 	min_offset = obj->placements[0].fpfn;
> > 	min_offset <<= PAGE_SHIFT;
> > 	max_offset = obj->placements[0].lpfn;
> > 	max_offset <<= PAGE_SHIFT;
> 
> 
> It's probably just simpler to be:
> 
> 	min_offset = (u64)obj->placements[0].fpfn << PAGE_SHIFT;
> 	max_offset = (u64)obj->placements[0].lpfn << PAGE_SHIFT;
> 
> But the larger questions aer why is min_offset a u64,
[DZ] max/min_offset is memory size.
 
>and can the shift actually
> wrap? 
[DZ] of course, adding shift wrap is better. fpfn/lpfn is page number, so <<PAGE_SHIFT is to convert to memory size.

Regards,
  David Zhou
> I'm just looking at static checker warnings, and I'm not very familiar
> with this code so I don't know the answers.
> 
> regards,
> dan carpenter



More information about the dri-devel mailing list