__free_pages_ok oops
Is it possible to modify your patch from:
if (in_interrupt())
BUG();
to
if (unlikely(in_interrupt())
BUG();
-- Amol
Hugh Dickins <[email protected]> on 02/08/2002 11:16:56 PM
To: Andrew Morton <[email protected]>
cc: Andrea Arcangeli <[email protected]>, Rik van Riel <[email protected]>,
"David S. Miller" <[email protected]>, Benjamin LaHaise <[email protected]>, Marcelo Tosatti <[email protected]>, Gerd Knorr <[email protected]>, [email protected] (bcc: Amol Lad/HSS)
Subject: Re: [PATCH] __free_pages_ok oops
Quoted 3 lines · Andrew Morton
OK, I agree the weird case won't trigger the bug. So I think we
agree that we need to run with Hugh's BUG check and do nothing else.
Thank you, Andrew and Andrea, for exploring and exploding those myths. I've checked back on the BUG which Ben submitted his 1st Jan patch for, and it was actually a PageLRU(page) in rmqueue, not in __free_pages_ok, so his patch would not have solved it.
But I cannot yet agree that Marcelo should take my interrupt BUG patch. I've also checked back on the BUG which I submitted my 15th Nov patch for (making unmap_kiobuf use page_cache_release instead of put_page), and Gerd Knorr's report (extracts below) implies that his bttv driver was calling unmap_kiobuf at interrupt time. Is that right, Gerd?
If that's so, then my proposed in_interrupt check before lru_cache_del will just give him a BUG again (and my 15th Nov patch was mistaken to encourage him to unmap at interrupt time). Now maybe Gerd's code is wrong anyway: a quick look suggests it may also vfree there, which would be wrong at interrupt time. But whether his code is right or wrong, unmap_kiobuf used to be safe at interrupt time and now is not (in some rare circumstances): are we right to have made that change?
Ben, you probably have an AIO opinion here. Is there a circumstance in which AIO can unpin a user page at interrupt time, after the calling task has (exited or) unmapped the page?
Hugh
Subject: [PATCH] Re: kiobuf / vm bug
Quoted 18 lines · Gerd Knorr
I think I have found a kiobuf-related bug in the VM of recent linux kernels. 2.4.13 is fine, 2.4.14-pre1 doesn't boot my machine, 2.4.14-pre2 + newer kernels are broken.
/me runs a kernel with a few v4l-related patches and my current 0.8.x bttv version (available from http://bytesex.org/patches/ +
http://bytesex.org/bttv/).With this kernel I can trigger the following
BUG():
ksymoops 2.4.3 on i686 2.4.15-pre4. Options used kernel BUG at page_alloc.c:84!Quoted 1 line
Quoted 1 line
EIP;
c0129e5a<__free_pages_ok+aa/29c> <=====Trace;
c012a6f2<__free_pages+1a/1c>
Trace;c0121120<unmap_kiobuf+34/48>The Oops seems to be triggered by the following actions:
Quoted 12 lines
(1) the application maps
/dev/video0. bttv 0.8.x simply returns some shared anonymous memory to as mapping.
(2) the application asks the driver to capture a frame. bttv will lock down the anonymous memory using kiobufs for I/O and prepare everything for DMA xfer.
(3) The applications exits for some reason, i.e. the anonymous memory will be unmapped while the DMA transfer is active and the pages are locked down for I/O.
(4) The DMA xfer is done and bttv's irq handler cleans up everything. This includes calling unlock_kiovec+unmap_kiobuf for the locked pages. Theunmap_kiobufcall at this point triggeres the Oops listed above ...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 10 lines · On Sat, 9 Feb 2002 [email protected] wrote:
Is it possible to modify your patch from:
if (
in_interrupt())
BUG();to
if (unlikely(in_interrupt())
BUG();
Unlikely!
But seriously, that function is so full of checks for the improbable, that it would seem a bit odd for me to add one just for this instance:
unless you've noticed that spectacularly bad code is generated here?
I think I'd prefer to blend in with the surroundings for now, and leave it for, say, the ACME Janitorial Services to come along and put BUG_ON()s throughout.
Hugh