Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1452000 > unrolled thread

[PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its implementation

Started byWei Yongjun <weiyj.lk@gmail.com>
First post2016-07-28 18:20 +0200
Last post2016-08-02 15:50 +0200
Articles 6 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its implementation Wei Yongjun <weiyj.lk@gmail.com> - 2016-07-28 18:20 +0200
    Re: [PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its implementation Sean Paul <seanpaul@google.com> - 2016-07-29 21:40 +0200
      Re: [PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its implementation Sean Paul <seanpaul@google.com> - 2016-07-29 21:50 +0200
      RE: [PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its  implementation "Deucher, Alexander" <Alexander.Deucher@amd.com> - 2016-07-30 00:20 +0200
        Re: [PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its  implementation Nicolai Hähnle <nhaehnle@gmail.com> - 2016-08-01 15:20 +0200
          Re: [PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its  implementation Christian König <deathsimple@vodafone.de> - 2016-08-02 15:50 +0200

#1452000 — [PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its implementation

FromWei Yongjun <weiyj.lk@gmail.com>
Date2016-07-28 18:20 +0200
Subject[PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its implementation
Message-ID<rZWcq-ek-19@gated-at.bofh.it>
Use kmemdup rather than duplicating its implementation.

Generated by: scripts/coccinelle/api/memdup.cocci

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
index a46a64c..b779b5f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -296,12 +296,10 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)
 	size = amdgpu_bo_size(adev->uvd.vcpu_bo);
 	ptr = adev->uvd.cpu_addr;
 
-	adev->uvd.saved_bo = kmalloc(size, GFP_KERNEL);
+	adev->uvd.saved_bo = kmemdup(ptr, size, GFP_KERNEL);
 	if (!adev->uvd.saved_bo)
 		return -ENOMEM;
 
-	memcpy(adev->uvd.saved_bo, ptr, size);
-
 	return 0;
 }
 

[toc] | [next] | [standalone]


#1452531

FromSean Paul <seanpaul@google.com>
Date2016-07-29 21:40 +0200
Message-ID<s0lNv-xD-7@gated-at.bofh.it>
In reply to#1452000
On Thu, Jul 28, 2016 at 12:18 PM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> Use kmemdup rather than duplicating its implementation.
>
> Generated by: scripts/coccinelle/api/memdup.cocci
>
> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>


Thanks for the patch. I'll apply this to -misc once the merge window is closed.

Acked-by: Sean Paul <seanpaul@chromium.org>


> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> index a46a64c..b779b5f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> @@ -296,12 +296,10 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)
>         size = amdgpu_bo_size(adev->uvd.vcpu_bo);
>         ptr = adev->uvd.cpu_addr;
>
> -       adev->uvd.saved_bo = kmalloc(size, GFP_KERNEL);
> +       adev->uvd.saved_bo = kmemdup(ptr, size, GFP_KERNEL);
>         if (!adev->uvd.saved_bo)
>                 return -ENOMEM;
>
> -       memcpy(adev->uvd.saved_bo, ptr, size);
> -
>         return 0;
>  }
>
>
>
>

[toc] | [prev] | [next] | [standalone]


#1452534

FromSean Paul <seanpaul@google.com>
Date2016-07-29 21:50 +0200
Message-ID<s0lXc-B0-9@gated-at.bofh.it>
In reply to#1452531
On Fri, Jul 29, 2016 at 3:38 PM, Deucher, Alexander
<Alexander.Deucher@amd.com> wrote:
>> -----Original Message-----
>> From: Sean Paul [mailto:seanpaul@google.com]
>> Sent: Friday, July 29, 2016 3:35 PM
>> To: Wei Yongjun
>> Cc: Deucher, Alexander; Koenig, Christian; Dave Airlie; Jiang, Sonny; Liu, Leo;
>> Nath, Arindam; Zhou, David(ChunMing); Zhou, Jammy; Liu, Monk; dri-devel;
>> Linux Kernel Mailing List
>> Subject: Re: [PATCH -next] drm/amdgpu: use kmemdup rather than
>> duplicating its implementation
>>
>> On Thu, Jul 28, 2016 at 12:18 PM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
>> > Use kmemdup rather than duplicating its implementation.
>> >
>> > Generated by: scripts/coccinelle/api/memdup.cocci
>> >
>> > Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
>>
>>
>> Thanks for the patch. I'll apply this to -misc once the merge window is closed.
>>
>> Acked-by: Sean Paul <seanpaul@chromium.org>
>
> Unless you've already applied this to the misc tree, I'd prefer to take it via the amdgpu tree.
>

Nope, it's all yours.

Sean


> Alex
>
>>
>>
>> > ---
>> >  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 4 +---
>> >  1 file changed, 1 insertion(+), 3 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>> > index a46a64c..b779b5f 100644
>> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>> > @@ -296,12 +296,10 @@ int amdgpu_uvd_suspend(struct amdgpu_device
>> *adev)
>> >         size = amdgpu_bo_size(adev->uvd.vcpu_bo);
>> >         ptr = adev->uvd.cpu_addr;
>> >
>> > -       adev->uvd.saved_bo = kmalloc(size, GFP_KERNEL);
>> > +       adev->uvd.saved_bo = kmemdup(ptr, size, GFP_KERNEL);
>> >         if (!adev->uvd.saved_bo)
>> >                 return -ENOMEM;
>> >
>> > -       memcpy(adev->uvd.saved_bo, ptr, size);
>> > -
>> >         return 0;
>> >  }
>> >
>> >
>> >
>> >

[toc] | [prev] | [next] | [standalone]


#1452599 — RE: [PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its implementation

From"Deucher, Alexander" <Alexander.Deucher@amd.com>
Date2016-07-30 00:20 +0200
SubjectRE: [PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its implementation
Message-ID<s0lXc-B0-11@gated-at.bofh.it>
In reply to#1452531
> -----Original Message-----
> From: Sean Paul [mailto:seanpaul@google.com]
> Sent: Friday, July 29, 2016 3:35 PM
> To: Wei Yongjun
> Cc: Deucher, Alexander; Koenig, Christian; Dave Airlie; Jiang, Sonny; Liu, Leo;
> Nath, Arindam; Zhou, David(ChunMing); Zhou, Jammy; Liu, Monk; dri-devel;
> Linux Kernel Mailing List
> Subject: Re: [PATCH -next] drm/amdgpu: use kmemdup rather than
> duplicating its implementation
> 
> On Thu, Jul 28, 2016 at 12:18 PM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> > Use kmemdup rather than duplicating its implementation.
> >
> > Generated by: scripts/coccinelle/api/memdup.cocci
> >
> > Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
> 
> 
> Thanks for the patch. I'll apply this to -misc once the merge window is closed.
> 
> Acked-by: Sean Paul <seanpaul@chromium.org>

Unless you've already applied this to the misc tree, I'd prefer to take it via the amdgpu tree.

Alex

> 
> 
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> > index a46a64c..b779b5f 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> > @@ -296,12 +296,10 @@ int amdgpu_uvd_suspend(struct amdgpu_device
> *adev)
> >         size = amdgpu_bo_size(adev->uvd.vcpu_bo);
> >         ptr = adev->uvd.cpu_addr;
> >
> > -       adev->uvd.saved_bo = kmalloc(size, GFP_KERNEL);
> > +       adev->uvd.saved_bo = kmemdup(ptr, size, GFP_KERNEL);
> >         if (!adev->uvd.saved_bo)
> >                 return -ENOMEM;
> >
> > -       memcpy(adev->uvd.saved_bo, ptr, size);
> > -
> >         return 0;
> >  }
> >
> >
> >
> >

[toc] | [prev] | [next] | [standalone]


#1453200 — Re: [PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its implementation

FromNicolai Hähnle <nhaehnle@gmail.com>
Date2016-08-01 15:20 +0200
SubjectRe: [PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its implementation
Message-ID<s1lip-6Ns-11@gated-at.bofh.it>
In reply to#1452599
On 29.07.2016 20:38, Deucher, Alexander wrote:
>> -----Original Message-----
>> From: Sean Paul [mailto:seanpaul@google.com]
>> Sent: Friday, July 29, 2016 3:35 PM
>> To: Wei Yongjun
>> Cc: Deucher, Alexander; Koenig, Christian; Dave Airlie; Jiang, Sonny; Liu, Leo;
>> Nath, Arindam; Zhou, David(ChunMing); Zhou, Jammy; Liu, Monk; dri-devel;
>> Linux Kernel Mailing List
>> Subject: Re: [PATCH -next] drm/amdgpu: use kmemdup rather than
>> duplicating its implementation
>>
>> On Thu, Jul 28, 2016 at 12:18 PM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
>>> Use kmemdup rather than duplicating its implementation.
>>>
>>> Generated by: scripts/coccinelle/api/memdup.cocci
>>>
>>> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
>>
>>
>> Thanks for the patch. I'll apply this to -misc once the merge window is closed.
>>
>> Acked-by: Sean Paul <seanpaul@chromium.org>
>
> Unless you've already applied this to the misc tree, I'd prefer to take it via the amdgpu tree.

I recall Christian NAKing an almost identical patch some time ago. 
Something about needing memcpy_fromio()?

Yup, it's here: https://lkml.org/lkml/2016/5/19/235

Cheers,
Nicolai

>
> Alex
>
>>
>>
>>> ---
>>>  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 4 +---
>>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>>> index a46a64c..b779b5f 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>>> @@ -296,12 +296,10 @@ int amdgpu_uvd_suspend(struct amdgpu_device
>> *adev)
>>>         size = amdgpu_bo_size(adev->uvd.vcpu_bo);
>>>         ptr = adev->uvd.cpu_addr;
>>>
>>> -       adev->uvd.saved_bo = kmalloc(size, GFP_KERNEL);
>>> +       adev->uvd.saved_bo = kmemdup(ptr, size, GFP_KERNEL);
>>>         if (!adev->uvd.saved_bo)
>>>                 return -ENOMEM;
>>>
>>> -       memcpy(adev->uvd.saved_bo, ptr, size);
>>> -
>>>         return 0;
>>>  }
>>>
>>>
>>>
>>>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>

[toc] | [prev] | [next] | [standalone]


#1454412 — Re: [PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its implementation

FromChristian König <deathsimple@vodafone.de>
Date2016-08-02 15:50 +0200
SubjectRe: [PATCH -next] drm/amdgpu: use kmemdup rather than duplicating its implementation
Message-ID<s1IeZ-589-5@gated-at.bofh.it>
In reply to#1453200
Am 01.08.2016 um 14:16 schrieb Nicolai Hähnle:
> On 29.07.2016 20:38, Deucher, Alexander wrote:
>>> -----Original Message-----
>>> From: Sean Paul [mailto:seanpaul@google.com]
>>> Sent: Friday, July 29, 2016 3:35 PM
>>> To: Wei Yongjun
>>> Cc: Deucher, Alexander; Koenig, Christian; Dave Airlie; Jiang, 
>>> Sonny; Liu, Leo;
>>> Nath, Arindam; Zhou, David(ChunMing); Zhou, Jammy; Liu, Monk; 
>>> dri-devel;
>>> Linux Kernel Mailing List
>>> Subject: Re: [PATCH -next] drm/amdgpu: use kmemdup rather than
>>> duplicating its implementation
>>>
>>> On Thu, Jul 28, 2016 at 12:18 PM, Wei Yongjun <weiyj.lk@gmail.com> 
>>> wrote:
>>>> Use kmemdup rather than duplicating its implementation.
>>>>
>>>> Generated by: scripts/coccinelle/api/memdup.cocci
>>>>
>>>> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
>>>
>>>
>>> Thanks for the patch. I'll apply this to -misc once the merge window 
>>> is closed.
>>>
>>> Acked-by: Sean Paul <seanpaul@chromium.org>
>>
>> Unless you've already applied this to the misc tree, I'd prefer to 
>> take it via the amdgpu tree.
>
> I recall Christian NAKing an almost identical patch some time ago. 
> Something about needing memcpy_fromio()?
>
> Yup, it's here: https://lkml.org/lkml/2016/5/19/235

Yes, exactly. We need memcpy_fromio() and memcpy_toio() in the 
suspend/resume functions instead of memcpy.

I just didn't had time to test that yet (and that was unfortunately a 
few month ago already).

So please drop this patch,
Christian.

>
> Cheers,
> Nicolai
>
>>
>> Alex
>>
>>>
>>>
>>>> ---
>>>>  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 4 +---
>>>>  1 file changed, 1 insertion(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>>>> index a46a64c..b779b5f 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>>>> @@ -296,12 +296,10 @@ int amdgpu_uvd_suspend(struct amdgpu_device
>>> *adev)
>>>>         size = amdgpu_bo_size(adev->uvd.vcpu_bo);
>>>>         ptr = adev->uvd.cpu_addr;
>>>>
>>>> -       adev->uvd.saved_bo = kmalloc(size, GFP_KERNEL);
>>>> +       adev->uvd.saved_bo = kmemdup(ptr, size, GFP_KERNEL);
>>>>         if (!adev->uvd.saved_bo)
>>>>                 return -ENOMEM;
>>>>
>>>> -       memcpy(adev->uvd.saved_bo, ptr, size);
>>>> -
>>>>         return 0;
>>>>  }
>>>>
>>>>
>>>>
>>>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web