Skip to contentSkip to conversation

cpu_hotplug: Adding a cpu hotplug stress test

RFC preeti 2 participants 6 messages Jul 17, 2012 – Jul 18, 2012

lore
Share & tools
lore

preeti

author
#0 lore raw

Hi

The test case included is a simple case for cpu hotplug.It does offlines the cpus that are online and does an online of the offlined cpus in a loop

This stress test had failed on certain distros when the loop was run infinite times.This test is presented here for review of correctness and necessity,as this is the first attempt at contributing test cases to LTP from this end.

The test is meant to be included under the testcases/kernel/hotplug/cpu_hotplug/functional directory.

Regards
Preeti
---

# File : stress_cpu_hotplug.sh
# Description : Switches the online state of all the cpus in a
# loop to test the robustness of cpu hotplug
# : The loop iteration of 20 is a randomly chosen number

#! /bin/bash

# Includes:
LHCS_PATH=${LHCS_PATH:-$LTPROOT/testcases/bin/cpu_hotplug} . $LHCS_PATH/include/hotplug.fns
. $LHCS_PATH/include/testsuite.fns

setup()

{
	export TST_TOTAL=1
	export TCID="setup"
	export TST_COUNT=0

	trap "cleanup" 0
	RC=0

	return $RC

}
cleanup()
{
set_all_cpu_state "$STATE"
}

test01()
{

	TCID="stress_cpu_hotplug"
	TST_COUNT=1
	RC=0

	NUMBER_OF_CPUS=`ls -d /sys/devices/system/cpu/cpu[0-9]* | wc -l`

	cd /sys/devices/system/cpu

	for ARRAY_INDEX in `seq 20`
	do
		for ((i=1; i < NUMBER_OF_CPUS; i++ ))
		do
			#skip the boot cpu;cannot offline it
			if [ $i -eq 0 ]
			then
				continue
			fi

        		state=`cat cpu$i/online`
		        if [ $state -eq 0 ]
        		then
				RC=online_cpu $i
        		else
                		RC=offline_cpu $i
        		fi

			if [ $RC -ne 0 ]
			then
				test_brkm TBROK NULL "stress_cpu_hotplug:
							cpu$i failed to hotplug"
				return $RC
			fi
		done

		if [ `expr $ARRAY_INDEX % 10` == 0 ]
		then
			echo "stress test successfully completed
				"$ARRAY_INDEX" times">$LTPTMP/test_file.out
		fi
	done
	test_res TPASS $LTPTMP/test_file.out "stress_cpu_hotplug:SUCCESS"
	return $RC
}

#main

RC=0
LTPTMP=${TMP}

#create output file to dump test results
touch $LTPTMP/test_file.out || RC=$?

if [ $RC -ne 0 ]
then
test_resm TFAIL "Failed to create output file under temp directory" exit $RC
fi

if ! get_all_cpus >/dev/null 2>$RC;
then
tst_brkm TCONF "system does not have required cpu hotplug support" exit $RC
fi

setup || exit $RC

#capture the initial state of the cpus
state=cd /sys/devices/system/cpu/ && grep '' */online | sed -e 's/\/online//g' -e 's/\ /\n/g'

test01 || exit $RC

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw

Hi Preeti,

Quoted 7 lines

Hi

The test case included is a simple case for cpu hotplug.It does offlines the cpus that are online and does an online of the offlined cpus in a loop

This stress test had failed on certain distros when the loop was run infinite times.This test is presented here for review of correctness and necessity,as this is the first attempt at contributing test cases to LTP from this end.

The test is meant to be included under the testcases/kernel/hotplug/cpu_hotplug/functional directory.

Why didn't you send this as a patch format?
Some comments below.

Quoted 28 lines

Regards
Preeti
---

# File : stress_cpu_hotplug.sh
# Description : Switches the online state of all the cpus in a
# loop to test the robustness of cpu hotplug
# : The loop iteration of 20 is a randomly chosen number

#! /bin/bash

# Includes:
LHCS_PATH=${LHCS_PATH:-$LTPROOT/testcases/bin/cpu_hotplug} . $LHCS_PATH/include/hotplug.fns
. $LHCS_PATH/include/testsuite.fns

