Gerd Hoffmann
2021-Feb-16 11:37 UTC
[PATCH 10/10] drm/qxl: add lock asserts to qxl_bo_kmap_locked + qxl_bo_kunmap_locked
Try avoid re-introducing locking bugs. Signed-off-by: Gerd Hoffmann <kraxel at redhat.com> --- drivers/gpu/drm/qxl/qxl_object.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm/qxl/qxl_object.c index 22748b9566af..90d5e5b7f927 100644 --- a/drivers/gpu/drm/qxl/qxl_object.c +++ b/drivers/gpu/drm/qxl/qxl_object.c @@ -162,6 +162,8 @@ int qxl_bo_kmap_locked(struct qxl_bo *bo, struct dma_buf_map *map) { int r; + dma_resv_assert_held(bo->tbo.base.resv); + if (bo->kptr) { bo->map_count++; goto out; @@ -236,6 +238,8 @@ void *qxl_bo_kmap_atomic_page(struct qxl_device *qdev, void qxl_bo_kunmap_locked(struct qxl_bo *bo) { + dma_resv_assert_held(bo->tbo.base.resv); + if (bo->kptr == NULL) return; bo->map_count--; -- 2.29.2
Thomas Zimmermann
2021-Feb-16 13:30 UTC
[PATCH 10/10] drm/qxl: add lock asserts to qxl_bo_kmap_locked + qxl_bo_kunmap_locked
Hi Am 16.02.21 um 12:37 schrieb Gerd Hoffmann:> Try avoid re-introducing locking bugs. > > Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>Acked-by: Thomas Zimmermann <tzimmermann at suse.de> IMHO this should eventually be done in the rsp TTM functions. But so far, I'd expect this to break some drivers. Best regards Thomas> --- > drivers/gpu/drm/qxl/qxl_object.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm/qxl/qxl_object.c > index 22748b9566af..90d5e5b7f927 100644 > --- a/drivers/gpu/drm/qxl/qxl_object.c > +++ b/drivers/gpu/drm/qxl/qxl_object.c > @@ -162,6 +162,8 @@ int qxl_bo_kmap_locked(struct qxl_bo *bo, struct dma_buf_map *map) > { > int r; > > + dma_resv_assert_held(bo->tbo.base.resv); > + > if (bo->kptr) { > bo->map_count++; > goto out; > @@ -236,6 +238,8 @@ void *qxl_bo_kmap_atomic_page(struct qxl_device *qdev, > > void qxl_bo_kunmap_locked(struct qxl_bo *bo) > { > + dma_resv_assert_held(bo->tbo.base.resv); > + > if (bo->kptr == NULL) > return; > bo->map_count--; >-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 N?rnberg, Germany (HRB 36809, AG N?rnberg) Gesch?ftsf?hrer: Felix Imend?rffer -------------- next part -------------- A non-text attachment was scrubbed... Name: OpenPGP_signature Type: application/pgp-signature Size: 840 bytes Desc: OpenPGP digital signature URL: <http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20210216/42797119/attachment-0001.sig>