panic: add support to update panic_timeout via DT
PATCH 1/1 panic: add support to update panic_timeout via DT
Add support to set 'panic_timeout' value via dtb to have control from device tree. This makes sense when you have multiple platforms support from same defconfig and differentiated only through device tree blob. The patch will check for panic time out value coming from dtb if it exists, otherwise continues with defconfig provided option.
--- kernel/panic.c | 7 +++++++ 1 file changed, 7 insertions(+)
kernel/panic.c +7 -0
@@ -27,6 +27,7 @@#include <linux/console.h> #include <linux/bug.h> #include <linux/ratelimit.h> +#include <linux/of.h> #define PANIC_TIMER_STEP 100#define PANIC_BLINK_SPD 18
@@ -482,6 +483,12 @@ static u64 oops_id;static int init_oops_id (void ) { +struct device_node *np; + + np =of_find_node_by_name (NULL ,"panic_timeout" ); +if (np) +of_property_read_u32 (np,"panic-timeout-value" , &panic_timeout); +if (!oops_id)get_random_bytes (&oops_id,sizeof (oops_id));else
Signature · 1 line
2.1.4
Quoted 7 lines · Jeetesh Burman
Add support to set '
panic_timeout' value via dtb to have control from device tree. This makes sense when you have multiple platforms support from same defconfig and differentiated only through device tree blob. The patch will check for panic time out value coming from dtb if it exists, otherwise continues with defconfig provided option.
*my personal opinion* - I'm not super happy to see more and more of_find_node_by_name()'s in random places. but that's just IMHO.
kernel/panic.c static u64 oops_id; · line 494
Quoted 11 lines
static int
init_oops_id(void)
{kernel/panic.c +6
-0+struct device_node *np; + + np =of_find_node_by_name (NULL ,"panic_timeout" ); +if (np) +of_property_read_u32 (np,"panic-timeout-value" , &panic_timeout); +if (!oops_id)get_random_bytes (&oops_id,sizeof (oops_id));else
why init_oops_id()? you are going to re-read it every time you call print_oops_end_marker(), and the system can be configured not to panic on oops. put it to oops_setup()? or, at least, move it to `if (!oops_id)' branch, maybe?
-ss
Hi Sergey,
Thanks for review, 'PATCH V2' uploaded
Quoted 4 lines
why
init_oops_id()? you are going to re-read it every time you callprint_oops_end_marker(), and the system can be configured not to panic on oops. put it tooops_setup()? or, at least, move it to `if (!oops_id)' branch, maybe?
[Jeetesh] It looks to make changes in oops_setup(), need to pass "oops" parameter in kernel-command line, so I made changes under 'if (!oops_id)', please review "PATCH V2"
Regards,
Jeetesh
Quoted 37 lines
-----Original Message-----
From: Sergey Senozhatsky [mailto:[email protected]]
Sent: Friday, October 27, 2017 1:30 PM
To: Jeetesh Burman <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; Bibek Basu <[email protected]>
Subject: Re: [PATCH] panic: add support to updatepanic_timeoutvia DTQuoted 5 lines · Jeetesh Burman
Add support to set '
panic_timeout' value via dtb to have control from device tree. This makes sense when you have multiple platforms support from same defconfig and differentiated only through device tree blob. The patch will check for panic time out value coming from dtb if it exists, otherwise continues with defconfig provided option.*my personal opinion* - I'm not super happy to see more and more of_find_node_by_name()'s in random places. but that's just IMHO.
kernel/panic.c static u64 oops_id;
Quoted 7 lines
static int
init_oops_id(void)
{kernel/panic.c +5
-0+struct device_node *np; + + np =of_find_node_by_name (NULL ,"panic_timeout" ); +if (np) + of_property_read_u32(np, "panic-timeout-value",
&panic_timeout);kernel/panic.c static u64 oops_id; · line 494
Quoted 4 lines
kernel/panic.c +1
-0+if (!oops_id)get_random_bytes (&oops_id,sizeof (oops_id));else why
init_oops_id()? you are going to re-read it every time you callprint_oops_end_marker(), and the system can be configured not to panic on oops. put it tooops_setup()? or, at least, move it to `if (!oops_id)' branch, maybe?-ss