* Re: [Intel-gfx] [PATCH] drm/i915: Check input parameter for NULL
[not found] <1645455221-38580-1-git-send-email-lyz_cs@pku.edu.cn>
@ 2022-02-21 23:41 ` kernel test robot
2022-02-22 0:12 ` kernel test robot
2022-02-22 1:23 ` kernel test robot
2 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2022-02-21 23:41 UTC (permalink / raw)
To: Yongzhi Liu, jani.nikula, joonas.lahtinen, rodrigo.vivi,
tvrtko.ursulin, airlied, daniel, thomas.hellstrom,
maarten.lankhorst, matthew.auld, matthew.d.roper, tzimmermann,
michal.winiarski
Cc: intel-gfx, llvm, kbuild-all, linux-kernel, dri-devel
Hi Yongzhi,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v5.17-rc5 next-20220217]
[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/Yongzhi-Liu/drm-i915-Check-input-parameter-for-NULL/20220221-225508
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-a014-20220221 (https://download.01.org/0day-ci/archive/20220222/202202220722.25BhJJ6r-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
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
# https://github.com/0day-ci/linux/commit/c54be425a38b3f4cb82c5badecf6b343f9e24a90
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yongzhi-Liu/drm-i915-Check-input-parameter-for-NULL/20220221-225508
git checkout c54be425a38b3f4cb82c5badecf6b343f9e24a90
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/gpu/drm/i915/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/i915/gem/i915_gem_phys.c:100:13: warning: mixing declarations and code is a C99 extension [-Wdeclaration-after-statement]
dma_addr_t dma = sg_dma_address(pages->sgl);
^
1 warning generated.
vim +100 drivers/gpu/drm/i915/gem/i915_gem_phys.c
f033428db28bdf Chris Wilson 2019-05-28 93
a61170975718d5 Maarten Lankhorst 2021-03-23 94 void
f033428db28bdf Chris Wilson 2019-05-28 95 i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj,
f033428db28bdf Chris Wilson 2019-05-28 96 struct sg_table *pages)
f033428db28bdf Chris Wilson 2019-05-28 97 {
c54be425a38b3f Yongzhi Liu 2022-02-21 98 if (!pages)
c54be425a38b3f Yongzhi Liu 2022-02-21 99 return;
c6790dc22312f5 Chris Wilson 2020-02-02 @100 dma_addr_t dma = sg_dma_address(pages->sgl);
c6790dc22312f5 Chris Wilson 2020-02-02 101 void *vaddr = sg_page(pages->sgl);
c6790dc22312f5 Chris Wilson 2020-02-02 102
f033428db28bdf Chris Wilson 2019-05-28 103 __i915_gem_object_release_shmem(obj, pages, false);
f033428db28bdf Chris Wilson 2019-05-28 104
f033428db28bdf Chris Wilson 2019-05-28 105 if (obj->mm.dirty) {
f033428db28bdf Chris Wilson 2019-05-28 106 struct address_space *mapping = obj->base.filp->f_mapping;
c6790dc22312f5 Chris Wilson 2020-02-02 107 void *src = vaddr;
f033428db28bdf Chris Wilson 2019-05-28 108 int i;
f033428db28bdf Chris Wilson 2019-05-28 109
f033428db28bdf Chris Wilson 2019-05-28 110 for (i = 0; i < obj->base.size / PAGE_SIZE; i++) {
f033428db28bdf Chris Wilson 2019-05-28 111 struct page *page;
f033428db28bdf Chris Wilson 2019-05-28 112 char *dst;
f033428db28bdf Chris Wilson 2019-05-28 113
f033428db28bdf Chris Wilson 2019-05-28 114 page = shmem_read_mapping_page(mapping, i);
f033428db28bdf Chris Wilson 2019-05-28 115 if (IS_ERR(page))
f033428db28bdf Chris Wilson 2019-05-28 116 continue;
f033428db28bdf Chris Wilson 2019-05-28 117
f033428db28bdf Chris Wilson 2019-05-28 118 dst = kmap_atomic(page);
c6790dc22312f5 Chris Wilson 2020-02-02 119 drm_clflush_virt_range(src, PAGE_SIZE);
c6790dc22312f5 Chris Wilson 2020-02-02 120 memcpy(dst, src, PAGE_SIZE);
f033428db28bdf Chris Wilson 2019-05-28 121 kunmap_atomic(dst);
f033428db28bdf Chris Wilson 2019-05-28 122
f033428db28bdf Chris Wilson 2019-05-28 123 set_page_dirty(page);
f033428db28bdf Chris Wilson 2019-05-28 124 if (obj->mm.madv == I915_MADV_WILLNEED)
f033428db28bdf Chris Wilson 2019-05-28 125 mark_page_accessed(page);
f033428db28bdf Chris Wilson 2019-05-28 126 put_page(page);
c6790dc22312f5 Chris Wilson 2020-02-02 127
c6790dc22312f5 Chris Wilson 2020-02-02 128 src += PAGE_SIZE;
f033428db28bdf Chris Wilson 2019-05-28 129 }
f033428db28bdf Chris Wilson 2019-05-28 130 obj->mm.dirty = false;
f033428db28bdf Chris Wilson 2019-05-28 131 }
f033428db28bdf Chris Wilson 2019-05-28 132
f033428db28bdf Chris Wilson 2019-05-28 133 sg_free_table(pages);
f033428db28bdf Chris Wilson 2019-05-28 134 kfree(pages);
f033428db28bdf Chris Wilson 2019-05-28 135
8ff5446a7ca47c Thomas Zimmermann 2021-01-28 136 dma_free_coherent(obj->base.dev->dev,
c6790dc22312f5 Chris Wilson 2020-02-02 137 roundup_pow_of_two(obj->base.size),
c6790dc22312f5 Chris Wilson 2020-02-02 138 vaddr, dma);
f033428db28bdf Chris Wilson 2019-05-28 139 }
f033428db28bdf Chris Wilson 2019-05-28 140
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915: Check input parameter for NULL
[not found] <1645455221-38580-1-git-send-email-lyz_cs@pku.edu.cn>
2022-02-21 23:41 ` [Intel-gfx] [PATCH] " kernel test robot
@ 2022-02-22 0:12 ` kernel test robot
2022-02-22 1:23 ` kernel test robot
2 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2022-02-22 0:12 UTC (permalink / raw)
To: Yongzhi Liu, jani.nikula, joonas.lahtinen, rodrigo.vivi,
tvrtko.ursulin, airlied, daniel, thomas.hellstrom,
maarten.lankhorst, matthew.auld, matthew.d.roper, tzimmermann,
michal.winiarski
Cc: intel-gfx, kbuild-all, linux-kernel, dri-devel
Hi Yongzhi,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v5.17-rc5 next-20220217]
[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/Yongzhi-Liu/drm-i915-Check-input-parameter-for-NULL/20220221-225508
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-a001-20220221 (https://download.01.org/0day-ci/archive/20220222/202202220847.76w2eWNU-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/c54be425a38b3f4cb82c5badecf6b343f9e24a90
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yongzhi-Liu/drm-i915-Check-input-parameter-for-NULL/20220221-225508
git checkout c54be425a38b3f4cb82c5badecf6b343f9e24a90
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/drm/i915/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/gpu/drm/i915/gem/i915_gem_phys.c: In function 'i915_gem_object_put_pages_phys':
>> drivers/gpu/drm/i915/gem/i915_gem_phys.c:100:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
100 | dma_addr_t dma = sg_dma_address(pages->sgl);
| ^~~~~~~~~~
vim +100 drivers/gpu/drm/i915/gem/i915_gem_phys.c
f033428db28bdf Chris Wilson 2019-05-28 93
a61170975718d5 Maarten Lankhorst 2021-03-23 94 void
f033428db28bdf Chris Wilson 2019-05-28 95 i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj,
f033428db28bdf Chris Wilson 2019-05-28 96 struct sg_table *pages)
f033428db28bdf Chris Wilson 2019-05-28 97 {
c54be425a38b3f Yongzhi Liu 2022-02-21 98 if (!pages)
c54be425a38b3f Yongzhi Liu 2022-02-21 99 return;
c6790dc22312f5 Chris Wilson 2020-02-02 @100 dma_addr_t dma = sg_dma_address(pages->sgl);
c6790dc22312f5 Chris Wilson 2020-02-02 101 void *vaddr = sg_page(pages->sgl);
c6790dc22312f5 Chris Wilson 2020-02-02 102
f033428db28bdf Chris Wilson 2019-05-28 103 __i915_gem_object_release_shmem(obj, pages, false);
f033428db28bdf Chris Wilson 2019-05-28 104
f033428db28bdf Chris Wilson 2019-05-28 105 if (obj->mm.dirty) {
f033428db28bdf Chris Wilson 2019-05-28 106 struct address_space *mapping = obj->base.filp->f_mapping;
c6790dc22312f5 Chris Wilson 2020-02-02 107 void *src = vaddr;
f033428db28bdf Chris Wilson 2019-05-28 108 int i;
f033428db28bdf Chris Wilson 2019-05-28 109
f033428db28bdf Chris Wilson 2019-05-28 110 for (i = 0; i < obj->base.size / PAGE_SIZE; i++) {
f033428db28bdf Chris Wilson 2019-05-28 111 struct page *page;
f033428db28bdf Chris Wilson 2019-05-28 112 char *dst;
f033428db28bdf Chris Wilson 2019-05-28 113
f033428db28bdf Chris Wilson 2019-05-28 114 page = shmem_read_mapping_page(mapping, i);
f033428db28bdf Chris Wilson 2019-05-28 115 if (IS_ERR(page))
f033428db28bdf Chris Wilson 2019-05-28 116 continue;
f033428db28bdf Chris Wilson 2019-05-28 117
f033428db28bdf Chris Wilson 2019-05-28 118 dst = kmap_atomic(page);
c6790dc22312f5 Chris Wilson 2020-02-02 119 drm_clflush_virt_range(src, PAGE_SIZE);
c6790dc22312f5 Chris Wilson 2020-02-02 120 memcpy(dst, src, PAGE_SIZE);
f033428db28bdf Chris Wilson 2019-05-28 121 kunmap_atomic(dst);
f033428db28bdf Chris Wilson 2019-05-28 122
f033428db28bdf Chris Wilson 2019-05-28 123 set_page_dirty(page);
f033428db28bdf Chris Wilson 2019-05-28 124 if (obj->mm.madv == I915_MADV_WILLNEED)
f033428db28bdf Chris Wilson 2019-05-28 125 mark_page_accessed(page);
f033428db28bdf Chris Wilson 2019-05-28 126 put_page(page);
c6790dc22312f5 Chris Wilson 2020-02-02 127
c6790dc22312f5 Chris Wilson 2020-02-02 128 src += PAGE_SIZE;
f033428db28bdf Chris Wilson 2019-05-28 129 }
f033428db28bdf Chris Wilson 2019-05-28 130 obj->mm.dirty = false;
f033428db28bdf Chris Wilson 2019-05-28 131 }
f033428db28bdf Chris Wilson 2019-05-28 132
f033428db28bdf Chris Wilson 2019-05-28 133 sg_free_table(pages);
f033428db28bdf Chris Wilson 2019-05-28 134 kfree(pages);
f033428db28bdf Chris Wilson 2019-05-28 135
8ff5446a7ca47c Thomas Zimmermann 2021-01-28 136 dma_free_coherent(obj->base.dev->dev,
c6790dc22312f5 Chris Wilson 2020-02-02 137 roundup_pow_of_two(obj->base.size),
c6790dc22312f5 Chris Wilson 2020-02-02 138 vaddr, dma);
f033428db28bdf Chris Wilson 2019-05-28 139 }
f033428db28bdf Chris Wilson 2019-05-28 140
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915: Check input parameter for NULL
[not found] <1645455221-38580-1-git-send-email-lyz_cs@pku.edu.cn>
2022-02-21 23:41 ` [Intel-gfx] [PATCH] " kernel test robot
2022-02-22 0:12 ` kernel test robot
@ 2022-02-22 1:23 ` kernel test robot
2 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2022-02-22 1:23 UTC (permalink / raw)
To: Yongzhi Liu, jani.nikula, joonas.lahtinen, rodrigo.vivi,
tvrtko.ursulin, airlied, daniel, thomas.hellstrom,
maarten.lankhorst, matthew.auld, matthew.d.roper, tzimmermann,
michal.winiarski
Cc: intel-gfx, kbuild-all, linux-kernel, dri-devel
Hi Yongzhi,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v5.17-rc5 next-20220217]
[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/Yongzhi-Liu/drm-i915-Check-input-parameter-for-NULL/20220221-225508
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-a004-20220221 (https://download.01.org/0day-ci/archive/20220222/202202220935.3r4emO4y-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/c54be425a38b3f4cb82c5badecf6b343f9e24a90
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yongzhi-Liu/drm-i915-Check-input-parameter-for-NULL/20220221-225508
git checkout c54be425a38b3f4cb82c5badecf6b343f9e24a90
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/gpu/drm/i915/gem/i915_gem_phys.c: In function 'i915_gem_object_put_pages_phys':
>> drivers/gpu/drm/i915/gem/i915_gem_phys.c:100:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
100 | dma_addr_t dma = sg_dma_address(pages->sgl);
| ^~~~~~~~~~
cc1: all warnings being treated as errors
vim +100 drivers/gpu/drm/i915/gem/i915_gem_phys.c
f033428db28bdf Chris Wilson 2019-05-28 93
a61170975718d5 Maarten Lankhorst 2021-03-23 94 void
f033428db28bdf Chris Wilson 2019-05-28 95 i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj,
f033428db28bdf Chris Wilson 2019-05-28 96 struct sg_table *pages)
f033428db28bdf Chris Wilson 2019-05-28 97 {
c54be425a38b3f Yongzhi Liu 2022-02-21 98 if (!pages)
c54be425a38b3f Yongzhi Liu 2022-02-21 99 return;
c6790dc22312f5 Chris Wilson 2020-02-02 @100 dma_addr_t dma = sg_dma_address(pages->sgl);
c6790dc22312f5 Chris Wilson 2020-02-02 101 void *vaddr = sg_page(pages->sgl);
c6790dc22312f5 Chris Wilson 2020-02-02 102
f033428db28bdf Chris Wilson 2019-05-28 103 __i915_gem_object_release_shmem(obj, pages, false);
f033428db28bdf Chris Wilson 2019-05-28 104
f033428db28bdf Chris Wilson 2019-05-28 105 if (obj->mm.dirty) {
f033428db28bdf Chris Wilson 2019-05-28 106 struct address_space *mapping = obj->base.filp->f_mapping;
c6790dc22312f5 Chris Wilson 2020-02-02 107 void *src = vaddr;
f033428db28bdf Chris Wilson 2019-05-28 108 int i;
f033428db28bdf Chris Wilson 2019-05-28 109
f033428db28bdf Chris Wilson 2019-05-28 110 for (i = 0; i < obj->base.size / PAGE_SIZE; i++) {
f033428db28bdf Chris Wilson 2019-05-28 111 struct page *page;
f033428db28bdf Chris Wilson 2019-05-28 112 char *dst;
f033428db28bdf Chris Wilson 2019-05-28 113
f033428db28bdf Chris Wilson 2019-05-28 114 page = shmem_read_mapping_page(mapping, i);
f033428db28bdf Chris Wilson 2019-05-28 115 if (IS_ERR(page))
f033428db28bdf Chris Wilson 2019-05-28 116 continue;
f033428db28bdf Chris Wilson 2019-05-28 117
f033428db28bdf Chris Wilson 2019-05-28 118 dst = kmap_atomic(page);
c6790dc22312f5 Chris Wilson 2020-02-02 119 drm_clflush_virt_range(src, PAGE_SIZE);
c6790dc22312f5 Chris Wilson 2020-02-02 120 memcpy(dst, src, PAGE_SIZE);
f033428db28bdf Chris Wilson 2019-05-28 121 kunmap_atomic(dst);
f033428db28bdf Chris Wilson 2019-05-28 122
f033428db28bdf Chris Wilson 2019-05-28 123 set_page_dirty(page);
f033428db28bdf Chris Wilson 2019-05-28 124 if (obj->mm.madv == I915_MADV_WILLNEED)
f033428db28bdf Chris Wilson 2019-05-28 125 mark_page_accessed(page);
f033428db28bdf Chris Wilson 2019-05-28 126 put_page(page);
c6790dc22312f5 Chris Wilson 2020-02-02 127
c6790dc22312f5 Chris Wilson 2020-02-02 128 src += PAGE_SIZE;
f033428db28bdf Chris Wilson 2019-05-28 129 }
f033428db28bdf Chris Wilson 2019-05-28 130 obj->mm.dirty = false;
f033428db28bdf Chris Wilson 2019-05-28 131 }
f033428db28bdf Chris Wilson 2019-05-28 132
f033428db28bdf Chris Wilson 2019-05-28 133 sg_free_table(pages);
f033428db28bdf Chris Wilson 2019-05-28 134 kfree(pages);
f033428db28bdf Chris Wilson 2019-05-28 135
8ff5446a7ca47c Thomas Zimmermann 2021-01-28 136 dma_free_coherent(obj->base.dev->dev,
c6790dc22312f5 Chris Wilson 2020-02-02 137 roundup_pow_of_two(obj->base.size),
c6790dc22312f5 Chris Wilson 2020-02-02 138 vaddr, dma);
f033428db28bdf Chris Wilson 2019-05-28 139 }
f033428db28bdf Chris Wilson 2019-05-28 140
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Intel-gfx] [PATCH] drm/i915: Check input parameter for NULL
@ 2022-02-22 14:46 Yongzhi Liu
2022-02-22 16:28 ` Tvrtko Ursulin
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Yongzhi Liu @ 2022-02-22 14:46 UTC (permalink / raw)
To: jani.nikula, joonas.lahtinen, rodrigo.vivi, tvrtko.ursulin,
airlied, daniel, thomas.hellstrom, maarten.lankhorst,
matthew.auld, matthew.d.roper, lyz_cs, tzimmermann,
michal.winiarski
Cc: intel-gfx, linux-kernel, dri-devel
[why]
i915_gem_object_put_pages_phys() frees pages and standard
pattern is to allow caller to not care if it's
NULL or not. This will reduce burden on
the callers to perform this check.
[how]
Fix it by adding Null check.
Signed-off-by: Yongzhi Liu <lyz_cs@pku.edu.cn>
---
drivers/gpu/drm/i915/gem/i915_gem_phys.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_phys.c b/drivers/gpu/drm/i915/gem/i915_gem_phys.c
index ca6faff..09c3dcb 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_phys.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_phys.c
@@ -95,8 +95,13 @@ void
i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj,
struct sg_table *pages)
{
- dma_addr_t dma = sg_dma_address(pages->sgl);
- void *vaddr = sg_page(pages->sgl);
+ dma_addr_t dma;
+ void *vaddr;
+
+ if (!pages)
+ return;
+ dma = sg_dma_address(pages->sgl);
+ vaddr = sg_page(pages->sgl);
__i915_gem_object_release_shmem(obj, pages, false);
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915: Check input parameter for NULL
2022-02-22 14:46 [Intel-gfx] [PATCH] drm/i915: Check input parameter for NULL Yongzhi Liu
@ 2022-02-22 16:28 ` Tvrtko Ursulin
2022-02-24 11:00 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for " Patchwork
2022-02-24 11:32 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2 siblings, 0 replies; 7+ messages in thread
From: Tvrtko Ursulin @ 2022-02-22 16:28 UTC (permalink / raw)
To: Yongzhi Liu, jani.nikula, joonas.lahtinen, rodrigo.vivi, airlied,
daniel, thomas.hellstrom, maarten.lankhorst, matthew.auld,
matthew.d.roper, tzimmermann, michal.winiarski
Cc: intel-gfx, linux-kernel, dri-devel
Hi,
On 22/02/2022 14:46, Yongzhi Liu wrote:
> [why]
> i915_gem_object_put_pages_phys() frees pages and standard
> pattern is to allow caller to not care if it's
> NULL or not. This will reduce burden on
> the callers to perform this check.
I don't think we want this in general, and definitely not just for phys
objects and leaving others not handle NULL.
See comment at the call site for these vfuncs:
/*
* XXX Temporary hijinx to avoid updating all backends to handle
* NULL pages. In the future, when we have more asynchronous
* get_pages backends we should be better able to handle the
* cancellation of the async task in a more uniform manner.
*/
if (!IS_ERR_OR_NULL(pages))
obj->ops->put_pages(obj, pages);
Maarten owns this area these days so he can comment as well.
Regards,
Tvrtko
> [how]
> Fix it by adding Null check.
>
> Signed-off-by: Yongzhi Liu <lyz_cs@pku.edu.cn>
> ---
> drivers/gpu/drm/i915/gem/i915_gem_phys.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_phys.c b/drivers/gpu/drm/i915/gem/i915_gem_phys.c
> index ca6faff..09c3dcb 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_phys.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_phys.c
> @@ -95,8 +95,13 @@ void
> i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj,
> struct sg_table *pages)
> {
> - dma_addr_t dma = sg_dma_address(pages->sgl);
> - void *vaddr = sg_page(pages->sgl);
> + dma_addr_t dma;
> + void *vaddr;
> +
> + if (!pages)
> + return;
> + dma = sg_dma_address(pages->sgl);
> + vaddr = sg_page(pages->sgl);
>
> __i915_gem_object_release_shmem(obj, pages, false);
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915: Check input parameter for NULL
2022-02-22 14:46 [Intel-gfx] [PATCH] drm/i915: Check input parameter for NULL Yongzhi Liu
2022-02-22 16:28 ` Tvrtko Ursulin
@ 2022-02-24 11:00 ` Patchwork
2022-02-24 11:32 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2022-02-24 11:00 UTC (permalink / raw)
To: Yongzhi Liu; +Cc: intel-gfx
== Series Details ==
Series: drm/i915: Check input parameter for NULL
URL : https://patchwork.freedesktop.org/series/100647/
State : warning
== Summary ==
$ dim sparse --fast origin/drm-tip
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Check input parameter for NULL
2022-02-22 14:46 [Intel-gfx] [PATCH] drm/i915: Check input parameter for NULL Yongzhi Liu
2022-02-22 16:28 ` Tvrtko Ursulin
2022-02-24 11:00 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for " Patchwork
@ 2022-02-24 11:32 ` Patchwork
2 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2022-02-24 11:32 UTC (permalink / raw)
To: Yongzhi Liu; +Cc: intel-gfx
[-- Attachment #1: Type: text/plain, Size: 8424 bytes --]
== Series Details ==
Series: drm/i915: Check input parameter for NULL
URL : https://patchwork.freedesktop.org/series/100647/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_11277 -> Patchwork_22387
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_22387 absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_22387, please notify your bug team to allow them
to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22387/index.html
Participating hosts (45 -> 42)
------------------------------
Missing (3): fi-bsw-cyan fi-bdw-samus fi-pnv-d510
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_22387:
### IGT changes ###
#### Possible regressions ####
* igt@i915_pm_rpm@basic-pci-d3-state:
- fi-skl-6600u: NOTRUN -> [FAIL][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22387/fi-skl-6600u/igt@i915_pm_rpm@basic-pci-d3-state.html
Known issues
------------
Here are the changes found in Patchwork_22387 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@amdgpu/amd_cs_nop@fork-compute0:
- fi-ivb-3770: NOTRUN -> [SKIP][2] ([fdo#109271]) +17 similar issues
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22387/fi-ivb-3770/igt@amdgpu/amd_cs_nop@fork-compute0.html
* igt@i915_selftest@live:
- fi-skl-6600u: NOTRUN -> [FAIL][3] ([i915#4547])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22387/fi-skl-6600u/igt@i915_selftest@live.html
* igt@i915_selftest@live@execlists:
- fi-bsw-n3050: [PASS][4] -> [INCOMPLETE][5] ([i915#2940])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11277/fi-bsw-n3050/igt@i915_selftest@live@execlists.html
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22387/fi-bsw-n3050/igt@i915_selftest@live@execlists.html
* igt@i915_selftest@live@gt_heartbeat:
- fi-bsw-n3050: [PASS][6] -> [DMESG-FAIL][7] ([i915#541])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11277/fi-bsw-n3050/igt@i915_selftest@live@gt_heartbeat.html
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22387/fi-bsw-n3050/igt@i915_selftest@live@gt_heartbeat.html
* igt@i915_selftest@live@gt_lrc:
- fi-bsw-n3050: [PASS][8] -> [DMESG-FAIL][9] ([i915#2373])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11277/fi-bsw-n3050/igt@i915_selftest@live@gt_lrc.html
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22387/fi-bsw-n3050/igt@i915_selftest@live@gt_lrc.html
* igt@kms_flip@basic-flip-vs-wf_vblank@b-edp1:
- fi-bsw-kefka: [PASS][10] -> [FAIL][11] ([i915#2122])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11277/fi-bsw-kefka/igt@kms_flip@basic-flip-vs-wf_vblank@b-edp1.html
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22387/fi-bsw-kefka/igt@kms_flip@basic-flip-vs-wf_vblank@b-edp1.html
* igt@prime_vgem@basic-userptr:
- fi-skl-6600u: NOTRUN -> [SKIP][12] ([fdo#109271])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22387/fi-skl-6600u/igt@prime_vgem@basic-userptr.html
* igt@runner@aborted:
- fi-bsw-n3050: NOTRUN -> [FAIL][13] ([fdo#109271] / [i915#1436] / [i915#2722] / [i915#3428] / [i915#4312])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22387/fi-bsw-n3050/igt@runner@aborted.html
#### Possible fixes ####
* igt@gem_exec_suspend@basic-s3@smem:
- {fi-rkl-11600}: [INCOMPLETE][14] ([i915#5127]) -> [PASS][15]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11277/fi-rkl-11600/igt@gem_exec_suspend@basic-s3@smem.html
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22387/fi-rkl-11600/igt@gem_exec_suspend@basic-s3@smem.html
* igt@i915_selftest@live@hangcheck:
- fi-ivb-3770: [INCOMPLETE][16] ([i915#3303]) -> [PASS][17]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11277/fi-ivb-3770/igt@i915_selftest@live@hangcheck.html
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22387/fi-ivb-3770/igt@i915_selftest@live@hangcheck.html
* igt@kms_busy@basic@modeset:
- {bat-adlp-6}: [DMESG-WARN][18] ([i915#3576]) -> [PASS][19]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11277/bat-adlp-6/igt@kms_busy@basic@modeset.html
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22387/bat-adlp-6/igt@kms_busy@basic@modeset.html
* igt@kms_psr@primary_page_flip:
- fi-skl-6600u: [FAIL][20] ([i915#4547]) -> [PASS][21]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11277/fi-skl-6600u/igt@kms_psr@primary_page_flip.html
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22387/fi-skl-6600u/igt@kms_psr@primary_page_flip.html
#### Warnings ####
* igt@i915_selftest@live@hangcheck:
- bat-dg1-6: [DMESG-FAIL][22] ([i915#4494] / [i915#4957]) -> [DMESG-FAIL][23] ([i915#4957])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11277/bat-dg1-6/igt@i915_selftest@live@hangcheck.html
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22387/bat-dg1-6/igt@i915_selftest@live@hangcheck.html
* igt@runner@aborted:
- fi-skl-6600u: [FAIL][24] ([i915#4312]) -> [FAIL][25] ([i915#1436] / [i915#4312])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11277/fi-skl-6600u/igt@runner@aborted.html
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22387/fi-skl-6600u/igt@runner@aborted.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436
[i915#2122]: https://gitlab.freedesktop.org/drm/intel/issues/2122
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2373]: https://gitlab.freedesktop.org/drm/intel/issues/2373
[i915#2722]: https://gitlab.freedesktop.org/drm/intel/issues/2722
[i915#2940]: https://gitlab.freedesktop.org/drm/intel/issues/2940
[i915#3012]: https://gitlab.freedesktop.org/drm/intel/issues/3012
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3303]: https://gitlab.freedesktop.org/drm/intel/issues/3303
[i915#3428]: https://gitlab.freedesktop.org/drm/intel/issues/3428
[i915#3576]: https://gitlab.freedesktop.org/drm/intel/issues/3576
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4494]: https://gitlab.freedesktop.org/drm/intel/issues/4494
[i915#4547]: https://gitlab.freedesktop.org/drm/intel/issues/4547
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4957]: https://gitlab.freedesktop.org/drm/intel/issues/4957
[i915#5127]: https://gitlab.freedesktop.org/drm/intel/issues/5127
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[i915#541]: https://gitlab.freedesktop.org/drm/intel/issues/541
Build changes
-------------
* Linux: CI_DRM_11277 -> Patchwork_22387
CI-20190529: 20190529
CI_DRM_11277: a9d1ffee8dbe2c5506cccf9077eab8fe439eea46 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6355: 83ec34916bd8268bc331105cf77c4d3d3cd352be @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_22387: 0f54199ed0a1dadd3b4a8714a5ae4c2f79a731af @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
0f54199ed0a1 drm/i915: Check input parameter for NULL
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22387/index.html
[-- Attachment #2: Type: text/html, Size: 8930 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-02-24 11:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-22 14:46 [Intel-gfx] [PATCH] drm/i915: Check input parameter for NULL Yongzhi Liu
2022-02-22 16:28 ` Tvrtko Ursulin
2022-02-24 11:00 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for " Patchwork
2022-02-24 11:32 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
[not found] <1645455221-38580-1-git-send-email-lyz_cs@pku.edu.cn>
2022-02-21 23:41 ` [Intel-gfx] [PATCH] " kernel test robot
2022-02-22 0:12 ` kernel test robot
2022-02-22 1:23 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox