True indeed. Something like 256 + 32 * num_ibs (or even 16 * num_ibs??? Need to double check) should do as well. Christian. Am 25.08.2016 um 10:28 schrieb Liu, Monk: > But even user space will submit 10 ibs this submission, the calculate of 256*ibs is totally overflow, remember that ring buffer is only 4kb size > > -----Original Message----- > From: Christian König [mailto:deathsimple at vodafone.de] > Sent: Thursday, August 25, 2016 4:12 PM > To: Liu, Monk <Monk.Liu at amd.com>; amd-gfx at lists.freedesktop.org > Subject: Re: [PATCH 2/2] drm/amdgpu:256dw is enough for one ib_schedule > > Well userspace is allowed to send any number of IBs down to this if I remember correctly. > > So we clearly need something depending on the number of IBs or reject submissions with to many IBs earlier in the CS. > > Otherwise we clearly open up a possible problem where userspace can trigger a ring overrun. > > Regards, > Christian. > > Am 25.08.2016 um 07:58 schrieb Monk Liu: >> Change-Id: I1ee3258276868a753e536ae2d9ae1b12e7eaf791 >> Signed-off-by: Monk Liu <Monk.Liu at amd.com> >> --- >> drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c >> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c >> index 4e5b2f3..b82904c 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c >> @@ -151,7 +151,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, >> return -EINVAL; >> } >> >> - r = amdgpu_ring_alloc(ring, 256 * num_ibs); >> + r = amdgpu_ring_alloc(ring, 256); >> if (r) { >> dev_err(adev->dev, "scheduling IB failed (%d).\n", r); >> return r; >