All of lore.kernel.org
 help / color / mirror / Atom feed
From: ludovic.desroches@atmel.com (Ludovic Desroches)
To: linux-arm-kernel@lists.infradead.org
Subject: atmel-mci causes kernel panic when CONFIG_DEBUG_VM is set
Date: Thu, 19 May 2011 14:17:54 +0200	[thread overview]
Message-ID: <4DD50A72.2050501@atmel.com> (raw)
In-Reply-To: <4DD4E1DF.7030005@atmel.com>

On 5/19/2011 11:24 AM, Ludovic Desroches wrote:
> On 5/19/2011 10:04 AM, Barry Song wrote:
>> 2011/5/19 Ludovic Desroches<ludovic.desroches@atmel.com>:
>>> Hello,
>>>
>>> There is a bug with the atmel-mci driver when the debug feature
>>> CONFIG_DEBUG_VM is set.
>>>
>>> Into the atmci_read_data_pio function we use flush_dcache_page (do 
>>> we really
>>> need it?) which call the page_mapping function where we can find
>>> VM_BUG_ON(PageSlab(Page)). Then a kernel panic happens.
>>>
>>> I don't understand the purpose of the VM_BUG_ON(PageSlab(Page)) (the 
>>> page
>>> comes from a scatter list). How could I correct this problem?
>> linux/include/linux/mmdebug.h:
>>
>> #ifdef CONFIG_DEBUG_VM
>> #define VM_BUG_ON(cond) BUG_ON(cond)
>> #else
>> #define VM_BUG_ON(cond) do { (void)(cond); } while (0)
>> #endif
>>
>> it is something like "assert" in kernel.
>
> Thanks for your answer but I know that. My question is more focused on 
> why there is this check.
This the reason:

commit b5fab14e5d87df4d94161ae5f5e0c8625f9ffda2
Author: Christoph Lameter <clameter@sgi.com>
Date:   Tue Jul 17 04:03:33 2007 -0700

     Add VM_BUG_ON in case someone uses page_mapping on a slab page

     Detect slab objects being passed to the page oriented functions of 
the VM.

     It is not sufficient to simply return NULL because the functions 
calling
     page_mapping may depend on other items of the page_struct also to 
be setup
     properly.  Moreover slab object may not be properly aligned.  The page
     oriented functions of the VM expect to operate on page aligned, 
page sized
     objects.  Operations on object straddling page boundaries may only 
affect the
     objects partially which may lead to surprising results.

     It is better to detect eventually remaining uses and eliminate them.


> Is flushing a page taken from a slab forbidden ? Is it risky ? Is it 
> no sense ?
>
Other drivers do a flush_dcache_page on a page coming from a scatter 
list. So I think they will also have an assert when CONFIG_DEBUG_VM is set.

What is the proper way to do this flush (if needed) ?


Regards,

Ludovic

  reply	other threads:[~2011-05-19 12:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-19  7:53 atmel-mci causes kernel panic when CONFIG_DEBUG_VM is set Ludovic Desroches
2011-05-19  8:04 ` Barry Song
2011-05-19  9:24   ` Ludovic Desroches
2011-05-19 12:17     ` Ludovic Desroches [this message]
2011-05-19 15:16       ` Ludovic Desroches
2011-05-19 15:16         ` Ludovic Desroches
2011-05-19 18:25 ` Uwe Kleine-König
2011-05-19 18:25   ` Uwe Kleine-König
2011-05-19 18:25   ` Uwe Kleine-König
2011-05-19 18:25   ` Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DD50A72.2050501@atmel.com \
    --to=ludovic.desroches@atmel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.