2020-11-27 08:48:58

by Tian Tao

[permalink] [raw]
Subject: [PATCH] drm/vboxvideo: Used the vram helper

if the driver uses drmm_vram_helper_init, there is no need to
call drm_vram_helper_release_mm when the drm module get unloaded,
as this will done automagically.

Signed-off-by: Tian Tao <[email protected]>
---
drivers/gpu/drm/vboxvideo/vbox_ttm.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/vboxvideo/vbox_ttm.c b/drivers/gpu/drm/vboxvideo/vbox_ttm.c
index f5a0667..e1909a8 100644
--- a/drivers/gpu/drm/vboxvideo/vbox_ttm.c
+++ b/drivers/gpu/drm/vboxvideo/vbox_ttm.c
@@ -16,8 +16,8 @@ int vbox_mm_init(struct vbox_private *vbox)
int ret;
struct drm_device *dev = &vbox->ddev;

- vmm = drm_vram_helper_alloc_mm(dev, pci_resource_start(dev->pdev, 0),
- vbox->available_vram_size);
+ vmm = drmm_vram_helper_init(dev, pci_resource_start(dev->pdev, 0),
+ vbox->available_vram_size);
if (IS_ERR(vmm)) {
ret = PTR_ERR(vmm);
DRM_ERROR("Error initializing VRAM MM; %d\n", ret);
@@ -32,5 +32,4 @@ int vbox_mm_init(struct vbox_private *vbox)
void vbox_mm_fini(struct vbox_private *vbox)
{
arch_phys_wc_del(vbox->fb_mtrr);
- drm_vram_helper_release_mm(&vbox->ddev);
}
--
2.7.4


2020-11-27 18:35:22

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH] drm/vboxvideo: Used the vram helper

On Fri, Nov 27, 2020 at 11:14:42AM +0800, Tian Tao wrote:
> if the driver uses drmm_vram_helper_init, there is no need to
> call drm_vram_helper_release_mm when the drm module get unloaded,
> as this will done automagically.
>
> Signed-off-by: Tian Tao <[email protected]>
> ---
> drivers/gpu/drm/vboxvideo/vbox_ttm.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/vboxvideo/vbox_ttm.c b/drivers/gpu/drm/vboxvideo/vbox_ttm.c
> index f5a0667..e1909a8 100644
> --- a/drivers/gpu/drm/vboxvideo/vbox_ttm.c
> +++ b/drivers/gpu/drm/vboxvideo/vbox_ttm.c
> @@ -16,8 +16,8 @@ int vbox_mm_init(struct vbox_private *vbox)
> int ret;
> struct drm_device *dev = &vbox->ddev;
>
> - vmm = drm_vram_helper_alloc_mm(dev, pci_resource_start(dev->pdev, 0),
> - vbox->available_vram_size);
> + vmm = drmm_vram_helper_init(dev, pci_resource_start(dev->pdev, 0),
> + vbox->available_vram_size);

Pretty sure this doesn't compile without warnings, since the return value
changes. With that fixed lgtm.

Btw if you're bored, a devm_ version of arch_phys_wc_add is very much on
the wishlist, and would allow us to complete remove vbox_mm_fini.

Cheers, Daniel

> if (IS_ERR(vmm)) {
> ret = PTR_ERR(vmm);
> DRM_ERROR("Error initializing VRAM MM; %d\n", ret);
> @@ -32,5 +32,4 @@ int vbox_mm_init(struct vbox_private *vbox)
> void vbox_mm_fini(struct vbox_private *vbox)
> {
> arch_phys_wc_del(vbox->fb_mtrr);
> - drm_vram_helper_release_mm(&vbox->ddev);
> }
> --
> 2.7.4
>

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

2020-12-02 17:14:24

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] drm/vboxvideo: Used the vram helper

Hi Tian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.10-rc6 next-20201201]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Tian-Tao/drm-vboxvideo-Used-the-vram-helper/20201127-112000
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 85a2c56cb4454c73f56d3099d96942e7919b292f
config: x86_64-randconfig-a016-20201202 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 2671fccf0381769276ca8246ec0499adcb9b0355)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/f3abc53a9794f39d04b604a243d28be17a88571f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tian-Tao/drm-vboxvideo-Used-the-vram-helper/20201127-112000
git checkout f3abc53a9794f39d04b604a243d28be17a88571f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/vboxvideo/vbox_ttm.c:19:6: warning: incompatible integer to pointer conversion assigning to 'struct drm_vram_mm *' from 'int' [-Wint-conversion]
vmm = drmm_vram_helper_init(dev, pci_resource_start(dev->pdev, 0),
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

vim +19 drivers/gpu/drm/vboxvideo/vbox_ttm.c

12
13 int vbox_mm_init(struct vbox_private *vbox)
14 {
15 struct drm_vram_mm *vmm;
16 int ret;
17 struct drm_device *dev = &vbox->ddev;
18
> 19 vmm = drmm_vram_helper_init(dev, pci_resource_start(dev->pdev, 0),
20 vbox->available_vram_size);
21 if (IS_ERR(vmm)) {
22 ret = PTR_ERR(vmm);
23 DRM_ERROR("Error initializing VRAM MM; %d\n", ret);
24 return ret;
25 }
26
27 vbox->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0),
28 pci_resource_len(dev->pdev, 0));
29 return 0;
30 }
31

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (2.74 kB)
.config.gz (45.53 kB)
Download all attachments

2020-12-07 21:34:03

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] drm/vboxvideo: Used the vram helper

Hi Tian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.10-rc7 next-20201207]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Tian-Tao/drm-vboxvideo-Used-the-vram-helper/20201127-112000
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 85a2c56cb4454c73f56d3099d96942e7919b292f
config: i386-randconfig-r031-20201207 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/f3abc53a9794f39d04b604a243d28be17a88571f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Tian-Tao/drm-vboxvideo-Used-the-vram-helper/20201127-112000
git checkout f3abc53a9794f39d04b604a243d28be17a88571f
# save the attached .config to linux build tree
make W=1 ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

drivers/gpu/drm/vboxvideo/vbox_ttm.c: In function 'vbox_mm_init':
>> drivers/gpu/drm/vboxvideo/vbox_ttm.c:19:6: warning: assignment to 'struct drm_vram_mm *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
19 | vmm = drmm_vram_helper_init(dev, pci_resource_start(dev->pdev, 0),
| ^

vim +19 drivers/gpu/drm/vboxvideo/vbox_ttm.c

12
13 int vbox_mm_init(struct vbox_private *vbox)
14 {
15 struct drm_vram_mm *vmm;
16 int ret;
17 struct drm_device *dev = &vbox->ddev;
18
> 19 vmm = drmm_vram_helper_init(dev, pci_resource_start(dev->pdev, 0),
20 vbox->available_vram_size);
21 if (IS_ERR(vmm)) {
22 ret = PTR_ERR(vmm);
23 DRM_ERROR("Error initializing VRAM MM; %d\n", ret);
24 return ret;
25 }
26
27 vbox->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0),
28 pci_resource_len(dev->pdev, 0));
29 return 0;
30 }
31

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (2.35 kB)
.config.gz (36.42 kB)
Download all attachments