--- Begin Message ---
Hi,
As written in the previous mail , I have modify some code.
PFA the patch for HT_affinity.Test is Passed in my system.
Kindly confirm that whether it is working fine on your system also.
Regards,
Rohit
On Fri, May 15, 2009 at 5:20 PM, rohit verma <[email protected]> wrote:
> Dear CAI Qian,
>
> I am also trying to update HT_affinity also.
>
> Issues:
>
> function: HT_GetAffinity()
>
> Line: mask1=get_porc_affinity(pid);
>
> function, get_porc_affinity() returns error ; No such file or directory.
>
> This is due the that this file eg. /proc/<pid>/affinity is not present in
> my system FC10.
>
> Is it removed/changed?.
>
> Can you pls confirm that.
>
> If it is removed/changed then we can simply compare the values of mask and
> mask2 or modify the the path.
>
> Test is passed on my system after removing the same
>
> One more thing, system call sched_getaffinity returns 4.
>
> It should return 0 or -1.
>
> Is it bug in the kernel?.
>
> Thanks and Regards,
> Rohit
>
>
> On Wed, May 13, 2009 at 9:17 PM, CAI Qian <[email protected]> wrote:
>
>> From: rohit verma <[email protected]>
>> Subject: Re: [LTP] Regarding ht_enable test case failure
>> Date: Wed, 13 May 2009 15:03:39 +0530
>>
>> > Hi,
>> >
>> > I want to update HT_enable test case in LTP.
>> >
>> > *HT_enabled:*Test for whether HT enabling is the default setting and the
>> > kernel option works as expected.
>> >
>> > *Issue:* Reported as failed in my System. However /proc/cpuinfo shows
>> two
>> > cpu and ht flag.
>> >
>>
>> If HT has been disabled in BIOS, you can still see the ht flag in
>> /proc/cpuinfo, so it is not enough to just look at it there. We have
>> looked at this before, and looks like the proper place to see if HT or
>> more generic term -- symmetrical multithreading (SMT) is sysfs (at least
>> for RHEL 5 kernels). There is a CPU topology information,
>>
>> /sys/devices/system/cpu/cpuX/topology/thread_siblings
>>
>> It looks like this,
>>
>> 00000001
>>
>> 00000002
>>
>> 00000008
>>
>> In all those case, It means there is no HT or SMT.
>>
>> If you see something like this,
>>
>> 00000003
>>
>> This one mean CPU0 and CPU1 are two threads in the same CPU core. This
>> is because the nth CPU id is,
>>
>> 2 raised to n.
>>
>> 3 = CPU0 (1) + CPU1 (2)
>>
>> There is also a tool to find out this information.
>>
>> lscpu from the latest utils-linux-ng package,
>> http://koji.fedoraproject.org/koji/packageinfo?packageID=4906
>>
>> > Can you pls tell me how to enable/disable hyperthreading in linux
>> kernel. I
>> > could not found proper document for the same.
>> >
>>
>> I am not sure if "noht" is still working. At least it has no effect in
>> RHEL5 kernel. Instead, it was suggested to use the following commands to
>> enable/disable it,
>>
>> From a public bug in Red Hat Bugzilla,
>> https://bugzilla.redhat.com/show_bug.cgi?id=440321
>>
>> "RHEL5 ships with CPU_HOTPLUG enabled. This option allows a user to
>> disable and enable HW or HT cores.
>>
>> For example,
>>
>> I have a 4 cpu system with two HT processors.
>>
>> To disable the HT processors one can do:
>>
>> echo 0 > /sys/devices/system/node/node0/cpu1/online
>> echo 0 > /sys/devices/system/node/node0/cpu3/online
>>
>> You could write a system service script that does something similar to
>> (please note that this code is untested and is just a suggestion):
>>
>> grep noht /proc/cmdline
>>
>> if [ $? -eq 0 ]; then
>> # noht specified on the command line, disabling HT cpus
>> echo 0 > /sys/devices/system/node/node0/cpu1/online
>> echo 0 > /sys/devices/system/node/node0/cpu3/online
>> fi
>> "
>>
>> > I also found that the check for kernel option "noht" is useless by
>> looking
>> > into code(HT_enabled.c).
>> >
>> > I think, we can remove that.
>>
>> I guess we can remove it if it is proved to be a dead option.
>>
>> CAI Qian
>>
>> >
>> > Regards,
>> >
>> > Rohit
>> >
>> > On Sat, Apr 11, 2009 at 2:25 PM, CAI Qian <[email protected]> wrote:
>> >>
>> >> Hi,
>> >>
>> >> --- On Mon, 3/30/09, rohit verma <[email protected]> wrote:
>> >>
>> >>> From: rohit verma <[email protected]>
>> >>> Subject: [LTP] Regarding ht_enable test case failure
>> >>> To: [email protected]
>> >>> Date: Monday, March 30, 2009, 9:10 PM
>> >>> O/P:
>> >>>
>> >>>
>> >>> ht_enable 0 INFO :
>> >>> Begin: HyperThreading Enabled
>> >>> ht_enable 0 INFO : The kernel boot paramter
>> >>> 'noht' is not set.
>> >>>
>> >>> ht_enable 1 FAIL : HT feature is not included
>> >>> in this Linux Kernel.
>> >>> ht_enable 0 INFO : End: HyperThreading Enabled
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> but noht is for
>> >>> disabling
>> >>> hyperthreading.
>> >>>
>> >>>
>> >>>
>> >>> Function
>> >>> is_ht_kernel (file:
>> > testcases/kernel/sched/hyperthreading/ht_affinity/HTutils.c) checks for
>> >>> string cpu_package in /proc/cpuinfo
>> >>> .
>> >>>
>> >>>
>> >>> but
>> >>> cpu_package string
>> >>> information does not exist in /proc/cpuinfo for
>> >>> 2.6.29 kernel
>> >>>
>> >>
>> >> From the page,
>> >>
>> >>
>> >
>> https://lists.linux-foundation.org/pipermail/cgl_discussion/2002-October/002632.html
>> >>
>> >> looks like cpu_package has been added in 2.4.x kernel by HT patches.
>> >> Has this field been removed later? I can't see it with 2.6.18 kernel.
>> >>
>> >> I have copied the author of those tests - Sonic Zhang to see if he has
>> any
>> >> insight of it.
>> >>
>> >> Anyway, this piece of code seems check if the kernel has HT support or
>> > not.
>> >> I am not sure if we'll still need it, because HT support has been added
>> >> to kernel many years ago.
>> >>
>> >> CAI Qian
>> >>
>> >>>
>> >>>
>> >>>
>> >>> Regards,
>> >>> Rohit
>> >>>
>>
>
>
diff -ruxB
ltp-full-20090430_orin/testcases/kernel/sched/hyperthreading/ht_affinity/HTaffinity.c
ltp-full-20090430/testcases/kernel/sched/hyperthreading/ht_affinity/HTaffinity.c
---
ltp-full-20090430_orin/testcases/kernel/sched/hyperthreading/ht_affinity/HTaffinity.c
2009-05-15 18:00:51.000000000 +0530
+++
ltp-full-20090430/testcases/kernel/sched/hyperthreading/ht_affinity/HTaffinity.c
2009-05-15 18:10:20.000000000 +0530
@@ -161,7 +161,7 @@
int HT_GetAffinity()
{
- unsigned long mask,mask1,mask2;
+ unsigned long mask,mask2;
pid_t pid;
mask=0x1;
@@ -173,20 +173,22 @@
sleep(1);
- mask1=get_porc_affinity(pid);
+ //mask1=get_porc_affinity(pid);
sched_getaffinity(pid, sizeof(unsigned int), &mask2);
- if(mask==0x1 && mask==mask1 && mask==mask2)
+ //if(mask==0x1 && mask==mask1 && mask==mask2)
+ if(mask==0x1 && mask==mask2)
{
mask=0x2;
sched_setaffinity(pid, sizeof(unsigned long), &mask);
sleep(1);
- mask1=get_porc_affinity(pid);
+ //mask1=get_porc_affinity(pid);
sched_getaffinity(pid, sizeof(unsigned int), &mask2);
- if(mask==0x2 && mask==mask1 && mask==mask2)
+ //if(mask==0x2 && mask==mask1 && mask==mask2)
+ if(mask==0x2 && mask==mask2)
return 1;
else
return 0;
@@ -217,7 +219,8 @@
exit(0);
}
- mask=get_porc_affinity(pid);
+ //mask=get_porc_affinity(pid);
+ sched_getaffinity(pid, sizeof(unsigned int), &mask);
if(mask==0x2)
return 1;
@@ -233,7 +236,7 @@
#ifndef __i386__
tst_brkm(TCONF, NULL, "This test suite can only excute on i386
architecture.");
#else
- if (!check_ht_capability())
+ //if (!check_ht_capability())
{
if(HT_GetAffinity())
@@ -255,10 +258,10 @@
else
tst_resm(TFAIL, "System call setaffinity() is error.");
}
- else
+ /*else
{
tst_brkm(TCONF, NULL, "HT is not enabled or not supported.");
- }
+ }*/
#endif
tst_resm(TINFO, "End: HyperThreading Affinity");
--- End Message ---