* [PATCH v6] pstore/ram: Add ramoops support for the Flattened Device Tree. @ 2012-09-07 18:29 Bryan Freed 2012-09-08 5:29 ` Anton Vorontsov 0 siblings, 1 reply; 14+ messages in thread From: Bryan Freed @ 2012-09-07 18:29 UTC (permalink / raw) To: linux-kernel Cc: keescook, anton.vorontsov, marco.stornelli, sboyd, gregkh, Bryan Freed When called with a non-zero of_node, fill out a new ramoops_platform_data with data from the specified Flattened Device Tree node. Update ramoops documentation with the new FDT interface. Update devicetree/binding documentation with pstore/ramoops.txt. --- I did not see any tree activity since I sent PATCH v5 on 6/26. So I cleaned up the code a bit and added support for the new console and ftrace logs as well. bryan. .../devicetree/bindings/pstore/ramoops.txt | 30 ++++++++++++ Documentation/ramoops.txt | 7 ++- fs/pstore/ram.c | 47 ++++++++++++++++++++ 3 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/pstore/ramoops.txt diff --git a/Documentation/devicetree/bindings/pstore/ramoops.txt b/Documentation/devicetree/bindings/pstore/ramoops.txt new file mode 100644 index 0000000..2fddba4 --- /dev/null +++ b/Documentation/devicetree/bindings/pstore/ramoops.txt @@ -0,0 +1,30 @@ +Ramoops oops/panic/console logger + +Required properties: +- compatible: Must be "ramoops". +- reg: Specifies the base physical address and size of preserved memory. + +Optional properties: +- record-size: Specifies the size of each record in preserved memory. +- console-size: Specifies the size of the console log. +- ftrace-size: Specifies the size of the ftrace log. +- ecc-size: Specifies the size of each record's ECC buffer. +- dump-oops: Specifies to dump oops in addition to panics. + +Example: + +ramoops { + compatible = "ramoops"; + reg = <0x41f00000 0x00100000>; + record-size = <0x00020000>; + ftrace-size = <0x00020000>; + dump-oops; +}; +The "reg = <0x41f00000 0x00100000>" line specifies a preserved memory +size of 1MB at physical address 0x41f00000. +The "record-size = <0x00020000>" line specifies a record size of 128KB. +The "ftrace-size = <0x00020000>" line specifies an ftrace log size of 128KB. +The optional "dump-oops" line tells ramoops to dump oopses as well as panics. +At least one of record, console, or ftrace size must be specified. +In this example, 128KB is allocated to the ftrace log, and 896KB +(1024KB - 128KB) is allocated to oops and panic records. diff --git a/Documentation/ramoops.txt b/Documentation/ramoops.txt index 197ad59..20ab20a 100644 --- a/Documentation/ramoops.txt +++ b/Documentation/ramoops.txt @@ -3,7 +3,7 @@ Ramoops oops/panic logger Sergiu Iordache <sergiu@chromium.org> -Updated: 17 November 2011 +Updated: 5 June 2012 0. Introduction @@ -37,7 +37,7 @@ corrupt, but usually it is restorable. 2. Setting the parameters -Setting the ramoops parameters can be done in 2 different manners: +Setting the ramoops parameters can be done in 3 different manners: 1. Use the module parameters (which have the names of the variables described as before). For quick debugging, you can also reserve parts of memory during boot @@ -84,6 +84,9 @@ very early in the architecture code, e.g.: memblock_reserve(ramoops_data.mem_address, ramoops_data.mem_size); + 3. Use the Flattened Device Tree to set the platform data. + This is described in devicetree/bindings/pstore/ramoops.txt. + 3. Dump format The data dump begins with a header, currently defined as "====" followed by a diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 0b311bc..876cc32 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -33,6 +33,7 @@ #include <linux/platform_device.h> #include <linux/slab.h> #include <linux/pstore_ram.h> +#include <linux/of_address.h> #define RAMOOPS_KERNMSG_HDR "====" #define MIN_MEM_SIZE 4096UL @@ -352,6 +353,43 @@ static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt, return 0; } +#ifdef CONFIG_OF +static struct ramoops_platform_data * __init +of_ramoops_platform_data(struct device *dev) +{ + struct device_node *node = dev->of_node; + struct ramoops_platform_data *pdata; + const __be32 *addrp; + u64 size; + u32 val; + + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (pdata == NULL) + return NULL; + + addrp = of_get_address(node, 0, &size, NULL); + if (addrp == NULL) + return NULL; + pdata->mem_address = of_translate_address(node, addrp); + pdata->mem_size = size; + + if (!of_property_read_u32(node, "record-size", &val)) + pdata->record_size = val; + if (!of_property_read_u32(node, "console-size", &val)) + pdata->console_size = val; + if (!of_property_read_u32(node, "ftrace-size", &val)) + pdata->ftrace_size = val; + if (!of_property_read_u32(node, "ecc-size", &val)) + pdata->ecc_size = val; + if (of_get_property(node, "dump-oops", NULL)) + pdata->dump_oops = 1; + + return pdata; +} +#else +#define of_ramoops_platform_data(dev) NULL +#endif + static int __devinit ramoops_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -367,6 +405,14 @@ static int __devinit ramoops_probe(struct platform_device *pdev) if (cxt->max_dump_cnt) goto fail_out; + if (!pdata && pdev->dev.of_node) { + pdata = of_ramoops_platform_data(&pdev->dev); + if (!pdata) { + pr_err("Invalid ramoops device tree data\n"); + goto fail_out; + } + } + if (!pdata->mem_size || (!pdata->record_size && !pdata->console_size && !pdata->ftrace_size)) { pr_err("The memory size and the record/console size must be " @@ -491,6 +537,7 @@ static struct platform_driver ramoops_driver = { .driver = { .name = "ramoops", .owner = THIS_MODULE, + .of_match_table = of_match_ptr(ramoops_of_match), }, }; -- 1.7.7.3 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v6] pstore/ram: Add ramoops support for the Flattened Device Tree. 2012-09-07 18:29 [PATCH v6] pstore/ram: Add ramoops support for the Flattened Device Tree Bryan Freed @ 2012-09-08 5:29 ` Anton Vorontsov 2012-09-08 7:23 ` Marco Stornelli 2012-09-17 6:23 ` Anton Vorontsov 0 siblings, 2 replies; 14+ messages in thread From: Anton Vorontsov @ 2012-09-08 5:29 UTC (permalink / raw) To: Bryan Freed Cc: John Stultz, linux-kernel, keescook, marco.stornelli, sboyd, gregkh, Colin Cross, Tony Luck, devicetree-discuss On Fri, Sep 07, 2012 at 11:29:36AM -0700, Bryan Freed wrote: > When called with a non-zero of_node, fill out a new ramoops_platform_data > with data from the specified Flattened Device Tree node. > Update ramoops documentation with the new FDT interface. > Update devicetree/binding documentation with pstore/ramoops.txt. Thanks for your work, Bryan! There were a few issues, I fixed them myself but I need your confirmation if you're OK w/ all the changes. First of, the Signed-off-by tag is missing, but I see it in v5. I also see that v5 had an Ack from Kees Cook, you did not preserve it, but generally it's a good idea to do so (if vX -> v(X+1) changes aren't drastic). [...] > +Optional properties: > +- record-size: Specifies the size of each record in preserved memory. > +- console-size: Specifies the size of the console log. > +- ftrace-size: Specifies the size of the ftrace log. > +- ecc-size: Specifies the size of each record's ECC buffer. > +- dump-oops: Specifies to dump oops in addition to panics. Personally, I don't see how this fits into device tree. It doesn't describe hardware, instead it's more a configuration stuff, which usually we try to not put into the device tree. It would be better to have a sane defaults in ramoops, instead of introducing more "virtual" stuff in the device tree. That is, feel free to change defaults if they seem to be not enough for most your setups. The only property that I see which is truly hardware-specific is ecc-size. E.g. if we're pretty sure that a specific hw does not need ecc, it's OK to avoid it. And some hw setups might require bigger ECC sizes, so it's OK to have it in the device-tree. > static struct ramoops_platform_data * __init > of_ramoops_platform_data(struct device *dev) You call this function from __devinit section, so using __init is an error. WARNING: fs/pstore/ramoops.o(.devinit.text+0x37): Section mismatch in reference from the function ramoops_probe() to the function .init.text:of_ramoops_platform_data() The function __devinit ramoops_probe() references I changed this to __devnit. [...] > + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); > + if (pdata == NULL) I wonder why people prefer to not write !pdata, which is more natural when reading the code.. :-) [...] > +#else > +#define of_ramoops_platform_data(dev) NULL Using static inline would be better, i.e. type-safe. >+ .of_match_table = of_match_ptr(ramoops_of_match), This fails to build: fs/pstore/ram.c: At top level: fs/pstore/ram.c:540:22: error: ‘ramoops_of_match’ undeclared here (not in a function) For some reason you lost ramoops_of_match hunk from the v5. So I made these changes on top of your patch (note, there's more text at the end of the email): - - - - diff --git a/Documentation/devicetree/bindings/pstore/ramoops.txt b/Documentation/devicetree/bindings/pstore/ramoops.txt index 2fddba4..1d43305 100644 --- a/Documentation/devicetree/bindings/pstore/ramoops.txt +++ b/Documentation/devicetree/bindings/pstore/ramoops.txt @@ -1,30 +1,17 @@ -Ramoops oops/panic/console logger +Ramoops oops/panic/console/trace logger Required properties: - compatible: Must be "ramoops". - reg: Specifies the base physical address and size of preserved memory. Optional properties: -- record-size: Specifies the size of each record in preserved memory. -- console-size: Specifies the size of the console log. -- ftrace-size: Specifies the size of the ftrace log. - ecc-size: Specifies the size of each record's ECC buffer. -- dump-oops: Specifies to dump oops in addition to panics. Example: ramoops { compatible = "ramoops"; reg = <0x41f00000 0x00100000>; - record-size = <0x00020000>; - ftrace-size = <0x00020000>; - dump-oops; }; The "reg = <0x41f00000 0x00100000>" line specifies a preserved memory size of 1MB at physical address 0x41f00000. -The "record-size = <0x00020000>" line specifies a record size of 128KB. -The "ftrace-size = <0x00020000>" line specifies an ftrace log size of 128KB. -The optional "dump-oops" line tells ramoops to dump oopses as well as panics. -At least one of record, console, or ftrace size must be specified. -In this example, 128KB is allocated to the ftrace log, and 896KB -(1024KB - 128KB) is allocated to oops and panic records. diff --git a/Documentation/ramoops.txt b/Documentation/ramoops.txt index 82d825d..a9d0c6a 100644 --- a/Documentation/ramoops.txt +++ b/Documentation/ramoops.txt @@ -3,7 +3,7 @@ Ramoops oops/panic logger Sergiu Iordache <sergiu@chromium.org> -Updated: 5 June 2012 +Updated: 7 September 2012 0. Introduction diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index b272473..c6e4485 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -25,6 +25,7 @@ #include <linux/kernel.h> #include <linux/err.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/version.h> #include <linux/pstore.h> #include <linux/time.h> @@ -34,6 +35,7 @@ #include <linux/slab.h> #include <linux/compiler.h> #include <linux/pstore_ram.h> +#include <linux/of.h> #include <linux/of_address.h> #define RAMOOPS_KERNMSG_HDR "====" @@ -354,7 +356,8 @@ static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt, } #ifdef CONFIG_OF -static struct ramoops_platform_data * __init + +static struct ramoops_platform_data * __devinit of_ramoops_platform_data(struct device *dev) { struct device_node *node = dev->of_node; @@ -364,30 +367,36 @@ of_ramoops_platform_data(struct device *dev) u32 val; pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); - if (pdata == NULL) + if (!pdata) return NULL; addrp = of_get_address(node, 0, &size, NULL); - if (addrp == NULL) + if (!addrp) return NULL; + pdata->mem_address = of_translate_address(node, addrp); pdata->mem_size = size; - if (!of_property_read_u32(node, "record-size", &val)) - pdata->record_size = val; - if (!of_property_read_u32(node, "console-size", &val)) - pdata->console_size = val; - if (!of_property_read_u32(node, "ftrace-size", &val)) - pdata->ftrace_size = val; + pdata->record_size = record_size; + pdata->console_size = ramoops_console_size; + pdata->ftrace_size = ramoops_ftrace_size; + pdata->dump_oops = dump_oops; + if (!of_property_read_u32(node, "ecc-size", &val)) pdata->ecc_size = val; - if (of_get_property(node, "dump-oops", NULL)) - pdata->dump_oops = 1; return pdata; } + +static const struct of_device_id ramoops_of_match[] = { + { .compatible = "ramoops", }, + { }, +}; +MODULE_DEVICE_TABLE(of, ramoops_of_match); + #else -#define of_ramoops_platform_data(dev) NULL +static inline struct ramoops_platform_data * +of_ramoops_platform_data(struct device *dev) { return NULL; } #endif static int __devinit ramoops_probe(struct platform_device *pdev) - - - - So, the resulting patch is down below. But I have not pushed it out yet, I'm waiting for your sign off. If you're OK with the changes, please reply with 'Signed-off-by: Bryan Freed <bfreed@chromium.org>' Thanks! - - - - From: Bryan Freed <bfreed@chromium.org> Subject: pstore/ram: Add ramoops support for the Flattened Device Tree When called with a non-zero of_node, fill out a new ramoops_platform_data with data from the specified Flattened Device Tree node. Update ramoops documentation with the new FDT interface. Update devicetree/binding documentation with pstore/ramoops.txt. Not-yet-signed-off-by: Bryan Freed <bfreed@chromium.org> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org> --- .../devicetree/bindings/pstore/ramoops.txt | 17 +++++++ Documentation/ramoops.txt | 7 ++- fs/pstore/ram.c | 56 ++++++++++++++++++++++ 3 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/pstore/ramoops.txt diff --git a/Documentation/devicetree/bindings/pstore/ramoops.txt b/Documentation/devicetree/bindings/pstore/ramoops.txt new file mode 100644 index 0000000..1d43305 --- /dev/null +++ b/Documentation/devicetree/bindings/pstore/ramoops.txt @@ -0,0 +1,17 @@ +Ramoops oops/panic/console/trace logger + +Required properties: +- compatible: Must be "ramoops". +- reg: Specifies the base physical address and size of preserved memory. + +Optional properties: +- ecc-size: Specifies the size of each record's ECC buffer. + +Example: + +ramoops { + compatible = "ramoops"; + reg = <0x41f00000 0x00100000>; +}; +The "reg = <0x41f00000 0x00100000>" line specifies a preserved memory +size of 1MB at physical address 0x41f00000. diff --git a/Documentation/ramoops.txt b/Documentation/ramoops.txt index 69b3cac..a9d0c6a 100644 --- a/Documentation/ramoops.txt +++ b/Documentation/ramoops.txt @@ -3,7 +3,7 @@ Ramoops oops/panic logger Sergiu Iordache <sergiu@chromium.org> -Updated: 17 November 2011 +Updated: 7 September 2012 0. Introduction @@ -37,7 +37,7 @@ corrupt, but usually it is restorable. 2. Setting the parameters -Setting the ramoops parameters can be done in 2 different manners: +Setting the ramoops parameters can be done in 3 different manners: 1. Use the module parameters (which have the names of the variables described as before). For quick debugging, you can also reserve parts of memory during boot @@ -84,6 +84,9 @@ very early in the architecture code, e.g.: memblock_reserve(ramoops_data.mem_address, ramoops_data.mem_size); + 3. Use the Flattened Device Tree to set the platform data. + This is described in devicetree/bindings/pstore/ramoops.txt. + 3. Dump format The data dump begins with a header, currently defined as "====" followed by a diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 1a4f6da..c6e4485 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -25,6 +25,7 @@ #include <linux/kernel.h> #include <linux/err.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/version.h> #include <linux/pstore.h> #include <linux/time.h> @@ -34,6 +35,8 @@ #include <linux/slab.h> #include <linux/compiler.h> #include <linux/pstore_ram.h> +#include <linux/of.h> +#include <linux/of_address.h> #define RAMOOPS_KERNMSG_HDR "====" #define MIN_MEM_SIZE 4096UL @@ -352,6 +355,50 @@ static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt, return 0; } +#ifdef CONFIG_OF + +static struct ramoops_platform_data * __devinit +of_ramoops_platform_data(struct device *dev) +{ + struct device_node *node = dev->of_node; + struct ramoops_platform_data *pdata; + const __be32 *addrp; + u64 size; + u32 val; + + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return NULL; + + addrp = of_get_address(node, 0, &size, NULL); + if (!addrp) + return NULL; + + pdata->mem_address = of_translate_address(node, addrp); + pdata->mem_size = size; + + pdata->record_size = record_size; + pdata->console_size = ramoops_console_size; + pdata->ftrace_size = ramoops_ftrace_size; + pdata->dump_oops = dump_oops; + + if (!of_property_read_u32(node, "ecc-size", &val)) + pdata->ecc_size = val; + + return pdata; +} + +static const struct of_device_id ramoops_of_match[] = { + { .compatible = "ramoops", }, + { }, +}; +MODULE_DEVICE_TABLE(of, ramoops_of_match); + +#else +static inline struct ramoops_platform_data * +of_ramoops_platform_data(struct device *dev) { return NULL; } +#endif + static int __devinit ramoops_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -367,6 +414,14 @@ static int __devinit ramoops_probe(struct platform_device *pdev) if (cxt->max_dump_cnt) goto fail_out; + if (!pdata && pdev->dev.of_node) { + pdata = of_ramoops_platform_data(&pdev->dev); + if (!pdata) { + pr_err("Invalid ramoops device tree data\n"); + goto fail_out; + } + } + if (!pdata->mem_size || (!pdata->record_size && !pdata->console_size && !pdata->ftrace_size)) { pr_err("The memory size and the record/console size must be " @@ -492,6 +547,7 @@ static struct platform_driver ramoops_driver = { .driver = { .name = "ramoops", .owner = THIS_MODULE, + .of_match_table = of_match_ptr(ramoops_of_match), }, }; -- 1.7.11.5 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v6] pstore/ram: Add ramoops support for the Flattened Device Tree. 2012-09-08 5:29 ` Anton Vorontsov @ 2012-09-08 7:23 ` Marco Stornelli 2012-09-08 8:06 ` Anton Vorontsov 2012-09-17 6:23 ` Anton Vorontsov 1 sibling, 1 reply; 14+ messages in thread From: Marco Stornelli @ 2012-09-08 7:23 UTC (permalink / raw) To: Anton Vorontsov Cc: Bryan Freed, John Stultz, linux-kernel, keescook, sboyd, gregkh, Colin Cross, Tony Luck, devicetree-discuss Il 08/09/2012 07:29, Anton Vorontsov ha scritto: > On Fri, Sep 07, 2012 at 11:29:36AM -0700, Bryan Freed wrote: >> When called with a non-zero of_node, fill out a new ramoops_platform_data >> with data from the specified Flattened Device Tree node. >> Update ramoops documentation with the new FDT interface. >> Update devicetree/binding documentation with pstore/ramoops.txt. > > Thanks for your work, Bryan! There were a few issues, I fixed > them myself but I need your confirmation if you're OK w/ all > the changes. > > First of, the Signed-off-by tag is missing, but I see it in v5. > I also see that v5 had an Ack from Kees Cook, you did not preserve it, > but generally it's a good idea to do so (if vX -> v(X+1) changes > aren't drastic). > > [...] >> +Optional properties: >> +- record-size: Specifies the size of each record in preserved memory. >> +- console-size: Specifies the size of the console log. >> +- ftrace-size: Specifies the size of the ftrace log. >> +- ecc-size: Specifies the size of each record's ECC buffer. >> +- dump-oops: Specifies to dump oops in addition to panics. > > Personally, I don't see how this fits into device tree. It doesn't > describe hardware, instead it's more a configuration stuff, which > usually we try to not put into the device tree. > > It would be better to have a sane defaults in ramoops, instead of > introducing more "virtual" stuff in the device tree. That is, feel > free to change defaults if they seem to be not enough for most your > setups. > > The only property that I see which is truly hardware-specific is > ecc-size. E.g. if we're pretty sure that a specific hw does not > need ecc, it's OK to avoid it. And some hw setups might require > bigger ECC sizes, so it's OK to have it in the device-tree. > >> static struct ramoops_platform_data * __init >> of_ramoops_platform_data(struct device *dev) > > You call this function from __devinit section, so using __init > is an error. > > WARNING: fs/pstore/ramoops.o(.devinit.text+0x37): Section mismatch in reference from the function ramoops_probe() to the function .init.text:of_ramoops_platform_data() > The function __devinit ramoops_probe() references > > I changed this to __devnit. > > [...] >> + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); >> + if (pdata == NULL) > > I wonder why people prefer to not write !pdata, which is more > natural when reading the code.. :-) > I think it's the same for sizeof, it's much more readable sizeof(struct ramoops_platform_data). Marco ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6] pstore/ram: Add ramoops support for the Flattened Device Tree. 2012-09-08 7:23 ` Marco Stornelli @ 2012-09-08 8:06 ` Anton Vorontsov 2012-09-08 8:27 ` Marco Stornelli 0 siblings, 1 reply; 14+ messages in thread From: Anton Vorontsov @ 2012-09-08 8:06 UTC (permalink / raw) To: Marco Stornelli Cc: Bryan Freed, John Stultz, linux-kernel, keescook, sboyd, gregkh, Colin Cross, Tony Luck, devicetree-discuss On Sat, Sep 08, 2012 at 09:23:40AM +0200, Marco Stornelli wrote: [...] > >>+ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); > >>+ if (pdata == NULL) > > > >I wonder why people prefer to not write !pdata, which is more natural > >when reading the code.. :-) > > I think it's the same for sizeof, it's much more readable > sizeof(struct ramoops_platform_data). Well, sizeof(struct...) is against Linux coding style. And there are good reasons for this rule, it's all in the CodingStyle file. Thus, it's not about personal preferences. But speaking of personal preferences, I don't find sizeof(struct...) more readable. :-) Thanks! Anton. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6] pstore/ram: Add ramoops support for the Flattened Device Tree. 2012-09-08 8:06 ` Anton Vorontsov @ 2012-09-08 8:27 ` Marco Stornelli 0 siblings, 0 replies; 14+ messages in thread From: Marco Stornelli @ 2012-09-08 8:27 UTC (permalink / raw) To: Anton Vorontsov Cc: Bryan Freed, John Stultz, linux-kernel, keescook, sboyd, gregkh, Colin Cross, Tony Luck, devicetree-discuss Il 08/09/2012 10:06, Anton Vorontsov ha scritto: > On Sat, Sep 08, 2012 at 09:23:40AM +0200, Marco Stornelli wrote: [...] >>>> + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); >>>> + if (pdata == NULL) >>> >>> I wonder why people prefer to not write !pdata, which is more natural >>> when reading the code.. :-) >> >> I think it's the same for sizeof, it's much more readable >> sizeof(struct ramoops_platform_data). > > Well, sizeof(struct...) is against Linux coding style. And there are > good reasons for this rule, it's all in the CodingStyle file. Thus, > it's not about personal preferences. But speaking of personal > preferences, I don't find sizeof(struct...) more readable. :-) > > Thanks! > Anton. > Yes, I know, but indeed it's only a personal preference as the check ==NULL instead of !pdata. :) Marco ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6] pstore/ram: Add ramoops support for the Flattened Device Tree. 2012-09-08 5:29 ` Anton Vorontsov 2012-09-08 7:23 ` Marco Stornelli @ 2012-09-17 6:23 ` Anton Vorontsov 2013-04-05 2:03 ` Rob Herring 1 sibling, 1 reply; 14+ messages in thread From: Anton Vorontsov @ 2012-09-17 6:23 UTC (permalink / raw) To: Bryan Freed Cc: John Stultz, linux-kernel, keescook, marco.stornelli, sboyd, gregkh, Colin Cross, Tony Luck, devicetree-discuss On Fri, Sep 07, 2012 at 10:29:10PM -0700, Anton Vorontsov wrote: > On Fri, Sep 07, 2012 at 11:29:36AM -0700, Bryan Freed wrote: > > When called with a non-zero of_node, fill out a new ramoops_platform_data > > with data from the specified Flattened Device Tree node. > > Update ramoops documentation with the new FDT interface. > > Update devicetree/binding documentation with pstore/ramoops.txt. > > Thanks for your work, Bryan! There were a few issues, I fixed > them myself but I need your confirmation if you're OK w/ all > the changes. [...] > So, the resulting patch is down below. But I have not pushed > it out yet, I'm waiting for your sign off. If you're OK with the > changes, please reply with > 'Signed-off-by: Bryan Freed <bfreed@chromium.org>' Bryan, have you had a chance to look into this? Thanks, Anton. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6] pstore/ram: Add ramoops support for the Flattened Device Tree. 2012-09-17 6:23 ` Anton Vorontsov @ 2013-04-05 2:03 ` Rob Herring 2013-04-07 17:43 ` Anton Vorontsov 0 siblings, 1 reply; 14+ messages in thread From: Rob Herring @ 2013-04-05 2:03 UTC (permalink / raw) To: Anton Vorontsov Cc: Bryan Freed, Tony Luck, keescook, marco.stornelli, gregkh, devicetree-discuss, sboyd, linux-kernel, John Stultz, Colin Cross, Olof Johansson On Mon, Sep 17, 2012 at 1:23 AM, Anton Vorontsov <cbouatmailru@gmail.com> wrote: > On Fri, Sep 07, 2012 at 10:29:10PM -0700, Anton Vorontsov wrote: >> On Fri, Sep 07, 2012 at 11:29:36AM -0700, Bryan Freed wrote: >> > When called with a non-zero of_node, fill out a new ramoops_platform_data >> > with data from the specified Flattened Device Tree node. >> > Update ramoops documentation with the new FDT interface. >> > Update devicetree/binding documentation with pstore/ramoops.txt. >> >> Thanks for your work, Bryan! There were a few issues, I fixed >> them myself but I need your confirmation if you're OK w/ all >> the changes. > [...] >> So, the resulting patch is down below. But I have not pushed >> it out yet, I'm waiting for your sign off. If you're OK with the >> changes, please reply with >> 'Signed-off-by: Bryan Freed <bfreed@chromium.org>' > > Bryan, have you had a chance to look into this? Whatever happened to this? Olof was also looking at doing a binding back in Jan 2012: http://www.mail-archive.com/devicetree-discuss@lists.ozlabs.org/msg09905.html Rob ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6] pstore/ram: Add ramoops support for the Flattened Device Tree. 2013-04-05 2:03 ` Rob Herring @ 2013-04-07 17:43 ` Anton Vorontsov 2013-04-08 19:54 ` Bryan Freed 0 siblings, 1 reply; 14+ messages in thread From: Anton Vorontsov @ 2013-04-07 17:43 UTC (permalink / raw) To: Rob Herring Cc: Bryan Freed, Tony Luck, keescook, marco.stornelli, gregkh, devicetree-discuss, sboyd, linux-kernel, John Stultz, Colin Cross, Olof Johansson On Thu, Apr 04, 2013 at 09:03:47PM -0500, Rob Herring wrote: > On Mon, Sep 17, 2012 at 1:23 AM, Anton Vorontsov <cbouatmailru@gmail.com> wrote: > > On Fri, Sep 07, 2012 at 10:29:10PM -0700, Anton Vorontsov wrote: > >> On Fri, Sep 07, 2012 at 11:29:36AM -0700, Bryan Freed wrote: > >> > When called with a non-zero of_node, fill out a new ramoops_platform_data > >> > with data from the specified Flattened Device Tree node. > >> > Update ramoops documentation with the new FDT interface. > >> > Update devicetree/binding documentation with pstore/ramoops.txt. > >> > >> Thanks for your work, Bryan! There were a few issues, I fixed > >> them myself but I need your confirmation if you're OK w/ all > >> the changes. > > [...] > >> So, the resulting patch is down below. But I have not pushed > >> it out yet, I'm waiting for your sign off. If you're OK with the > >> changes, please reply with > >> 'Signed-off-by: Bryan Freed <bfreed@chromium.org>' > > > > Bryan, have you had a chance to look into this? > > Whatever happened to this? Olof was also looking at doing a binding > back in Jan 2012: > > http://www.mail-archive.com/devicetree-discuss@lists.ozlabs.org/msg09905.html I don't know. Bryan's patch looked good, I'd happily apply it. But I still need Bryan's Signed-off-by tag. :-/ Or, somebody needs to sign off on his behalf (anyone from Chromium project?). Or redo the patch. Thanks, Anton ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6] pstore/ram: Add ramoops support for the Flattened Device Tree. 2013-04-07 17:43 ` Anton Vorontsov @ 2013-04-08 19:54 ` Bryan Freed 2013-04-08 22:43 ` Rob Herring 2013-04-14 14:24 ` Anton Vorontsov 0 siblings, 2 replies; 14+ messages in thread From: Bryan Freed @ 2013-04-08 19:54 UTC (permalink / raw) To: Anton Vorontsov Cc: Rob Herring, Tony Luck, Kees Cook, Marco Stornelli, Greg Kroah-Hartman, devicetree-discuss, Stephen Boyd, linux-kernel, John Stultz, Colin Cross, Olof Johansson Sorry for dropping the ball on this one, Anton. Thank you for your feedback and modifications in the code. I gotta ask, however, why do you completely remove key ramoops fields like record_size and ftrace_size? >From your 9/7/2012 comments (again, sorry for the delay in getting back to you): > Personally, I don't see how this fits into device tree. It doesn't > describe hardware, instead it's more a configuration stuff, which > usually we try to not put into the device tree. > > It would be better to have a sane defaults in ramoops, instead of > introducing more "virtual" stuff in the device tree. That is, feel > free to change defaults if they seem to be not enough for most your > setups. So there are only two alternatives I can see to set these fields. 1. Pass kernel command line parameters, or 2. Modify the defaults in ram.c. Neither of these alternatives is particularly clean to me. The first is shunned to avoid clutter on the command line. And the second requires us to maintain our own version of ram.c or push our defaults on the rest of the community. We (ok, maybe just 'I') prefer to keep our device specific values in the device tree, even though it is not strictly defining hardware in the system. What do you think of at least keeping the record_size, console_size and ftrace_size fields as optional in the ramoops device tree specification? And as a more general question, why should we try not to put configuration in the device tree? It seems like a great (and portable) place to put this stuff. It certainly seems better to have it there than hardwired in the kernel or tacked onto the kernel command line. Thanks, bryan. On Sun, Apr 7, 2013 at 10:43 AM, Anton Vorontsov <anton@enomsg.org> wrote: > On Thu, Apr 04, 2013 at 09:03:47PM -0500, Rob Herring wrote: >> On Mon, Sep 17, 2012 at 1:23 AM, Anton Vorontsov <cbouatmailru@gmail.com> wrote: >> > On Fri, Sep 07, 2012 at 10:29:10PM -0700, Anton Vorontsov wrote: >> >> On Fri, Sep 07, 2012 at 11:29:36AM -0700, Bryan Freed wrote: >> >> > When called with a non-zero of_node, fill out a new ramoops_platform_data >> >> > with data from the specified Flattened Device Tree node. >> >> > Update ramoops documentation with the new FDT interface. >> >> > Update devicetree/binding documentation with pstore/ramoops.txt. >> >> >> >> Thanks for your work, Bryan! There were a few issues, I fixed >> >> them myself but I need your confirmation if you're OK w/ all >> >> the changes. >> > [...] >> >> So, the resulting patch is down below. But I have not pushed >> >> it out yet, I'm waiting for your sign off. If you're OK with the >> >> changes, please reply with >> >> 'Signed-off-by: Bryan Freed <bfreed@chromium.org>' >> > >> > Bryan, have you had a chance to look into this? >> >> Whatever happened to this? Olof was also looking at doing a binding >> back in Jan 2012: >> >> http://www.mail-archive.com/devicetree-discuss@lists.ozlabs.org/msg09905.html > > I don't know. Bryan's patch looked good, I'd happily apply it. But I still > need Bryan's Signed-off-by tag. :-/ Or, somebody needs to sign off on his > behalf (anyone from Chromium project?). Or redo the patch. > > Thanks, > > Anton ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6] pstore/ram: Add ramoops support for the Flattened Device Tree. 2013-04-08 19:54 ` Bryan Freed @ 2013-04-08 22:43 ` Rob Herring 2013-04-14 14:24 ` Anton Vorontsov 1 sibling, 0 replies; 14+ messages in thread From: Rob Herring @ 2013-04-08 22:43 UTC (permalink / raw) To: Bryan Freed Cc: Anton Vorontsov, Tony Luck, Kees Cook, Marco Stornelli, Greg Kroah-Hartman, devicetree-discuss, Stephen Boyd, linux-kernel, John Stultz, Colin Cross, Olof Johansson On 04/08/2013 02:54 PM, Bryan Freed wrote: > Sorry for dropping the ball on this one, Anton. > > Thank you for your feedback and modifications in the code. > I gotta ask, however, why do you completely remove key ramoops fields > like record_size and ftrace_size? > > From your 9/7/2012 comments (again, sorry for the delay in getting back to you): >> Personally, I don't see how this fits into device tree. It doesn't >> describe hardware, instead it's more a configuration stuff, which >> usually we try to not put into the device tree. >> >> It would be better to have a sane defaults in ramoops, instead of >> introducing more "virtual" stuff in the device tree. That is, feel >> free to change defaults if they seem to be not enough for most your >> setups. > > So there are only two alternatives I can see to set these fields. > 1. Pass kernel command line parameters, or > 2. Modify the defaults in ram.c. > > Neither of these alternatives is particularly clean to me. The first > is shunned to avoid clutter on the command line. > And the second requires us to maintain our own version of ram.c or > push our defaults on the rest of the community. > > We (ok, maybe just 'I') prefer to keep our device specific values in > the device tree, even though it is not strictly defining hardware in > the system. > What do you think of at least keeping the record_size, console_size > and ftrace_size fields as optional in the ramoops device tree > specification? > > And as a more general question, why should we try not to put > configuration in the device tree? It seems like a great (and > portable) place to put this stuff. > It certainly seems better to have it there than hardwired in the > kernel or tacked onto the kernel command line. You have to account for the fact that you may not be able to update the dtb which may be part of firmware. I can imagine you might want to change some of the sizes frequently based on what you are doing and trying to capture. So even if you put in the DT, you need some easy way to override the settings. This could always be fixed-up by the bootloader which is what is done for things we don't expect the firmware to know like initrd address/size and kernel command line. This is why the prior discussion I mentioned below suggested putting all this in the /chosen node. Rob > > Thanks, > > bryan. > > On Sun, Apr 7, 2013 at 10:43 AM, Anton Vorontsov <anton@enomsg.org> wrote: >> On Thu, Apr 04, 2013 at 09:03:47PM -0500, Rob Herring wrote: >>> On Mon, Sep 17, 2012 at 1:23 AM, Anton Vorontsov <cbouatmailru@gmail.com> wrote: >>>> On Fri, Sep 07, 2012 at 10:29:10PM -0700, Anton Vorontsov wrote: >>>>> On Fri, Sep 07, 2012 at 11:29:36AM -0700, Bryan Freed wrote: >>>>>> When called with a non-zero of_node, fill out a new ramoops_platform_data >>>>>> with data from the specified Flattened Device Tree node. >>>>>> Update ramoops documentation with the new FDT interface. >>>>>> Update devicetree/binding documentation with pstore/ramoops.txt. >>>>> >>>>> Thanks for your work, Bryan! There were a few issues, I fixed >>>>> them myself but I need your confirmation if you're OK w/ all >>>>> the changes. >>>> [...] >>>>> So, the resulting patch is down below. But I have not pushed >>>>> it out yet, I'm waiting for your sign off. If you're OK with the >>>>> changes, please reply with >>>>> 'Signed-off-by: Bryan Freed <bfreed@chromium.org>' >>>> >>>> Bryan, have you had a chance to look into this? >>> >>> Whatever happened to this? Olof was also looking at doing a binding >>> back in Jan 2012: >>> >>> http://www.mail-archive.com/devicetree-discuss@lists.ozlabs.org/msg09905.html >> >> I don't know. Bryan's patch looked good, I'd happily apply it. But I still >> need Bryan's Signed-off-by tag. :-/ Or, somebody needs to sign off on his >> behalf (anyone from Chromium project?). Or redo the patch. >> >> Thanks, >> >> Anton ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6] pstore/ram: Add ramoops support for the Flattened Device Tree. 2013-04-08 19:54 ` Bryan Freed 2013-04-08 22:43 ` Rob Herring @ 2013-04-14 14:24 ` Anton Vorontsov 2016-01-06 1:04 ` Kees Cook 1 sibling, 1 reply; 14+ messages in thread From: Anton Vorontsov @ 2013-04-14 14:24 UTC (permalink / raw) To: Bryan Freed, Arnd Bergmann Cc: Rob Herring, Tony Luck, Kees Cook, Marco Stornelli, Greg Kroah-Hartman, devicetree-discuss, Stephen Boyd, linux-kernel, John Stultz, Colin Cross, Olof Johansson On Mon, Apr 08, 2013 at 12:54:01PM -0700, Bryan Freed wrote: [...] > And as a more general question, why should we try not to put > configuration in the device tree? It seems like a great (and > portable) place to put this stuff. > It certainly seems better to have it there than hardwired in the > kernel or tacked onto the kernel command line. But then we have two in-kernel APIs to pass kernel parameters? So we'll have to maintain two ways of passing the options for each driver. That is hardly a good solution. If you would like to see a convenient way to pass kernel/module options via the device tree, I would suggest implementing something like this: chosen { kernel-options { linux,pstore.record-size = 123; linux,foo = "bar"; }; }; And then let the kernel translate all these to module_param_*(). I am still not sure about placing the options along with devices layout, but if we go this route, then that is also viable: pstore-node { linux,pstore.record-size = 123; }; And translate "linux,*" this to module_param_*(). How does that sound? Thanks, Anton ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6] pstore/ram: Add ramoops support for the Flattened Device Tree. 2013-04-14 14:24 ` Anton Vorontsov @ 2016-01-06 1:04 ` Kees Cook 2016-01-06 1:06 ` Kees Cook 0 siblings, 1 reply; 14+ messages in thread From: Kees Cook @ 2016-01-06 1:04 UTC (permalink / raw) To: Anton Vorontsov Cc: Bryan Freed, Arnd Bergmann, Rob Herring, Tony Luck, Marco Stornelli, Greg Kroah-Hartman, devicetree-discuss, Stephen Boyd, linux-kernel, John Stultz, Colin Cross, Olof Johansson [thread necromancy, if you don't have the thread locally, it's here: https://patchwork.kernel.org/patch/1426261/] We still need to solve this, and John pinged me about it today. Where does this stand? -Kees On Sun, Apr 14, 2013 at 7:24 AM, Anton Vorontsov <anton@enomsg.org> wrote: > On Mon, Apr 08, 2013 at 12:54:01PM -0700, Bryan Freed wrote: > [...] >> And as a more general question, why should we try not to put >> configuration in the device tree? It seems like a great (and >> portable) place to put this stuff. >> It certainly seems better to have it there than hardwired in the >> kernel or tacked onto the kernel command line. > > But then we have two in-kernel APIs to pass kernel parameters? So we'll > have to maintain two ways of passing the options for each driver. That is > hardly a good solution. > > If you would like to see a convenient way to pass kernel/module options > via the device tree, I would suggest implementing something like this: > > chosen { > kernel-options { > linux,pstore.record-size = 123; > linux,foo = "bar"; > }; > }; > > And then let the kernel translate all these to module_param_*(). > > I am still not sure about placing the options along with devices layout, > but if we go this route, then that is also viable: > > pstore-node { > linux,pstore.record-size = 123; > }; > > And translate "linux,*" this to module_param_*(). > > How does that sound? > > Thanks, > Anton -- Kees Cook Chrome OS & Brillo Security ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6] pstore/ram: Add ramoops support for the Flattened Device Tree. 2016-01-06 1:04 ` Kees Cook @ 2016-01-06 1:06 ` Kees Cook 2016-01-06 1:42 ` Rob Herring 0 siblings, 1 reply; 14+ messages in thread From: Kees Cook @ 2016-01-06 1:06 UTC (permalink / raw) To: Anton Vorontsov Cc: Bryan Freed, Arnd Bergmann, Rob Herring, Tony Luck, Marco Stornelli, Greg Kroah-Hartman, Stephen Boyd, linux-kernel, John Stultz, Colin Cross, Olof Johansson, devicetree [fixing devicetree mailing list] On Tue, Jan 5, 2016 at 5:04 PM, Kees Cook <keescook@chromium.org> wrote: > [thread necromancy, if you don't have the thread locally, it's here: > https://patchwork.kernel.org/patch/1426261/] > > We still need to solve this, and John pinged me about it today. Where > does this stand? > > -Kees > > > On Sun, Apr 14, 2013 at 7:24 AM, Anton Vorontsov <anton@enomsg.org> wrote: >> On Mon, Apr 08, 2013 at 12:54:01PM -0700, Bryan Freed wrote: >> [...] >>> And as a more general question, why should we try not to put >>> configuration in the device tree? It seems like a great (and >>> portable) place to put this stuff. >>> It certainly seems better to have it there than hardwired in the >>> kernel or tacked onto the kernel command line. >> >> But then we have two in-kernel APIs to pass kernel parameters? So we'll >> have to maintain two ways of passing the options for each driver. That is >> hardly a good solution. >> >> If you would like to see a convenient way to pass kernel/module options >> via the device tree, I would suggest implementing something like this: >> >> chosen { >> kernel-options { >> linux,pstore.record-size = 123; >> linux,foo = "bar"; >> }; >> }; >> >> And then let the kernel translate all these to module_param_*(). >> >> I am still not sure about placing the options along with devices layout, >> but if we go this route, then that is also viable: >> >> pstore-node { >> linux,pstore.record-size = 123; >> }; >> >> And translate "linux,*" this to module_param_*(). >> >> How does that sound? >> >> Thanks, >> Anton > > > > -- > Kees Cook > Chrome OS & Brillo Security -- Kees Cook Chrome OS & Brillo Security ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v6] pstore/ram: Add ramoops support for the Flattened Device Tree. 2016-01-06 1:06 ` Kees Cook @ 2016-01-06 1:42 ` Rob Herring 0 siblings, 0 replies; 14+ messages in thread From: Rob Herring @ 2016-01-06 1:42 UTC (permalink / raw) To: Kees Cook Cc: Anton Vorontsov, Bryan Freed, Arnd Bergmann, Tony Luck, Marco Stornelli, Greg Kroah-Hartman, Stephen Boyd, linux-kernel, John Stultz, Colin Cross, Olof Johansson, devicetree, Greg Hackmann +Greg H On Tue, Jan 5, 2016 at 7:06 PM, Kees Cook <keescook@chromium.org> wrote: > [fixing devicetree mailing list] > > On Tue, Jan 5, 2016 at 5:04 PM, Kees Cook <keescook@chromium.org> wrote: >> [thread necromancy, if you don't have the thread locally, it's here: >> https://patchwork.kernel.org/patch/1426261/] >> >> We still need to solve this, and John pinged me about it today. Where >> does this stand? Wrong thread here as the latest version is "[PATCH v2] pstore-ram: add Device Tree bindings" recently posted by Greg H (and reviewed by you). I am mostly happy with it and only had a minor comment remaining. I was expecting to see a v3. Rob ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2016-01-06 1:42 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-09-07 18:29 [PATCH v6] pstore/ram: Add ramoops support for the Flattened Device Tree Bryan Freed 2012-09-08 5:29 ` Anton Vorontsov 2012-09-08 7:23 ` Marco Stornelli 2012-09-08 8:06 ` Anton Vorontsov 2012-09-08 8:27 ` Marco Stornelli 2012-09-17 6:23 ` Anton Vorontsov 2013-04-05 2:03 ` Rob Herring 2013-04-07 17:43 ` Anton Vorontsov 2013-04-08 19:54 ` Bryan Freed 2013-04-08 22:43 ` Rob Herring 2013-04-14 14:24 ` Anton Vorontsov 2016-01-06 1:04 ` Kees Cook 2016-01-06 1:06 ` Kees Cook 2016-01-06 1:42 ` Rob Herring
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).