linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Matt Mackall <mpm@selenic.com>
Cc: linuxppc-dev@ozlabs.org, m.kozlowski@tuxland.pl,
	paulus@samba.org, linux-kernel@vger.kernel.org
Subject: Re: 2.6.24-rc8-mm1: powerpc oopses
Date: Thu, 17 Jan 2008 16:05:13 -0800	[thread overview]
Message-ID: <20080117160513.3456b4eb.akpm@linux-foundation.org> (raw)
In-Reply-To: <1200613194.3839.22.camel@cinder.waste.org>

On Thu, 17 Jan 2008 17:39:54 -0600
Matt Mackall <mpm@selenic.com> wrote:

> 
> On Thu, 2008-01-17 at 14:51 -0800, Andrew Morton wrote:
> > > proc_loop: /proc/3731/task/3731/pagemap
> > > kernel: BUG: sleeping function called from invalid context at fs/proc/task_mmu.c:554
> > > kernel: in_atomic():1, irqs_disabled():0
> > > kernel: Call Trace:
> > > kernel: [cf1cddf0] [c000840c] show_stack+0x3c/0x194 (unreliable)
> > > kernel: [cf1cde20] [c002b2ec] __might_sleep+0xf4/0x108
> > > kernel: [cf1cde30] [c00d2d54] add_to_pagemap+0x40/0x11c
> > > kernel: [cf1cde50] [c00d2f44] pagemap_pte_range+0xa8/0x10c
> > > kernel: [cf1cde70] [c0081b30] walk_page_range+0x148/0x23c
> > > kernel: [cf1cdeb0] [c00d3104] pagemap_read+0x15c/0x244
> > > kernel: [cf1cdef0] [c0092144] vfs_read+0xc4/0x16c
> > > kernel: [cf1cdf10] [c009261c] sys_read+0x4c/0x90
> > > kernel: [cf1cdf40] [c001328c] ret_from_syscall+0x0/0x40
> > 
> > It's not really an oops - it's a warning.  add_to_pagemap() is doing a
> > put_user() inside pagemap_pte_range->pte_offset_map->kmap_atomic.
> > 
> > A known bug, I'm afraid.
> > 
> > How to fix?
> > 
> > - double-buffer the data to be copied to userspace or
> > 
> > - take a local copy of the pte page then work on that instead or
> > 
> > - play copy_to_user_inatomic() tricks.
> 
> Hmm, this fell off my radar. How about something like this as a minimal
> fix (untested as -mm is a complete doorstop for me at the moment)?
> 
> diff -r 5595adaea70f fs/proc/task_mmu.c
> --- a/fs/proc/task_mmu.c	Thu Jan 17 13:26:54 2008 -0600
> +++ b/fs/proc/task_mmu.c	Thu Jan 17 17:29:21 2008 -0600
> @@ -582,20 +583,26 @@
>  {
>  	struct pagemapread *pm = private;
>  	pte_t *pte;
> -	int err = 0;
> +	int offset = 0, err = 0;
>  
>  	pte = pte_offset_map(pmd, addr);
> -	for (; addr != end; pte++, addr += PAGE_SIZE) {
> +	for (; addr != end; offset++, addr += PAGE_SIZE) {
>  		u64 pfn = PM_NOT_PRESENT;
> -		if (is_swap_pte(*pte))
> -			pfn = swap_pte_to_pagemap_entry(*pte);
> -		else if (pte_present(*pte))
> -			pfn = pte_pfn(*pte);
> +		if (is_swap_pte(pte[offset]))
> +			pfn = swap_pte_to_pagemap_entry(pte[offset]);
> +		else if (pte_present(pte[offset]))
> +			pfn = pte_pfn(pte[offset]);
> +#ifdef CONFIG_HIGHPTE
> +		pte_unmap(pte);
>  		err = add_to_pagemap(addr, pfn, pm);
> +		pte = pte_offset_map(pmd, addr);
> +#else
> +		err = add_to_pagemap(addr, pfn, pm);
> +#endif
>  		if (err)
>  			return err;
>  	}
> -	pte_unmap(pte - 1);
> +	pte_unmap(pte);
>  
>  	cond_resched();
>  

Good point, it really can be taht simple.

Do we need the ifdef?  pte_offset_map/pte_unmap should be super-cheap on
!CONFIG_HIGHPTE builds.

  reply	other threads:[~2008-01-18  0:05 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080117023514.9df393cf.akpm@linux-foundation.org>
2008-01-17 18:18 ` 2.6.24-rc8-mm1: powerpc: include/asm/nvram.h:62: error: field 'partition' has incomplete type Mariusz Kozlowski
2008-01-17 19:27   ` Andrew Morton
2008-01-17 19:06 ` 2.6.24-rc8-mm1 powerpc build errors Olof Johansson
2008-01-17 19:35   ` Andrew Morton
2008-01-17 22:00     ` Greg KH
2008-01-17 22:15 ` 2.6.24-rc8-mm1: powerpc oopses Mariusz Kozlowski
2008-01-17 22:51   ` Andrew Morton
2008-01-17 23:39     ` Matt Mackall
2008-01-18  0:05       ` Andrew Morton [this message]
2008-01-18  0:12         ` Matt Mackall
2008-01-18  0:29           ` Andrew Morton
2008-01-18  0:47             ` Matt Mackall
2008-01-18  1:07               ` Andrew Morton
2008-01-18  1:16                 ` Matt Mackall
2008-01-18 17:23               ` Mariusz Kozlowski
2008-01-18 17:33                 ` Matt Mackall
2008-01-18  7:09 ` 2.6.24-rc8-mm1 build failure on headers_check Kamalesh Babulal
2008-01-18  7:38   ` Andrew Morton
2008-01-18  8:36 ` 2.6.24-rc8-mm1 Kernel oops will running kernbench Kamalesh Babulal
2008-01-18  8:44   ` Andrew Morton
2008-01-18  9:01     ` Paul Mackerras
2008-01-18  9:34       ` Kamalesh Babulal
2008-01-18 10:19         ` Paul Mackerras
2008-01-18 15:41           ` Milton Miller
2008-01-18 10:26         ` Paul Mackerras
2008-01-18 10:44           ` Kamalesh Babulal
2008-01-18 10:54             ` Balbir Singh
2008-01-25  6:05           ` 2.6.24 Kernel oops will running kernbench regression from 2.6.24-rc8-mm1 Kamalesh Babulal

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=20080117160513.3456b4eb.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=m.kozlowski@tuxland.pl \
    --cc=mpm@selenic.com \
    --cc=paulus@samba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).