diff mbox

[0/2] ARM: sunxi: Convert DTSI to new CPU bindings

Message ID 20130629225426.GA12221@quad.lixom.net (mailing list archive)
State New, archived
Headers show

Commit Message

Olof Johansson June 29, 2013, 10:54 p.m. UTC
On Sat, Jun 29, 2013 at 08:38:19PM +0100, Russell King - ARM Linux wrote:
> On Fri, Jun 28, 2013 at 01:05:42PM -0700, Olof Johansson wrote:
> > On Fri, Jun 28, 2013 at 1:03 PM, Maxime Ripard
> > <maxime.ripard@free-electrons.com> wrote:
> > > On Fri, Jun 28, 2013 at 06:15:32PM +0100, Lorenzo Pieralisi wrote:
> > >> The patch above should already be queued in next/dt right ?
> > >
> > > Indeed.
> > >
> > > Then why the latest patch of your patchset got in 3.10, while the
> > > patches actually fixing the DT it would have impacted were delayed to
> > > 3.11?
> > >
> > > (And why was it merged so late in the development cycle?)
> > 
> > This. So now we have to scramble because some device trees will
> > produce warnings at boot.
> > 
> > Russell, the alternative is to revert Lorenzo's patch for 3.10 (and
> > re-introduce it for 3.11). Do you have a preference?
> 
> Sorry but I really don't understand what all the fuss in this thread
> is about.
> 
> This thread seems to be saying that two development patches were
> merged, which were 7762/1 and 7763/1, and that 7764/1 is a fix?
> Are you sure about that, because that's not how they're described,
> and not how they look either.

Most of this ruffle seems to be about the fact that booting a kernel
with a device tree that doesn't conform to the brand spanking new,
and never previously enforced, binding for the cpu nodes will produce
a WARN_ON(). Lots of our in-tree device trees fall into this category.

And while I think it was a bad idea for Lorenzo to ask for this to be
merged as a fix this late (and most in particular for stable), as far
as I can tell nothing (new) is broken by it -- just the alarming warning
is being printed.

I think it probably makes sense to downgrade the WARN to just a printk, and
people will be a lot less worried. How about the below?

If you're OK with it, Russell, can we get your ack so Linus can apply
directly given the imminence of final 3.10? Or, if you prefer, you can of
course apply and send it on instead.


Thanks,

-Olof


-----

ARM: dt: Only print warning, not WARN() on bad cpu map in device tree

Due to recent changes and expecations of proper cpu bindings, there are now
cases for many of the in-tree devicetrees where a WARN() will hit on boot due
to badly formatted /cpus nodes.

Downgrade this to a pr_warn() to be less alarmist, since it's not a new
problem.

Tested on Arndale, Cubox, Seaboard and Panda ES. Panda hits the WARN
without this, the others do not.

Signed-off-by: Olof Johansson <olof@lixom.net>

Comments

Russell King - ARM Linux June 29, 2013, 11:14 p.m. UTC | #1
On Sat, Jun 29, 2013 at 03:54:26PM -0700, Olof Johansson wrote:
> Most of this ruffle seems to be about the fact that booting a kernel
> with a device tree that doesn't conform to the brand spanking new,
> and never previously enforced, binding for the cpu nodes will produce
> a WARN_ON(). Lots of our in-tree device trees fall into this category.
> 
> And while I think it was a bad idea for Lorenzo to ask for this to be
> merged as a fix this late (and most in particular for stable), as far
> as I can tell nothing (new) is broken by it -- just the alarming warning
> is being printed.
> 
> I think it probably makes sense to downgrade the WARN to just a printk, and
> people will be a lot less worried. How about the below?
> 
> If you're OK with it, Russell, can we get your ack so Linus can apply
> directly given the imminence of final 3.10? Or, if you prefer, you can of
> course apply and send it on instead.

You can have my usual rmk+kernel ack for it with one change...

