diff --git a/sys/external/bsd/drm2/dist/drm/radeon/radeon_cs.c b/sys/external/bsd/drm2/dist/drm/radeon/radeon_cs.c index 3d030afabfeb..69fd0b9e3c6b 100644 --- a/sys/external/bsd/drm2/dist/drm/radeon/radeon_cs.c +++ b/sys/external/bsd/drm2/dist/drm/radeon/radeon_cs.c @@ -672,6 +672,8 @@ static int radeon_cs_ib_fill(struct radeon_device *rdev, struct radeon_cs_parser return 0; } +DEFINE_WW_CLASS(radeon_lossage_class); + int radeon_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) { struct radeon_device *rdev = dev->dev_private; @@ -692,6 +694,8 @@ int radeon_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) } /* initialize parser */ memset(&parser, 0, sizeof(struct radeon_cs_parser)); + ww_acquire_init(&parser.ticket, &radeon_lossage_class); + ww_acquire_fini(&parser.ticket); parser.filp = filp; parser.rdev = rdev; parser.dev = rdev->dev; @@ -702,6 +706,9 @@ int radeon_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) radeon_cs_parser_fini(&parser, r, false); up_read(&rdev->exclusive_lock); r = radeon_cs_handle_lockup(rdev, r); + KASSERT(parser.ticket.wwx_acquired == ~0U); + KASSERT(parser.ticket.wwx_owner == NULL); + KDASSERT(parser.ticket.wwx_magic == 0xe9e9e9e9e9e9e9e9); return r; } @@ -716,6 +723,9 @@ int radeon_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) radeon_cs_parser_fini(&parser, r, false); up_read(&rdev->exclusive_lock); r = radeon_cs_handle_lockup(rdev, r); + KASSERT(parser.ticket.wwx_acquired == ~0U); + KASSERT(parser.ticket.wwx_owner == NULL); + KDASSERT(parser.ticket.wwx_magic == 0xe9e9e9e9e9e9e9e9); return r; } @@ -733,6 +743,9 @@ out: radeon_cs_parser_fini(&parser, r, true); up_read(&rdev->exclusive_lock); r = radeon_cs_handle_lockup(rdev, r); + KASSERT(parser.ticket.wwx_acquired == ~0U); + KASSERT(parser.ticket.wwx_owner == NULL); + KDASSERT(parser.ticket.wwx_magic == 0xe9e9e9e9e9e9e9e9); return r; }