setup()

{
	export TST_TOTAL=1
	export TCID="setup"
	export TST_COUNT=0

	trap "cleanup" 0
	RC=0

	return $RC
Quoted 4 lines

}
cleanup()
{
set_all_cpu_state "$STATE"

I can't find the definition of "$STATE" in your test script.

Quoted 23 lines

}

test01()
{

	TCID="stress_cpu_hotplug"
	TST_COUNT=1
	RC=0

	NUMBER_OF_CPUS=`ls -d /sys/devices/system/cpu/cpu[0-9]* | wc -l`

	cd /sys/devices/system/cpu

	for ARRAY_INDEX in `seq 20`
	do
		for ((i=1; i < NUMBER_OF_CPUS; i++ ))
		do
			#skip the boot cpu;cannot offline it
			if [ $i -eq 0 ]
			then
				continue
			fi
Quoted 7 lines
        		state=`cat cpu$i/online`
		        if [ $state -eq 0 ]
        		then
				RC=online_cpu $i
        		else
                		RC=offline_cpu $i
        		fi

Can it always success? I suppose that it need a bit sleep for the online/offline time delay.

Quoted 9 lines

if [ $RC -ne 0 ]
then
test_brkm TBROK NULL "stress_cpu_hotplug:
cpu$i failed to hotplug"
return $RC
fi
done

Quoted 4 lines

if [ expr $ARRAY_INDEX % 10 == 0 ]
then
echo "stress test successfully completed
"$ARRAY_INDEX" times">$LTPTMP/test_file.out

Every 10 times means a successful test?

Quoted 26 lines

fi
done
test_res TPASS $LTPTMP/test_file.out "stress_cpu_hotplug:SUCCESS" return $RC
}

#main

RC=0
LTPTMP=${TMP}

#create output file to dump test results
touch $LTPTMP/test_file.out || RC=$?

if [ $RC -ne 0 ]
then
test_resm TFAIL "Failed to create output file under temp directory" exit $RC
fi

if ! get_all_cpus >/dev/null 2>$RC;
then
tst_brkm TCONF "system does not have required cpu hotplug support" exit $RC
fi

Quoted 5 lines

setup || exit $RC

#capture the initial state of the cpus
state=cd /sys/devices/system/cpu/ && grep '' */online | sed -e 's/\/online//g' -e 's/\ /\n/g'

This is the "STATE"?

Does the output of get_all_cpu_states() not suit the set_all_cpu_states()? if not, please fix it.

Quoted 2 lines

test01 || exit $RC

Don't you want to cleanup and reset the cpu state after the test?

Thanks,
Wanlong Gao

Quoted 13 lines

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

author
#2 lore raw
Quoted 11 lines · Wanlong Gao

Hi Preeti,

Quoted 7 lines

Hi

The test case included is a simple case for cpu hotplug.It does offlines the cpus that are online and does an online of the offlined cpus in a loop

This stress test had failed on certain distros when the loop was run infinite times.This test is presented here for review of correctness and necessity,as this is the first attempt at contributing test cases to LTP from this end.

The test is meant to be included under the testcases/kernel/hotplug/cpu_hotplug/functional directory.

Why didn't you send this as a patch format?

This was a frst attempt at sending test cases to LTP,so thought would get it reviewed as an RFC first.

Quoted 28 lines

Some comments below.

Quoted 26 lines

Regards
Preeti
---

# File : stress_cpu_hotplug.sh
# Description : Switches the online state of all the cpus in a
# loop to test the robustness of cpu hotplug
# : The loop iteration of 20 is a randomly chosen number

#! /bin/bash

# Includes:
LHCS_PATH=${LHCS_PATH:-$LTPROOT/testcases/bin/cpu_hotplug} . $LHCS_PATH/include/hotplug.fns
. $LHCS_PATH/include/testsuite.fns

setup()

