x86: fix bug caused by commit 0ade5e
PATCH 1/1 x86: fix bug caused by commit 0ade5e
Commit 0ade5e causes a bug that only the psr features presented in cmdline cannot be correctly enumerated.
1. If there is only 'psr=', the CMT is enumerated which is not right.
2. If cmdline is 'psr=cmt,cat,cdp,mba', only the last feature is enumerated.
This patch fixes the issues.
--- xen/arch/x86/psr.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
xen/arch/x86/psr.c +7 -2
@@ -422,9 +422,10 @@ static bool __init parse_psr_bool(const char *s, const char *delim, const char *ss, const char *feature, unsigned int mask) { - if ( !strncmp(s, feature, delim - s) ) + /* If cmdline is 'psr=', we need make sure delim != s */ + if ( delim != s && !strncmp(s, feature, delim - s) ) { - if ( !*delim ) + if ( !*delim || *delim == ',' ) opt_psr |= mask; else {
@@ -457,6 +458,10 @@ static int __init parse_psr_param(const char *s)if ( !val_delim ) val_delim =strchr (s,'\0' ); +/* E.g. 'psr=cmt,rmid_max:200' */ +if ( val_delim > ss ) + val_delim = ss; +if ( *val_delim && !strncmp (s,"rmid_max" , val_delim - s) ) { opt_rmid_max =simple_strtoul (val_delim +1 , &q,0 );
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 8 lines · Yi Sun
Commit 0ade5e causes a bug that only the psr features presented in cmdline cannot be correctly enumerated.
1. If there is only 'psr=', the CMT is enumerated which is not right.
2. If cmdline is 'psr=cmt,cat,cdp,mba', only the last feature is enumerated.This patch fixes the issues.
Signed-off-by Yi Sun <[email protected]>
Juergen
Quoted 23 lines
--- xen/arch/x86/psr.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)xen/arch/x86/psr.c +3
-2@@ -422,9 +422,10 @@ static bool __init parse_psr_bool(const char *s, const char *delim, const char *ss, const char *feature, unsigned int mask) { - if ( !strncmp(s, feature, delim - s) ) + /* If cmdline is 'psr=', we need make sure delim != s */ + if ( delim != s && !strncmp(s, feature, delim - s) ) { - if ( !*delim ) + if ( !*delim || *delim == ',' ) opt_psr |= mask; else {
xen/arch/x86/psr.c static int __init parse_psr_param(const char *s) · line 467
Quoted 10 lines
xen/arch/x86/psr.c +4
-0@@ -457,6 +458,10 @@ static int __init parse_psr_param(const char *s)if ( !val_delim ) val_delim =strchr (s,'\0' ); +/* E.g. 'psr=cmt,rmid_max:200' */ +if ( val_delim > ss ) + val_delim = ss; +if ( *val_delim && !strncmp (s,"rmid_max" , val_delim - s) ) { opt_rmid_max =simple_strtoul (val_delim +1 , &q,0 );
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 1 line
Quoted 1 line
Quoted 1 line · On 21.09.17 at 10:11, <[email protected]> wrote:
A better title for the patch is needed.
Quoted 2 lines
Commit 0ade5e causes a bug that only the psr features presented in cmdline cannot be correctly enumerated.
To me it looks like either the "only" is wrong here, or the "cannot" was meant to be "can"; the way it's now I can't make sense of it.
Quoted 1 line
1. If there is only 'psr=', the CMT is enumerated which is not right.
s/,the /,then/ ?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH v2 1/1 x86: commit 0ade5e causes psr features in cmdline cannot be correctly enumerated
In reply to Yi SunCommit 0ade5e causes a bug that the psr features presented in cmdline cannot be correctly enumerated.
1. If there is only 'psr=', then CMT is enumerated which is not right.
2. If cmdline is 'psr=cmt,cat,cdp,mba', only the last feature is enumerated.
This patch fixes the issues.
---
v2:
- fix title and commit message.
(suggested by Jan Beulich)
--- xen/arch/x86/psr.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
xen/arch/x86/psr.c +7 -2
@@ -422,9 +422,10 @@ static bool __init parse_psr_bool(const char *s, const char *delim, const char *ss, const char *feature, unsigned int mask) { - if ( !strncmp(s, feature, delim - s) ) + /* If cmdline is 'psr=', we need make sure delim != s */ + if ( delim != s && !strncmp(s, feature, delim - s) ) { - if ( !*delim ) + if ( !*delim || *delim == ',' ) opt_psr |= mask; else {
@@ -457,6 +458,10 @@ static int __init parse_psr_param(const char *s)if ( !val_delim ) val_delim =strchr (s,'\0' ); +/* E.g. 'psr=cmt,rmid_max:200' */ +if ( val_delim > ss ) + val_delim = ss; +if ( *val_delim && !strncmp (s,"rmid_max" , val_delim - s) ) { opt_rmid_max =simple_strtoul (val_delim +1 , &q,0 );
Signature · 7 lines
1.9.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel