public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] __free_pages_ok oops
@ 2002-02-06 19:06 Hugh Dickins
  2002-02-06 19:47 ` Andrew Morton
  2002-02-07  5:09 ` Benjamin LaHaise
  0 siblings, 2 replies; 44+ messages in thread
From: Hugh Dickins @ 2002-02-06 19:06 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: Andrew Morton, Benjamin LaHaise, linux-kernel

Sorry, no solution, but maybe another oops in __free_pages_ok might help?

Hugh

--- 2.4.18-pre8/mm/page_alloc.c	Tue Feb  5 12:55:36 2002
+++ linux/mm/page_alloc.c	Wed Feb  6 18:31:07 2002
@@ -73,9 +73,11 @@
 	/* Yes, think what happens when other parts of the kernel take 
 	 * a reference to a page in order to pin it for io. -ben
 	 */
-	if (PageLRU(page))
+	if (PageLRU(page)) {
+		if (in_interrupt())
+			BUG();
 		lru_cache_del(page);
-
+	}
 	if (page->buffers)
 		BUG();
 	if (page->mapping)


^ permalink raw reply	[flat|nested] 44+ messages in thread
* Re: [PATCH] __free_pages_ok oops
@ 2002-02-09  8:52 alad
  2002-02-09 10:46 ` Hugh Dickins
  0 siblings, 1 reply; 44+ messages in thread
From: alad @ 2002-02-09  8:52 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Andrew Morton, Andrea Arcangeli, Rik van Riel, David S. Miller,
	Benjamin LaHaise, Marcelo Tosatti, Gerd Knorr, linux-kernel



Is it possible to modify your patch from:

if (in_interrupt())
   BUG();

to

if (unlikely(in_interrupt())
    BUG();

-- Amol





Hugh Dickins <hugh@veritas.com> on 02/08/2002 11:16:56 PM

To:   Andrew Morton <akpm@zip.com.au>
cc:   Andrea Arcangeli <andrea@suse.de>, Rik van Riel <riel@conectiva.com.br>,
      "David S. Miller" <davem@redhat.com>, Benjamin LaHaise <bcrl@redhat.com>,
      Marcelo Tosatti <marcelo@conectiva.com.br>, Gerd Knorr
      <kraxel@bytesex.org>, linux-kernel@vger.kernel.org (bcc: Amol Lad/HSS)

Subject:  Re: [PATCH] __free_pages_ok oops




On Thu, 7 Feb 2002, Andrew Morton wrote:
>
> 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
On Thu, 15 Nov 2001, Gerd Knorr wrote:
>
> 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!
> >>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:
>
> (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.  The unmap_kiobuf call 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/





^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2002-02-25 19:36 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-06 19:06 [PATCH] __free_pages_ok oops Hugh Dickins
2002-02-06 19:47 ` Andrew Morton
2002-02-06 20:15   ` Hugh Dickins
2002-02-06 21:11     ` Andrew Morton
2002-02-07 20:31       ` Manfred Spraul
2002-02-07  5:09 ` Benjamin LaHaise
2002-02-07  5:47   ` Andrew Morton
2002-02-07  5:55     ` David S. Miller
2002-02-07  6:19       ` Andrew Morton
2002-02-07  6:49         ` David S. Miller
2002-02-07  7:07           ` Andrew Morton
2002-02-07 11:52             ` Hugh Dickins
2002-02-07 12:34             ` Rik van Riel
2002-02-07 12:37               ` David S. Miller
2002-02-07 12:44                 ` Rik van Riel
2002-02-07 13:19                   ` Hugh Dickins
2002-02-07 13:27                     ` Rik van Riel
2002-02-07 13:55                       ` Daniel Phillips
2002-02-07 14:28                       ` Hugh Dickins
2002-02-07 14:56                         ` Rik van Riel
2002-02-07 20:21                           ` Hugh Dickins
2002-02-07 20:58                         ` Andrea Arcangeli
2002-02-07 21:09                           ` Andrew Morton
2002-02-07 22:18                             ` Andrea Arcangeli
2002-02-07 22:31                               ` Andrew Morton
2002-02-07 23:09                                 ` Andrea Arcangeli
2002-02-07 23:27                                   ` Andrew Morton
2002-02-08 17:46                                     ` Hugh Dickins
2002-02-09 14:14                                       ` Gerd Knorr
2002-02-09 15:47                                         ` arjan
2002-02-09 14:33                                       ` Benjamin LaHaise
2002-02-12 20:19                                         ` Hugh Dickins
2002-02-13 18:52                                           ` Marcelo Tosatti
2002-02-14 10:47                                             ` Hugh Dickins
2002-02-14 11:10                                               ` Gerd Knorr
2002-02-14 13:10                                                 ` Andrea Arcangeli
2002-02-14 14:01                                                   ` Hugh Dickins
2002-02-14 15:17                                                     ` Andrea Arcangeli
2002-02-14 16:27                                                   ` Linus Torvalds
2002-02-25 18:32                                                     ` Benjamin LaHaise
2002-02-25 19:35                                                       ` Linus Torvalds
2002-02-07  9:48         ` Benjamin LaHaise
  -- strict thread matches above, loose matches on Subject: below --
2002-02-09  8:52 alad
2002-02-09 10:46 ` Hugh Dickins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox