* [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks @ 2019-05-03 17:47 Douglas Anderson 2019-05-03 19:06 ` Guenter Roeck ` (2 more replies) 0 siblings, 3 replies; 12+ messages in thread From: Douglas Anderson @ 2019-05-03 17:47 UTC (permalink / raw) To: Kees Cook, Anton Vorontsov Cc: linux-rockchip, jwerner, groeck, mka, briannorris, Douglas Anderson, Colin Cross, Tony Luck, linux-kernel When you try to run an upstream kernel on an old ARM-based Chromebook you'll find that console-ramoops doesn't work. Old ARM-based Chromebooks, before <https://crrev.com/c/439792> ("ramoops: support upstream {console,pmsg,ftrace}-size properties") used to create a "ramoops" node at the top level that looked like: / { ramoops { compatible = "ramoops"; reg = <...>; record-size = <...>; dump-oops; }; }; ...and these Chromebooks assumed that the downstream kernel would make console_size / pmsg_size match the record size. The above ramoops node was added by the firmware so it's not easy to make any changes. Let's match the expected behavior, but only for those using the old backward-compatible way of working where ramoops is right under the root node. NOTE: if there are some out-of-tree devices that had ramoops at the top level, left everything but the record size as 0, and somehow doesn't want this behavior, we can try to add more conditions here. Signed-off-by: Douglas Anderson <dianders@chromium.org> --- fs/pstore/ram.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index c5c685589e36..8df3bfa2837f 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -669,6 +669,7 @@ static int ramoops_parse_dt(struct platform_device *pdev, struct ramoops_platform_data *pdata) { struct device_node *of_node = pdev->dev.of_node; + struct device_node *parent_node; struct resource *res; u32 value; int ret; @@ -703,6 +704,23 @@ static int ramoops_parse_dt(struct platform_device *pdev, #undef parse_size + /* + * Some old Chromebooks relied on the kernel setting the console_size + * and pmsg_size to the record size since that's what the downstream + * kernel did. These same Chromebooks had "ramoops" straight under + * the root node which isn't according to the upstream bindings. Let's + * make those old Chromebooks work by detecting this and mimicing the + * expected behavior. + */ + parent_node = of_get_parent(of_node); + if (of_node_is_root(parent_node) && + !pdata->console_size && !pdata->ftrace_size && + !pdata->pmsg_size && !pdata->ecc_info.ecc_size) { + pdata->console_size = pdata->record_size; + pdata->pmsg_size = pdata->record_size; + } + of_node_put(parent_node); + return 0; } -- 2.21.0.1020.gf2820cf01a-goog ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks 2019-05-03 17:47 [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks Douglas Anderson @ 2019-05-03 19:06 ` Guenter Roeck 2019-05-06 21:09 ` Kees Cook 2019-05-06 21:40 ` Brian Norris 2 siblings, 0 replies; 12+ messages in thread From: Guenter Roeck @ 2019-05-03 19:06 UTC (permalink / raw) To: Douglas Anderson Cc: Kees Cook, Anton Vorontsov, open list:ARM/Rockchip SoC..., Julius Werner, Guenter Roeck, Matthias Kaehlcke, Brian Norris, Colin Cross, Tony Luck, linux-kernel On Fri, May 3, 2019 at 10:48 AM Douglas Anderson <dianders@chromium.org> wrote: > > When you try to run an upstream kernel on an old ARM-based Chromebook > you'll find that console-ramoops doesn't work. > > Old ARM-based Chromebooks, before <https://crrev.com/c/439792> > ("ramoops: support upstream {console,pmsg,ftrace}-size properties") > used to create a "ramoops" node at the top level that looked like: > > / { > ramoops { > compatible = "ramoops"; > reg = <...>; > record-size = <...>; > dump-oops; > }; > }; > > ...and these Chromebooks assumed that the downstream kernel would make > console_size / pmsg_size match the record size. The above ramoops > node was added by the firmware so it's not easy to make any changes. > > Let's match the expected behavior, but only for those using the old > backward-compatible way of working where ramoops is right under the > root node. > > NOTE: if there are some out-of-tree devices that had ramoops at the > top level, left everything but the record size as 0, and somehow > doesn't want this behavior, we can try to add more conditions here. > > Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Guenter Roeck <groeck@chromium.org> > --- > > fs/pstore/ram.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c > index c5c685589e36..8df3bfa2837f 100644 > --- a/fs/pstore/ram.c > +++ b/fs/pstore/ram.c > @@ -669,6 +669,7 @@ static int ramoops_parse_dt(struct platform_device *pdev, > struct ramoops_platform_data *pdata) > { > struct device_node *of_node = pdev->dev.of_node; > + struct device_node *parent_node; > struct resource *res; > u32 value; > int ret; > @@ -703,6 +704,23 @@ static int ramoops_parse_dt(struct platform_device *pdev, > > #undef parse_size > > + /* > + * Some old Chromebooks relied on the kernel setting the console_size > + * and pmsg_size to the record size since that's what the downstream > + * kernel did. These same Chromebooks had "ramoops" straight under > + * the root node which isn't according to the upstream bindings. Let's > + * make those old Chromebooks work by detecting this and mimicing the > + * expected behavior. > + */ > + parent_node = of_get_parent(of_node); > + if (of_node_is_root(parent_node) && > + !pdata->console_size && !pdata->ftrace_size && > + !pdata->pmsg_size && !pdata->ecc_info.ecc_size) { > + pdata->console_size = pdata->record_size; > + pdata->pmsg_size = pdata->record_size; > + } > + of_node_put(parent_node); > + > return 0; > } > > -- > 2.21.0.1020.gf2820cf01a-goog > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks 2019-05-03 17:47 [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks Douglas Anderson 2019-05-03 19:06 ` Guenter Roeck @ 2019-05-06 21:09 ` Kees Cook 2019-05-06 21:33 ` Rob Herring 2019-05-06 23:58 ` Doug Anderson 2019-05-06 21:40 ` Brian Norris 2 siblings, 2 replies; 12+ messages in thread From: Kees Cook @ 2019-05-06 21:09 UTC (permalink / raw) To: Douglas Anderson, Rob Herring Cc: Anton Vorontsov, linux-rockchip, jwerner, Guenter Roeck, Matthias Kaehlcke, Brian Norris, Colin Cross, Tony Luck, LKML From: Douglas Anderson <dianders@chromium.org> Date: Fri, May 3, 2019 at 10:48 AM To: Kees Cook, Anton Vorontsov Cc: <linux-rockchip@lists.infradead.org>, <jwerner@chromium.org>, <groeck@chromium.org>, <mka@chromium.org>, <briannorris@chromium.org>, Douglas Anderson, Colin Cross, Tony Luck, <linux-kernel@vger.kernel.org> > When you try to run an upstream kernel on an old ARM-based Chromebook > you'll find that console-ramoops doesn't work. > > Old ARM-based Chromebooks, before <https://crrev.com/c/439792> > ("ramoops: support upstream {console,pmsg,ftrace}-size properties") > used to create a "ramoops" node at the top level that looked like: > > / { > ramoops { > compatible = "ramoops"; > reg = <...>; > record-size = <...>; > dump-oops; > }; > }; > > ...and these Chromebooks assumed that the downstream kernel would make > console_size / pmsg_size match the record size. The above ramoops > node was added by the firmware so it's not easy to make any changes. > > Let's match the expected behavior, but only for those using the old > backward-compatible way of working where ramoops is right under the > root node. > > NOTE: if there are some out-of-tree devices that had ramoops at the > top level, left everything but the record size as 0, and somehow > doesn't want this behavior, we can try to add more conditions here. > > Signed-off-by: Douglas Anderson <dianders@chromium.org> I like this; thanks! Rob is this okay by you? I just want to double-check since it's part of the DT parsing logic. I'll pick it up and add a Cc: stable. -Kees > --- > > fs/pstore/ram.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c > index c5c685589e36..8df3bfa2837f 100644 > --- a/fs/pstore/ram.c > +++ b/fs/pstore/ram.c > @@ -669,6 +669,7 @@ static int ramoops_parse_dt(struct platform_device *pdev, > struct ramoops_platform_data *pdata) > { > struct device_node *of_node = pdev->dev.of_node; > + struct device_node *parent_node; > struct resource *res; > u32 value; > int ret; > @@ -703,6 +704,23 @@ static int ramoops_parse_dt(struct platform_device *pdev, > > #undef parse_size > > + /* > + * Some old Chromebooks relied on the kernel setting the console_size > + * and pmsg_size to the record size since that's what the downstream > + * kernel did. These same Chromebooks had "ramoops" straight under > + * the root node which isn't according to the upstream bindings. Let's > + * make those old Chromebooks work by detecting this and mimicing the > + * expected behavior. > + */ > + parent_node = of_get_parent(of_node); > + if (of_node_is_root(parent_node) && > + !pdata->console_size && !pdata->ftrace_size && > + !pdata->pmsg_size && !pdata->ecc_info.ecc_size) { > + pdata->console_size = pdata->record_size; > + pdata->pmsg_size = pdata->record_size; > + } > + of_node_put(parent_node); > + > return 0; > } > > -- > 2.21.0.1020.gf2820cf01a-goog > -- Kees Cook ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks 2019-05-06 21:09 ` Kees Cook @ 2019-05-06 21:33 ` Rob Herring 2019-05-06 23:58 ` Doug Anderson 1 sibling, 0 replies; 12+ messages in thread From: Rob Herring @ 2019-05-06 21:33 UTC (permalink / raw) To: Kees Cook Cc: Douglas Anderson, Anton Vorontsov, open list:ARM/Rockchip SoC..., Julius Werner, Guenter Roeck, Matthias Kaehlcke, Brian Norris, Colin Cross, Tony Luck, LKML On Mon, May 6, 2019 at 4:10 PM Kees Cook <keescook@chromium.org> wrote: > > From: Douglas Anderson <dianders@chromium.org> > Date: Fri, May 3, 2019 at 10:48 AM > To: Kees Cook, Anton Vorontsov > Cc: <linux-rockchip@lists.infradead.org>, <jwerner@chromium.org>, > <groeck@chromium.org>, <mka@chromium.org>, <briannorris@chromium.org>, > Douglas Anderson, Colin Cross, Tony Luck, > <linux-kernel@vger.kernel.org> > > > When you try to run an upstream kernel on an old ARM-based Chromebook > > you'll find that console-ramoops doesn't work. > > > > Old ARM-based Chromebooks, before <https://crrev.com/c/439792> > > ("ramoops: support upstream {console,pmsg,ftrace}-size properties") > > used to create a "ramoops" node at the top level that looked like: > > > > / { > > ramoops { > > compatible = "ramoops"; > > reg = <...>; > > record-size = <...>; > > dump-oops; > > }; > > }; > > > > ...and these Chromebooks assumed that the downstream kernel would make > > console_size / pmsg_size match the record size. The above ramoops > > node was added by the firmware so it's not easy to make any changes. > > > > Let's match the expected behavior, but only for those using the old > > backward-compatible way of working where ramoops is right under the > > root node. > > > > NOTE: if there are some out-of-tree devices that had ramoops at the > > top level, left everything but the record size as 0, and somehow > > doesn't want this behavior, we can try to add more conditions here. > > > > Signed-off-by: Douglas Anderson <dianders@chromium.org> > > I like this; thanks! Rob is this okay by you? I just want to > double-check since it's part of the DT parsing logic. I'll leave it to you. It does fall into the case of supporting downstream bindings that weren't reviewed (IIRC reviewed maybe, but not accepted) which isn't great precedent. OTOH, it's a small change for a largish number of devices. Rob ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks 2019-05-06 21:09 ` Kees Cook 2019-05-06 21:33 ` Rob Herring @ 2019-05-06 23:58 ` Doug Anderson 2019-05-07 4:51 ` Doug Anderson 2019-05-07 22:17 ` Frank Rowand 1 sibling, 2 replies; 12+ messages in thread From: Doug Anderson @ 2019-05-06 23:58 UTC (permalink / raw) To: Kees Cook Cc: Rob Herring, Anton Vorontsov, open list:ARM/Rockchip SoC..., Julius Werner, Guenter Roeck, Matthias Kaehlcke, Brian Norris, Colin Cross, Tony Luck, LKML Hi, On Mon, May 6, 2019 at 2:10 PM Kees Cook <keescook@chromium.org> wrote: > > From: Douglas Anderson <dianders@chromium.org> > Date: Fri, May 3, 2019 at 10:48 AM > To: Kees Cook, Anton Vorontsov > Cc: <linux-rockchip@lists.infradead.org>, <jwerner@chromium.org>, > <groeck@chromium.org>, <mka@chromium.org>, <briannorris@chromium.org>, > Douglas Anderson, Colin Cross, Tony Luck, > <linux-kernel@vger.kernel.org> > > > When you try to run an upstream kernel on an old ARM-based Chromebook > > you'll find that console-ramoops doesn't work. > > > > Old ARM-based Chromebooks, before <https://crrev.com/c/439792> > > ("ramoops: support upstream {console,pmsg,ftrace}-size properties") > > used to create a "ramoops" node at the top level that looked like: > > > > / { > > ramoops { > > compatible = "ramoops"; > > reg = <...>; > > record-size = <...>; > > dump-oops; > > }; > > }; > > > > ...and these Chromebooks assumed that the downstream kernel would make > > console_size / pmsg_size match the record size. The above ramoops > > node was added by the firmware so it's not easy to make any changes. > > > > Let's match the expected behavior, but only for those using the old > > backward-compatible way of working where ramoops is right under the > > root node. > > > > NOTE: if there are some out-of-tree devices that had ramoops at the > > top level, left everything but the record size as 0, and somehow > > doesn't want this behavior, we can try to add more conditions here. > > > > Signed-off-by: Douglas Anderson <dianders@chromium.org> > > I like this; thanks! Rob is this okay by you? I just want to > double-check since it's part of the DT parsing logic. > > I'll pick it up and add a Cc: stable. Hold off a second--I may need to send out a v2 but out of time for the day. I think I need a #include file to fix errors on x86: > implicit declaration of function 'of_node_is_root' [-Werror,-Wimplicit-function-declaration I'm unfortunately out of time for now, but I'll post a v2 within the next day. -Doug ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks 2019-05-06 23:58 ` Doug Anderson @ 2019-05-07 4:51 ` Doug Anderson 2019-05-07 22:17 ` Frank Rowand 1 sibling, 0 replies; 12+ messages in thread From: Doug Anderson @ 2019-05-07 4:51 UTC (permalink / raw) To: Kees Cook Cc: Rob Herring, Anton Vorontsov, open list:ARM/Rockchip SoC..., Julius Werner, Guenter Roeck, Matthias Kaehlcke, Brian Norris, Colin Cross, Tony Luck, LKML Hi, On Mon, May 6, 2019 at 4:58 PM Doug Anderson <dianders@chromium.org> wrote: > > Hi, > > On Mon, May 6, 2019 at 2:10 PM Kees Cook <keescook@chromium.org> wrote: > > > > From: Douglas Anderson <dianders@chromium.org> > > Date: Fri, May 3, 2019 at 10:48 AM > > To: Kees Cook, Anton Vorontsov > > Cc: <linux-rockchip@lists.infradead.org>, <jwerner@chromium.org>, > > <groeck@chromium.org>, <mka@chromium.org>, <briannorris@chromium.org>, > > Douglas Anderson, Colin Cross, Tony Luck, > > <linux-kernel@vger.kernel.org> > > > > > When you try to run an upstream kernel on an old ARM-based Chromebook > > > you'll find that console-ramoops doesn't work. > > > > > > Old ARM-based Chromebooks, before <https://crrev.com/c/439792> > > > ("ramoops: support upstream {console,pmsg,ftrace}-size properties") > > > used to create a "ramoops" node at the top level that looked like: > > > > > > / { > > > ramoops { > > > compatible = "ramoops"; > > > reg = <...>; > > > record-size = <...>; > > > dump-oops; > > > }; > > > }; > > > > > > ...and these Chromebooks assumed that the downstream kernel would make > > > console_size / pmsg_size match the record size. The above ramoops > > > node was added by the firmware so it's not easy to make any changes. > > > > > > Let's match the expected behavior, but only for those using the old > > > backward-compatible way of working where ramoops is right under the > > > root node. > > > > > > NOTE: if there are some out-of-tree devices that had ramoops at the > > > top level, left everything but the record size as 0, and somehow > > > doesn't want this behavior, we can try to add more conditions here. > > > > > > Signed-off-by: Douglas Anderson <dianders@chromium.org> > > > > I like this; thanks! Rob is this okay by you? I just want to > > double-check since it's part of the DT parsing logic. > > > > I'll pick it up and add a Cc: stable. > > Hold off a second--I may need to send out a v2 but out of time for the > day. I think I need a #include file to fix errors on x86: > > > implicit declaration of function 'of_node_is_root' [-Werror,-Wimplicit-function-declaration > > I'm unfortunately out of time for now, but I'll post a v2 within the next day. OK, it needs this to land first: https://lore.kernel.org/lkml/20190507044801.250396-1-dianders@chromium.org/T/#u I thought it'd be OK to just send a separate patch. -Doug ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks 2019-05-06 23:58 ` Doug Anderson 2019-05-07 4:51 ` Doug Anderson @ 2019-05-07 22:17 ` Frank Rowand 2019-05-07 22:19 ` Doug Anderson 1 sibling, 1 reply; 12+ messages in thread From: Frank Rowand @ 2019-05-07 22:17 UTC (permalink / raw) To: Doug Anderson, Kees Cook Cc: Rob Herring, Anton Vorontsov, open list:ARM/Rockchip SoC..., Julius Werner, Guenter Roeck, Matthias Kaehlcke, Brian Norris, Colin Cross, Tony Luck, LKML On 5/6/19 4:58 PM, Doug Anderson wrote: > Hi, > > On Mon, May 6, 2019 at 2:10 PM Kees Cook <keescook@chromium.org> wrote: >> >> From: Douglas Anderson <dianders@chromium.org> >> Date: Fri, May 3, 2019 at 10:48 AM >> To: Kees Cook, Anton Vorontsov >> Cc: <linux-rockchip@lists.infradead.org>, <jwerner@chromium.org>, >> <groeck@chromium.org>, <mka@chromium.org>, <briannorris@chromium.org>, >> Douglas Anderson, Colin Cross, Tony Luck, >> <linux-kernel@vger.kernel.org> >> >>> When you try to run an upstream kernel on an old ARM-based Chromebook >>> you'll find that console-ramoops doesn't work. >>> >>> Old ARM-based Chromebooks, before <https://crrev.com/c/439792> >>> ("ramoops: support upstream {console,pmsg,ftrace}-size properties") >>> used to create a "ramoops" node at the top level that looked like: >>> >>> / { >>> ramoops { >>> compatible = "ramoops"; >>> reg = <...>; >>> record-size = <...>; >>> dump-oops; >>> }; >>> }; >>> >>> ...and these Chromebooks assumed that the downstream kernel would make >>> console_size / pmsg_size match the record size. The above ramoops >>> node was added by the firmware so it's not easy to make any changes. >>> >>> Let's match the expected behavior, but only for those using the old >>> backward-compatible way of working where ramoops is right under the >>> root node. >>> >>> NOTE: if there are some out-of-tree devices that had ramoops at the >>> top level, left everything but the record size as 0, and somehow >>> doesn't want this behavior, we can try to add more conditions here. >>> >>> Signed-off-by: Douglas Anderson <dianders@chromium.org> >> >> I like this; thanks! Rob is this okay by you? I just want to >> double-check since it's part of the DT parsing logic. >> >> I'll pick it up and add a Cc: stable. > > Hold off a second--I may need to send out a v2 but out of time for the > day. I think I need a #include file to fix errors on x86: > >> implicit declaration of function 'of_node_is_root' [-Werror,-Wimplicit-function-declaration Instead of checking "of_node_is_root(parent_node)" the patch could check for parent_node not "/reserved-memory". Then the x86 error would not occur. The check I am suggesting is not as precise, but it should be good enough for this case, correct? -Frank > > I'm unfortunately out of time for now, but I'll post a v2 within the next day. > > > -Doug > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks 2019-05-07 22:17 ` Frank Rowand @ 2019-05-07 22:19 ` Doug Anderson 2019-05-07 22:23 ` Frank Rowand 0 siblings, 1 reply; 12+ messages in thread From: Doug Anderson @ 2019-05-07 22:19 UTC (permalink / raw) To: Frank Rowand Cc: Kees Cook, Rob Herring, Anton Vorontsov, open list:ARM/Rockchip SoC..., Julius Werner, Guenter Roeck, Matthias Kaehlcke, Brian Norris, Colin Cross, Tony Luck, LKML Hi, On Tue, May 7, 2019 at 3:17 PM Frank Rowand <frowand.list@gmail.com> wrote: > > On 5/6/19 4:58 PM, Doug Anderson wrote: > > Hi, > > > > On Mon, May 6, 2019 at 2:10 PM Kees Cook <keescook@chromium.org> wrote: > >> > >> From: Douglas Anderson <dianders@chromium.org> > >> Date: Fri, May 3, 2019 at 10:48 AM > >> To: Kees Cook, Anton Vorontsov > >> Cc: <linux-rockchip@lists.infradead.org>, <jwerner@chromium.org>, > >> <groeck@chromium.org>, <mka@chromium.org>, <briannorris@chromium.org>, > >> Douglas Anderson, Colin Cross, Tony Luck, > >> <linux-kernel@vger.kernel.org> > >> > >>> When you try to run an upstream kernel on an old ARM-based Chromebook > >>> you'll find that console-ramoops doesn't work. > >>> > >>> Old ARM-based Chromebooks, before <https://crrev.com/c/439792> > >>> ("ramoops: support upstream {console,pmsg,ftrace}-size properties") > >>> used to create a "ramoops" node at the top level that looked like: > >>> > >>> / { > >>> ramoops { > >>> compatible = "ramoops"; > >>> reg = <...>; > >>> record-size = <...>; > >>> dump-oops; > >>> }; > >>> }; > >>> > >>> ...and these Chromebooks assumed that the downstream kernel would make > >>> console_size / pmsg_size match the record size. The above ramoops > >>> node was added by the firmware so it's not easy to make any changes. > >>> > >>> Let's match the expected behavior, but only for those using the old > >>> backward-compatible way of working where ramoops is right under the > >>> root node. > >>> > >>> NOTE: if there are some out-of-tree devices that had ramoops at the > >>> top level, left everything but the record size as 0, and somehow > >>> doesn't want this behavior, we can try to add more conditions here. > >>> > >>> Signed-off-by: Douglas Anderson <dianders@chromium.org> > >> > >> I like this; thanks! Rob is this okay by you? I just want to > >> double-check since it's part of the DT parsing logic. > >> > >> I'll pick it up and add a Cc: stable. > > > > Hold off a second--I may need to send out a v2 but out of time for the > > day. I think I need a #include file to fix errors on x86: > > > >> implicit declaration of function 'of_node_is_root' [-Werror,-Wimplicit-function-declaration > > Instead of checking "of_node_is_root(parent_node)" the patch could check > for parent_node not "/reserved-memory". Then the x86 error would not > occur. > > The check I am suggesting is not as precise, but it should be good enough > for this case, correct? Sure, there are a million different ways to slice it. If you prefer that instead of adding a dummy of_node_is_root() I'm happy to do that. -Doug ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks 2019-05-07 22:19 ` Doug Anderson @ 2019-05-07 22:23 ` Frank Rowand 0 siblings, 0 replies; 12+ messages in thread From: Frank Rowand @ 2019-05-07 22:23 UTC (permalink / raw) To: Doug Anderson Cc: Kees Cook, Rob Herring, Anton Vorontsov, open list:ARM/Rockchip SoC..., Julius Werner, Guenter Roeck, Matthias Kaehlcke, Brian Norris, Colin Cross, Tony Luck, LKML Hi Doug, On 5/7/19 3:19 PM, Doug Anderson wrote: > Hi, > > On Tue, May 7, 2019 at 3:17 PM Frank Rowand <frowand.list@gmail.com> wrote: >> >> On 5/6/19 4:58 PM, Doug Anderson wrote: >>> Hi, >>> >>> On Mon, May 6, 2019 at 2:10 PM Kees Cook <keescook@chromium.org> wrote: >>>> >>>> From: Douglas Anderson <dianders@chromium.org> >>>> Date: Fri, May 3, 2019 at 10:48 AM >>>> To: Kees Cook, Anton Vorontsov >>>> Cc: <linux-rockchip@lists.infradead.org>, <jwerner@chromium.org>, >>>> <groeck@chromium.org>, <mka@chromium.org>, <briannorris@chromium.org>, >>>> Douglas Anderson, Colin Cross, Tony Luck, >>>> <linux-kernel@vger.kernel.org> >>>> >>>>> When you try to run an upstream kernel on an old ARM-based Chromebook >>>>> you'll find that console-ramoops doesn't work. >>>>> >>>>> Old ARM-based Chromebooks, before <https://crrev.com/c/439792> >>>>> ("ramoops: support upstream {console,pmsg,ftrace}-size properties") >>>>> used to create a "ramoops" node at the top level that looked like: >>>>> >>>>> / { >>>>> ramoops { >>>>> compatible = "ramoops"; >>>>> reg = <...>; >>>>> record-size = <...>; >>>>> dump-oops; >>>>> }; >>>>> }; >>>>> >>>>> ...and these Chromebooks assumed that the downstream kernel would make >>>>> console_size / pmsg_size match the record size. The above ramoops >>>>> node was added by the firmware so it's not easy to make any changes. >>>>> >>>>> Let's match the expected behavior, but only for those using the old >>>>> backward-compatible way of working where ramoops is right under the >>>>> root node. >>>>> >>>>> NOTE: if there are some out-of-tree devices that had ramoops at the >>>>> top level, left everything but the record size as 0, and somehow >>>>> doesn't want this behavior, we can try to add more conditions here. >>>>> >>>>> Signed-off-by: Douglas Anderson <dianders@chromium.org> >>>> >>>> I like this; thanks! Rob is this okay by you? I just want to >>>> double-check since it's part of the DT parsing logic. >>>> >>>> I'll pick it up and add a Cc: stable. >>> >>> Hold off a second--I may need to send out a v2 but out of time for the >>> day. I think I need a #include file to fix errors on x86: >>> >>>> implicit declaration of function 'of_node_is_root' [-Werror,-Wimplicit-function-declaration >> >> Instead of checking "of_node_is_root(parent_node)" the patch could check >> for parent_node not "/reserved-memory". Then the x86 error would not >> occur. >> >> The check I am suggesting is not as precise, but it should be good enough >> for this case, correct? > > Sure, there are a million different ways to slice it. If you prefer > that instead of adding a dummy of_node_is_root() I'm happy to do that. Yes, I would prefer to avoid adding a dummy of_node_is_root() if the alternative is reasonable (and if I understand, you are saying the alternative is reasonable). Thanks, Frank ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks 2019-05-03 17:47 [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks Douglas Anderson 2019-05-03 19:06 ` Guenter Roeck 2019-05-06 21:09 ` Kees Cook @ 2019-05-06 21:40 ` Brian Norris 2019-05-07 16:25 ` Doug Anderson 2 siblings, 1 reply; 12+ messages in thread From: Brian Norris @ 2019-05-06 21:40 UTC (permalink / raw) To: Douglas Anderson Cc: Kees Cook, Anton Vorontsov, open list:ARM/Rockchip SoC..., Julius Werner, Guenter Roeck, Matthias Kaehlcke, Colin Cross, Tony Luck, Linux Kernel On Fri, May 3, 2019 at 10:48 AM Douglas Anderson <dianders@chromium.org> wrote: > When you try to run an upstream kernel on an old ARM-based Chromebook > you'll find that console-ramoops doesn't work. Ooh, nice! I still get annoyed by old depthcharge firmware. It's almost as if we should have gotten an upstream binding approved before baking it into firmware... > --- a/fs/pstore/ram.c > +++ b/fs/pstore/ram.c > @@ -703,6 +704,23 @@ static int ramoops_parse_dt(struct platform_device *pdev, > > #undef parse_size > > + /* > + * Some old Chromebooks relied on the kernel setting the console_size > + * and pmsg_size to the record size since that's what the downstream > + * kernel did. These same Chromebooks had "ramoops" straight under > + * the root node which isn't according to the upstream bindings. The last part of the sentence technically isn't true -- the original bindings (notably, with no DT maintainer Reviewed-by) didn't specify where such a node should be found: 35da60941e44 pstore/ram: add Device Tree bindings so child-of-root used to be a valid location. But anyway, this code is just part of a heuristic for "old DT" (where later bindings clarified this), so it still seems valid. > Let's > + * make those old Chromebooks work by detecting this and mimicing the s/mimicing/mimicking/ > + * expected behavior. > + */ > + parent_node = of_get_parent(of_node); > + if (of_node_is_root(parent_node) && > + !pdata->console_size && !pdata->ftrace_size && > + !pdata->pmsg_size && !pdata->ecc_info.ecc_size) { > + pdata->console_size = pdata->record_size; > + pdata->pmsg_size = pdata->record_size; > + } > + of_node_put(parent_node); > + > return 0; > } > Otherwise, looks good to me: Reviewed-by: Brian Norris <briannorris@chromium.org> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks 2019-05-06 21:40 ` Brian Norris @ 2019-05-07 16:25 ` Doug Anderson 2019-05-07 16:48 ` Brian Norris 0 siblings, 1 reply; 12+ messages in thread From: Doug Anderson @ 2019-05-07 16:25 UTC (permalink / raw) To: Brian Norris Cc: Kees Cook, Anton Vorontsov, open list:ARM/Rockchip SoC..., Julius Werner, Guenter Roeck, Matthias Kaehlcke, Colin Cross, Tony Luck, Linux Kernel Hi, On Mon, May 6, 2019 at 2:40 PM Brian Norris <briannorris@chromium.org> wrote: > > On Fri, May 3, 2019 at 10:48 AM Douglas Anderson <dianders@chromium.org> wrote: > > When you try to run an upstream kernel on an old ARM-based Chromebook > > you'll find that console-ramoops doesn't work. > > Ooh, nice! I still get annoyed by old depthcharge firmware. It's > almost as if we should have gotten an upstream binding approved before > baking it into firmware... > > > --- a/fs/pstore/ram.c > > +++ b/fs/pstore/ram.c > > > @@ -703,6 +704,23 @@ static int ramoops_parse_dt(struct platform_device *pdev, > > > > #undef parse_size > > > > + /* > > + * Some old Chromebooks relied on the kernel setting the console_size > > + * and pmsg_size to the record size since that's what the downstream > > + * kernel did. These same Chromebooks had "ramoops" straight under > > + * the root node which isn't according to the upstream bindings. > > The last part of the sentence technically isn't true -- the original > bindings (notably, with no DT maintainer Reviewed-by) didn't specify > where such a node should be found: > > 35da60941e44 pstore/ram: add Device Tree bindings > > so child-of-root used to be a valid location. But anyway, this code is > just part of a heuristic for "old DT" (where later bindings clarified > this), so it still seems valid. I agree that it was unclear in the past, but it is true that being under the root node is not according to the _current_ upstream bindings, right? ;-) > > Let's > > + * make those old Chromebooks work by detecting this and mimicing the > > s/mimicing/mimicking/ Kees: if you want me to spin with this typo fix then please let me know. Otherwise I'll assume it's less work for you to just fix it yourself when applying. -Doug ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks 2019-05-07 16:25 ` Doug Anderson @ 2019-05-07 16:48 ` Brian Norris 0 siblings, 0 replies; 12+ messages in thread From: Brian Norris @ 2019-05-07 16:48 UTC (permalink / raw) To: Doug Anderson Cc: Kees Cook, Anton Vorontsov, open list:ARM/Rockchip SoC..., Julius Werner, Guenter Roeck, Matthias Kaehlcke, Colin Cross, Tony Luck, Linux Kernel On Tue, May 7, 2019 at 9:25 AM Doug Anderson <dianders@chromium.org> wrote: > On Mon, May 6, 2019 at 2:40 PM Brian Norris <briannorris@chromium.org> wrote: > > The last part of the sentence technically isn't true -- the original > > bindings (notably, with no DT maintainer Reviewed-by) didn't specify > > where such a node should be found: > > > > 35da60941e44 pstore/ram: add Device Tree bindings > > > > so child-of-root used to be a valid location. But anyway, this code is > > just part of a heuristic for "old DT" (where later bindings clarified > > this), so it still seems valid. > > I agree that it was unclear in the past, but it is true that being > under the root node is not according to the _current_ upstream > bindings, right? ;-) Sure, I suppose. Although, given the general ABI policy around DT, it seems to me that something that was "according to" an old binding cannot really be made "no longer" according to the binding. It can be discouraged, and removed from new DTs, but it doesn't really become *wrong*. But our DT was definitely *not* according to even the (un-reviewed) merged binding. So I'm mostly mincing words here. Brian ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2019-05-07 22:23 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-05-03 17:47 [PATCH] pstore/ram: Improve backward compatibility with older Chromebooks Douglas Anderson 2019-05-03 19:06 ` Guenter Roeck 2019-05-06 21:09 ` Kees Cook 2019-05-06 21:33 ` Rob Herring 2019-05-06 23:58 ` Doug Anderson 2019-05-07 4:51 ` Doug Anderson 2019-05-07 22:17 ` Frank Rowand 2019-05-07 22:19 ` Doug Anderson 2019-05-07 22:23 ` Frank Rowand 2019-05-06 21:40 ` Brian Norris 2019-05-07 16:25 ` Doug Anderson 2019-05-07 16:48 ` Brian Norris
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).