Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Sep 2006 22:38:34 -0600
From:      Scott Long <scottl@samsco.org>
To:        Jan Mikkelsen <janm@transactionware.com>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: Patch: sym(4) "VTOBUS FAILED" panics on amd64, amd64/89550
Message-ID:  <451368CA.1030404@samsco.org>
In-Reply-To: <003001c6ddff$278d52d0$d435083d@transactionware.com>
References:  <003001c6ddff$278d52d0$d435083d@transactionware.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Jan Mikkelsen wrote:

> Hi,
> 
> Doug White wrote:
> 
>>On Fri, 22 Sep 2006, Jan Mikkelsen wrote:
>>
>>
>>>Quick summary:  sym(4) assumes on amd64 that virtual 
>>
>>addresses provided by
>>
>>>bus_dmamem_alloc() have the same alignment as the physical 
>>
>>addresses (in
>>
>>>this case, 2*PAGE_SIZE).  They don't, and stuff breaks.  
>>
>>This patch works
>>
>>>around that.
>>
>>Why is this? busdma supports alignment constraints; why not 
>>just set the 
>>alignment to what you need it set at? I realize sym has its own hand 
>>rolled DMA management craziness but alignment is something 
>>busdma can take 
>>care of easily.
> 
> 
> sym has the alignment requirement on the virtual address because of the
> buddy memory allocation algorithm; changing how sym allocates memory
> internally would remove the requirement.  The buddy algorithm with 2^13
> bytes aligned on a 2^12 byte (but not a 2^13 byte) boundary can provide two
> chunks of 2^12 bytes but nothing greater than 2^12 bytes.
> 
> The VTOBUS failure is caused by the buddy implementation making alignment
> assumptions which aren't true, and then getting the virtual addresses wrong.
> 
> Perhaps I'm just doing something wrong with bus_dma.  I believe I set the
> alignment requirements to be 2*PAGE_SIZE, and this is what I see for the
> physical address.  However the virtual address seems to only be page
> aligned.
> 
> I can't see any mention of virtual address alignment in the bus_dma man
> page.  Can it take care of virtual address alignment?  If so, how?
>  

busdma makes no guarantees on virtual addresses.

Sigh, sorry I never got this fixed.  The custom memory allocator made me
unhappy, and I never had time to dig into it.  Do real docs on sym exist
somewhere?  I'm not against sitting down and re-writing the physical
memory handling to both work and conform to the FreeBSD APIs.

Scott




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?451368CA.1030404>