{
	export TST_TOTAL=1
	export TCID="setup"
	export TST_COUNT=0

	trap "cleanup" 0
	RC=0
Quoted 8 lines
Quoted 6 lines

return $RC

}
cleanup()
{
set_all_cpu_state "$STATE"

I can't find the definition of "$STATE" in your test script.

I apologise for this typo.It needs to be $state as you have pointed out below.

Quoted 32 lines
Quoted 24 lines

}

test01()
{

	TCID="stress_cpu_hotplug"
	TST_COUNT=1
	RC=0

	NUMBER_OF_CPUS=`ls -d /sys/devices/system/cpu/cpu[0-9]* | wc -l`

	cd /sys/devices/system/cpu

	for ARRAY_INDEX in `seq 20`
	do
		for ((i=1; i < NUMBER_OF_CPUS; i++ ))
		do
			#skip the boot cpu;cannot offline it
			if [ $i -eq 0 ]
			then
				continue
			fi
Quoted 7 lines
        		state=`cat cpu$i/online`
		        if [ $state -eq 0 ]
        		then
				RC=online_cpu $i
        		else
                		RC=offline_cpu $i
        		fi
Quoted 1 line

Can it always success? I suppose that it need a bit sleep for the online/offline time delay.

It does not need a sleep because we are doing an online and offline of different cpus in one loop.i.e.for example:cpu1->1,cpu2->0,cpu3->1. so it takes one complete loop for cpu1->0 to occur which is enough time for an online or an offline operation for a cpu.

Besides this,the test has been carried out on RHEL distros before and they have succeeded.Only the snapshot 5 of RHEL 6.3 is failing after running for a few seconds which is equivalent to nearly two loops.

Quoted 10 lines
Quoted 10 lines

if [ $RC -ne 0 ]
then
test_brkm TBROK NULL "stress_cpu_hotplug:
cpu$i failed to hotplug"
return $RC
fi
done

Quoted 6 lines
Quoted 4 lines
		if [ `expr $ARRAY_INDEX % 10` == 0 ]
		then
			echo "stress test successfully completed
				"$ARRAY_INDEX" times">$LTPTMP/test_file.out

Every 10 times means a successful test?

Not really.This message is intended to tell us after how many runs of the cpu hotplug operation on all the cpus, is the machine failing to withstand the stress.It might fail after running the loop 100 times or fail within 50 times itself. Also 20 is a very small number for this stress test.It should typically run 100 times.

I have captured the state of the stress test for every 10 iterations,instead of logging for every iteration.So for example if the test is meant to run 100 times,but fails on some distro after 30 loops,the above message logging tells us that the distro withstood the test for 30 loops atleast if not for the entire duration.

Quoted 27 lines
Quoted 27 lines

fi
done
test_res TPASS $LTPTMP/test_file.out "stress_cpu_hotplug:SUCCESS" return $RC
}

#main

RC=0
LTPTMP=${TMP}

#create output file to dump test results
touch $LTPTMP/test_file.out || RC=$?

if [ $RC -ne 0 ]
then
test_resm TFAIL "Failed to create output file under temp directory" exit $RC
fi

if ! get_all_cpus >/dev/null 2>$RC;
then
tst_brkm TCONF "system does not have required cpu hotplug support" exit $RC
fi

Quoted 7 lines
Quoted 5 lines

setup || exit $RC

#capture the initial state of the cpus
state=cd /sys/devices/system/cpu/ && grep '' */online | sed -e 's/\/online//g' -e 's/\ /\n/g'

This is the "STATE"?

Yes this is the one.

Quoted 3 lines

Does the output of get_all_cpu_states() not suit the set_all_cpu_states()? if not, please fix it.

No, get_all_cpu_states(),simply echos the states of the cpus onto the screen in a single line.while the set_all_cpu_states() requires it as a variable with the cpu states printed on multiple lines.Sure will fix this up.

Quoted 5 lines
Quoted 3 lines

test01 || exit $RC

Don't you want to cleanup and reset the cpu state after the test?

yes that is done in the cleanup function,except that it should be set_all_cpu_states "$state"

Quoted 5 lines

Thanks,
Wanlong Gao

Quoted 1 line

Thank you,
Preeti

Quoted 14 lines
Quoted 12 lines

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#3 lore raw
Quoted 7 lines · preeti
Quoted 6 lines · Wanlong Gao

Hi Preeti,

Quoted 4 lines

Hi

The test case included is a simple case for cpu hotplug.It does offlines the cpus that are online and does an online of the offlined cpus in a loop

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

This stress test had failed on certain distros when the loop was run infinite times.This test is presented here for review of correctness and necessity,as this is the first attempt at contributing test cases to LTP from this end.

The test is meant to be included under the testcases/kernel/hotplug/cpu_hotplug/functional directory.

Why didn't you send this as a patch format?

This was a frst attempt at sending test cases to LTP,so thought would get it reviewed as an RFC first.

Yeah, but you can also send a patch titled like [RFC PATCH] xxx.

Quoted 74 lines
Quoted 29 lines

Some comments below.

Quoted 26 lines

Regards
Preeti
---

# File : stress_cpu_hotplug.sh
# Description : Switches the online state of all the cpus in a
# loop to test the robustness of cpu hotplug
# : The loop iteration of 20 is a randomly chosen number

#! /bin/bash

# Includes:
LHCS_PATH=${LHCS_PATH:-$LTPROOT/testcases/bin/cpu_hotplug} . $LHCS_PATH/include/hotplug.fns
. $LHCS_PATH/include/testsuite.fns

setup()

{
	export TST_TOTAL=1
	export TCID="setup"
	export TST_COUNT=0

	trap "cleanup" 0
	RC=0
Quoted 8 lines
Quoted 6 lines

return $RC

}
cleanup()
{
set_all_cpu_state "$STATE"

I can't find the definition of "$STATE" in your test script.

I apologise for this typo.It needs to be $state as you have pointed out below.

Quoted 32 lines
Quoted 24 lines

}

test01()
{

	TCID="stress_cpu_hotplug"
	TST_COUNT=1
	RC=0

	NUMBER_OF_CPUS=`ls -d /sys/devices/system/cpu/cpu[0-9]* | wc -l`

	cd /sys/devices/system/cpu

	for ARRAY_INDEX in `seq 20`
	do
		for ((i=1; i < NUMBER_OF_CPUS; i++ ))
		do
			#skip the boot cpu;cannot offline it
			if [ $i -eq 0 ]
			then
				continue
			fi
Quoted 7 lines
        		state=`cat cpu$i/online`
		        if [ $state -eq 0 ]
        		then
				RC=online_cpu $i
        		else
                		RC=offline_cpu $i
        		fi
Quoted 1 line

Can it always success? I suppose that it need a bit sleep for the online/offline time delay.

Quoted 8 lines

It does not need a sleep because we are doing an online and offline of different cpus in one loop.i.e.for example:cpu1->1,cpu2->0,cpu3->1. so it takes one complete loop for cpu1->0 to occur which is enough time for an online or an offline operation for a cpu.

Besides this,the test has been carried out on RHEL distros before and they have succeeded.Only the snapshot 5 of RHEL 6.3 is failing after running for a few seconds which is equivalent to nearly two loops.

Did you investigate this problem? Why does it fail? Kernel problem or any others?

Quoted 23 lines
Quoted 10 lines
Quoted 10 lines

if [ $RC -ne 0 ]
then
test_brkm TBROK NULL "stress_cpu_hotplug:
cpu$i failed to hotplug"
return $RC
fi
done

Quoted 6 lines
Quoted 4 lines
		if [ `expr $ARRAY_INDEX % 10` == 0 ]
		then
			echo "stress test successfully completed
				"$ARRAY_INDEX" times">$LTPTMP/test_file.out

Every 10 times means a successful test?

Not really.This message is intended to tell us after how many runs of the cpu hotplug operation on all the cpus, is the machine failing to withstand the stress.It might fail after running the loop 100 times or fail within 50 times itself. Also 20 is a very small number for this stress test.It should typically run 100 times.

Quoted 5 lines

I have captured the state of the stress test for every 10 iterations,instead of logging for every iteration.So for example if the test is meant to run 100 times,but fails on some distro after 30 loops,the above message logging tells us that the distro withstood the test for 30 loops atleast if not for the entire duration.

Yeah, so the message "stress test successfully completed" need to be fixed ?

Quoted 34 lines
Quoted 27 lines
Quoted 27 lines

fi
done
test_res TPASS $LTPTMP/test_file.out "stress_cpu_hotplug:SUCCESS" return $RC
}

