Skip to content

Commit c3c9acb

Browse files
committed
Merge tag 'drm-misc-fixes-2023-09-14' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
Short summary of fixes pull: * radeon: Uninterruptible fence waiting * tests: Fix use-after-free bug * vkms: Revert hrtimer fix Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20230914122649.GA28252@linux-uq9g
2 parents c6fbd2b + 139a278 commit c3c9acb

File tree

5 files changed

+11
-17
lines changed

5 files changed

+11
-17
lines changed

drivers/gpu/drm/radeon/radeon_sa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ int radeon_sa_bo_new(struct radeon_sa_manager *sa_manager,
123123
unsigned int size, unsigned int align)
124124
{
125125
struct drm_suballoc *sa = drm_suballoc_new(&sa_manager->base, size,
126-
GFP_KERNEL, true, align);
126+
GFP_KERNEL, false, align);
127127

128128
if (IS_ERR(sa)) {
129129
*sa_bo = NULL;

drivers/gpu/drm/vkms/vkms_composer.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -408,15 +408,10 @@ void vkms_set_composer(struct vkms_output *out, bool enabled)
408408
if (enabled)
409409
drm_crtc_vblank_get(&out->crtc);
410410

411-
mutex_lock(&out->enabled_lock);
411+
spin_lock_irq(&out->lock);
412412
old_enabled = out->composer_enabled;
413413
out->composer_enabled = enabled;
414-
415-
/* the composition wasn't enabled, so unlock the lock to make sure the lock
416-
* will be balanced even if we have a failed commit
417-
*/
418-
if (!out->composer_enabled)
419-
mutex_unlock(&out->enabled_lock);
414+
spin_unlock_irq(&out->lock);
420415

421416
if (old_enabled)
422417
drm_crtc_vblank_put(&out->crtc);

drivers/gpu/drm/vkms/vkms_crtc.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
1616
struct drm_crtc *crtc = &output->crtc;
1717
struct vkms_crtc_state *state;
1818
u64 ret_overrun;
19-
bool ret, fence_cookie, composer_enabled;
19+
bool ret, fence_cookie;
2020

2121
fence_cookie = dma_fence_begin_signalling();
2222

@@ -25,15 +25,15 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
2525
if (ret_overrun != 1)
2626
pr_warn("%s: vblank timer overrun\n", __func__);
2727

28+
spin_lock(&output->lock);
2829
ret = drm_crtc_handle_vblank(crtc);
2930
if (!ret)
3031
DRM_ERROR("vkms failure on handling vblank");
3132

3233
state = output->composer_state;
33-
composer_enabled = output->composer_enabled;
34-
mutex_unlock(&output->enabled_lock);
34+
spin_unlock(&output->lock);
3535

36-
if (state && composer_enabled) {
36+
if (state && output->composer_enabled) {
3737
u64 frame = drm_crtc_accurate_vblank_count(crtc);
3838

3939
/* update frame_start only if a queued vkms_composer_worker()
@@ -295,7 +295,6 @@ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
295295

296296
spin_lock_init(&vkms_out->lock);
297297
spin_lock_init(&vkms_out->composer_lock);
298-
mutex_init(&vkms_out->enabled_lock);
299298

300299
vkms_out->composer_workq = alloc_ordered_workqueue("vkms_composer", 0);
301300
if (!vkms_out->composer_workq)

drivers/gpu/drm/vkms/vkms_drv.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,8 @@ struct vkms_output {
108108
struct workqueue_struct *composer_workq;
109109
/* protects concurrent access to composer */
110110
spinlock_t lock;
111-
/* guarantees that if the composer is enabled, a job will be queued */
112-
struct mutex enabled_lock;
113111

114-
/* protected by @enabled_lock */
112+
/* protected by @lock */
115113
bool composer_enabled;
116114
struct vkms_crtc_state *composer_state;
117115

include/drm/drm_kunit_helpers.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#ifndef DRM_KUNIT_HELPERS_H_
44
#define DRM_KUNIT_HELPERS_H_
55

6+
#include <linux/device.h>
7+
68
#include <kunit/test.h>
79

810
struct drm_device;
@@ -51,7 +53,7 @@ __drm_kunit_helper_alloc_drm_device(struct kunit *test,
5153
{
5254
struct drm_driver *driver;
5355

54-
driver = kunit_kzalloc(test, sizeof(*driver), GFP_KERNEL);
56+
driver = devm_kzalloc(dev, sizeof(*driver), GFP_KERNEL);
5557
KUNIT_ASSERT_NOT_NULL(test, driver);
5658

5759
driver->driver_features = features;

0 commit comments

Comments
 (0)