From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: mika.kuoppala@linux.intel.com, intel-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm: Mark up racy check of drm_gem_object.handle_count
Date: Mon, 16 Mar 2020 11:03:40 +0100 [thread overview]
Message-ID: <20200316100340.GL2363188@phenom.ffwll.local> (raw)
In-Reply-To: <20200309120151.7675-1-chris@chris-wilson.co.uk>
On Mon, Mar 09, 2020 at 12:01:51PM +0000, Chris Wilson wrote:
> [ 1715.899800] BUG: KCSAN: data-race in drm_gem_handle_create_tail / drm_gem_object_handle_put_unlocked
> [ 1715.899838]
> [ 1715.899861] write to 0xffff8881830f3604 of 4 bytes by task 7834 on cpu 1:
> [ 1715.899896] drm_gem_handle_create_tail+0x62/0x250
> [ 1715.899927] drm_gem_open_ioctl+0xc1/0x160
> [ 1715.899956] drm_ioctl_kernel+0xe4/0x120
> [ 1715.899981] drm_ioctl+0x297/0x4c7
> [ 1715.900003] ksys_ioctl+0x89/0xb0
> [ 1715.900027] __x64_sys_ioctl+0x42/0x60
> [ 1715.900052] do_syscall_64+0x6e/0x2c0
> [ 1715.900079] entry_SYSCALL_64_after_hwframe+0x44/0xa9
> [ 1715.900100]
> [ 1715.900119] read to 0xffff8881830f3604 of 4 bytes by task 8137 on cpu 0:
> [ 1715.900149] drm_gem_object_handle_put_unlocked+0x31/0x130
> [ 1715.900180] drm_gem_object_release_handle+0x93/0xe0
> [ 1715.900208] drm_gem_handle_delete+0x7b/0xe0
> [ 1715.900235] drm_gem_close_ioctl+0x61/0x80
> [ 1715.900264] drm_ioctl_kernel+0xe4/0x120
> [ 1715.900291] drm_ioctl+0x297/0x4c7
> [ 1715.900316] ksys_ioctl+0x89/0xb0
> [ 1715.900340] __x64_sys_ioctl+0x42/0x60
> [ 1715.900363] do_syscall_64+0x6e/0x2c0
> [ 1715.900388] entry_SYSCALL_64_after_hwframe+0x44/0xa9
I'm impressed. The dream that we all get replaced by some scripts might be
real :-)
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> drivers/gpu/drm/drm_gem.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index a9e4a610445a..37627d06fb06 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -218,7 +218,7 @@ drm_gem_object_handle_put_unlocked(struct drm_gem_object *obj)
> struct drm_device *dev = obj->dev;
> bool final = false;
>
> - if (WARN_ON(obj->handle_count == 0))
> + if (WARN_ON(READ_ONCE(obj->handle_count) == 0))
> return;
>
> /*
> --
> 2.20.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
prev parent reply other threads:[~2020-03-16 10:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-09 12:01 [PATCH] drm: Mark up racy check of drm_gem_object.handle_count Chris Wilson
2020-03-16 10:03 ` Daniel Vetter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200316100340.GL2363188@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=chris@chris-wilson.co.uk \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mika.kuoppala@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox