Skip to contentSkip to conversation

tools:misc:xenpm: set max freq to all cpu with default cpuid

PATCH In review Luwei Kang 4 participants 4 messages Apr 13, 2017

lore
Share & tools
lore

Luwei Kang

author
#0 lore raw

PATCH v2 1/1 tools:misc:xenpm: set max freq to all cpu with default cpuid

User can set max freq to specific cpu by "xenpm set-scaling-maxfreq [cpuid] <HZ>" or set max freq to all cpu with default cpuid by "xenpm set-scaling-maxfreq <HZ>".

Set max freq with default cpuid will cause segmentation fault after commit id d4906b5d05. This patch will fix this issue and add ability to set max freq with default cpuid.

---
 tools/misc/xenpm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
tools/misc/xenpm.c +5 -3
index ded40b9..762311e 100644
@@ -99,10 +99,12 @@ static void parse_cpuid_and_int(int argc, char *argv[],
          exit(EINVAL);
     }
 
-    parse_cpuid(argv[0], cpuid);
-    if ( sscanf(argv[1], "%d", val) != 1 )
+    if ( argc > 1 )
+        parse_cpuid(argv[0], cpuid);
+
+    if ( sscanf(argv[argc > 1], "%d", val) != 1 )
     {
-        fprintf(stderr, "Invalid %s '%s'\n", what, argv[1]);
+        fprintf(stderr, "Invalid %s '%s'\n", what, argv[argc > 1]);
         exit(EINVAL);
     }
 }
Signature · 7 lines
1.8.3.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 11 lines · Luwei Kang

User can set max freq to specific cpu by "xenpm set-scaling-maxfreq [cpuid] <HZ>" or set max freq to all cpu with default cpuid by "xenpm set-scaling-maxfreq <HZ>".

Set max freq with default cpuid will cause segmentation fault after commit id d4906b5d05. This patch will fix this issue and add ability to set max freq with default cpuid.

Sorry for that.

(using clang 4.0)

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by on v2 1/1
#2 lore raw
In reply to Luwei Kang
Quoted 11 lines · Luwei Kang

User can set max freq to specific cpu by "xenpm set-scaling-maxfreq [cpuid] <HZ>" or set max freq to all cpu with default cpuid by "xenpm set-scaling-maxfreq <HZ>".

Set max freq with default cpuid will cause segmentation fault after commit id d4906b5d05. This patch will fix this issue and add ability to set max freq with default cpuid.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw

Hi,

Quoted 6 lines · Wei Liu
Quoted 5 lines · Luwei Kang

User can set max freq to specific cpu by "xenpm set-scaling-maxfreq [cpuid] <HZ>" or set max freq to all cpu with default cpuid by "xenpm set-scaling-maxfreq <HZ>".

Quoted 8 lines
Quoted 6 lines

Set max freq with default cpuid will cause segmentation fault after commit id d4906b5d05. This patch will fix this issue and add ability to set max freq with default cpuid.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel