Minor improvement to early boot code
cover Minor improvement to early boot code
Wei Liu (2):
x86: make sure module array is large enough in pvh-boot.c
xen: make opt_xen_console true before console initialisation
xen/arch/x86/guest/pvh-boot.c | 9 ++++++++- xen/drivers/char/console.c | 7 ++++++- 2 files changed, 14 insertions(+), 2 deletions(-)
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 1/2 x86: make sure module array is large enough in pvh-boot.c
The relocation code in __start_xen requires one extra element in the module array. By the looks of it the temporary array is already large enough. Add a BUG_ON to catch any issue in the future.
While at it, turn another ASSERT to BUG_ON as well.
--- xen/arch/x86/guest/pvh-boot.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
xen/arch/x86/guest/pvh-boot.c +8 -1
@@ -42,7 +42,14 @@ static void __init convert_pvh_info(void)module_t *mod;unsigned int i; -ASSERT (pvh_info->magic ==XEN_HVM_START_MAGIC_VALUE ); +BUG_ON (pvh_info->magic !=XEN_HVM_START_MAGIC_VALUE ); + +/* +* Temporary module array needs to be at least one element bigger than +* required. The extra element is used to aid relocation. See +* arch/x86/setup.c:__start_xen(). +*/ +BUG_ON (ARRAY_SIZE (pvh_mbi_mods) <= pvh_info->nr_modules);/* * Turn hvm_start_info into mbi. Luckily all modules are placed under 4GB
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 1/2] x86: make sure module array is large enough in pvh-boot.c
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 28.09.18 at 10:24, <[email protected]> wrote:
The relocation code in
__start_xenrequires one extra element in the module array. By the looks of it the temporary array is already large enough. Add aBUG_ONto catch any issue in the future.While at it, turn another ASSERT to
BUG_ONas well.
Hmm, a little strange - I thought we had agreed on panic() before. The extra output BUG_ON() produces is unlikely to be helpful here. With this switched to panic() it certainly can have my ack.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 1/2] x86: make sure module array is large enough in pvh-boot.c
Quoted 10 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 28.09.18 at 10:24, <[email protected]> wrote:
The relocation code in
__start_xenrequires one extra element in the module array. By the looks of it the temporary array is already large enough. Add aBUG_ONto catch any issue in the future.While at it, turn another ASSERT to
BUG_ONas well.Hmm, a little strange - I thought we had agreed on
panic()before. The extra outputBUG_ON()produces is unlikely to be helpful here. With this switched topanic()it certainly can have my ack.
Oops, I have no idea why I agreed to use panic but wrote BUG_ON instead. My memory has failed me.
I will resend this patch.
Wei.
Quoted 4 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 2/2 xen: make opt_xen_console true before console initialisation
In reply to Wei LiuThis helps capture issues before console is initialised. The impact is minimal because it only affects Xen running in as a guest.
--- xen/drivers/char/console.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
xen/drivers/char/console.c +6 -1
@@ -91,7 +91,8 @@ static uint32_t conringc, conringp;static int __read_mostly sercon_handle =-1 ;#ifdef CONFIG_X86 -static bool __read_mostly opt_console_xen;/* console=xen */ +/* Set to true at start of day to catch early boot issues */ +static bool __read_mostly opt_console_xen = true;/* console=xen */ #endif static DEFINE_SPINLOCK (console_lock);
@@ -821,6 +822,10 @@ void __init console_init_preirq(void)serial_init_preirq (); +#ifdef CONFIG_X86 + opt_console_xen = false; +#endif +/* Where should console output go? */ for ( p = opt_console; p !=NULL ; p =strchr (p,',' ) ) {
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 2/2] xen: make opt_xen_console true before console initialisation
xen/drivers/char/console.c static uint32_t conringc, conringp; · line 95
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 28.09.18 at 10:24, <[email protected]> wrote:
xen/drivers/char/console.c +2
-1@@ -91,7 +91,8 @@ static uint32_t conringc, conringp;static int __read_mostly sercon_handle =-1 ;#ifdef CONFIG_X86 -static bool __read_mostly opt_console_xen;/* console=xen */ +/* Set to true at start of day to catch early boot issues */ +static bool __read_mostly opt_console_xen = true;/* console=xen */
When Andrew suggested this, iirc he said to make the variable tristate. Otherwise ...
xen/drivers/char/console.c void __init console_init_preirq(void) · line 827
Quoted 7 lines
xen/drivers/char/console.c +3
-0@@ -821,6 +822,10 @@ void __init console_init_preirq(void)serial_init_preirq (); +#ifdef CONFIG_X86 + opt_console_xen = false; +#endif
... you possibly override a user specified "true" here.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 2/2] xen: make opt_xen_console true before console initialisation
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 28.09.18 at 10:24, <[email protected]> wrote:
xen/drivers/char/console.c +0
-0@@ -91,7 +91,8 @@ static uint32_t conringc, conringp;static int __read_mostly sercon_handle =-1 ;
Quoted 7 lines
xen/drivers/char/console.c static uint32_t conringc, conringp; · line 95
Quoted 4 lines
xen/drivers/char/console.c +2
-1#ifdef CONFIG_X86 -static bool __read_mostly opt_console_xen;/* console=xen */ +/* Set to true at start of day to catch early boot issues */ +static bool __read_mostly opt_console_xen = true;/* console=xen */ When Andrew suggested this, iirc he said to make the variable tristate. Otherwise ...
I figure it doesn't need to be tristate.
Quoted 10 lines
xen/drivers/char/console.c void __init console_init_preirq(void) · line 827
Quoted 8 lines
xen/drivers/char/console.c +3
-0@@ -821,6 +822,10 @@ void __init console_init_preirq(void)serial_init_preirq (); +#ifdef CONFIG_X86 + opt_console_xen = false; +#endif ... you possibly override a user specified "true" here.
Do I? This is right before option parsing, during which opt_console_xen is set.
Wei.
Quoted 4 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 2/2] xen: make opt_xen_console true before console initialisation
Quoted 17 lines · Wei Liu
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 28.09.18 at 10:24, <[email protected]> wrote:
xen/drivers/char/console.c +0
-0@@ -91,7 +91,8 @@ static uint32_t conringc, conringp;static int __read_mostly sercon_handle =-1 ;Quoted 6 lines
xen/drivers/char/console.c static uint32_t conringc, conringp; · line 95
Quoted 4 lines
xen/drivers/char/console.c +2
-1#ifdef CONFIG_X86 -static bool __read_mostly opt_console_xen;/* console=xen */ +/* Set to true at start of day to catch early boot issues */ +static bool __read_mostly opt_console_xen = true;/* console=xen */ When Andrew suggested this, iirc he said to make the variable tristate. Otherwise ...
I figure it doesn't need to be tristate.
Quoted 2 lines
Quoted 2 lines
xen/drivers/char/console.c +0
-0@@ -821,6 +822,10 @@ void __init console_init_preirq(void)
Quoted 8 lines
Quoted 6 lines
xen/drivers/char/console.c void __init console_init_preirq(void) · line 827
Quoted 5 lines
xen/drivers/char/console.c +3
-0serial_init_preirq (); +#ifdef CONFIG_X86 + opt_console_xen = false; +#endif ... you possibly override a user specified "true" here.
Do I? This is right before option parsing, during which
opt_console_xenis set.
This is fine in principle, but you can't initialise it to true at compile time, or native boots will try using hypercalls / port 0xe9.
The best bet is to set it to true in the PVH entry asm.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 2/2] xen: make opt_xen_console true before console initialisation
Quoted 24 lines · Andrew Cooper
Quoted 23 lines · Wei Liu
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 28.09.18 at 10:24, <[email protected]> wrote:
xen/drivers/char/console.c +0
-0@@ -91,7 +91,8 @@ static uint32_t conringc, conringp;static int __read_mostly sercon_handle =-1 ;Quoted 6 lines
xen/drivers/char/console.c static uint32_t conringc, conringp; · line 95
Quoted 4 lines
xen/drivers/char/console.c +2
-1#ifdef CONFIG_X86 -static bool __read_mostly opt_console_xen;/* console=xen */ +/* Set to true at start of day to catch early boot issues */ +static bool __read_mostly opt_console_xen = true;/* console=xen */ When Andrew suggested this, iirc he said to make the variable tristate. Otherwise ...
I figure it doesn't need to be tristate.
Quoted 8 lines
xen/drivers/char/console.c void __init console_init_preirq(void) · line 827
Quoted 7 lines
xen/drivers/char/console.c +3
-0@@ -821,6 +822,10 @@ void __init console_init_preirq(void)serial_init_preirq (); +#ifdef CONFIG_X86 + opt_console_xen = false; +#endif ... you possibly override a user specified "true" here.
Quoted 7 lines
Quoted 2 lines
Do I? This is right before option parsing, during which
opt_console_xenis set.This is fine in principle, but you can't initialise it to true at compile time, or native boots will try using hypercalls / port
0xe9.The best bet is to set it to true in the PVH entry asm.
Right. I will set it in the PVH entry instead.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 2/2] xen: make opt_xen_console true before console initialisation
In reply to Wei LiuQuoted 23 lines
Quoted 1 line
Quoted 1 line · On 28.09.18 at 17:12, <[email protected]> wrote:
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 28.09.18 at 10:24, <[email protected]> wrote:
xen/drivers/char/console.c +0
-0@@ -91,7 +91,8 @@ static uint32_t conringc, conringp;static int __read_mostly sercon_handle =-1 ;Quoted 7 lines
xen/drivers/char/console.c static uint32_t conringc, conringp; · line 95
Quoted 4 lines
xen/drivers/char/console.c +2
-1#ifdef CONFIG_X86 -static bool __read_mostly opt_console_xen;/* console=xen */ +/* Set to true at start of day to catch early boot issues */ +static bool __read_mostly opt_console_xen = true;/* console=xen */ When Andrew suggested this, iirc he said to make the variable tristate. Otherwise ...
I figure it doesn't need to be tristate.
Quoted 5 lines
Quoted 5 lines
xen/drivers/char/console.c +0
-0@@ -821,6 +822,10 @@ void __init console_init_preirq(void)serial_init_preirq ();
Quoted 8 lines
Quoted 5 lines
xen/drivers/char/console.c void __init console_init_preirq(void) · line 827
Quoted 3 lines
xen/drivers/char/console.c +3
-0+#ifdef CONFIG_X86 + opt_console_xen = false; +#endif ... you possibly override a user specified "true" here.
Do I? This is right before option parsing, during which
opt_console_xenis set.
Hmm, I see - I didn't recall we still have this ad hoc parsing in place, instead of using custom_param(). But isn't this too early then, as messages issued from the parsing code then would not be visible?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 2/2] xen: make opt_xen_console true before console initialisation
Quoted 29 lines · Jan Beulich
Quoted 29 lines
Quoted 1 line
Quoted 1 line · On 28.09.18 at 17:12, <[email protected]> wrote:
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 28.09.18 at 10:24, <[email protected]> wrote:
xen/drivers/char/console.c +0
-0@@ -91,7 +91,8 @@ static uint32_t conringc, conringp;static int __read_mostly sercon_handle =-1 ;Quoted 7 lines
xen/drivers/char/console.c static uint32_t conringc, conringp; · line 95
Quoted 4 lines
xen/drivers/char/console.c +2
-1#ifdef CONFIG_X86 -static bool __read_mostly opt_console_xen;/* console=xen */ +/* Set to true at start of day to catch early boot issues */ +static bool __read_mostly opt_console_xen = true;/* console=xen */ When Andrew suggested this, iirc he said to make the variable tristate. Otherwise ...
I figure it doesn't need to be tristate.
Quoted 10 lines
xen/drivers/char/console.c void __init console_init_preirq(void) · line 827
Quoted 8 lines
xen/drivers/char/console.c +3
-0@@ -821,6 +822,10 @@ void __init console_init_preirq(void)serial_init_preirq (); +#ifdef CONFIG_X86 + opt_console_xen = false; +#endif ... you possibly override a user specified "true" here.
Quoted 6 lines
Quoted 2 lines
Do I? This is right before option parsing, during which
opt_console_xenis set.Hmm, I see - I didn't recall we still have this ad hoc parsing in place, instead of using
custom_param(). But isn't this too early then, as messages issued from the parsing code then would not be visible?
To me it doesn't make anything worse than before. But I see your point. I will see if there is an easy way to fix this.
Wei.
Quoted 4 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 2/2] xen: make opt_xen_console true before console initialisation
Quoted 33 lines · Wei Liu
Quoted 32 lines · Jan Beulich
Quoted 31 lines
Quoted 1 line
Quoted 1 line · On 28.09.18 at 17:12, <[email protected]> wrote:
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 28.09.18 at 10:24, <[email protected]> wrote:
xen/drivers/char/console.c +0
-0@@ -91,7 +91,8 @@ static uint32_t conringc, conringp;static int __read_mostly sercon_handle =-1 ;Quoted 7 lines
xen/drivers/char/console.c static uint32_t conringc, conringp; · line 95
Quoted 4 lines
xen/drivers/char/console.c +2
-1#ifdef CONFIG_X86 -static bool __read_mostly opt_console_xen;/* console=xen */ +/* Set to true at start of day to catch early boot issues */ +static bool __read_mostly opt_console_xen = true;/* console=xen */ When Andrew suggested this, iirc he said to make the variable tristate. Otherwise ...
I figure it doesn't need to be tristate.
Quoted 10 lines
xen/drivers/char/console.c void __init console_init_preirq(void) · line 827
Quoted 8 lines
xen/drivers/char/console.c +3
-0@@ -821,6 +822,10 @@ void __init console_init_preirq(void)serial_init_preirq (); +#ifdef CONFIG_X86 + opt_console_xen = false; +#endif ... you possibly override a user specified "true" here.
Do I? This is right before option parsing, during which
opt_console_xenis set.
Quoted 6 lines
Quoted 3 lines
Hmm, I see - I didn't recall we still have this ad hoc parsing in place, instead of using
custom_param(). But isn't this too early then, as messages issued from the parsing code then would not be visible?To me it doesn't make anything worse than before. But I see your point. I will see if there is an easy way to fix this.
At the moment the ordering of the options matter, which means if "xen" is not the first option we can lose output.
I think one easy way of improving is to parse opt_console twice. The first time solely looks for "xen" and the second time parses the rest options.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 2/2] xen: make opt_xen_console true before console initialisation
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 28.09.18 at 17:53, <[email protected]> wrote:
At the moment the ordering of the options matter, which means if "xen" is not the first option we can lose output.
I think one easy way of improving is to parse
opt_consoletwice. The first time solely looks for "xen" and the second time parses the rest options.
What's wrong with making the variable a tristate, and move your set-to-false after the parsing loop? If the user said "false" for the option, then they apparently don't care much about the output.
But yes, what you suggest is an option as well.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 2/2] xen: make opt_xen_console true before console initialisation
Quoted 11 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 28.09.18 at 17:53, <[email protected]> wrote:
At the moment the ordering of the options matter, which means if "xen" is not the first option we can lose output.
I think one easy way of improving is to parse
opt_consoletwice. The first time solely looks for "xen" and the second time parses the rest options.What's wrong with making the variable a tristate, and move your set-to-false after the parsing loop? If the user said "false" for the option, then they apparently don't care much about the output.
Oh, there is nothing wrong with that. It just I didn't think about that solution while thinking about this problem.
Quoted 2 lines
But yes, what you suggest is an option as well.
Yeah, I already got code for it.
Wei.
Quoted 4 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 2/2] xen: make opt_xen_console true before console initialisation
Quoted 13 lines · Wei Liu
Quoted 11 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 28.09.18 at 17:53, <[email protected]> wrote:
At the moment the ordering of the options matter, which means if "xen" is not the first option we can lose output.
I think one easy way of improving is to parse
opt_consoletwice. The first time solely looks for "xen" and the second time parses the rest options.What's wrong with making the variable a tristate, and move your set-to-false after the parsing loop? If the user said "false" for the option, then they apparently don't care much about the output.
Quoted 7 lines
Oh, there is nothing wrong with that. It just I didn't think about that solution while thinking about this problem.
Quoted 2 lines
But yes, what you suggest is an option as well.
Yeah, I already got code for it.
After fixing the bugs in my code it has become too long for my liking so I will turn to use tristate instead. :p
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel