mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@cs.helsinki.fi>
To: Nick Piggin <npiggin@suse.de>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>,
	torvalds@linux-foundation.org, linux-kernel@vger.kernel.org,
	akpm@linux-foundation.org, cl@linux-foundation.org,
	kamezawa.hiroyu@jp.fujitsu.com, lizf@cn.fujitsu.com,
	mingo@elte.hu, yinghai@kernel.org, benh@kernel.crashing.org
Subject: Re: [GIT PULL v2] Early SLAB fixes for 2.6.31
Date: Mon, 15 Jun 2009 11:32:59 +0300	[thread overview]
Message-ID: <1245054779.23207.6.camel@penberg-laptop> (raw)
In-Reply-To: <20090615082636.GA30964@wotan.suse.de>

Hi Nick,

On Mon, 2009-06-15 at 10:26 +0200, Nick Piggin wrote:
> On Mon, Jun 15, 2009 at 10:18:31AM +0200, Heiko Carstens wrote:
> > On Fri, Jun 12, 2009 at 07:16:30PM +0300, Pekka J Enberg wrote:
> > > Hi Linus,
> > > 
> > > I dropped the GFP_WAIT conversion patch and added the gfp masking patch 
> > > you liked. I tested this on x86-64 with both SLAB and SLUB.
> > 
> > Hi Pekka,
> > 
> > I tried to convert some of the early allocations on s390. Some callsites
> > however need to have the GFP_DMA flag, since we need to allocate memory below
> > 2GB. Passing GFP_DMA causes this crash:
> > 
> >     <1>Unable to handle kernel pointer dereference at virtual kernel address fffffffffffff000
> >     <4>Oops: 0038 [#1] PREEMPT SMP 
> >     <4>Modules linked in:
> >     <4>CPU: 0 Not tainted 2.6.30-03984-g45e3e19-dirty #233
> >     <4>Process swapper (pid: 0, task: 00000000006a2ef0, ksp: 0000000000718000)
> >     <4>Krnl PSW : 0700100180000000 00000000000808ee (queue_work_on+0x8e/0xe0)
> >     <4>           R:0 T:1 IO:1 EX:1 Key:0 M:0 W:0 P:0 AS:0 CC:1 PM:0 EA:3
> >     <4>Krnl GPRS: 0000000000000000 ffffffffffffffff 0000000000000000 00000000006b8b88
> >     <4>           00000000006b8b88 0000000000000001 0000000000000008 0000000000000200
> >     <4>           000000003fe28000 0000000000008001 00000000011da730 0000000000717ca0
> >     <4>           00000000006b8b88 0000000000488650 0000000000717cd0 0000000000717ca0
> >     <4>Krnl Code: 00000000000808de: e310d0000082        xg      %r1,0(%r13)
> >     <4>           00000000000808e4: eb220003000d        sllg    %r2,%r2,3
> >     <4>           00000000000808ea: b9040034            lgr     %r3,%r4
> >     <4>          >00000000000808ee: e32210000004        lg      %r2,0(%r2,%r1)
> >     <4>           00000000000808f4: c0e5ffffff28        brasl   %r14,80744
> >     <4>           00000000000808fa: a7280001            lhi     %r2,1
> >     <4>           00000000000808fe: e340b0b80004        lg      %r4,184(%r11)
> >     <4>           0000000000080904: b9140022            lgfr    %r2,%r2
> >     <4>Call Trace:
> >     <4>([<000000003fe28000>] 0x3fe28000)
> >     <4> [<0000000000080e96>] queue_work+0x62/0xa4
> >     <4> [<0000000000080f26>] schedule_work+0x4e/0x60
> >     <4> [<0000000000132f7e>] dma_kmalloc_cache+0x1ca/0x1d0
> >     <4> [<00000000001330ae>] get_slab+0x12a/0x130
> >     <4> [<00000000001337b6>] __kmalloc+0x5e/0x364
> >     <4> [<0000000000739132>] con3215_init+0x1c2/0x2e4
> >     <4> [<00000000007333ea>] console_init+0x42/0x5c
> >     <4> [<0000000000718e50>] start_kernel+0x53c/0x6b8
> >     <4> [<0000000000012020>] _ehead+0x20/0x80
> > 
> > I didn't look any deeper into this, but looks to me like doing something like
> > schedule_work() this early isn't ok.
> > 
> > This is the conversion that leads to the crash:
> > 
> > -               alloc_bootmem_low(sizeof(struct raw3215_info));
> > +               kzalloc(sizeof(struct raw3215_info), GFP_NOWAIT | GFP_DMA);
> > 
> > Might be that I missed something. Maybe some special flag?
> 
> No, just a bug in the conversion.
> 
> If you predicate the schedule_work call on slab_state == SYSFS, then
> it should work (when sysfs comes up later in init, previously added
> slabs will be registered with sysfs).
> 
> Oh, and you'd need to also not pass __SYSFS_ADD_DEFERRED into
> kmem_cache_create in that case too.

I am not sure I follow you here. We are setting up slab so early that we
absolutely _must_ defer sysfs setup. But we're also setting up slab much
earlier than workqueues, so we shouldn't really do schedule_work() at
that point. Furthermore, early boot cache sysfs setup is explicitly
handled in slab_sysfs_init() so I think we need something like the patch
below?

			Pekka

diff --git a/mm/slub.c b/mm/slub.c
index 30354bf..4c12138 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2642,7 +2642,13 @@ static noinline struct kmem_cache *dma_kmalloc_cache(int index, gfp_t flags)
 	list_add(&s->list, &slab_caches);
 	kmalloc_caches_dma[index] = s;
 
-	schedule_work(&sysfs_add_work);
+	/*
+	 * The slab allocator is set up much earlier than workqueues. As early
+	 * boot caches are handle by slab_sysfs_init(), avoid calling
+	 * schedule_work() until keventd is up.
+	 */
+	if (keventd_up())
+		schedule_work(&sysfs_add_work);
 
 unlock_out:
 	up_write(&slub_lock);



  reply	other threads:[~2009-06-15  8:33 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-12 13:25 [GIT PULL] " Pekka J Enberg
2009-06-12 13:38 ` Benjamin Herrenschmidt
2009-06-12 13:45   ` Pekka Enberg
2009-06-12 14:30     ` Christoph Lameter
2009-06-12 16:16 ` [GIT PULL v2] " Pekka J Enberg
2009-06-12 17:30   ` Christoph Lameter
2009-06-12 21:46     ` Benjamin Herrenschmidt
2009-06-15  6:46       ` Nick Piggin
2009-06-15  9:10         ` Pekka Enberg
2009-06-15  9:38           ` Nick Piggin
2009-06-15 14:43       ` Christoph Lameter
2009-06-14  7:12     ` Pekka J Enberg
2009-06-15 14:55       ` Christoph Lameter
2009-06-15 14:58         ` Pekka Enberg
2009-06-15 15:05           ` Christoph Lameter
2009-06-15 15:11             ` Pekka Enberg
2009-06-15 15:27               ` Pekka Enberg
2009-06-15 15:51                 ` Christoph Lameter
2009-06-15 15:57                   ` Pekka Enberg
2009-06-15 16:08                     ` Christoph Lameter
2009-06-15 17:15                 ` Linus Torvalds
2009-06-15 18:19                   ` Pekka Enberg
2009-06-15 15:48               ` Christoph Lameter
2009-06-15  8:18   ` Heiko Carstens
2009-06-15  8:26     ` Nick Piggin
2009-06-15  8:32       ` Pekka Enberg [this message]
2009-06-15  8:52         ` Nick Piggin
2009-06-15  9:08           ` Pekka Enberg
2009-06-15 10:20             ` Heiko Carstens
2009-06-15 10:21               ` Pekka Enberg
2009-06-15 10:31                 ` Nick Piggin
2009-06-15 10:36                   ` Pekka Enberg
2009-06-15  9:10     ` Pekka Enberg
2009-06-15  9:41       ` Nick Piggin
2009-06-15  9:48         ` Pekka Enberg
2009-06-15  9:59           ` Nick Piggin
2009-06-15  9:51         ` Benjamin Herrenschmidt
2009-06-15  9:57           ` Pekka Enberg
2009-06-15 10:27             ` Nick Piggin
2009-06-15 10:45               ` Benjamin Herrenschmidt
2009-06-15 11:23                 ` Nick Piggin
2009-06-15 12:38                   ` Hugh Dickins
2009-06-15 13:07                     ` Pekka Enberg
2009-06-16  4:57                     ` Nick Piggin
2009-06-16  5:28                       ` Benjamin Herrenschmidt
2009-06-16  5:36                         ` Nick Piggin
2009-06-16 15:12                           ` Christoph Lameter
2009-06-16 15:59                             ` Nick Piggin
2009-06-15 21:31                   ` Benjamin Herrenschmidt
2009-06-16  4:46                     ` Nick Piggin
2009-06-16  5:18                       ` Benjamin Herrenschmidt
2009-06-16  5:29                         ` Nick Piggin
2009-06-16 18:45                       ` Linus Torvalds
2009-06-17  7:47                         ` Nick Piggin
2009-06-17 16:01                           ` Linus Torvalds
2009-06-17 16:17                             ` Nick Piggin
2009-06-17 21:39                             ` Benjamin Herrenschmidt
2009-06-15 10:12           ` Nick Piggin
2009-06-15 10:39             ` Benjamin Herrenschmidt
2009-06-15 11:22               ` Nick Piggin
2009-06-15 11:28                 ` Nick Piggin
2009-06-15 11:38                   ` Nick Piggin
2009-06-15 21:37                     ` Benjamin Herrenschmidt
2009-06-16  4:42                       ` Nick Piggin
2009-06-15 21:32                   ` Benjamin Herrenschmidt
2009-06-16 15:08                     ` Christoph Lameter
2009-06-16 19:10                       ` Linus Torvalds
2009-06-16 19:23                         ` Christoph Lameter
2009-06-16 19:33                           ` Linus Torvalds
2009-06-16 19:48                             ` Christoph Lameter
2009-06-17  5:18                             ` Pekka Enberg
2009-06-17 16:45                               ` Linus Torvalds
2009-06-18  2:00                                 ` Benjamin Herrenschmidt
2009-06-18  3:24                                   ` Benjamin Herrenschmidt
2009-06-18  6:01                                     ` Pekka Enberg
2009-06-18  8:52                                       ` Benjamin Herrenschmidt
2009-06-16 21:58                         ` Benjamin Herrenschmidt
2009-06-16 22:06                           ` Linus Torvalds
2009-06-16 22:51                             ` Benjamin Herrenschmidt

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=1245054779.23207.6.camel@penberg-laptop \
    --to=penberg@cs.helsinki.fi \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=cl@linux-foundation.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mingo@elte.hu \
    --cc=npiggin@suse.de \
    --cc=torvalds@linux-foundation.org \
    --cc=yinghai@kernel.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

all inboxes | Powered by JetHome®