Hi Kevin,

I tried to compile and use the "davinci_vpfe" as a module, but on 'rmmod
davinci-vpfe', I got a severe memory error:

/ $ rmmod davinci-vpfe
Bad page state in process 'rmmod'
page:c02d3020 flags:0x00000400 mapping:00000000 mapcount:0 count:0
Trying to fix it up, but a reboot is needed
Backtrace:

(this message seems to repeat ad infinitum, I didn't wait for it to
finish). :)

It turns out that the buffer pages are made Reserved in vpfe_init()
using the macro "SetPageReserved". I made a patch against the GIT tree
(which is attached) to solve this problem. Basically, the patch just
clears the Reserved bit on all pages using "ClearPageReserved" in
vpfe_cleanup(). 

Can you assess the correctness of my patch? I tested it, and I could
successfully rmmod the module. 

Best regards,
Sander



-----Original Message-----
From: Kevin Hilman [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 01, 2007 8:55 PM
To: Sander Huijsen
Cc: davinci-linux-open-source@linux.davincidsp.com
Subject: Re: [PATCH 1/1] ARM: DaVinci: video capture support... almost

Sander Huijsen wrote:
> 
> According to 'Linux Device Drivers' (O'Reilly, 3rd edition, Corbet et
> al.), the size N which is provided to get_order(N) must be a power of
> two. Since the requested buffer size 768*576*2 = 884,736 is not a
power
> of two, get_order() will return a value that is one too low. 

Great catch!  Thanks!  Here is an updated patch with this fix.

> I think there are two possible solutions:
> 
> #1 
> Replace get_order(VPFE_MAX_FBUF_SIZE) with
> (1+get_order(VPFE_MAX_FBUF_SIZE)).
> 
> #2
> Replace get_order(VPFE_MAX_FBUF_SIZE) with
> get_order(roundup_pow_of_two(VPFE_MAX_FBUF_SIZE)), which also works
> correctly if the buffer size is a power of two.
> 
> Since we already know that the buffer size is not a power of 2, I
think
> solution #1 is the best of the two (basically Alex' fix).

I prefer the roundup option because it is much more readable, and
clearer what is going on.

> However, I do believe that ALL get_order() occurences should be fixed
in
> davinci_vpfe.c, otherwise you will be freeing less memory than was
> claimed at first and possibly running into other problems.
>
> Alex' fix actually doubled the buffers that 1) were too small in the
> first place and 2) were overflown for that reason.

Now, I'm really wondering how this ever worked properly in the exisiting
2.6.10 kernel driver.

Kevin
  
--------------------------------------------------------

 
CONFIDENTIALITY NOTICE - This e-mail transmission, and any documents, files or 
previous e-mail messages attached to it may contain information that is 
confidential or legally privileged. If you are not the intended recipient, or a 
person responsible for delivering it to the intended recipient, you are hereby 
notified that you must not read this transmission and that any disclosure, 
copying, printing, distribution or use of any of the information contained in 
or attached to this transmission is STRICTLY PROHIBITED. If you have received 
this transmission in error, please immediately notify Sander Huijsen by 
telephone or [EMAIL PROTECTED] and delete the original transmission and its 
attachments without reading or saving in any manner.

Attachment: vpfe.patch
Description: vpfe.patch

_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to