From owner-svn-src-all@FreeBSD.ORG Fri Apr 23 14:48:30 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A887106566B; Fri, 23 Apr 2010 14:48:30 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 791F78FC0C; Fri, 23 Apr 2010 14:48:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3NEmUL6029442; Fri, 23 Apr 2010 14:48:30 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3NEmU3t029437; Fri, 23 Apr 2010 14:48:30 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <201004231448.o3NEmU3t029437@svn.freebsd.org> From: Robert Noland Date: Fri, 23 Apr 2010 14:48:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207118 - head/sys/dev/drm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2010 14:48:30 -0000 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;