> +	if (!bootcpu_valid) {
> +		pr_warn("DT missing boot CPU MPIDR[23:0], fall back to "
> +			"default cpu_logical_map\n");

Don't wrap messages kernel messages inspite of what checkpatch says.
Always keep messages like that on a single line so they're greppable.
Checkpatch is far from perfect and does get stuff wrong, and this is
one of its common mistakes.

Incidentally, here's a few of fun ones I found today which illustrates
why checkpatch can be bad news if everything it spits out is believed
by the user:

WARNING: simple_strtoul is obsolete, use kstrtoul instead
#1424: FILE: drivers/gpu/drm/armada/armada_debugfs.c:90:
+       reg = simple_strtoul(buf, &p, 16);

Umm yes, and to use kstrtoul(), I'd have to:
- copy the string _safely_ to avoid any buffer overflow
- find the first non-value character
- terminate the string with a \0 or a \n\0
- remember where in the string I'd got to to parse the next argument
And pushing that complexity into drivers, which if it's wrong causes
security problems, is better than using simple_strtoul() because ...?

ERROR: Macros with multiple statements should be enclosed in a do - while loop
#2122: FILE: drivers/gpu/drm/armada/armada_fb.c:45:
+#define FMT(drm, fmt, mod)             \
+       case DRM_FORMAT_##drm:          \
+               format = CFG_##fmt;     \
+               config = mod;           \
+               break

Oh yea, that's really going to work for that isn't it!

WARNING: externs should be avoided in .c files
#2126: FILE: drivers/gpu/drm/armada/armada_fb.c:49:
+               break

Err, what extern? :)
Olof Johansson June 29, 2013, 11:20 p.m. UTC | #2
On Sun, Jun 30, 2013 at 12:14:26AM +0100, Russell King - ARM Linux wrote:
> On Sat, Jun 29, 2013 at 03:54:26PM -0700, Olof Johansson wrote:
> > Most of this ruffle seems to be about the fact that booting a kernel
> > with a device tree that doesn't conform to the brand spanking new,
> > and never previously enforced, binding for the cpu nodes will produce
> > a WARN_ON(). Lots of our in-tree device trees fall into this category.
> > 
> > And while I think it was a bad idea for Lorenzo to ask for this to be
> > merged as a fix this late (and most in particular for stable), as far
> > as I can tell nothing (new) is broken by it -- just the alarming warning
> > is being printed.
> > 
> > I think it probably makes sense to downgrade the WARN to just a printk, and
> > people will be a lot less worried. How about the below?
> > 
> > If you're OK with it, Russell, can we get your ack so Linus can apply
> > directly given the imminence of final 3.10? Or, if you prefer, you can of
> > course apply and send it on instead.
> 
> You can have my usual rmk+kernel ack for it with one change...
> 
> > +	if (!bootcpu_valid) {
> > +		pr_warn("DT missing boot CPU MPIDR[23:0], fall back to "
> > +			"default cpu_logical_map\n");
> 
> Don't wrap messages kernel messages inspite of what checkpatch says.
> Always keep messages like that on a single line so they're greppable.
> Checkpatch is far from perfect and does get stuff wrong, and this is
> one of its common mistakes.

I didn't even run it through checkpatch, and I prefer greppable strings too --
I just went with what the rest of the file already used in this case to keep
the change minimal given timing.

I'll send a fresh copy with your ack and the above changed. Thanks.


-Olof
diff mbox

Patch

diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index 0905502..707f99e 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -152,9 +152,11 @@  void __init arm_dt_init_cpu_maps(void)
 		tmp_map[i] = hwid;
 	}
 
-	if (WARN(!bootcpu_valid, "DT missing boot CPU MPIDR[23:0], "
-				 "fall back to default cpu_logical_map\n"))
+	if (!bootcpu_valid) {
+		pr_warn("DT missing boot CPU MPIDR[23:0], fall back to "
+			"default cpu_logical_map\n");
 		return;
+	}
 
 	/*
 	 * Since the boot CPU node contains proper data, and all nodes have