Subject: Re: x86 bus_dmamem_alloc vs BUS_DMA_NOWAIT
To: YAMAMOTO Takashi <>
From: Manuel Bouyer <>
List: tech-kern
Date: 11/24/2005 21:50:08
On Thu, Nov 24, 2005 at 07:45:40PM +0900, YAMAMOTO Takashi wrote:
> > Hi,
> > the x86 bus_dmamem_alloc() doesn't look at the BUS_DMA_NOWAIT when calling
> > uvm_km_alloc(), as a result, an assertion can be triggered in uvm_map_prepare
> > if called from interrupt context with BUS_DMA_NOWAIT. For example see this
> > stack trace sent by John R. Shannon in private mail:
> > panic: kernel diagnostic assertion "doing_shutdown || curlwp != NULL || (map->flags & VM_MAP_INTRSAFE)" failed: file "/usr/src/sys/uvm/uvm_map.c", line 834
> > The attached patch should fix this (just translate BUS_DMA_NOWAIT to
> > UVM_KMF_NOWAIT). Does it looks right ?
> your patch is correct.

I see you fixed the bus_dma implementations that needed it. Thanks for this

> but i don't think that it fix the problem.
> you can't use kernel_map from interrupt context.

Hum, I guess most bus_dmamem_map implementations use kernel_map, right ?

I don't think drivers needs to do bus_dmamem_map/unmap from interrupt
context (I've patches to ahc/ahd to fix this; it's quite easy with
scsipi), but the man page doesn't say anything about interrupt context.

Manuel Bouyer <>
     NetBSD: 26 ans d'experience feront toujours la difference