[Mesa-dev] [PATCH] vc4: Fix infinite retry in vc4_bo_alloc()
Eric Engestrom
eric.engestrom at imgtec.com
Tue Sep 26 18:01:24 UTC 2017
On Tuesday, 2017-09-26 07:48:37 +0000, Boris Brezillon wrote:
> cleared_and_retried is always reset to false when jumping to the retry
> label, thus leading to an infinite retry loop.
>
> Fix that by moving the cleared_and_retried variable definitions at the
> beginning of the function.
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>
Fixes: 78087676c98aa8884ba92 "vc4: Restructure the simulator mode."
Cc: Eric Anholt <eric at anholt.net>
> While we're at it, move the create variable with the other local
> variables and explicitly reset its content in the retry path.
That was actually changed the other way around by the commit which
introduced the bug (78087676c98aa8884ba92); you should probably wait for
Eric Anholt's reply (cc'ed) on this before reverting that.
(you might want to split the two changes into two patches)
>
> Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
> ---
> src/gallium/drivers/vc4/vc4_bufmgr.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/src/gallium/drivers/vc4/vc4_bufmgr.c b/src/gallium/drivers/vc4/vc4_bufmgr.c
> index 12af7f8a9ef2..0653f8823232 100644
> --- a/src/gallium/drivers/vc4/vc4_bufmgr.c
> +++ b/src/gallium/drivers/vc4/vc4_bufmgr.c
> @@ -123,6 +123,8 @@ vc4_bo_from_cache(struct vc4_screen *screen, uint32_t size, const char *name)
> struct vc4_bo *
> vc4_bo_alloc(struct vc4_screen *screen, uint32_t size, const char *name)
> {
> + bool cleared_and_retried = false;
> + struct drm_vc4_create_bo create;
> struct vc4_bo *bo;
> int ret;
>
> @@ -149,12 +151,8 @@ vc4_bo_alloc(struct vc4_screen *screen, uint32_t size, const char *name)
> bo->private = true;
>
> retry:
> - ;
> -
> - bool cleared_and_retried = false;
> - struct drm_vc4_create_bo create = {
> - .size = size
> - };
> + memset(&create, 0, sizeof(create));
> + create.size = size;
>
> ret = vc4_ioctl(screen->fd, DRM_IOCTL_VC4_CREATE_BO, &create);
> bo->handle = create.handle;
> --
> 2.11.0
>
More information about the mesa-dev
mailing list