diff mbox series

drm/vram: fix incorrect flag variable usage.

Message ID 20201119011423.14224-1-airlied@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm/vram: fix incorrect flag variable usage. | expand

Commit Message

Dave Airlie Nov. 19, 2020, 1:14 a.m. UTC
From: Dave Airlie <airlied@redhat.com>

In 7053e0eab473119503f6565b4e398f9a73122481
drm/vram-helper: stop using TTM placement flags

it appears the flags got mixed up.

This should fix a regression on ast
[   64.782340] WARNING: CPU: 51 PID: 1964 at drivers/gpu/drm/drm_gem_vram_helper.c:284 drm_gem_vram_offset+0x35/0x40 [drm_vram_helper]
[   64.782411] CPU: 51 PID: 1964 Comm: Xorg Not tainted 5.10.0-rc3 #12
[   64.782413] Hardware name: To be filled.
[   64.782419] RIP: 0010:drm_gem_vram_offset+0x35/0x40 [drm_vram_helper]
[   64.782424] Code: 00 48 89 e5 85 c0 74 17 48 83 bf 78 01 00 00 00 74 18 48 8b 87 80 01 00 00 5d 48 c1 e0 0c c3 0f 0b 48 c7 c0 ed ff ff ff 5d c3 <0f> 0b 31 c0 5d c3 0f 1f 44 00 00 0f 1f 44 00 00 55 48 8b 87 18 06
[   64.782427] RSP: 0018:ffffa9128909fa68 EFLAGS: 00010246
[   64.782431] RAX: 0000000000000002 RBX: ffff95a5c25e1ec0 RCX: ffffffffc02b6600
[   64.782433] RDX: ffff959e49824000 RSI: ffff95a5c25e0b40 RDI: ffff959e4b1c2c00
[   64.782434] RBP: ffffa9128909fa68 R08: 0000000000000040 R09: ffff95a9c5dcb688
[   64.782436] R10: 0000000000000000 R11: 0000000000000001 R12: ffff959e49824000
[   64.782437] R13: 0000000000000000 R14: 0000000000000000 R15: ffff95a5c5c56f00
[   64.782440] FS:  00007f485d466a80(0000) GS:ffff95a9afcc0000(0000) knlGS:0000000000000000
[   64.782442] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   64.782444] CR2: 00007f485e202000 CR3: 0000000c82a0e000 CR4: 00000000003506e0
[   64.782446] Call Trace:
[   64.782455]  ast_cursor_page_flip+0x22/0x100 [ast]
[   64.782460]  ast_cursor_plane_helper_atomic_update+0x46/0x70 [ast]
[   64.782477]  drm_atomic_helper_commit_planes+0xbd/0x220 [drm_kms_helper]
[   64.782493]  drm_atomic_helper_commit_tail_rpm+0x3a/0x70 [drm_kms_helper]
[   64.782507]  commit_tail+0x99/0x130 [drm_kms_helper]
[   64.782521]  drm_atomic_helper_commit+0x123/0x150 [drm_kms_helper]
[   64.782551]  drm_atomic_commit+0x4a/0x50 [drm]
[   64.782565]  drm_atomic_helper_update_plane+0xe7/0x140 [drm_kms_helper]
[   64.782592]  __setplane_atomic+0xcc/0x110 [drm]
[   64.782619]  drm_mode_cursor_universal+0x13e/0x260 [drm]
[   64.782647]  drm_mode_cursor_common+0xef/0x220 [drm]
[   64.782654]  ? tomoyo_path_number_perm+0x6f/0x200
[   64.782680]  ? drm_mode_cursor_ioctl+0x60/0x60 [drm]
[   64.782706]  drm_mode_cursor2_ioctl+0xe/0x10 [drm]
[   64.782727]  drm_ioctl_kernel+0xae/0xf0 [drm]
[   64.782749]  drm_ioctl+0x241/0x3f0 [drm]
[   64.782774]  ? drm_mode_cursor_ioctl+0x60/0x60 [drm]
[   64.782781]  ? tomoyo_file_ioctl+0x19/0x20
[   64.782787]  __x64_sys_ioctl+0x91/0xc0
[   64.782792]  do_syscall_64+0x38/0x90
[   64.782797]  entry_SYSCALL_64_after_hwframe+0x44/0xa9

Signed-off-by: Dave Airlie <airlied@redhat.com>
Cc: Wen Pu <puwen@hygon.cn>
Cc: David Laight <David.Laight@aculab.com>
Cc: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/drm_gem_vram_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

kernel test robot Nov. 19, 2020, 7:12 a.m. UTC | #1
Hi Dave,

I love your patch! Yet something to improve:

[auto build test ERROR on tegra-drm/drm/tegra/for-next]
[also build test ERROR on linus/master v5.10-rc4]
[cannot apply to drm-exynos/exynos-drm-next drm-intel/for-linux-next drm-tip/drm-tip drm/drm-next next-20201118]
[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/Dave-Airlie/drm-vram-fix-incorrect-flag-variable-usage/20201119-091523
base:   git://anongit.freedesktop.org/tegra/linux.git drm/tegra/for-next
config: riscv-randconfig-r034-20201119 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project b2613fb2f0f53691dd0211895afbb9413457fca7)
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 riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/34989355252d40699a479afefb95750e30b90766
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Dave-Airlie/drm-vram-fix-incorrect-flag-variable-usage/20201119-091523
        git checkout 34989355252d40699a479afefb95750e30b90766
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 

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/drm_gem_vram_helper.c:143:3: error: use of undeclared identifier 'invariant_flag'; did you mean 'invariant_flags'?
                   invariant_flag = TTM_PL_FLAG_TOPDOWN;
                   ^~~~~~~~~~~~~~
                   invariant_flags
   drivers/gpu/drm/drm_gem_vram_helper.c:138:6: note: 'invariant_flags' declared here
           u32 invariant_flags = 0;
               ^
   1 error generated.

vim +143 drivers/gpu/drm/drm_gem_vram_helper.c

   134	
   135	static void drm_gem_vram_placement(struct drm_gem_vram_object *gbo,
   136					   unsigned long pl_flag)
   137	{
   138		u32 invariant_flags = 0;
   139		unsigned int i;
   140		unsigned int c = 0;
   141	
   142		if (pl_flag & DRM_GEM_VRAM_PL_FLAG_TOPDOWN)
 > 143			invariant_flag = TTM_PL_FLAG_TOPDOWN;
   144	
   145		gbo->placement.placement = gbo->placements;
   146		gbo->placement.busy_placement = gbo->placements;
   147	
   148		if (pl_flag & DRM_GEM_VRAM_PL_FLAG_VRAM) {
   149			gbo->placements[c].mem_type = TTM_PL_VRAM;
   150			gbo->placements[c++].flags = TTM_PL_FLAG_WC |
   151						     TTM_PL_FLAG_UNCACHED |
   152						     invariant_flags;
   153		}
   154	
   155		if (pl_flag & DRM_GEM_VRAM_PL_FLAG_SYSTEM || !c) {
   156			gbo->placements[c].mem_type = TTM_PL_SYSTEM;
   157			gbo->placements[c++].flags = TTM_PL_MASK_CACHING |
   158						     invariant_flags;
   159		}
   160	
   161		gbo->placement.num_placement = c;
   162		gbo->placement.num_busy_placement = c;
   163	
   164		for (i = 0; i < c; ++i) {
   165			gbo->placements[i].fpfn = 0;
   166			gbo->placements[i].lpfn = 0;
   167		}
   168	}
   169	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Thomas Zimmermann Nov. 19, 2020, 7:51 a.m. UTC | #2
Hi

we already have

   b8f8dbf64958 ("drm/vram-helper: Fix use of top-down placement")

in drm-tip. And it does exactly the same. I guess it went in through 
drm-misc-next instead of -misc-fixes.

Am 19.11.20 um 02:14 schrieb Dave Airlie:
> From: Dave Airlie <airlied@redhat.com>
> 
> In 7053e0eab473119503f6565b4e398f9a73122481
> drm/vram-helper: stop using TTM placement flags

The subject line might be a bit misleading.

In any case

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

Best regards
Thomas

> 
> it appears the flags got mixed up.
> 
> This should fix a regression on ast
> [   64.782340] WARNING: CPU: 51 PID: 1964 at drivers/gpu/drm/drm_gem_vram_helper.c:284 drm_gem_vram_offset+0x35/0x40 [drm_vram_helper]
> [   64.782411] CPU: 51 PID: 1964 Comm: Xorg Not tainted 5.10.0-rc3 #12
> [   64.782413] Hardware name: To be filled.
> [   64.782419] RIP: 0010:drm_gem_vram_offset+0x35/0x40 [drm_vram_helper]
> [   64.782424] Code: 00 48 89 e5 85 c0 74 17 48 83 bf 78 01 00 00 00 74 18 48 8b 87 80 01 00 00 5d 48 c1 e0 0c c3 0f 0b 48 c7 c0 ed ff ff ff 5d c3 <0f> 0b 31 c0 5d c3 0f 1f 44 00 00 0f 1f 44 00 00 55 48 8b 87 18 06
> [   64.782427] RSP: 0018:ffffa9128909fa68 EFLAGS: 00010246
> [   64.782431] RAX: 0000000000000002 RBX: ffff95a5c25e1ec0 RCX: ffffffffc02b6600
> [   64.782433] RDX: ffff959e49824000 RSI: ffff95a5c25e0b40 RDI: ffff959e4b1c2c00
> [   64.782434] RBP: ffffa9128909fa68 R08: 0000000000000040 R09: ffff95a9c5dcb688
> [   64.782436] R10: 0000000000000000 R11: 0000000000000001 R12: ffff959e49824000
> [   64.782437] R13: 0000000000000000 R14: 0000000000000000 R15: ffff95a5c5c56f00
> [   64.782440] FS:  00007f485d466a80(0000) GS:ffff95a9afcc0000(0000) knlGS:0000000000000000
> [   64.782442] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [   64.782444] CR2: 00007f485e202000 CR3: 0000000c82a0e000 CR4: 00000000003506e0
> [   64.782446] Call Trace:
> [   64.782455]  ast_cursor_page_flip+0x22/0x100 [ast]
> [   64.782460]  ast_cursor_plane_helper_atomic_update+0x46/0x70 [ast]
> [   64.782477]  drm_atomic_helper_commit_planes+0xbd/0x220 [drm_kms_helper]
> [   64.782493]  drm_atomic_helper_commit_tail_rpm+0x3a/0x70 [drm_kms_helper]
> [   64.782507]  commit_tail+0x99/0x130 [drm_kms_helper]
> [   64.782521]  drm_atomic_helper_commit+0x123/0x150 [drm_kms_helper]
> [   64.782551]  drm_atomic_commit+0x4a/0x50 [drm]
> [   64.782565]  drm_atomic_helper_update_plane+0xe7/0x140 [drm_kms_helper]
> [   64.782592]  __setplane_atomic+0xcc/0x110 [drm]
> [   64.782619]  drm_mode_cursor_universal+0x13e/0x260 [drm]
> [   64.782647]  drm_mode_cursor_common+0xef/0x220 [drm]
> [   64.782654]  ? tomoyo_path_number_perm+0x6f/0x200
> [   64.782680]  ? drm_mode_cursor_ioctl+0x60/0x60 [drm]
> [   64.782706]  drm_mode_cursor2_ioctl+0xe/0x10 [drm]
> [   64.782727]  drm_ioctl_kernel+0xae/0xf0 [drm]
> [   64.782749]  drm_ioctl+0x241/0x3f0 [drm]
> [   64.782774]  ? drm_mode_cursor_ioctl+0x60/0x60 [drm]
> [   64.782781]  ? tomoyo_file_ioctl+0x19/0x20
> [   64.782787]  __x64_sys_ioctl+0x91/0xc0
> [   64.782792]  do_syscall_64+0x38/0x90
> [   64.782797]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> Cc: Wen Pu <puwen@hygon.cn>
> Cc: David Laight <David.Laight@aculab.com>
> Cc: Christian König <christian.koenig@amd.com>
> ---
>   drivers/gpu/drm/drm_gem_vram_helper.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
> index 50cad0e4a92e..2896a057b771 100644
> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
> @@ -140,7 +140,7 @@ static void drm_gem_vram_placement(struct drm_gem_vram_object *gbo,
>   	unsigned int c = 0;
>   
>   	if (pl_flag & DRM_GEM_VRAM_PL_FLAG_TOPDOWN)
> -		pl_flag = TTM_PL_FLAG_TOPDOWN;
> +		invariant_flag = TTM_PL_FLAG_TOPDOWN;
>   
>   	gbo->placement.placement = gbo->placements;
>   	gbo->placement.busy_placement = gbo->placements;
>
Christian König Nov. 19, 2020, 7:52 a.m. UTC | #3
Am 19.11.20 um 02:14 schrieb Dave Airlie:
> From: Dave Airlie <airlied@redhat.com>
>
> In 7053e0eab473119503f6565b4e398f9a73122481
> drm/vram-helper: stop using TTM placement flags
>
> it appears the flags got mixed up.
>
> This should fix a regression on ast
> [   64.782340] WARNING: CPU: 51 PID: 1964 at drivers/gpu/drm/drm_gem_vram_helper.c:284 drm_gem_vram_offset+0x35/0x40 [drm_vram_helper]
> [   64.782411] CPU: 51 PID: 1964 Comm: Xorg Not tainted 5.10.0-rc3 #12
> [   64.782413] Hardware name: To be filled.
> [   64.782419] RIP: 0010:drm_gem_vram_offset+0x35/0x40 [drm_vram_helper]
> [   64.782424] Code: 00 48 89 e5 85 c0 74 17 48 83 bf 78 01 00 00 00 74 18 48 8b 87 80 01 00 00 5d 48 c1 e0 0c c3 0f 0b 48 c7 c0 ed ff ff ff 5d c3 <0f> 0b 31 c0 5d c3 0f 1f 44 00 00 0f 1f 44 00 00 55 48 8b 87 18 06
> [   64.782427] RSP: 0018:ffffa9128909fa68 EFLAGS: 00010246
> [   64.782431] RAX: 0000000000000002 RBX: ffff95a5c25e1ec0 RCX: ffffffffc02b6600
> [   64.782433] RDX: ffff959e49824000 RSI: ffff95a5c25e0b40 RDI: ffff959e4b1c2c00
> [   64.782434] RBP: ffffa9128909fa68 R08: 0000000000000040 R09: ffff95a9c5dcb688
> [   64.782436] R10: 0000000000000000 R11: 0000000000000001 R12: ffff959e49824000
> [   64.782437] R13: 0000000000000000 R14: 0000000000000000 R15: ffff95a5c5c56f00
> [   64.782440] FS:  00007f485d466a80(0000) GS:ffff95a9afcc0000(0000) knlGS:0000000000000000
> [   64.782442] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [   64.782444] CR2: 00007f485e202000 CR3: 0000000c82a0e000 CR4: 00000000003506e0
> [   64.782446] Call Trace:
> [   64.782455]  ast_cursor_page_flip+0x22/0x100 [ast]
> [   64.782460]  ast_cursor_plane_helper_atomic_update+0x46/0x70 [ast]
> [   64.782477]  drm_atomic_helper_commit_planes+0xbd/0x220 [drm_kms_helper]
> [   64.782493]  drm_atomic_helper_commit_tail_rpm+0x3a/0x70 [drm_kms_helper]
> [   64.782507]  commit_tail+0x99/0x130 [drm_kms_helper]
> [   64.782521]  drm_atomic_helper_commit+0x123/0x150 [drm_kms_helper]
> [   64.782551]  drm_atomic_commit+0x4a/0x50 [drm]
> [   64.782565]  drm_atomic_helper_update_plane+0xe7/0x140 [drm_kms_helper]
> [   64.782592]  __setplane_atomic+0xcc/0x110 [drm]
> [   64.782619]  drm_mode_cursor_universal+0x13e/0x260 [drm]
> [   64.782647]  drm_mode_cursor_common+0xef/0x220 [drm]
> [   64.782654]  ? tomoyo_path_number_perm+0x6f/0x200
> [   64.782680]  ? drm_mode_cursor_ioctl+0x60/0x60 [drm]
> [   64.782706]  drm_mode_cursor2_ioctl+0xe/0x10 [drm]
> [   64.782727]  drm_ioctl_kernel+0xae/0xf0 [drm]
> [   64.782749]  drm_ioctl+0x241/0x3f0 [drm]
> [   64.782774]  ? drm_mode_cursor_ioctl+0x60/0x60 [drm]
> [   64.782781]  ? tomoyo_file_ioctl+0x19/0x20
> [   64.782787]  __x64_sys_ioctl+0x91/0xc0
> [   64.782792]  do_syscall_64+0x38/0x90
> [   64.782797]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
>
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> Cc: Wen Pu <puwen@hygon.cn>
> Cc: David Laight <David.Laight@aculab.com>
> Cc: Christian König <christian.koenig@amd.com>

Good catch of a stupid typo.

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/drm_gem_vram_helper.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
> index 50cad0e4a92e..2896a057b771 100644
> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
> @@ -140,7 +140,7 @@ static void drm_gem_vram_placement(struct drm_gem_vram_object *gbo,
>   	unsigned int c = 0;
>   
>   	if (pl_flag & DRM_GEM_VRAM_PL_FLAG_TOPDOWN)
> -		pl_flag = TTM_PL_FLAG_TOPDOWN;
> +		invariant_flag = TTM_PL_FLAG_TOPDOWN;
>   
>   	gbo->placement.placement = gbo->placements;
>   	gbo->placement.busy_placement = gbo->placements;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
index 50cad0e4a92e..2896a057b771 100644
--- a/drivers/gpu/drm/drm_gem_vram_helper.c
+++ b/drivers/gpu/drm/drm_gem_vram_helper.c
@@ -140,7 +140,7 @@  static void drm_gem_vram_placement(struct drm_gem_vram_object *gbo,
 	unsigned int c = 0;
 
 	if (pl_flag & DRM_GEM_VRAM_PL_FLAG_TOPDOWN)
-		pl_flag = TTM_PL_FLAG_TOPDOWN;
+		invariant_flag = TTM_PL_FLAG_TOPDOWN;
 
 	gbo->placement.placement = gbo->placements;
 	gbo->placement.busy_placement = gbo->placements;