#main

RC=0
LTPTMP=${TMP}

#create output file to dump test results
touch $LTPTMP/test_file.out || RC=$?

if [ $RC -ne 0 ]
then
test_resm TFAIL "Failed to create output file under temp directory" exit $RC
fi

if ! get_all_cpus >/dev/null 2>$RC;
then
tst_brkm TCONF "system does not have required cpu hotplug support" exit $RC
fi

Quoted 7 lines
Quoted 5 lines

setup || exit $RC

#capture the initial state of the cpus
state=cd /sys/devices/system/cpu/ && grep '' */online | sed -e 's/\/online//g' -e 's/\ /\n/g'

This is the "STATE"?

Quoted 8 lines

Yes this is the one.

Quoted 3 lines

Does the output of get_all_cpu_states() not suit the set_all_cpu_states()? if not, please fix it.

No, get_all_cpu_states(),simply echos the states of the cpus onto the screen in a single line.while the set_all_cpu_states() requires it as a variable with the cpu states printed on multiple lines.Sure will fix this up.

OK, please.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

test01 || exit $RC

Don't you want to cleanup and reset the cpu state after the test?

yes that is done in the cleanup function,except that it should be set_all_cpu_states "$state"

You didn't call cleanup() after the test.

Thanks,
Wanlong Gao

Quoted 24 lines
Quoted 5 lines

Thanks,
Wanlong Gao

Quoted 1 line

Thank you,
Preeti

Quoted 14 lines
Quoted 12 lines

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

author
#4 lore raw
Quoted 10 lines · Wanlong Gao
Quoted 9 lines · preeti
Quoted 8 lines · Wanlong Gao

Hi Preeti,

Quoted 6 lines

Hi

The test case included is a simple case for cpu hotplug.It does offlines the cpus that are online and does an online of the offlined cpus in a loop

This stress test had failed on certain distros when the loop was run infinite times.This test is presented here for review of correctness and necessity,as this is the first attempt at contributing test cases to LTP from this end.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

The test is meant to be included under the testcases/kernel/hotplug/cpu_hotplug/functional directory.

Why didn't you send this as a patch format?

This was a frst attempt at sending test cases to LTP,so thought would get it reviewed as an RFC first.

Yeah, but you can also send a patch titled like [RFC PATCH] xxx.

Ok.

Quoted 80 lines
Quoted 80 lines
Quoted 30 lines

Some comments below.

Quoted 26 lines

Regards
Preeti
---

# File : stress_cpu_hotplug.sh
# Description : Switches the online state of all the cpus in a
# loop to test the robustness of cpu hotplug
# : The loop iteration of 20 is a randomly chosen number

#! /bin/bash

# Includes:
LHCS_PATH=${LHCS_PATH:-$LTPROOT/testcases/bin/cpu_hotplug} . $LHCS_PATH/include/hotplug.fns
. $LHCS_PATH/include/testsuite.fns

setup()

{
	export TST_TOTAL=1
	export TCID="setup"
	export TST_COUNT=0

	trap "cleanup" 0
	RC=0
Quoted 8 lines
Quoted 6 lines

return $RC

}
cleanup()
{
set_all_cpu_state "$STATE"

I can't find the definition of "$STATE" in your test script.

I apologise for this typo.It needs to be $state as you have pointed out below.

Quoted 32 lines
Quoted 24 lines

}

