public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Olof Johansson <olof@lixom.net>
To: Doug Anderson <dianders@chromium.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>,
	Thomas Abraham <thomas.abraham@linaro.org>,
	Simon Glass <sjg@chromium.org>,
	linux-samsung-soc@vger.kernel.org,
	Tomasz Figa <tomasz.figa@gmail.com>,
	Russell King <linux@arm.linux.org.uk>,
	Ben Dooks <ben-linux@fluff.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ARM: samsung: avoid racy early printk at bootup
Date: Tue, 4 Jun 2013 20:15:36 -0700	[thread overview]
Message-ID: <20130605031536.GA24910@quad.lixom.net> (raw)
In-Reply-To: <1370397539-21653-1-git-send-email-dianders@chromium.org>

Hi,

On Tue, Jun 04, 2013 at 06:58:59PM -0700, Doug Anderson wrote:
> At boot, we've got a stack trace that looks something like this
> (exynos5 as example)
> * exynos5_map_io
> * s3c_init_cpu
> * exynos_init_io
> * exynos5_dt_map_io
> * paging_init
> * setup_arch
> 
> When paging_init() runs we'll lose any early MMU mappings that we
> might have had to allow us access to S3C_VA_UART.  We won't add those
> mappings back in until after the SoC-specific map_io() function is
> called.  However, we print the CPU ID _right before_ we call the
> SoC-specific function.  Oops.
> 
> 
> Things happen to work all right most of the time because the mapping
> is sticking around in our TLB.  ...but if we get really unlucky (like
> me!) or we put an explicit flush_tlb_all() at the start of
> exynos_init_io(), then things go boom.
> 
> This patch moves the problematic printk() till after the cpu->map_io()
> call.  It also switches it over to pr_info().  This patch _doesn't_
> remove the questionable printks in the panic case, since we might get
> lucky and the TLB might still let us print.  This patch also adds a
> few warnings to help others avoid similar headaches.

This seems to be caused by not calling iotable_ini() in exynos_init_io()
when a device tree is passed into the kernel, thus not setting up the
mapping for the UART in that case.

I think the solution is instead to map the uart earlier. The window of
exposure is still there, but much smaller (and similar to how it always
has been).

In current upstream, if there is no map_io mach_desc entry at all,
debug_ll_io_init() will be called on all platforms. Seems appropriate
to call that explicitly before of_scan_flat_dt() in exynos_init_io()
in this case.

Or am I missing something?


-Olof

  reply	other threads:[~2013-06-05  3:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05  1:58 [PATCH] ARM: samsung: avoid racy early printk at bootup Doug Anderson
2013-06-05  3:15 ` Olof Johansson [this message]
2013-06-05 20:56   ` Doug Anderson
2013-06-05 20:56 ` [PATCH v2] ARM: exynos: add debug_ll_io_init() call in exynos_init_io() Doug Anderson
2013-06-05 21:12   ` Olof Johansson
2013-06-05 23:32     ` Kukjin Kim
2013-06-08  1:12       ` Olof Johansson

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=20130605031536.GA24910@quad.lixom.net \
    --to=olof@lixom.net \
    --cc=ben-linux@fluff.org \
    --cc=dianders@chromium.org \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=sjg@chromium.org \
    --cc=thomas.abraham@linaro.org \
    --cc=tomasz.figa@gmail.com \
    /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