Short summary of fixes pull:

* radeon: Uninterruptible fence waiting
  * tests: Fix use-after-free bug
  * vkms: Revert hrtimer fix
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEchf7rIzpz2NEoWjlaA3BHVMLeiMFAmUC+9wACgkQaA3BHVML
 eiOhFgf6A72+7tKe2XIioVJ/oOtU+6rFnFybexyIgJ6Yx7BB1ZoOn2dM6birfSld
 vhR87x6OaOEhZsi1bThg0lmzhHXRSRedipE26NmJApPmrXYBE1fFQzvUhN/rMC+M
 Yp0EM03iYT5IS1zwQR7P+G96ZaarQDd31ODCfR5+KfTMr8fVGmYsA4wh4UNNNgQg
 YXjpCrZ48N733upca3S/LgmkJAuR0hViS9DiD1bT40KZ40Rc8OIWbIhWy24chbgM
 /OvHFI/qplawVum9x0ltWAsv1OzOGIGPGaQg+4FuHLIgXntLRgB6H3rPHj0TEful
 c6vzBO61BrVRHMyRJSxioNHzp3NKag==
 =DlGq
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Dave Airlie 2023-09-15 11:07:05 +10:00
commit c3c9acb8b2
5 changed files with 11 additions and 17 deletions

View file

@ -123,7 +123,7 @@ int radeon_sa_bo_new(struct radeon_sa_manager *sa_manager,
unsigned int size, unsigned int align)
{
struct drm_suballoc *sa = drm_suballoc_new(&sa_manager->base, size,
GFP_KERNEL, true, align);
GFP_KERNEL, false, align);
if (IS_ERR(sa)) {
*sa_bo = NULL;

View file

@ -408,15 +408,10 @@ void vkms_set_composer(struct vkms_output *out, bool enabled)
if (enabled)
drm_crtc_vblank_get(&out->crtc);
mutex_lock(&out->enabled_lock);
spin_lock_irq(&out->lock);
old_enabled = out->composer_enabled;
out->composer_enabled = enabled;
/* the composition wasn't enabled, so unlock the lock to make sure the lock
* will be balanced even if we have a failed commit
*/
if (!out->composer_enabled)
mutex_unlock(&out->enabled_lock);
spin_unlock_irq(&out->lock);
if (old_enabled)
drm_crtc_vblank_put(&out->crtc);

View file

@ -16,7 +16,7 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
struct drm_crtc *crtc = &output->crtc;
struct vkms_crtc_state *state;
u64 ret_overrun;
bool ret, fence_cookie, composer_enabled;
bool ret, fence_cookie;
fence_cookie = dma_fence_begin_signalling();
@ -25,15 +25,15 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer)
if (ret_overrun != 1)
pr_warn("%s: vblank timer overrun\n", __func__);
spin_lock(&output->lock);
ret = drm_crtc_handle_vblank(crtc);
if (!ret)
DRM_ERROR("vkms failure on handling vblank");
state = output->composer_state;
composer_enabled = output->composer_enabled;
mutex_unlock(&output->enabled_lock);
spin_unlock(&output->lock);
if (state && composer_enabled) {
if (state && output->composer_enabled) {
u64 frame = drm_crtc_accurate_vblank_count(crtc);
/* 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,
spin_lock_init(&vkms_out->lock);
spin_lock_init(&vkms_out->composer_lock);
mutex_init(&vkms_out->enabled_lock);
vkms_out->composer_workq = alloc_ordered_workqueue("vkms_composer", 0);
if (!vkms_out->composer_workq)

View file

@ -108,10 +108,8 @@ struct vkms_output {
struct workqueue_struct *composer_workq;
/* protects concurrent access to composer */
spinlock_t lock;
/* guarantees that if the composer is enabled, a job will be queued */
struct mutex enabled_lock;
/* protected by @enabled_lock */
/* protected by @lock */
bool composer_enabled;
struct vkms_crtc_state *composer_state;

View file

@ -3,6 +3,8 @@
#ifndef DRM_KUNIT_HELPERS_H_
#define DRM_KUNIT_HELPERS_H_
#include <linux/device.h>
#include <kunit/test.h>
struct drm_device;
@ -51,7 +53,7 @@ __drm_kunit_helper_alloc_drm_device(struct kunit *test,
{
struct drm_driver *driver;
driver = kunit_kzalloc(test, sizeof(*driver), GFP_KERNEL);
driver = devm_kzalloc(dev, sizeof(*driver), GFP_KERNEL);
KUNIT_ASSERT_NOT_NULL(test, driver);
driver->driver_features = features;