[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200521130637.celg23pnqivdmaei@outlook.office365.com>
Date: Thu, 21 May 2020 09:06:37 -0400
From: Aurabindo Pillai <aurabindo.pillai@....com>
To: Felix Kuehling <felix.kuehling@....com>
Cc: alexander.deucher@....com, christian.koenig@....com,
airlied@...ux.ie, daniel@...ll.ch, amd-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
Amber Lin <Amber.Lin@....com>
Subject: Re: [PATCH] drm/amd/amdkfd: Fix large framesize for kfd_smi_ev_read()
On 05/20, Felix Kuehling wrote:
> Am 2020-05-20 um 9:53 a.m. schrieb Aurabindo Pillai:
> > The buffer allocated is of 1024 bytes. Allocate this from
> > heap instead of stack.
> >
> > Also remove check for stack size since we're allocating from heap
> >
> > Signed-off-by: Aurabindo Pillai <aurabindo.pillai@....com>
> > Tested-by: Amber Lin <Amber.Lin@....com>
>
> See one comment inline. With that fixed, the patch is
>
> Reviewed-by: Felix Kuehling <Felix.Kuehling@....com>
>
>
> > ---
> > drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c | 26 +++++++++++++++------
> > 1 file changed, 19 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
> > index f5fd18eacf0d..5aebe169f8c6 100644
> > --- a/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
> > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_smi_events.c
> > @@ -77,9 +77,11 @@ static ssize_t kfd_smi_ev_read(struct file *filep, char __user *user,
> > int ret;
> > size_t to_copy;
> > struct kfd_smi_client *client = filep->private_data;
> > - unsigned char buf[MAX_KFIFO_SIZE];
> > + unsigned char *buf;
> >
> > - BUILD_BUG_ON(MAX_KFIFO_SIZE > 1024);
> > + buf = kzalloc(MAX_KFIFO_SIZE * sizeof(*buf), GFP_KERNEL);
>
> kzalloc is not necessary here, you could use kmalloc. The part of that
> allocation that matters will be overwritten by kfifo_out.
>
> Regards,
> Felix
>
>
Thank you Felix, Alex for the review. I shall make that change and submit it.
Thanks & Regards,
Aurabindo
Download attachment "signature.asc" of type "application/pgp-signature" (660 bytes)
Powered by blists - more mailing lists