svn commit: r207118 - head/sys/dev/drm
Robert Noland
rnoland at FreeBSD.org
Fri Apr 23 14:48:30 UTC 2010
Author: rnoland
Date: Fri Apr 23 14:48:30 2010
New Revision: 207118
URL: http://svn.freebsd.org/changeset/base/207118
Log:
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
Modified:
head/sys/dev/drm/drmP.h
head/sys/dev/drm/drm_hashtab.c
head/sys/dev/drm/drm_mm.c
head/sys/dev/drm/drm_sman.c
Modified: head/sys/dev/drm/drmP.h
==============================================================================
--- head/sys/dev/drm/drmP.h Fri Apr 23 14:35:03 2010 (r207117)
+++ head/sys/dev/drm/drmP.h Fri Apr 23 14:48:30 2010 (r207118)
@@ -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;
Modified: head/sys/dev/drm/drm_hashtab.c
==============================================================================
--- head/sys/dev/drm/drm_hashtab.c Fri Apr 23 14:35:03 2010 (r207117)
+++ head/sys/dev/drm/drm_hashtab.c Fri Apr 23 14:48:30 2010 (r207118)
@@ -46,7 +46,8 @@ int drm_ht_create(struct drm_open_hash *
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;
Modified: head/sys/dev/drm/drm_mm.c
==============================================================================
--- head/sys/dev/drm/drm_mm.c Fri Apr 23 14:35:03 2010 (r207117)
+++ head/sys/dev/drm/drm_mm.c Fri Apr 23 14:48:30 2010 (r207118)
@@ -333,7 +333,8 @@ int drm_mm_init(struct drm_mm * mm, unsi
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)
Modified: head/sys/dev/drm/drm_sman.c
==============================================================================
--- head/sys/dev/drm/drm_sman.c Fri Apr 23 14:35:03 2010 (r207117)
+++ head/sys/dev/drm/drm_sman.c Fri Apr 23 14:48:30 2010 (r207118)
@@ -96,7 +96,8 @@ static void *drm_sman_mm_allocate(void *
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 * sma
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_g
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
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;
More information about the svn-src-head
mailing list