test01()
{

	TCID="stress_cpu_hotplug"
	TST_COUNT=1
	RC=0

	NUMBER_OF_CPUS=`ls -d /sys/devices/system/cpu/cpu[0-9]* | wc -l`

	cd /sys/devices/system/cpu

	for ARRAY_INDEX in `seq 20`
	do
		for ((i=1; i < NUMBER_OF_CPUS; i++ ))
		do
			#skip the boot cpu;cannot offline it
			if [ $i -eq 0 ]
			then
				continue
			fi
Quoted 7 lines
        		state=`cat cpu$i/online`
		        if [ $state -eq 0 ]
        		then
				RC=online_cpu $i
        		else
                		RC=offline_cpu $i
        		fi
Quoted 1 line

Can it always success? I suppose that it need a bit sleep for the online/offline time delay.

It does not need a sleep because we are doing an online and offline of different cpus in one loop.i.e.for example:cpu1->1,cpu2->0,cpu3->1. so it takes one complete loop for cpu1->0 to occur which is enough time for an online or an offline operation for a cpu.

Quoted 5 lines
Quoted 3 lines

Besides this,the test has been carried out on RHEL distros before and they have succeeded.Only the snapshot 5 of RHEL 6.3 is failing after running for a few seconds which is equivalent to nearly two loops.

Did you investigate this problem? Why does it fail? Kernel problem or any others?

Yes,it is a kernel problem.The dmesg output showed that the cpu hotplug operation hangs at synchronize_sched().The scheduler is waiting for some rcu read side critical section to complete,and is either not notified of the completion of the task or there is some rcu section which is actually not completed.

The machine is responsive,in the sense that it responds to the ping packets,but is too slow to perform any operation on.But slowly recovers back to the original state.We have opened a bug on this.

Quoted 24 lines
Quoted 24 lines
Quoted 11 lines
Quoted 11 lines

if [ $RC -ne 0 ]
then
test_brkm TBROK NULL "stress_cpu_hotplug:
cpu$i failed to hotplug"
return $RC
fi
done

Quoted 6 lines
Quoted 4 lines
		if [ `expr $ARRAY_INDEX % 10` == 0 ]
		then
			echo "stress test successfully completed
				"$ARRAY_INDEX" times">$LTPTMP/test_file.out

Every 10 times means a successful test?

Not really.This message is intended to tell us after how many runs of the cpu hotplug operation on all the cpus, is the machine failing to withstand the stress.It might fail after running the loop 100 times or fail within 50 times itself. Also 20 is a very small number for this stress test.It should typically run 100 times.

Quoted 7 lines
Quoted 5 lines

I have captured the state of the stress test for every 10 iterations,instead of logging for every iteration.So for example if the test is meant to run 100 times,but fails on some distro after 30 loops,the above message logging tells us that the distro withstood the test for 30 loops atleast if not for the entire duration.

Yeah, so the message "stress test successfully completed" need to be fixed ?

no the code statement is:

echo "stress test successfully completed "$ARRAY_INDEX" times">$LTPTMP/test_file.out where $ARRAY_INDEX contains the loop number.

Quoted 48 lines
Quoted 35 lines
Quoted 28 lines
Quoted 28 lines

fi
done
test_res TPASS $LTPTMP/test_file.out "stress_cpu_hotplug:SUCCESS" return $RC
}

#main

RC=0
LTPTMP=${TMP}

#create output file to dump test results
touch $LTPTMP/test_file.out || RC=$?

if [ $RC -ne 0 ]
then
test_resm TFAIL "Failed to create output file under temp directory" exit $RC
fi

if ! get_all_cpus >/dev/null 2>$RC;
then
tst_brkm TCONF "system does not have required cpu hotplug support" exit $RC
fi

Quoted 7 lines
Quoted 5 lines

setup || exit $RC

#capture the initial state of the cpus
state=cd /sys/devices/system/cpu/ && grep '' */online | sed -e 's/\/online//g' -e 's/\ /\n/g'

This is the "STATE"?

Quoted 8 lines

Yes this is the one.

Quoted 3 lines

Does the output of get_all_cpu_states() not suit the set_all_cpu_states()? if not, please fix it.

No, get_all_cpu_states(),simply echos the states of the cpus onto the screen in a single line.while the set_all_cpu_states() requires it as a variable with the cpu states printed on multiple lines.Sure will fix this up.

OK, please.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

test01 || exit $RC

Don't you want to cleanup and reset the cpu state after the test?

yes that is done in the cleanup function,except that it should be set_all_cpu_states "$state"

You didn't call cleanup() after the test.

