Re: xorg 7.2 locks system in current

From: Ganbold <ganbold_at_micom.mng.net>
Date: Fri, 06 Jul 2007 18:17:48 +0800
Kostik Belousov wrote:
> [Redirecting to x11_at_ as more appropriate]
>
> On Fri, Jul 06, 2007 at 12:44:43PM +0800, Ganbold wrote:
>   
>> Hi,
>>
>> I have todays CURRENT. My machine is Dell Latitude D620 with 945GM 
>> graphics card.
>> When I try to run xorg 7.2, my machine hangs and on serial console it 
>> showed:
>>
>> uma_zalloc_arg: zone "64" with the following non-sleepable locks held:
>> exclusive sleep mutex drm device r = 0 (0xc3c06cd8) locked _at_ 
>> /usr/src/sys/modules/drm/drm/../../../dev/drm/drm_drv.c:907
>> KDB: enter: witness_warn
>> [thread pid 739 tid 100092 ]
>> Stopped at      kdb_enter+0x32: leave
>> db> bt
>> Tracing pid 739 tid 100092 td 0xc3fe2220
>> kdb_enter(c086100b,e63ea9fc,4,1,0,...) at kdb_enter+0x32
>> witness_warn(5,0,c08bd9fe,c08a71b1,66666666,...) at witness_warn+0x1b9
>> uma_zalloc_arg(c1072d20,0,102,2,c09d9d64,...) at uma_zalloc_arg+0x34
>> malloc(2c,c093d0c0,102,12,c4325db0,...) at malloc+0xd2
>> sysctl_add_oid(c4325dcc,c09d9d64,ffffffff,c4325db0,80000001,...) at 
>> sysctl_add_oid+0x95
>> alloc_bounce_zone(44,c09399e0,101,1000,c3c8ec80,...) at 
>> alloc_bounce_zone+0x16d
>> bus_dma_tag_create(0,1000,0,ffffffff,ffffffff,...) at 
>> bus_dma_tag_create+0x1a9
>> drm_pci_alloc(c3c06c00,1000,1000,ffffffff,20000,...) at drm_pci_alloc+0xe1
>> i915_dma_init(c3bf3800,80446440,c4325e80,3,c3fe2220,...) at 
>> i915_dma_init+0x2b8
>> drm_ioctl(c3bf3800,80446440,c4325e80,3,c3fe2220,...) at drm_ioctl+0x357
>> giant_ioctl(c3bf3800,80446440,c4325e80,3,c3fe2220,...) at giant_ioctl+0x56
>> devfs_ioctl_f(c3e70048,80446440,c4325e80,c405c500,c3fe2220,...) at 
>> devfs_ioctl_f+0xc9
>> kern_ioctl(c3fe2220,8,80446440,c4325e80,0,...) at kern_ioctl+0x243
>> ioctl(c3fe2220,e63eacfc,c,c089e511,c0935830,...) at ioctl+0x134
>> syscall(e63ead38) at syscall+0x2b3
>> Xint0x80_syscall() at Xint0x80_syscall+0x20
>> --- syscall (54, FreeBSD ELF32, ioctl), eip = 0x483decc3, esp = 
>> 0xbfbfea5c, ebp = 0xbfbfea78 ---
>> db>
>> db> c
>> uma_zalloc_arg: zone "16" with the following non-sleepable locks held:
>> exclusive sleep mutex drm device r = 0 (0xc3c06cd8) locked _at_ 
>> /usr/src/sys/modules/drm/drm/../../../dev/drm/drm_drv.c:907
>> KDB: enter: witness_warn
>> [thread pid 739 tid 100092 ]
>> Stopped at      kdb_enter+0x32: leave
>> db>
>>
>> thanks,
>>
>> Ganbold
>>     
>
> Man page states explicitely that bus_dma_tag_create() (as well as
> bus_dmamem_alloc()) shall not be called with non-sleepable lock held.
> I am not completely sure, but it seems to be safe to drop the drm
> lock around drm_pci_alloc() when the later moved to the start of the
> i915_initialize().
>
> Could you, please, test the patch below ?
>
> diff --git a/sys/dev/drm/i915_dma.c b/sys/dev/drm/i915_dma.c
> index 1d1877b..118d160 100644
> --- a/sys/dev/drm/i915_dma.c
> +++ b/sys/dev/drm/i915_dma.c
> _at__at_ -122,7 +122,22 _at__at_ static int i915_initialize(drm_device_t * dev,
>  			   drm_i915_private_t * dev_priv,
>  			   drm_i915_init_t * init)
>  {
> +	drm_dma_handle_t *dmah;
> +
> +	DRM_UNLOCK();
> +	dmah = drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 
> +	    0xffffffff);
> +	if (!dmah) {
> +		dev->dev_private = (void *)dev_priv;
> +		i915_dma_cleanup(dev);
> +		DRM_ERROR("Can not allocate hardware status page\n");
> +		DRM_LOCK();
> +		return DRM_ERR(ENOMEM);
> +	}
> +	DRM_LOCK();
> +
>  	memset(dev_priv, 0, sizeof(drm_i915_private_t));
> +	dev_priv->status_page_dmah = dmah;
>  
>  	DRM_GETSAREA();
>  	if (!dev_priv->sarea) {
> _at__at_ -181,15 +196,6 _at__at_ static int i915_initialize(drm_device_t * dev,
>  	dev_priv->allow_batchbuffer = 1;
>  
>  	/* Program Hardware Status Page */
> -	dev_priv->status_page_dmah = drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 
> -	    0xffffffff);
> -
> -	if (!dev_priv->status_page_dmah) {
> -		dev->dev_private = (void *)dev_priv;
> -		i915_dma_cleanup(dev);
> -		DRM_ERROR("Can not allocate hardware status page\n");
> -		return DRM_ERR(ENOMEM);
> -	}
>  	dev_priv->hw_status_page = dev_priv->status_page_dmah->vaddr;
>  	dev_priv->dma_status_page = dev_priv->status_page_dmah->busaddr;
>  	
>   

Thanks a lot, Xorg 7.2 works here with above patch with WITNESS enabled 
kernel.


Ganbold


-- 
What the world *really* needs is a good Automatic Bicycle Sharpener.
Received on Fri Jul 06 2007 - 08:17:56 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:13 UTC