[PATCH] Revert "drm/amdgpu: add drm buddy support to amdgpu"

Alex Deucher alexdeucher at gmail.com
Thu Jul 14 13:33:23 UTC 2022


On Thu, Jul 14, 2022 at 9:09 AM Christian König
<christian.koenig at amd.com> wrote:
>
> Hi Mauro,
>
> well the last time I checked drm-tip was clean.
>
> The revert is necessary because we had some problems with the commit
> which we couldn't fix in the 5.19 cycle.

Would it be worth reverting the revert and applying the actual fix[1]?
 It's a huge revert unfortunately while the actual fix is like 10
lines of code.  I'm concerned there will be subtle fallout from the
revert due to how extensive it is.

[1] - https://gitlab.freedesktop.org/drm/amd/uploads/564b2cc2b5ea87357f39e45c3a1a44e2/0001-drm-amdgpu-Fix-for-drm-buddy-memory-corruption.patch

Alex


>
> I will double check drm-tip once more.
>
> Regards,
> Christian.
>
> Am 14.07.22 um 14:54 schrieb Mauro Carvalho Chehab:
> > On Fri, 8 Jul 2022 03:21:24 -0700
> > Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam at amd.com> wrote:
> >
> >> This reverts the following commits:
> >> commit 708d19d9f362 ("drm/amdgpu: move internal vram_mgr function into the C file")
> >> commit 5e3f1e7729ec ("drm/amdgpu: fix start calculation in amdgpu_vram_mgr_new")
> >> commit c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu")
> >>
> >> [WHY]
> >> Few users reported garbaged graphics as soon as x starts,
> >> reverting until this can be resolved.
> >>
> >> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam at amd.com>
> > This revert is currently breaking drm-tip. Please revert it ASAP, as it
> > is preventing CI bots to properly test new patches on the top of current
> > drm-tip:
> >
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_new’:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:459:13: error: ‘cur_size’ undeclared (first use in this function)
> >    459 |         if (cur_size != size) {
> >        |             ^~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:459:13: note: each undeclared identifier is reported only once for each function it appears in
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:459:25: error: ‘size’ undeclared (first use in this function); did you mean ‘ksize’?
> >    459 |         if (cur_size != size) {
> >        |                         ^~~~
> >        |                         ksize
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:465:30: error: ‘vres’ undeclared (first use in this function); did you mean ‘res’?
> >    465 |                 trim_list = &vres->blocks;
> >        |                              ^~~~
> >        |                              res
> > In file included from ./include/linux/bits.h:22,
> >                   from ./include/linux/ratelimit_types.h:5,
> >                   from ./include/linux/ratelimit.h:5,
> >                   from ./include/linux/dev_printk.h:16,
> >                   from ./include/linux/device.h:15,
> >                   from ./include/linux/dma-mapping.h:7,
> >                   from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25:
> > ./include/linux/container_of.h:19:54: error: invalid use of undefined type ‘struct drm_buddy_block’
> >     19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
> >        |                                                      ^~
> > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’
> >     78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> >        |                                                        ^~~~
> > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’
> >     19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
> >        |         ^~~~~~~~~~~~~
> > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’
> >     19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
> >        |                       ^~~~~~~~~~~
> > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’
> >    520 |         container_of(ptr, type, member)
> >        |         ^~~~~~~~~~~~
> > ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’
> >    542 |         list_entry((ptr)->prev, type, member)
> >        |         ^~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:473:33: note: in expansion of macro ‘list_last_entry’
> >    473 |                         block = list_last_entry(&vres->blocks, typeof(*block), link);
> >        |                                 ^~~~~~~~~~~~~~~
> > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer
> >    295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
> >        |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’
> >     78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> >        |                                                        ^~~~
> > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’
> >     19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
> >        |         ^~~~~~~~~~~~~
> > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’
> >     19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
> >        |                       ^~~~~~~~~~~
> > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’
> >    520 |         container_of(ptr, type, member)
> >        |         ^~~~~~~~~~~~
> > ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’
> >    542 |         list_entry((ptr)->prev, type, member)
> >        |         ^~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:473:33: note: in expansion of macro ‘list_last_entry’
> >    473 |                         block = list_last_entry(&vres->blocks, typeof(*block), link);
> >        |                                 ^~~~~~~~~~~~~~~
> > In file included from ./include/uapi/linux/posix_types.h:5,
> >                   from ./include/uapi/linux/types.h:14,
> >                   from ./include/linux/types.h:6,
> >                   from ./include/linux/kasan-checks.h:5,
> >                   from ./include/asm-generic/rwonce.h:26,
> >                   from ./arch/x86/include/generated/asm/rwonce.h:1,
> >                   from ./include/linux/compiler.h:248,
> >                   from ./include/linux/string.h:5,
> >                   from ./include/linux/dma-mapping.h:6:
> > ./include/linux/stddef.h:16:33: error: invalid use of undefined type ‘struct drm_buddy_block’
> >     16 | #define offsetof(TYPE, MEMBER)  __builtin_offsetof(TYPE, MEMBER)
> >        |                                 ^~~~~~~~~~~~~~~~~~
> > ./include/linux/container_of.h:22:28: note: in expansion of macro ‘offsetof’
> >     22 |         ((type *)(__mptr - offsetof(type, member))); })
> >        |                            ^~~~~~~~
> > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’
> >    520 |         container_of(ptr, type, member)
> >        |         ^~~~~~~~~~~~
> > ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’
> >    542 |         list_entry((ptr)->prev, type, member)
> >        |         ^~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:473:33: note: in expansion of macro ‘list_last_entry’
> >    473 |                         block = list_last_entry(&vres->blocks, typeof(*block), link);
> >        |                                 ^~~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:474:46: error: invalid use of undefined type ‘struct drm_buddy_block’
> >    474 |                         list_move_tail(&block->link, &temp);
> >        |                                              ^~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:480:41: error: implicit declaration of function ‘amdgpu_vram_mgr_block_size’; did you mean ‘amdgpu_vram_mgr_vis_size’? [-Werror=implicit-function-declaration]
> >    480 |                         original_size = amdgpu_vram_mgr_block_size(block) - (size - cur_size);
> >        |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~
> >        |                                         amdgpu_vram_mgr_vis_size
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:483:28: error: passing argument 1 of ‘mutex_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    483 |                 mutex_lock(&mgr->lock);
> >        |                            ^~~~~~~~~~
> >        |                            |
> >        |                            spinlock_t * {aka struct spinlock *}
> > In file included from ./include/linux/rhashtable-types.h:14,
> >                   from ./include/linux/ipc.h:7,
> >                   from ./include/uapi/linux/sem.h:5,
> >                   from ./include/linux/sem.h:5,
> >                   from ./include/linux/sched.h:15,
> >                   from ./include/linux/ratelimit.h:6:
> > ./include/linux/mutex.h:199:38: note: expected ‘struct mutex *’ but argument is of type ‘spinlock_t *’ {aka ‘struct spinlock *’}
> >    199 | extern void mutex_lock(struct mutex *lock);
> >        |                        ~~~~~~~~~~~~~~^~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:484:17: error: implicit declaration of function ‘drm_buddy_block_trim’ [-Werror=implicit-function-declaration]
> >    484 |                 drm_buddy_block_trim(mm,
> >        |                 ^~~~~~~~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:487:30: error: passing argument 1 of ‘mutex_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    487 |                 mutex_unlock(&mgr->lock);
> >        |                              ^~~~~~~~~~
> >        |                              |
> >        |                              spinlock_t * {aka struct spinlock *}
> > ./include/linux/mutex.h:218:40: note: expected ‘struct mutex *’ but argument is of type ‘spinlock_t *’ {aka ‘struct spinlock *’}
> >    218 | extern void mutex_unlock(struct mutex *lock);
> >        |                          ~~~~~~~~~~~~~~^~~~
> > In file included from ./include/linux/rculist.h:10,
> >                   from ./include/linux/pid.h:5,
> >                   from ./include/linux/sched.h:14:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:493:29: error: ‘block’ undeclared (first use in this function); did you mean ‘flock’?
> >    493 |         list_for_each_entry(block, &vres->blocks, link)
> >        |                             ^~~~~
> > ./include/linux/list.h:674:14: note: in definition of macro ‘list_for_each_entry’
> >    674 |         for (pos = list_first_entry(head, typeof(*pos), member);        \
> >        |              ^~~
> > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer
> >    295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
> >        |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’
> >     78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> >        |                                                        ^~~~
> > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’
> >     19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
> >        |         ^~~~~~~~~~~~~
> > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’
> >     19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
> >        |                       ^~~~~~~~~~~
> > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’
> >    520 |         container_of(ptr, type, member)
> >        |         ^~~~~~~~~~~~
> > ./include/linux/list.h:531:9: note: in expansion of macro ‘list_entry’
> >    531 |         list_entry((ptr)->next, type, member)
> >        |         ^~~~~~~~~~
> > ./include/linux/list.h:674:20: note: in expansion of macro ‘list_first_entry’
> >    674 |         for (pos = list_first_entry(head, typeof(*pos), member);        \
> >        |                    ^~~~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:493:9: note: in expansion of macro ‘list_for_each_entry’
> >    493 |         list_for_each_entry(block, &vres->blocks, link)
> >        |         ^~~~~~~~~~~~~~~~~~~
> > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer
> >    295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
> >        |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’
> >     78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> >        |                                                        ^~~~
> > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’
> >     19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
> >        |         ^~~~~~~~~~~~~
> > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’
> >     19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
> >        |                       ^~~~~~~~~~~
> > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’
> >    520 |         container_of(ptr, type, member)
> >        |         ^~~~~~~~~~~~
> > ./include/linux/list.h:564:9: note: in expansion of macro ‘list_entry’
> >    564 |         list_entry((pos)->member.next, typeof(*(pos)), member)
> >        |         ^~~~~~~~~~
> > ./include/linux/list.h:676:20: note: in expansion of macro ‘list_next_entry’
> >    676 |              pos = list_next_entry(pos, member))
> >        |                    ^~~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:493:9: note: in expansion of macro ‘list_for_each_entry’
> >    493 |         list_for_each_entry(block, &vres->blocks, link)
> >        |         ^~~~~~~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:496:17: error: implicit declaration of function ‘amdgpu_vram_mgr_first_block’; did you mean ‘amdgpu_vram_mgr_virt_start’? [-Werror=implicit-function-declaration]
> >    496 |         block = amdgpu_vram_mgr_first_block(&vres->blocks);
> >        |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> >        |                 amdgpu_vram_mgr_virt_start
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:502:28: error: implicit declaration of function ‘amdgpu_vram_mgr_block_start’; did you mean ‘amdgpu_vram_mgr_virt_start’? [-Werror=implicit-function-declaration]
> >    502 |         vres->base.start = amdgpu_vram_mgr_block_start(block) >> PAGE_SHIFT;
> >        |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> >        |                            amdgpu_vram_mgr_virt_start
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:504:13: error: implicit declaration of function ‘amdgpu_is_vram_mgr_blocks_contiguous’ [-Werror=implicit-function-declaration]
> >    504 |         if (amdgpu_is_vram_mgr_blocks_contiguous(&vres->blocks))
> >        |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > cc1: all warnings being treated as errors
> > make[4]: *** [scripts/Makefile.build:249: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o] Error 1
> > make[4]: *** Waiting for unfinished jobs....
> > make[3]: *** [scripts/Makefile.build:466: drivers/gpu/drm/amd/amdgpu] Error 2
> > make[2]: *** [scripts/Makefile.build:466: drivers/gpu/drm] Error 2
> > make[1]: *** [scripts/Makefile.build:466: drivers/gpu] Error 2
> > make: *** [Makefile:1843: drivers] Error 2
> > mchehab at sal /new_devel/v4l/tmp $ nano drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> > mchehab at sal /new_devel/v4l/tmp $ make drivers/gpu/drm/amd/amdgpu/
> >    DESCEND objtool
> >    CALL    scripts/atomic/check-atomics.sh
> >    CALL    scripts/checksyscalls.sh
> >    CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o
> >    CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_csa.o
> >    CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.o
> >    CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.o
> >    CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.o
> >    CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.o
> >    CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.o
> >    CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.o
> >    CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_umc.o
> > In file included from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:30:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h:29:8: error: redefinition of ‘struct amdgpu_vram_mgr’
> >     29 | struct amdgpu_vram_mgr {
> >        |        ^~~~~~~~~~~~~~~
> > In file included from drivers/gpu/drm/amd/amdgpu/amdgpu.h:73,
> >                   from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:28:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:41:8: note: originally defined here
> >     41 | struct amdgpu_vram_mgr {
> >        |        ^~~~~~~~~~~~~~~
> > In file included from ./include/linux/bits.h:22,
> >                   from ./include/linux/ratelimit_types.h:5,
> >                   from ./include/linux/ratelimit.h:5,
> >                   from ./include/linux/dev_printk.h:16,
> >                   from ./include/linux/device.h:15,
> >                   from ./include/linux/dma-mapping.h:7,
> >                   from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:25:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘to_amdgpu_device’:
> > ./include/linux/build_bug.h:78:41: error: static assertion failed: "pointer type mismatch in container_of()"
> >     78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> >        |                                         ^~~~~~~~~~~~~~
> > ./include/linux/build_bug.h:77:34: note: in expansion of macro ‘__static_assert’
> >     77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
> >        |                                  ^~~~~~~~~~~~~~~
> > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’
> >     19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
> >        |         ^~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:49:16: note: in expansion of macro ‘container_of’
> >     49 |         return container_of(mgr, struct amdgpu_device, mman.vram_mgr);
> >        |                ^~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_do_reserve’:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:244:29: error: initialization of ‘struct drm_mm *’ from incompatible pointer type ‘struct drm_buddy *’ [-Werror=incompatible-pointer-types]
> >    244 |         struct drm_mm *mm = &mgr->mm;
> >        |                             ^
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: At top level:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:273:5: error: conflicting types for ‘amdgpu_vram_mgr_reserve_range’; have ‘int(struct amdgpu_vram_mgr *, uint64_t,  uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int,  long long unsigned int)’}
> >    273 | int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr,
> >        |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:129:5: note: previous declaration of ‘amdgpu_vram_mgr_reserve_range’ with type ‘int(struct amdgpu_vram_mgr *, uint64_t,  uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int,  long long unsigned int)’}
> >    129 | int amdgpu_vram_mgr_reserve_range(struct amdgpu_vram_mgr *mgr,
> >        |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_reserve_range’:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:286:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    286 |         spin_lock(&mgr->lock);
> >        |                   ^~~~~~~~~~
> >        |                   |
> >        |                   struct mutex *
> > In file included from ./include/linux/wait.h:9,
> >                   from ./include/linux/pid.h:6,
> >                   from ./include/linux/sched.h:14,
> >                   from ./include/linux/ratelimit.h:6:
> > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’
> >    347 | static __always_inline void spin_lock(spinlock_t *lock)
> >        |                                       ~~~~~~~~~~~~^~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:289:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    289 |         spin_unlock(&mgr->lock);
> >        |                     ^~~~~~~~~~
> >        |                     |
> >        |                     struct mutex *
> > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’
> >    387 | static __always_inline void spin_unlock(spinlock_t *lock)
> >        |                                         ~~~~~~~~~~~~^~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: At top level:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:305:5: error: conflicting types for ‘amdgpu_vram_mgr_query_page_status’; have ‘int(struct amdgpu_vram_mgr *, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int)’}
> >    305 | int amdgpu_vram_mgr_query_page_status(struct amdgpu_vram_mgr *mgr,
> >        |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:131:5: note: previous declaration of ‘amdgpu_vram_mgr_query_page_status’ with type ‘int(struct amdgpu_vram_mgr *, uint64_t)’ {aka ‘int(struct amdgpu_vram_mgr *, long long unsigned int)’}
> >    131 | int amdgpu_vram_mgr_query_page_status(struct amdgpu_vram_mgr *mgr,
> >        |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_query_page_status’:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:311:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    311 |         spin_lock(&mgr->lock);
> >        |                   ^~~~~~~~~~
> >        |                   |
> >        |                   struct mutex *
> > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’
> >    347 | static __always_inline void spin_lock(spinlock_t *lock)
> >        |                                       ~~~~~~~~~~~~^~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:331:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    331 |         spin_unlock(&mgr->lock);
> >        |                     ^~~~~~~~~~
> >        |                     |
> >        |                     struct mutex *
> > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’
> >    387 | static __always_inline void spin_unlock(spinlock_t *lock)
> >        |                                         ~~~~~~~~~~~~^~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_new’:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:377:29: error: initialization of ‘struct drm_mm *’ from incompatible pointer type ‘struct drm_buddy *’ [-Werror=incompatible-pointer-types]
> >    377 |         struct drm_mm *mm = &mgr->mm;
> >        |                             ^
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:429:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    429 |         spin_lock(&mgr->lock);
> >        |                   ^~~~~~~~~~
> >        |                   |
> >        |                   struct mutex *
> > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’
> >    347 | static __always_inline void spin_lock(spinlock_t *lock)
> >        |                                       ~~~~~~~~~~~~^~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:458:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    458 |         spin_unlock(&mgr->lock);
> >        |                     ^~~~~~~~~~
> >        |                     |
> >        |                     struct mutex *
> > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’
> >    387 | static __always_inline void spin_unlock(spinlock_t *lock)
> >        |                                         ~~~~~~~~~~~~^~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:460:13: error: ‘cur_size’ undeclared (first use in this function)
> >    460 |         if (cur_size != size) {
> >        |             ^~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:460:13: note: each undeclared identifier is reported only once for each function it appears in
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:460:25: error: ‘size’ undeclared (first use in this function); did you mean ‘ksize’?
> >    460 |         if (cur_size != size) {
> >        |                         ^~~~
> >        |                         ksize
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:466:30: error: ‘vres’ undeclared (first use in this function); did you mean ‘res’?
> >    466 |                 trim_list = &vres->blocks;
> >        |                              ^~~~
> >        |                              res
> > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer
> >    295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
> >        |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’
> >     78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> >        |                                                        ^~~~
> > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’
> >     19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
> >        |         ^~~~~~~~~~~~~
> > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’
> >     19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
> >        |                       ^~~~~~~~~~~
> > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’
> >    520 |         container_of(ptr, type, member)
> >        |         ^~~~~~~~~~~~
> > ./include/linux/list.h:542:9: note: in expansion of macro ‘list_entry’
> >    542 |         list_entry((ptr)->prev, type, member)
> >        |         ^~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:474:33: note: in expansion of macro ‘list_last_entry’
> >    474 |                         block = list_last_entry(&vres->blocks, typeof(*block), link);
> >        |                                 ^~~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:485:38: error: passing argument 1 of ‘drm_buddy_block_trim’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    485 |                 drm_buddy_block_trim(mm,
> >        |                                      ^~
> >        |                                      |
> >        |                                      struct drm_mm *
> > In file included from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h:27:
> > ./include/drm/drm_buddy.h:146:44: note: expected ‘struct drm_buddy *’ but argument is of type ‘struct drm_mm *’
> >    146 | int drm_buddy_block_trim(struct drm_buddy *mm,
> >        |                          ~~~~~~~~~~~~~~~~~~^~
> > In file included from ./include/linux/rculist.h:10,
> >                   from ./include/linux/pid.h:5:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:29: error: ‘block’ undeclared (first use in this function); did you mean ‘flock’?
> >    494 |         list_for_each_entry(block, &vres->blocks, link)
> >        |                             ^~~~~
> > ./include/linux/list.h:674:14: note: in definition of macro ‘list_for_each_entry’
> >    674 |         for (pos = list_first_entry(head, typeof(*pos), member);        \
> >        |              ^~~
> > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer
> >    295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
> >        |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’
> >     78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> >        |                                                        ^~~~
> > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’
> >     19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
> >        |         ^~~~~~~~~~~~~
> > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’
> >     19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
> >        |                       ^~~~~~~~~~~
> > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’
> >    520 |         container_of(ptr, type, member)
> >        |         ^~~~~~~~~~~~
> > ./include/linux/list.h:531:9: note: in expansion of macro ‘list_entry’
> >    531 |         list_entry((ptr)->next, type, member)
> >        |         ^~~~~~~~~~
> > ./include/linux/list.h:674:20: note: in expansion of macro ‘list_first_entry’
> >    674 |         for (pos = list_first_entry(head, typeof(*pos), member);        \
> >        |                    ^~~~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:9: note: in expansion of macro ‘list_for_each_entry’
> >    494 |         list_for_each_entry(block, &vres->blocks, link)
> >        |         ^~~~~~~~~~~~~~~~~~~
> > ././include/linux/compiler_types.h:295:27: error: expression in static assertion is not an integer
> >    295 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
> >        |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ./include/linux/build_bug.h:78:56: note: in definition of macro ‘__static_assert’
> >     78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> >        |                                                        ^~~~
> > ./include/linux/container_of.h:19:9: note: in expansion of macro ‘static_assert’
> >     19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
> >        |         ^~~~~~~~~~~~~
> > ./include/linux/container_of.h:19:23: note: in expansion of macro ‘__same_type’
> >     19 |         static_assert(__same_type(*(ptr), ((type *)0)->member) ||       \
> >        |                       ^~~~~~~~~~~
> > ./include/linux/list.h:520:9: note: in expansion of macro ‘container_of’
> >    520 |         container_of(ptr, type, member)
> >        |         ^~~~~~~~~~~~
> > ./include/linux/list.h:564:9: note: in expansion of macro ‘list_entry’
> >    564 |         list_entry((pos)->member.next, typeof(*(pos)), member)
> >        |         ^~~~~~~~~~
> > ./include/linux/list.h:676:20: note: in expansion of macro ‘list_next_entry’
> >    676 |              pos = list_next_entry(pos, member))
> >        |                    ^~~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:494:9: note: in expansion of macro ‘list_for_each_entry’
> >    494 |         list_for_each_entry(block, &vres->blocks, link)
> >        |         ^~~~~~~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:520:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    520 |         spin_unlock(&mgr->lock);
> >        |                     ^~~~~~~~~~
> >        |                     |
> >        |                     struct mutex *
> > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’
> >    387 | static __always_inline void spin_unlock(spinlock_t *lock)
> >        |                                         ~~~~~~~~~~~~^~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_del’:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:545:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    545 |         spin_lock(&mgr->lock);
> >        |                   ^~~~~~~~~~
> >        |                   |
> >        |                   struct mutex *
> > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’
> >    347 | static __always_inline void spin_lock(spinlock_t *lock)
> >        |                                       ~~~~~~~~~~~~^~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:554:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    554 |         spin_unlock(&mgr->lock);
> >        |                     ^~~~~~~~~~
> >        |                     |
> >        |                     struct mutex *
> > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’
> >    387 | static __always_inline void spin_unlock(spinlock_t *lock)
> >        |                                         ~~~~~~~~~~~~^~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: At top level:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:680:10: error: conflicting types for ‘amdgpu_vram_mgr_vis_usage’; have ‘uint64_t(struct amdgpu_vram_mgr *)’ {aka ‘long long unsigned int(struct amdgpu_vram_mgr *)’}
> >    680 | uint64_t amdgpu_vram_mgr_vis_usage(struct amdgpu_vram_mgr *mgr)
> >        |          ^~~~~~~~~~~~~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h:128:10: note: previous declaration of ‘amdgpu_vram_mgr_vis_usage’ with type ‘uint64_t(struct amdgpu_vram_mgr *)’ {aka ‘long long unsigned int(struct amdgpu_vram_mgr *)’}
> >    128 | uint64_t amdgpu_vram_mgr_vis_usage(struct amdgpu_vram_mgr *mgr);
> >        |          ^~~~~~~~~~~~~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_debug’:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:701:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    701 |         spin_lock(&mgr->lock);
> >        |                   ^~~~~~~~~~
> >        |                   |
> >        |                   struct mutex *
> > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’
> >    347 | static __always_inline void spin_lock(spinlock_t *lock)
> >        |                                       ~~~~~~~~~~~~^~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:702:22: error: passing argument 1 of ‘drm_mm_print’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    702 |         drm_mm_print(&mgr->mm, printer);
> >        |                      ^~~~~~~~
> >        |                      |
> >        |                      struct drm_buddy *
> > In file included from ./include/drm/ttm/ttm_range_manager.h:8,
> >                   from drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:26:
> > ./include/drm/drm_mm.h:551:40: note: expected ‘const struct drm_mm *’ but argument is of type ‘struct drm_buddy *’
> >    551 | void drm_mm_print(const struct drm_mm *mm, struct drm_printer *p);
> >        |                   ~~~~~~~~~~~~~~~~~~~~~^~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:703:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    703 |         spin_unlock(&mgr->lock);
> >        |                     ^~~~~~~~~~
> >        |                     |
> >        |                     struct mutex *
> > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’
> >    387 | static __always_inline void spin_unlock(spinlock_t *lock)
> >        |                                         ~~~~~~~~~~~~^~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_init’:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:721:39: error: initialization of ‘struct amdgpu_vram_mgr *’ from incompatible pointer type ‘struct amdgpu_vram_mgr *’ [-Werror=incompatible-pointer-types]
> >    721 |         struct amdgpu_vram_mgr *mgr = &adev->mman.vram_mgr;
> >        |                                       ^
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:729:21: error: passing argument 1 of ‘drm_mm_init’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    729 |         drm_mm_init(&mgr->mm, 0, man->size >> PAGE_SHIFT);
> >        |                     ^~~~~~~~
> >        |                     |
> >        |                     struct drm_buddy *
> > ./include/drm/drm_mm.h:467:33: note: expected ‘struct drm_mm *’ but argument is of type ‘struct drm_buddy *’
> >    467 | void drm_mm_init(struct drm_mm *mm, u64 start, u64 size);
> >        |                  ~~~~~~~~~~~~~~~^~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:730:24: error: passing argument 1 of ‘spinlock_check’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    730 |         spin_lock_init(&mgr->lock);
> >        |                        ^~~~~~~~~~
> >        |                        |
> >        |                        struct mutex *
> > ./include/linux/spinlock.h:341:24: note: in definition of macro ‘spin_lock_init’
> >    341 |         spinlock_check(_lock);                  \
> >        |                        ^~~~~
> > ./include/linux/spinlock.h:322:67: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’
> >    322 | static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
> >        |                                                       ~~~~~~~~~~~~^~~~
> > In file included from ./include/linux/spinlock.h:87:
> > ./include/linux/spinlock_types.h:41:9: error: incompatible types when assigning to type ‘struct mutex’ from type ‘spinlock_t’ {aka ‘struct spinlock’}
> >     41 |         (spinlock_t) __SPIN_LOCK_INITIALIZER(lockname)
> >        |         ^
> > ./include/linux/spinlock.h:342:20: note: in expansion of macro ‘__SPIN_LOCK_UNLOCKED’
> >    342 |         *(_lock) = __SPIN_LOCK_UNLOCKED(_lock); \
> >        |                    ^~~~~~~~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:730:9: note: in expansion of macro ‘spin_lock_init’
> >    730 |         spin_lock_init(&mgr->lock);
> >        |         ^~~~~~~~~~~~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c: In function ‘amdgpu_vram_mgr_fini’:
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:749:39: error: initialization of ‘struct amdgpu_vram_mgr *’ from incompatible pointer type ‘struct amdgpu_vram_mgr *’ [-Werror=incompatible-pointer-types]
> >    749 |         struct amdgpu_vram_mgr *mgr = &adev->mman.vram_mgr;
> >        |                                       ^
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:760:19: error: passing argument 1 of ‘spin_lock’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    760 |         spin_lock(&mgr->lock);
> >        |                   ^~~~~~~~~~
> >        |                   |
> >        |                   struct mutex *
> > ./include/linux/spinlock.h:347:51: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’
> >    347 | static __always_inline void spin_lock(spinlock_t *lock)
> >        |                                       ~~~~~~~~~~~~^~~~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:768:25: error: passing argument 1 of ‘drm_mm_takedown’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    768 |         drm_mm_takedown(&mgr->mm);
> >        |                         ^~~~~~~~
> >        |                         |
> >        |                         struct drm_buddy *
> > ./include/drm/drm_mm.h:468:37: note: expected ‘struct drm_mm *’ but argument is of type ‘struct drm_buddy *’
> >    468 | void drm_mm_takedown(struct drm_mm *mm);
> >        |                      ~~~~~~~~~~~~~~~^~
> > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c:769:21: error: passing argument 1 of ‘spin_unlock’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> >    769 |         spin_unlock(&mgr->lock);
> >        |                     ^~~~~~~~~~
> >        |                     |
> >        |                     struct mutex *
> > ./include/linux/spinlock.h:387:53: note: expected ‘spinlock_t *’ {aka ‘struct spinlock *’} but argument is of type ‘struct mutex *’
> >    387 | static __always_inline void spin_unlock(spinlock_t *lock)
> >        |                                         ~~~~~~~~~~~~^~~~
> > cc1: all warnings being treated as errors
> > make[4]: *** [scripts/Makefile.build:249: drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o] Error 1
> > make[4]: *** Waiting for unfinished jobs....
> >    CC [M]  drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.o
> > make[3]: *** [scripts/Makefile.build:466: drivers/gpu/drm/amd/amdgpu] Error 2
> > make[2]: *** [scripts/Makefile.build:466: drivers/gpu/drm] Error 2
> > make[1]: *** [scripts/Makefile.build:466: drivers/gpu] Error 2
> > make: *** [Makefile:1843: drivers] Error 2
> >
> > Regards,
> > Mauro
>


More information about the dri-devel mailing list