Notice the statement trap "cleanup" 0 under setup.This will call the cleanup() function on exit,where 0 is the code for exit.This is declared when setup() is called.

Quoted 12 lines

Thanks,
Wanlong Gao

Quoted 8 lines
Quoted 5 lines

Thanks,
Wanlong Gao

Quoted 1 line

Thank you,
Preeti

Quoted 1 line
Quoted 1 line

Thanks
Preeti

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list

Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#5 lore raw
Quoted 107 lines · preeti
Quoted 10 lines · Wanlong Gao
Quoted 9 lines · preeti
Quoted 8 lines · Wanlong Gao

Hi Preeti,

Quoted 6 lines

Hi

The test case included is a simple case for cpu hotplug.It does offlines the cpus that are online and does an online of the offlined cpus in a loop

This stress test had failed on certain distros when the loop was run infinite times.This test is presented here for review of correctness and necessity,as this is the first attempt at contributing test cases to LTP from this end.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

The test is meant to be included under the testcases/kernel/hotplug/cpu_hotplug/functional directory.

Why didn't you send this as a patch format?

This was a frst attempt at sending test cases to LTP,so thought would get it reviewed as an RFC first.

Yeah, but you can also send a patch titled like [RFC PATCH] xxx.

Ok.

Quoted 80 lines
Quoted 80 lines
Quoted 30 lines

Some comments below.

Quoted 26 lines

Regards
Preeti
---

# File : stress_cpu_hotplug.sh
# Description : Switches the online state of all the cpus in a
# loop to test the robustness of cpu hotplug
# : The loop iteration of 20 is a randomly chosen number

#! /bin/bash

# Includes:
LHCS_PATH=${LHCS_PATH:-$LTPROOT/testcases/bin/cpu_hotplug} . $LHCS_PATH/include/hotplug.fns
. $LHCS_PATH/include/testsuite.fns

setup()

{
	export TST_TOTAL=1
	export TCID="setup"
	export TST_COUNT=0

	trap "cleanup" 0
	RC=0
Quoted 8 lines
Quoted 6 lines

return $RC

}
cleanup()
{
set_all_cpu_state "$STATE"

I can't find the definition of "$STATE" in your test script.

I apologise for this typo.It needs to be $state as you have pointed out below.

Quoted 32 lines
Quoted 24 lines

}

test01()
{

	TCID="stress_cpu_hotplug"
	TST_COUNT=1
	RC=0

	NUMBER_OF_CPUS=`ls -d /sys/devices/system/cpu/cpu[0-9]* | wc -l`

	cd /sys/devices/system/cpu

	for ARRAY_INDEX in `seq 20`
	do
		for ((i=1; i < NUMBER_OF_CPUS; i++ ))
		do
			#skip the boot cpu;cannot offline it
			if [ $i -eq 0 ]
			then
				continue
			fi
Quoted 7 lines
        		state=`cat cpu$i/online`
		        if [ $state -eq 0 ]
        		then
				RC=online_cpu $i
        		else
                		RC=offline_cpu $i
        		fi
Quoted 1 line

Can it always success? I suppose that it need a bit sleep for the online/offline time delay.

It does not need a sleep because we are doing an online and offline of different cpus in one loop.i.e.for example:cpu1->1,cpu2->0,cpu3->1. so it takes one complete loop for cpu1->0 to occur which is enough time for an online or an offline operation for a cpu.

Quoted 5 lines
Quoted 3 lines

Besides this,the test has been carried out on RHEL distros before and they have succeeded.Only the snapshot 5 of RHEL 6.3 is failing after running for a few seconds which is equivalent to nearly two loops.

Did you investigate this problem? Why does it fail? Kernel problem or any others?

Quoted 8 lines

Yes,it is a kernel problem.The dmesg output showed that the cpu hotplug operation hangs at synchronize_sched().The scheduler is waiting for some rcu read side critical section to complete,and is either not notified of the completion of the task or there is some rcu section which is actually not completed.

The machine is responsive,in the sense that it responds to the ping packets,but is too slow to perform any operation on.But slowly recovers back to the original state.We have opened a bug on this.

Ok, thank you.

Wanlong Gao

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list