2021-02-04 15:08:07

by Christian König

[permalink] [raw]
Subject: Re: [PATCH v6 01/10] [hack] silence ttm fini WARNING

?

What's the background here?

Christian.

Am 04.02.21 um 15:57 schrieb Gerd Hoffmann:
> kobject: '(null)' ((____ptrval____)): is not initialized, yet kobject_put() is being called.
> WARNING: CPU: 0 PID: 209 at lib/kobject.c:750 kobject_put+0x3a/0x60
> [ ... ]
> Call Trace:
> ttm_device_fini+0x133/0x1b0 [ttm]
> qxl_ttm_fini+0x2f/0x40 [qxl]
> ---
> drivers/gpu/drm/ttm/ttm_device.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c
> index ac0903c9e60a..b638cbb0bd45 100644
> --- a/drivers/gpu/drm/ttm/ttm_device.c
> +++ b/drivers/gpu/drm/ttm/ttm_device.c
> @@ -50,7 +50,7 @@ static void ttm_global_release(void)
> goto out;
>
> kobject_del(&glob->kobj);
> - kobject_put(&glob->kobj);
> +// kobject_put(&glob->kobj);
> ttm_mem_global_release(&ttm_mem_glob);
> __free_page(glob->dummy_read_page);
> memset(glob, 0, sizeof(*glob));


2021-02-05 07:45:26

by Gerd Hoffmann

[permalink] [raw]
Subject: Re: [PATCH v6 01/10] [hack] silence ttm fini WARNING

On Thu, Feb 04, 2021 at 03:58:33PM +0100, Christian K?nig wrote:
> ?
>
> What's the background here?
>
> Christian.
>
> Am 04.02.21 um 15:57 schrieb Gerd Hoffmann:
> > kobject: '(null)' ((____ptrval____)): is not initialized, yet kobject_put() is being called.
> > WARNING: CPU: 0 PID: 209 at lib/kobject.c:750 kobject_put+0x3a/0x60
> > [ ... ]
> > Call Trace:
> > ttm_device_fini+0x133/0x1b0 [ttm]
> > qxl_ttm_fini+0x2f/0x40 [qxl]

Happens on driver removal. Seen with both qxl and bochs (the later
using vram helpers).

Testcase: "drmtest --unbind" (https://git.kraxel.org/cgit/drminfo/).

static int try_unbind(int card)
{
char path[256];
char *device, *name;
int fd;

snprintf(path, sizeof(path), "/sys/class/drm/card%d/device", card);
device = realpath(path, NULL);
if (device == NULL) {
fprintf(stderr, "%s: can't resolve sysfs device path\n", __func__);
return -1;
}

snprintf(path, sizeof(path), "%s/driver/unbind", device);
fd = open(path, O_WRONLY);
if (fd < 0) {
fprintf(stderr, "open %s: %s\n", path, strerror(errno));
return -1;
}

name = strrchr(device, '/') + 1;
write(fd, name, strlen(name));
close(fd);
return 0;
}

take care,
Gerd