summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/vkms/vkms_drv.h
diff options
context:
space:
mode:
authorHaneen Mohammed <hamohammed.sa@gmail.com>2018-09-04 00:18:17 +0300
committerDaniel Vetter <daniel.vetter@ffwll.ch>2018-09-05 17:04:50 +0300
commit0ca33adb91c0a94a29bdcecf49cd08fe24a21666 (patch)
treee487af079a4fd29add813e801f9afcc3f0f2d37f /drivers/gpu/drm/vkms/vkms_drv.h
parent428e15cc41e3603942edd4a1aa991127ce9eccea (diff)
downloadlinux-0ca33adb91c0a94a29bdcecf49cd08fe24a21666.tar.xz
drm/vkms: Fix race condition around accessing frame number
crtc_state is accessed by both vblank_handle() and the ordered work_struct handle vkms_crc_work_handle() to retrieve and or update the frame number for computed CRC. Since work_struct can fail, add frame_end to account for missing frame numbers. Use (frame_[start/end]) for synchronization between hrtimer callback and ordered work_struct handle. This patch passes the following subtests from igt kms_pipe_crc_basic test: bad-source, read-crc-pipe-A, read-crc-pipe-A-frame-sequence, nonblocking-crc-pipe-A, nonblocking-crc-pipe-A-frame-sequence Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20180903211743.GA2773@haneenDRM
Diffstat (limited to 'drivers/gpu/drm/vkms/vkms_drv.h')
-rw-r--r--drivers/gpu/drm/vkms/vkms_drv.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index 2017a2ccc43d..80af6d3a65e7 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -39,12 +39,14 @@ struct vkms_plane_state {
* vkms_crtc_state - Driver specific CRTC state
* @base: base CRTC state
* @crc_work: work struct to compute and add CRC entries
- * @n_frame: frame number for computed CRC
+ * @n_frame_start: start frame number for computed CRC
+ * @n_frame_end: end frame number for computed CRC
*/
struct vkms_crtc_state {
struct drm_crtc_state base;
struct work_struct crc_work;
- unsigned int n_frame;
+ u64 frame_start;
+ u64 frame_end;
};
struct vkms_output {
@@ -59,6 +61,8 @@ struct vkms_output {
struct workqueue_struct *crc_workq;
/* protects concurrent access to crc_data */
spinlock_t lock;
+ /* protects concurrent access to crtc_state */
+ spinlock_t state_lock;
};
struct vkms_device {