[igt-dev] [PATCH i-g-t] i915/api_intel_bb: Correct size for munmap
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Wed Feb 2 06:21:02 UTC 2022
On Tue, Feb 01, 2022 at 01:53:14PM -0800, Dixit, Ashutosh wrote:
> On Mon, 31 Jan 2022 08:48:04 -0800, Zbigniew Kempczyński wrote:
> >
> > If we don't release the entirety of the mmap we create, it still holds a
> > reference to the fd/object.
> >
> > Signed-off-by: Chris Wilson <chris.p.wilson at intel.com>
> > Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> > ---
> > tests/i915/api_intel_bb.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tests/i915/api_intel_bb.c b/tests/i915/api_intel_bb.c
> > index 5c996f644..130fb9014 100644
> > --- a/tests/i915/api_intel_bb.c
> > +++ b/tests/i915/api_intel_bb.c
> > @@ -1169,7 +1169,7 @@ static void delta_check(struct buf_ops *bops)
> > ptr = gem_mmap__device_coherent(i915, buf->handle, 0,
> > intel_buf_size(buf), PROT_READ);
> > val = ptr[0x2000 / sizeof(uint32_t)];
> > - gem_munmap(ptr, ibb->size);
> > + gem_munmap(ptr, intel_buf_bo_size(buf));
>
> For making it easier, maybe we should also change to intel_buf_bo_size() in
> the mmap (similar to the munmap). Or have intel_buf_size() in the munmap
> too? Basically the same in both map and unmap. With that, this is:
Yes, you're right. I missed that in above mapping. intel_buf_size() is not
always intel_buf_bo_size() as first one contains requested buffer size.
It may differ than buffer size created by the kernel.
For above case intel_buf_size() should be put as an argument.
Thanks for spotting that. I'm going to change and resend.
--
Zbigniew
>
> Reviewed-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
More information about the igt-dev
mailing list