All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Hogan <james.hogan@imgtec.com>
To: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	David Daney <david.daney@cavium.com>, <linux-mips@linux-mips.org>,
	<linux-kernel@vger.kernel.org>,
	Hemmo Nieminen <hemmo.nieminen@iki.fi>, <stable@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] MIPS: fix kernel lockup or crash after CPU offline/online
Date: Fri, 30 Jan 2015 18:23:16 +0000	[thread overview]
Message-ID: <20150130182316.GA30459@jhogan-linux.le.imgtec.org> (raw)
In-Reply-To: <20150130175532.GE591@fuloong-minipc.musicnaut.iki.fi>

[-- Attachment #1: Type: text/plain, Size: 1824 bytes --]

On Fri, Jan 30, 2015 at 07:55:32PM +0200, Aaro Koskinen wrote:
> Hi,
> 
> On Fri, Jan 30, 2015 at 02:59:57PM +0000, James Hogan wrote:
> > On 30/01/15 12:47, Maciej W. Rozycki wrote:
> > > On Fri, 30 Jan 2015, James Hogan wrote:
> > > 
> > >>>  Hmm, why can a call to `printk' cause a TLB miss, what's so special about 
> > >>> this function?  Does it use kernel mapped addresses for any purpose such 
> > >>> as `vmalloc'?
> > >>
> > >> It would be the fact netconsole (or whatever other console is in use) is
> > >> built as a kernel module, memory for which is allocated from the vmalloc
> > >> area.
> > > 
> > >  Ah, I see, thanks for enlightening me.  But in that case wouldn't it be 
> > > possible to postpone console output from `printk' until it is safe to 
> > > access the device?  In a manner similar to how for example we handle calls 
> > > to `printk' made from the hardirq context.  That would make things less 
> > > fragile.
> > 
> > Hmm, kernel/printk/printk.c does have:
> > 
> > static inline int can_use_console(unsigned int cpu)
> > {
> > 	return cpu_online(cpu) || have_callable_console();
> > }
> > 
> > which should prevent it dumping printk buffer to console. CPU shouldn't
> > be marked online that early, which suggests that the console has the
> > CON_ANYTIME flag set, which it probably shouldn't if it depends on
> > module code. call_console_drivers() seems to ensure the CPU is online or
> > has CON_ANYTIME before calling the console write callback.
> > 
> > A quick glance and I can't see any evidence of netconsole being able to
> > get CON_ANYTIME.
> 
> It does not set the flag. But flags are kept in module's static data,
> so the original problem stays.
> 
> A.

Ah yes, of course. This approach looks correct to me then.

Cheers
James

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: James Hogan <james.hogan@imgtec.com>
To: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	David Daney <david.daney@cavium.com>,
	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
	Hemmo Nieminen <hemmo.nieminen@iki.fi>,
	stable@vger.kernel.org
Subject: Re: [PATCH v2 2/2] MIPS: fix kernel lockup or crash after CPU offline/online
Date: Fri, 30 Jan 2015 18:23:16 +0000	[thread overview]
Message-ID: <20150130182316.GA30459@jhogan-linux.le.imgtec.org> (raw)
Message-ID: <20150130182316.wkOLs-vtwTdCVOcURlhV2yb_YX2mE5XMvVZy392-3UE@z> (raw)
In-Reply-To: <20150130175532.GE591@fuloong-minipc.musicnaut.iki.fi>

[-- Attachment #1: Type: text/plain, Size: 1824 bytes --]

On Fri, Jan 30, 2015 at 07:55:32PM +0200, Aaro Koskinen wrote:
> Hi,
> 
> On Fri, Jan 30, 2015 at 02:59:57PM +0000, James Hogan wrote:
> > On 30/01/15 12:47, Maciej W. Rozycki wrote:
> > > On Fri, 30 Jan 2015, James Hogan wrote:
> > > 
> > >>>  Hmm, why can a call to `printk' cause a TLB miss, what's so special about 
> > >>> this function?  Does it use kernel mapped addresses for any purpose such 
> > >>> as `vmalloc'?
> > >>
> > >> It would be the fact netconsole (or whatever other console is in use) is
> > >> built as a kernel module, memory for which is allocated from the vmalloc
> > >> area.
> > > 
> > >  Ah, I see, thanks for enlightening me.  But in that case wouldn't it be 
> > > possible to postpone console output from `printk' until it is safe to 
> > > access the device?  In a manner similar to how for example we handle calls 
> > > to `printk' made from the hardirq context.  That would make things less 
> > > fragile.
> > 
> > Hmm, kernel/printk/printk.c does have:
> > 
> > static inline int can_use_console(unsigned int cpu)
> > {
> > 	return cpu_online(cpu) || have_callable_console();
> > }
> > 
> > which should prevent it dumping printk buffer to console. CPU shouldn't
> > be marked online that early, which suggests that the console has the
> > CON_ANYTIME flag set, which it probably shouldn't if it depends on
> > module code. call_console_drivers() seems to ensure the CPU is online or
> > has CON_ANYTIME before calling the console write callback.
> > 
> > A quick glance and I can't see any evidence of netconsole being able to
> > get CON_ANYTIME.
> 
> It does not set the flag. But flags are kept in module's static data,
> so the original problem stays.
> 
> A.

Ah yes, of course. This approach looks correct to me then.

Cheers
James

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-01-30 18:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-15 21:01 [PATCH v2 1/2] MIPS: OCTEON: fix kernel crash when offlining a CPU Aaro Koskinen
2015-01-15 21:01 ` [PATCH v2 2/2] MIPS: fix kernel lockup or crash after CPU offline/online Aaro Koskinen
2015-01-30  9:25   ` Maciej W. Rozycki
2015-01-30 10:22     ` James Hogan
2015-01-30 10:22       ` James Hogan
2015-01-30 12:47       ` Maciej W. Rozycki
2015-01-30 14:59         ` James Hogan
2015-01-30 14:59           ` James Hogan
2015-01-30 17:55           ` Aaro Koskinen
2015-01-30 18:23             ` James Hogan [this message]
2015-01-30 18:23               ` James Hogan
2015-01-30 18:53               ` Maciej W. Rozycki

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=20150130182316.GA30459@jhogan-linux.le.imgtec.org \
    --to=james.hogan@imgtec.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=david.daney@cavium.com \
    --cc=hemmo.nieminen@iki.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=stable@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.