* [LTP] [PATCH] ltp: handle missing online file
@ 2013-08-20 20:34 Dave Kleikamp
2013-08-21 6:31 ` Wanlong Gao
2013-08-21 6:50 ` Jan Stancek
0 siblings, 2 replies; 4+ messages in thread
From: Dave Kleikamp @ 2013-08-20 20:34 UTC (permalink / raw)
To: ltp-list
gather_node_cpus() fails if the /sys/devices/system/node/nodeX/cpuX/online
file is missing for any cpu other than cpu0. The absence of the online file
should not be treated as a failure, but as an indication that the cpu is
not hot-pluggable and cannot be taken offline.
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index 9bc926e..99243a6 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -786,16 +786,14 @@ static void gather_node_cpus(char *cpus, long nd)
if (path_exist(path, nd, i)) {
snprintf(path1, BUFSIZ, "%s/online", path);
/*
- * No cpu0/online knob, as it can't support to
- * on/offline cpu0, so if the 'nd' node contains
- * cpu0, it should skip to check cpu0/online's value.
+ * if there is no online knob, then the cpu cannot
+ * be taken offline
*/
- if (i == 0)
- goto next;
- SAFE_FILE_SCANF(cleanup, path1, "%ld", &online);
- if (online == 0)
- continue;
-next:
+ if (path_exist(path1)) {
+ SAFE_FILE_SCANF(cleanup, path1, "%ld", &online);
+ if (online == 0)
+ continue;
+ }
sprintf(buf, "%d,", i);
strcat(cpus, buf);
}
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [LTP] [PATCH] ltp: handle missing online file
2013-08-20 20:34 [LTP] [PATCH] ltp: handle missing online file Dave Kleikamp
@ 2013-08-21 6:31 ` Wanlong Gao
2013-08-21 6:50 ` Jan Stancek
1 sibling, 0 replies; 4+ messages in thread
From: Wanlong Gao @ 2013-08-21 6:31 UTC (permalink / raw)
To: Dave Kleikamp; +Cc: ltp-list
On 08/21/2013 04:34 AM, Dave Kleikamp wrote:
> gather_node_cpus() fails if the /sys/devices/system/node/nodeX/cpuX/online
> file is missing for any cpu other than cpu0. The absence of the online file
> should not be treated as a failure, but as an indication that the cpu is
> not hot-pluggable and cannot be taken offline.
>
> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
>
> diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
> index 9bc926e..99243a6 100644
> --- a/testcases/kernel/mem/lib/mem.c
> +++ b/testcases/kernel/mem/lib/mem.c
> @@ -786,16 +786,14 @@ static void gather_node_cpus(char *cpus, long nd)
> if (path_exist(path, nd, i)) {
> snprintf(path1, BUFSIZ, "%s/online", path);
> /*
> - * No cpu0/online knob, as it can't support to
> - * on/offline cpu0, so if the 'nd' node contains
> - * cpu0, it should skip to check cpu0/online's value.
> + * if there is no online knob, then the cpu cannot
> + * be taken offline
> */
> - if (i == 0)
> - goto next;
> - SAFE_FILE_SCANF(cleanup, path1, "%ld", &online);
> - if (online == 0)
> - continue;
> -next:
> + if (path_exist(path1)) {
> + SAFE_FILE_SCANF(cleanup, path1, "%ld", &online);
> + if (online == 0)
> + continue;
> + }
> sprintf(buf, "%d,", i);
> strcat(cpus, buf);
> }
>
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and
> AppDynamics. Performance Central is your source for news, insights,
> analysis and resources for efficient Application Performance Management.
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [LTP] [PATCH] ltp: handle missing online file
2013-08-20 20:34 [LTP] [PATCH] ltp: handle missing online file Dave Kleikamp
2013-08-21 6:31 ` Wanlong Gao
@ 2013-08-21 6:50 ` Jan Stancek
2013-08-21 12:19 ` Dave Kleikamp
1 sibling, 1 reply; 4+ messages in thread
From: Jan Stancek @ 2013-08-21 6:50 UTC (permalink / raw)
To: Dave Kleikamp; +Cc: ltp-list
----- Original Message -----
> From: "Dave Kleikamp" <dave.kleikamp@oracle.com>
> To: ltp-list@lists.sourceforge.net
> Sent: Tuesday, 20 August, 2013 10:34:39 PM
> Subject: [LTP] [PATCH] ltp: handle missing online file
>
> gather_node_cpus() fails if the /sys/devices/system/node/nodeX/cpuX/online
> file is missing for any cpu other than cpu0. The absence of the online file
> should not be treated as a failure, but as an indication that the cpu is
> not hot-pluggable and cannot be taken offline.
>
> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Looks good to me. One comment inline.
Reviewed-by: Jan Stancek <jstancek@redhat.com>
>
> diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
> index 9bc926e..99243a6 100644
> --- a/testcases/kernel/mem/lib/mem.c
> +++ b/testcases/kernel/mem/lib/mem.c
> @@ -786,16 +786,14 @@ static void gather_node_cpus(char *cpus, long nd)
> if (path_exist(path, nd, i)) {
^^ ^^
|---|--> Are these parameters used for anything?
Line above already does snprintf.
> snprintf(path1, BUFSIZ, "%s/online", path);
> /*
> - * No cpu0/online knob, as it can't support to
> - * on/offline cpu0, so if the 'nd' node contains
> - * cpu0, it should skip to check cpu0/online's value.
> + * if there is no online knob, then the cpu cannot
> + * be taken offline
> */
> - if (i == 0)
> - goto next;
> - SAFE_FILE_SCANF(cleanup, path1, "%ld", &online);
> - if (online == 0)
> - continue;
> -next:
> + if (path_exist(path1)) {
> + SAFE_FILE_SCANF(cleanup, path1, "%ld", &online);
> + if (online == 0)
> + continue;
> + }
> sprintf(buf, "%d,", i);
> strcat(cpus, buf);
> }
>
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and
> AppDynamics. Performance Central is your source for news, insights,
> analysis and resources for efficient Application Performance Management.
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [LTP] [PATCH] ltp: handle missing online file
2013-08-21 6:50 ` Jan Stancek
@ 2013-08-21 12:19 ` Dave Kleikamp
0 siblings, 0 replies; 4+ messages in thread
From: Dave Kleikamp @ 2013-08-21 12:19 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
On 08/21/2013 01:50 AM, Jan Stancek wrote:
>
>
>
>
> ----- Original Message -----
>> From: "Dave Kleikamp" <dave.kleikamp@oracle.com>
>> To: ltp-list@lists.sourceforge.net
>> Sent: Tuesday, 20 August, 2013 10:34:39 PM
>> Subject: [LTP] [PATCH] ltp: handle missing online file
>>
>> gather_node_cpus() fails if the /sys/devices/system/node/nodeX/cpuX/online
>> file is missing for any cpu other than cpu0. The absence of the online file
>> should not be treated as a failure, but as an indication that the cpu is
>> not hot-pluggable and cannot be taken offline.
>>
>> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
>
> Looks good to me. One comment inline.
>
> Reviewed-by: Jan Stancek <jstancek@redhat.com>
>
>>
>> diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
>> index 9bc926e..99243a6 100644
>> --- a/testcases/kernel/mem/lib/mem.c
>> +++ b/testcases/kernel/mem/lib/mem.c
>> @@ -786,16 +786,14 @@ static void gather_node_cpus(char *cpus, long nd)
>> if (path_exist(path, nd, i)) {
> ^^ ^^
> |---|--> Are these parameters used for anything?
> Line above already does snprintf.
They aren't. That's why I left them off the call I added below.
>
>> snprintf(path1, BUFSIZ, "%s/online", path);
>> /*
>> - * No cpu0/online knob, as it can't support to
>> - * on/offline cpu0, so if the 'nd' node contains
>> - * cpu0, it should skip to check cpu0/online's value.
>> + * if there is no online knob, then the cpu cannot
>> + * be taken offline
>> */
>> - if (i == 0)
>> - goto next;
>> - SAFE_FILE_SCANF(cleanup, path1, "%ld", &online);
>> - if (online == 0)
>> - continue;
>> -next:
>> + if (path_exist(path1)) {
>> + SAFE_FILE_SCANF(cleanup, path1, "%ld", &online);
>> + if (online == 0)
>> + continue;
>> + }
>> sprintf(buf, "%d,", i);
>> strcat(cpus, buf);
>> }
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-08-21 12:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-20 20:34 [LTP] [PATCH] ltp: handle missing online file Dave Kleikamp
2013-08-21 6:31 ` Wanlong Gao
2013-08-21 6:50 ` Jan Stancek
2013-08-21 12:19 ` Dave Kleikamp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox