Skip to contentSkip to conversation

compositing broken in -next (idr bug)

PATCH Jiri Slaby 2 participants 6 messages Feb 12, 2013

Subsystems (2)
lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

Hi,

this commit in -next causes my KDE to get stuck while starting. I see only the splash screen. If I disable effects by alt-shift-f12, it continues.

I bisected it to this commit:
commit 430440fce7da4ad52c2af06a04a5132e5d19faaf

Author: Tejun Heo <[email protected]>
Date:   Thu Feb 7 12:31:37 2013 +1100

drm: convert to idr_alloc()

More concretely to the change in drm_gem_flink_ioctl. If I revert solely that one, it works again. Maybe I'm blind, but I do not see why...

Well I see a bug in there, but that is not the root cause -- there is a missing call to idr_preload_end. Of course, that one only leaves preemption disabled forever.

What I tried with no effect is this:

drivers/gpu/drm/drm_gem.c +0 -0
@@ -453,7 +453,8 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
        spin_lock(&dev->object_name_lock);
        if (!obj->name) {
                ret = idr_alloc(&dev->object_name_idr, obj, 1, 0,

GFP_NOWAIT);
- obj->name = ret;
+ if (ret >= 0)

+                       obj->name = ret;
                args->name = (uint64_t) obj->name;
                spin_unlock(&dev->object_name_lock);

@@ -469,6 +470,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,

        }

err:

+       idr_preload_end();
        drm_gem_object_unreference_unlocked(obj);
        return ret;

}

thanks,

Signature · 2 lines
js
suse labs
#1 lore raw

Hello, Jiri.

Quoted 11 lines · Jiri Slaby

this commit in -next causes my KDE to get stuck while starting. I see only the splash screen. If I disable effects by alt-shift-f12, it continues.

I bisected it to this commit:
commit 430440fce7da4ad52c2af06a04a5132e5d19faaf

Author: Tejun Heo <[email protected]>
Date:   Thu Feb 7 12:31:37 2013 +1100

drm: convert to idr_alloc()

Quoted 6 lines

More concretely to the change in drm_gem_flink_ioctl. If I revert solely that one, it works again. Maybe I'm blind, but I do not see why...

Well I see a bug in there, but that is not the root cause -- there is a missing call to idr_preload_end. Of course, that one only leaves preemption disabled forever.

Fix for this bug is already queued in -mm.

http://article.gmane.org/gmane.linux.kernel/1439101/raw

But you're saying that adding the missing idr_preload_end() doesn't make the problem go away, right?

Thanks.

Signature · 1 line
tejun
author
#2 lore raw
Quoted 21 lines · Tejun Heo

Hello, Jiri.

Quoted 11 lines · Jiri Slaby

this commit in -next causes my KDE to get stuck while starting. I see only the splash screen. If I disable effects by alt-shift-f12, it continues.

I bisected it to this commit:
commit 430440fce7da4ad52c2af06a04a5132e5d19faaf

Author: Tejun Heo <[email protected]>
Date:   Thu Feb 7 12:31:37 2013 +1100

drm: convert to idr_alloc()

Quoted 6 lines

More concretely to the change in drm_gem_flink_ioctl. If I revert solely that one, it works again. Maybe I'm blind, but I do not see why...

Well I see a bug in there, but that is not the root cause -- there is a missing call to idr_preload_end. Of course, that one only leaves preemption disabled forever.

Quoted 6 lines

Fix for this bug is already queued in -mm.

http://article.gmane.org/gmane.linux.kernel/1439101/raw

But you're saying that adding the missing idr_preload_end() doesn't make the problem go away, right?

Yeah, right. I had to revert the whole hunk...

Signature · 2 lines
js
suse labs
author
#3 lore raw
In reply to Jiri Slaby
Quoted 14 lines · Jiri Slaby
drivers/gpu/drm/drm_gem.c +2 -1
@@ -453,7 +453,8 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
        spin_lock(&dev->object_name_lock);
        if (!obj->name) {
                ret = idr_alloc(&dev->object_name_idr, obj, 1, 0,
 GFP_NOWAIT);
-               obj->name = ret;
+               if (ret >= 0)
+                       obj->name = ret;
                args->name = (uint64_t) obj->name;
                spin_unlock(&dev->object_name_lock);

drivers/gpu/drm/drm_gem.c drm_gem_flink_ioctl(struct drm_device *dev, void *data, · line 475

Quoted 6 lines
drivers/gpu/drm/drm_gem.c +1 -0
@@ -469,6 +470,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
        }
 
 err:
+       idr_preload_end();
        drm_gem_object_unreference_unlocked(obj);
        return ret;

Oh my, maybe: return ret < 0 ? ret : 0... Let's try.

Signature · 2 lines
js
suse labs
author
#4 lore raw
Quoted 17 lines · Jiri Slaby
Quoted 16 lines · Jiri Slaby
drivers/gpu/drm/drm_gem.c +2 -1
@@ -453,7 +453,8 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
        spin_lock(&dev->object_name_lock);
        if (!obj->name) {
                ret = idr_alloc(&dev->object_name_idr, obj, 1, 0,
 GFP_NOWAIT);
-               obj->name = ret;
+               if (ret >= 0)
+                       obj->name = ret;
                args->name = (uint64_t) obj->name;
                spin_unlock(&dev->object_name_lock);
@@ -469,6 +470,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
        }
 
Quoted 6 lines

drivers/gpu/drm/drm_gem.c drm_gem_flink_ioctl(struct drm_device *dev, void *data, · line 475

Quoted 4 lines
drivers/gpu/drm/drm_gem.c +1 -0
 err:
+       idr_preload_end();
        drm_gem_object_unreference_unlocked(obj);
        return ret;

Oh my, maybe: return ret < 0 ? ret : 0... Let's try.

Bull's eye.

drivers/gpu/drm/drm_gem.c +1 -0
@@ -459,6 +459,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
 
                if (ret < 0)
                        goto err;
+               ret = 0;
 
                /* Allocate a reference for the name table.  */
                drm_gem_object_reference(obj);
Signature · 2 lines
js
suse labs
#5 lore raw

Hello, Jiri.

Quoted 3 lines · Jiri Slaby
Quoted 1 line

Oh my, maybe: return ret < 0 ? ret : 0... Let's try.

Bull's eye.

Aieee....

drivers/gpu/drm/drm_gem.c drm_gem_flink_ioctl(struct drm_device *dev, void *data, · line 465

Quoted 10 lines
drivers/gpu/drm/drm_gem.c +1 -0
@@ -459,6 +459,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
 
                if (ret < 0)
                        goto err;
+               ret = 0;
 
                /* Allocate a reference for the name table.  */
                drm_gem_object_reference(obj);

Care to write up a proper patch w/ SOB?

Thanks!

Signature · 1 line
tejun