Address some WITNESS panics that occur when using the via driver.
Some of these cases should be safe in a non-atomic fashion, however since all of the driver ioctls are locked, a lot of work is required to fix it correctly. Just don't sleep now. MFC after: 2 weeks
This commit is contained in:
parent
2f826fdf53
commit
05d841b38b
@ -228,7 +228,7 @@ enum {
|
||||
#define DRM_MTRR_WC MDF_WRITECOMBINE
|
||||
#define jiffies ticks
|
||||
|
||||
typedef unsigned long dma_addr_t;
|
||||
typedef vm_paddr_t dma_addr_t;
|
||||
typedef u_int64_t u64;
|
||||
typedef u_int32_t u32;
|
||||
typedef u_int16_t u16;
|
||||
|
@ -46,7 +46,8 @@ int drm_ht_create(struct drm_open_hash *ht, unsigned int order)
|
||||
ht->size = 1 << order;
|
||||
ht->order = order;
|
||||
ht->table = NULL;
|
||||
ht->table = hashinit(ht->size, DRM_MEM_HASHTAB, &ht->mask);
|
||||
ht->table = hashinit_flags(ht->size, DRM_MEM_HASHTAB, &ht->mask,
|
||||
HASH_NOWAIT);
|
||||
if (!ht->table) {
|
||||
DRM_ERROR("Out of memory for hash table\n");
|
||||
return -ENOMEM;
|
||||
|
@ -333,7 +333,8 @@ int drm_mm_init(struct drm_mm * mm, unsigned long start, unsigned long size)
|
||||
mm->num_unused = 0;
|
||||
mtx_init(&mm->unused_lock, "drm_unused", NULL, MTX_DEF);
|
||||
|
||||
return drm_mm_create_tail_node(mm, start, size, 0);
|
||||
/* XXX This could be non-atomic but gets called from a locked path */
|
||||
return drm_mm_create_tail_node(mm, start, size, 1);
|
||||
}
|
||||
|
||||
void drm_mm_takedown(struct drm_mm * mm)
|
||||
|
@ -96,7 +96,8 @@ static void *drm_sman_mm_allocate(void *private, unsigned long size,
|
||||
if (!tmp) {
|
||||
return NULL;
|
||||
}
|
||||
tmp = drm_mm_get_block(tmp, size, alignment);
|
||||
/* This could be non-atomic, but we are called from a locked path */
|
||||
tmp = drm_mm_get_block_atomic(tmp, size, alignment);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@ -131,7 +132,7 @@ drm_sman_set_range(struct drm_sman * sman, unsigned int manager,
|
||||
KASSERT(manager < sman->num_managers, ("Invalid manager"));
|
||||
|
||||
sman_mm = &sman->mm[manager];
|
||||
mm = malloc(sizeof(*mm), DRM_MEM_MM, M_WAITOK | M_ZERO);
|
||||
mm = malloc(sizeof(*mm), DRM_MEM_MM, M_NOWAIT | M_ZERO);
|
||||
if (!mm) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
@ -174,7 +175,7 @@ static struct drm_owner_item *drm_sman_get_owner_item(struct drm_sman * sman,
|
||||
owner_hash);
|
||||
}
|
||||
|
||||
owner_item = malloc(sizeof(*owner_item), DRM_MEM_MM, M_WAITOK | M_ZERO);
|
||||
owner_item = malloc(sizeof(*owner_item), DRM_MEM_MM, M_NOWAIT | M_ZERO);
|
||||
if (!owner_item)
|
||||
goto out;
|
||||
|
||||
@ -206,12 +207,11 @@ struct drm_memblock_item *drm_sman_alloc(struct drm_sman *sman, unsigned int man
|
||||
|
||||
sman_mm = &sman->mm[manager];
|
||||
tmp = sman_mm->allocate(sman_mm->private, size, alignment);
|
||||
|
||||
if (!tmp) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memblock = malloc(sizeof(*memblock), DRM_MEM_MM, M_WAITOK | M_ZERO);
|
||||
memblock = malloc(sizeof(*memblock), DRM_MEM_MM, M_NOWAIT | M_ZERO);
|
||||
DRM_DEBUG("allocated mem_block %p\n", memblock);
|
||||
if (!memblock)
|
||||
goto out;
|
||||
|
Loading…
Reference in New Issue
Block a user