linux-mips
[Top] [All Lists]

Re: [PATCH] MIPS: Alchemy: fix dbdma ring destruction memory deb

To: David Daney <ddaney@caviumnetworks.com>
Subject: Re: [PATCH] MIPS: Alchemy: fix dbdma ring destruction memory debugcheck.
From: Manuel Lauss <manuel.lauss@googlemail.com>
Date: Tue, 26 Jan 2010 18:58:42 +0100
Cc: Linux-MIPS <linux-mips@linux-mips.org>, Manuel Lauss <manuel.lauss@gmail.com>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=+9T+2Uz9knEkgelEuxTnRGCLYrbB9qa8+1kijWqPzqU=; b=X9AoqFOeZqz21yMYbzIlgA+K+Xjyb5N+dfDVOg1O6E4nRUCdZWHWMx6rKLSqUOl4es ztdOu4Erj7gd4xE3YrJSuHlWgR7pbqn7QPCPMQLIp5toWnYhqtMTqVVBMQDLR+G4voXC KpwZdqoCeYqCVQ2mPblPRe7aT0K8j5AiWbDoc=
Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=DLxm7xgH9a7bTv1gM0zJY3Lw9b30wMPtDeVHlJ+KzrKosjA1L+8qs5IhUw9JNxQ6hn dfSRMn+thHlbZaBvWVMJAE9wLRFAXD/o/+603g7e+znLh8j+tZXLZHvDPRvSAODHYWRF H6M55iX7Z3ijV3XlkgIQSt89HJjJOmRI/ViWI=
In-reply-to: <4B5F29EE.1060906@caviumnetworks.com>
References: <1264527242-9214-1-git-send-email-manuel.lauss@gmail.com> <4B5F29EE.1060906@caviumnetworks.com>
Sender: linux-mips-bounce@linux-mips.org
On Tue, Jan 26, 2010 at 6:44 PM, David Daney <ddaney@caviumnetworks.com> wrote:
> Manuel Lauss wrote:
>>
>> DBDMA descriptors need to be located at 32-byte aligned addresses;
>> however kmalloc rarely delivers such addresses.  The dbdma code
>> works around that by allocating 63 bytes and re-aligning the
>> descriptor base afterwards.  Hoewever when freeing memory it does
>> not account for this adjustment and trips the kfree debugcheck:
>>
>
> Correct me if I am wrong, but don't kmalloc et al. return blocks aligned
>  boundaries of the size rounded up the the next power of two?  So if you
> need 32-byte aligned addresses, just use a size value of 32 or greater.  You
> wouldn't have to add 63 and do masking and remember the membase value as you
> do in the patch.

The description is not completely correct (I suck a writing those):
It allocates a number
of descriptor entries (64 bytes each) specified by the driver in a single block:

        desc_base = (u32)kmalloc(entries * sizeof(au1x_ddma_desc_t),
                                 GFP_KERNEL|GFP_DMA);
        if (desc_base == 0)
                return 0;

        if (desc_base & 0x1f) {

So far the 3 users I have (mmc, spi, audio) always return true on the above
check (2 descriptors for audio for instance).

Manuel

<Prev in Thread] Current Thread [Next in Thread>