Skip to contentSkip to conversation

futex: skip futex_wake04.c if system not support huge pages

PATCH New Li Wang 2 participants 7 messages Nov 15, 2015 – Nov 17, 2015

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 futex: skip futex_wake04.c if system not support huge pages

Testcase fails on system which not support hugepages:

futex_wake04    1  TBROK  :  safe_file_ops.c:155: The FILE '/proc/sys/vm/nr_hugepages' ended prematurely at futex_wake04.c:74
futex_wake04    2  TBROK  :  safe_file_ops.c:155: Remaining cases broken

Skip the testcase cases with TCONF rather than failing with TBROK.

---
 testcases/kernel/syscalls/futex/futex_wake04.c | 4 ++++
 1 file changed, 4 insertions(+)
testcases/kernel/syscalls/futex/futex_wake04.c +4 -0
index dcefde8..2d6bd4c 100644
@@ -50,6 +50,7 @@
 
 #define PATH_MEMINFO "/proc/meminfo"
 #define PATH_NR_HUGEPAGES "/proc/sys/vm/nr_hugepages"
+#define PATH_SYS_HUGEPAGES "/sys/kernel/mm/hugepages/"
 
 const char *TCID = "futex_wake04";
 const int TST_TOTAL = 1;
@@ -69,6 +70,9 @@ static void setup(void)
 			"that are 2.6.32 or higher");
 	}
 
+	if (access(PATH_SYS_HUGEPAGES, F_OK) == -1)
+		tst_brkm(TCONF, NULL, "Huge page is not supported.");
+
 	tst_tmpdir();
 
 	SAFE_FILE_SCANF(NULL, PATH_NR_HUGEPAGES, "%ld", &orig_hugepages);
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/1 futex: skip futex_wake04.c if system not support huge pages

Quoted 17 lines · Li Wang

Testcase fails on system which not support hugepages:

futex_wake04    1  TBROK  :  safe_file_ops.c:155: The FILE '/proc/sys/vm/nr_hugepages' ended prematurely at futex_wake04.c:74
futex_wake04    2  TBROK  :  safe_file_ops.c:155: Remaining cases broken

Skip the testcase cases with TCONF rather than failing with TBROK.

---
 testcases/kernel/syscalls/futex/futex_wake04.c | 4 ++++
 1 file changed, 4 insertions(+)
testcases/kernel/syscalls/futex/futex_wake04.c +0 -0
index dcefde8..2d6bd4c 100644

testcases/kernel/syscalls/futex/futex_wake04.c line 53

Quoted 4 lines
testcases/kernel/syscalls/futex/futex_wake04.c +1 -0
@@ -50,6 +50,7 @@
 
 #define PATH_MEMINFO "/proc/meminfo"
 #define PATH_NR_HUGEPAGES "/proc/sys/vm/nr_hugepages"
+#define PATH_SYS_HUGEPAGES "/sys/kernel/mm/hugepages/"

Why not use the original "/proc/sys/vm/nr_hugepages" to check the hugetlb support but add a new one ?

Thanks,
Wanlong Gao

Quoted 19 lines
testcases/kernel/syscalls/futex/futex_wake04.c +3 -0
 const char *TCID = "futex_wake04";
 const int TST_TOTAL = 1;
@@ -69,6 +70,9 @@ static void setup(void)
 			"that are 2.6.32 or higher");
 	}
 
+	if (access(PATH_SYS_HUGEPAGES, F_OK) == -1)
+		tst_brkm(TCONF, NULL, "Huge page is not supported.");
+
 	tst_tmpdir();
 
 	SAFE_FILE_SCANF(NULL, PATH_NR_HUGEPAGES, "%ld", &orig_hugepages);
Signature · 5 lines
1.9.3


-- 
Mailing list info: http://lists.linux.it/listinfo/ltp
author
#2 lore raw

PATCH 1/1 futex: skip futex_wake04.c if system not support huge pages

Hi,

Quoted 21 lines · Wanlong Gao
Quoted 3 lines · Li Wang

Testcase fails on system which not support hugepages:

futex_wake04 1 TBROK : safe_file_ops.c:155: The FILE

'/proc/sys/vm/nr_hugepages' ended prematurely at futex_wake04.c:74

Review

Quoted 10 lines

futex_wake04 2 TBROK : safe_file_ops.c:155: Remaining cases broken

Skip the testcase cases with TCONF rather than failing with TBROK.

---
 testcases/kernel/syscalls/futex/futex_wake04.c | 4 ++++
 1 file changed, 4 insertions(+)
(quoted diff) +0 -0

b/testcases/kernel/syscalls/futex/futex_wake04.c

Quoted 5 lines

index dcefde8..2d6bd4c 100644

testcases/kernel/syscalls/futex/futex_wake04.c +0 -0
@@ -50,6 +50,7 @@
 
Quoted 7 lines

testcases/kernel/syscalls/futex/futex_wake04.c line 53

Quoted 3 lines
testcases/kernel/syscalls/futex/futex_wake04.c +1 -0
 #define PATH_MEMINFO "/proc/meminfo"
 #define PATH_NR_HUGEPAGES "/proc/sys/vm/nr_hugepages"
+#define PATH_SYS_HUGEPAGES "/sys/kernel/mm/hugepages/"

Why not use the original "/proc/sys/vm/nr_hugepages" to check the hugetlb support but add a new one ?

In my test system, there exist file "/proc/sys/vm/nr_hugepages" with normal permission, but reject any R/W operation.

So, if I use if (access(PATH_NR_HUGEPAGES, F_OK) == -1), It doesn't work.

# ll /proc/sys/vm/nr_hugepages
-rw-r--r--. 1 root root 0 Nov 15 09:03 /proc/sys/vm/nr_hugepages
# cat /proc/sys/vm/nr_hugepages
cat: write error: Bad address
# cat /proc/meminfo
MemTotal:        8663296 kB
MemFree:         6637056 kB
MemAvailable:    8151744 kB
Buffers:            4160 kB
Cached:          1504192 kB
SwapCached:            0 kB
Active:           946816 kB
Inactive:         788480 kB
Active(anon):     230592 kB
Inactive(anon):     9472 kB
Active(file):     716224 kB
Inactive(file):   779008 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       4652992 kB
SwapFree:        4652992 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:        226944 kB
Mapped:            51456 kB
Shmem:             13120 kB
Slab:             188032 kB
SReclaimable:      63232 kB
SUnreclaim:       124800 kB
KernelStack:        2944 kB
PageTables:         2176 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     8984640 kB
Committed_AS:     464064 kB
VmallocTotal:   8589934592 kB
VmallocUsed:       53056 kB
VmallocChunk:   8589850624 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
Signature · 6 lines
Regards,
Li Wang
Email: [email protected]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20151116/60c4716c/attachment.html>
#3 lore raw

PATCH 1/1 futex: skip futex_wake04.c if system not support huge pages

Quoted 36 lines · Li Wang

Hi,

On Mon, Nov 16, 2015 at 1:06 PM, Wanlong Gao <[email protected]> wrote:

    On Sun, Nov 15, 2015 at 04:41:00PM +0800, Li Wang wrote:
    > Testcase fails on system which not support hugepages:
    >
    > futex_wake04? ? 1? TBROK? :? safe_file_ops.c:155: The FILE '/proc/sys/vm/
    nr_hugepages' ended prematurely at futex_wake04.c:74
    > futex_wake04? ? 2? TBROK? :? safe_file_ops.c:155: Remaining cases broken
    >
    > Skip the testcase cases with TCONF rather than failing with TBROK.
    >
    > Signed-off-by: Li Wang <[email protected]>
    > ---
    >? testcases/kernel/syscalls/futex/futex_wake04.c | 4 ++++
    >? 1 file changed, 4 insertions(+)
    >
    > diff --git a/testcases/kernel/syscalls/futex/futex_wake04.c b/testcases/
    kernel/syscalls/futex/futex_wake04.c
    > index dcefde8..2d6bd4c 100644
    > --- a/testcases/kernel/syscalls/futex/futex_wake04.c
    > +++ b/testcases/kernel/syscalls/futex/futex_wake04.c
    > @@ -50,6 +50,7 @@
    >
    >? #define PATH_MEMINFO "/proc/meminfo"
    >? #define PATH_NR_HUGEPAGES "/proc/sys/vm/nr_hugepages"
    > +#define PATH_SYS_HUGEPAGES "/sys/kernel/mm/hugepages/"

    Why not use the original "/proc/sys/vm/nr_hugepages" to check the hugetlb
    support but add a new one ?

In my test system, there exist file "/proc/sys/vm/nr_hugepages" with normal permission, but reject any R/W operation.

Quoted 7 lines

So, if I use ? if (access(PATH_NR_HUGEPAGES, F_OK) == -1),? It doesn't work.

# ll /proc/sys/vm/nr_hugepages
-rw-r--r--. 1 root root 0 Nov 15 09:03 /proc/sys/vm/nr_hugepages
# cat /proc/sys/vm/nr_hugepages
cat: write error: Bad address

Would you show your kernel version or investigate why this happens? This should not exist if we disable the hugetlbfs in kernel config.

Quoted 38 lines
# cat /proc/meminfo
MemTotal:??????? 8663296 kB
MemFree:???????? 6637056 kB
MemAvailable:??? 8151744 kB
Buffers:??????????? 4160 kB
Cached:????????? 1504192 kB
SwapCached:??????????? 0 kB
Active:?????????? 946816 kB
Inactive:???????? 788480 kB
Active(anon):???? 230592 kB
Inactive(anon):???? 9472 kB
Active(file):???? 716224 kB
Inactive(file):?? 779008 kB
Unevictable:?????????? 0 kB
Mlocked:?????????????? 0 kB
SwapTotal:?????? 4652992 kB
SwapFree:??????? 4652992 kB
Dirty:???????????????? 0 kB
Writeback:???????????? 0 kB
AnonPages:??????? 226944 kB
Mapped:??????????? 51456 kB
Shmem:???????????? 13120 kB
Slab:???????????? 188032 kB
SReclaimable:????? 63232 kB
SUnreclaim:?????? 124800 kB
KernelStack:??????? 2944 kB
PageTables:???????? 2176 kB
NFS_Unstable:????????? 0 kB
Bounce:??????????????? 0 kB
WritebackTmp:????????? 0 kB
CommitLimit:???? 8984640 kB
Committed_AS:???? 464064 kB
VmallocTotal:?? 8589934592 kB
VmallocUsed:?????? 53056 kB
VmallocChunk:?? 8589850624 kB
HardwareCorrupted:???? 0 kB
Quoted 1 line

AnonHugePages:???????? 0 kB

This tells that your kernel support THP.

Thanks,
Wanlong Gao

Quoted 6 lines

--
Regards,
Li Wang
Email: [email protected]

author
#4 lore raw

PATCH 1/1 futex: skip futex_wake04.c if system not support huge pages

Hi,

Quoted 9 lines · Wanlong Gao
Quoted 2 lines · Li Wang

In my test system, there exist file "/proc/sys/vm/nr_hugepages" with

normal

Quoted 3 lines

permission, but reject any R/W operation.

So, if I use if (access(PATH_NR_HUGEPAGES, F_OK) == -1), It doesn't

work.

Quoted 1 line
Quoted 9 lines
Quoted 5 lines
# ll /proc/sys/vm/nr_hugepages
-rw-r--r--. 1 root root 0 Nov 15 09:03 /proc/sys/vm/nr_hugepages
# cat /proc/sys/vm/nr_hugepages
cat: write error: Bad address

Would you show your kernel version or investigate why this happens? This should not exist if we disable the hugetlbfs in kernel config.

I looked close to my test bed, it is a KVM Guest which enabled hugetlbfs on IBM POWER8E,

the config is:
CONFIG_CGROUP_HUGETLB=y
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y
CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y
CONFIG_SYS_SUPPORTS_HUGETLBFS=y
CONFIG_TRANSPARENT_HUGEPAGE=y
# CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS is not set
CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y
CONFIG_HUGETLBFS=y
CONFIG_HUGETLB_PAGE=y

# uname -r
3.10.0-*.el7.ppc64le
Quoted 8 lines
Quoted 5 lines
VmallocChunk:   8589850624 kB
HardwareCorrupted:     0 kB

AnonHugePages: 0 kB

This tells that your kernel support THP.

yes, the reason is that my kvm guest XML was not added these below line:

guest XML:
<memoryBacking>
<hugepages/>
</memoryBacking>

after adding them, the kvm guest can works well with hugepages.

it is a configuration issue of guest, not a kernel bug. so, I propose my patch as previously.

Thanks~

Signature · 6 lines
Regards,
Li Wang
Email: [email protected]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20151116/b0d09faa/attachment.html>
author
#5 lore raw

PATCH 1/1 futex: skip futex_wake04.c if system not support huge pages

Hi,

Quoted 58 lines · Li Wang

Hi,

Quoted 9 lines · Wanlong Gao
Quoted 2 lines · Li Wang

In my test system, there exist file "/proc/sys/vm/nr_hugepages" with

normal

Quoted 3 lines

permission, but reject any R/W operation.

So, if I use if (access(PATH_NR_HUGEPAGES, F_OK) == -1), It doesn't

work.

Quoted 1 line
Quoted 9 lines
Quoted 5 lines
# ll /proc/sys/vm/nr_hugepages
-rw-r--r--. 1 root root 0 Nov 15 09:03 /proc/sys/vm/nr_hugepages
# cat /proc/sys/vm/nr_hugepages
cat: write error: Bad address

Would you show your kernel version or investigate why this happens? This should not exist if we disable the hugetlbfs in kernel config.

I looked close to my test bed, it is a KVM Guest which enabled hugetlbfs on IBM POWER8E,

the config is:
CONFIG_CGROUP_HUGETLB=y
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y
CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y
CONFIG_SYS_SUPPORTS_HUGETLBFS=y
CONFIG_TRANSPARENT_HUGEPAGE=y
# CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS is not set
CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y
CONFIG_HUGETLBFS=y
CONFIG_HUGETLB_PAGE=y

# uname -r
3.10.0-*.el7.ppc64le
Quoted 8 lines
Quoted 5 lines
VmallocChunk:   8589850624 kB
HardwareCorrupted:     0 kB

AnonHugePages: 0 kB

This tells that your kernel support THP.

yes, the reason is that my kvm guest XML was not added these below line:

guest XML:
<memoryBacking>
<hugepages/>
</memoryBacking>

Quoted 5 lines

after adding them, the kvm guest can works well with hugepages.

it is a configuration issue of guest, not a kernel bug. so, I propose my patch as previously.

IMO, if we use the original "/proc/sys/vm/nr_hugepages" to check the hugetlb support, it does not work on the situation which I mentioned above.

So, I suggest to add new Marco 'PATH_SYS_HUGEPAGES' to skip the testcase.

what do you think?

Signature · 6 lines
Regards,
Li Wang
Email: [email protected]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20151117/932a8a90/attachment-0001.html>
#6 lore raw

PATCH 1/1 futex: skip futex_wake04.c if system not support huge pages

Quoted 67 lines · Li Wang

Hi,

On Mon, Nov 16, 2015 at 5:01 PM, Li Wang <[email protected]> wrote:

Hi,

On Mon, Nov 16, 2015 at 3:37 PM, Wanlong Gao <[email protected]> wrote:

On Mon, Nov 16, 2015 at 02:00:52PM +0800, Li Wang wrote:
>
> In my test system, there exist file "/proc/sys/vm/nr_hugepages" with normal
> permission, but reject any R/W operation.
>
> So, if I use ? if (access(PATH_NR_HUGEPAGES, F_OK) == -1),? It doesn't work.
>
> # ll /proc/sys/vm/nr_hugepages
> -rw-r--r--. 1 root root 0 Nov 15 09:03 /proc/sys/vm/nr_hugepages >
> # cat /proc/sys/vm/nr_hugepages
> cat: write error: Bad address

Would you show your kernel version or investigate why this happens? This should not exist if we disable the hugetlbfs in kernel config.

I looked close to my test bed, it is a KVM Guest which enabled hugetlbfs on IBM POWER8E,

the config is:
CONFIG_CGROUP_HUGETLB=y CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y CONFIG_SYS_SUPPORTS_HUGETLBFS=y CONFIG_TRANSPARENT_HUGEPAGE=y
# CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS is not set CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y CONFIG_HUGETLBFS=y CONFIG_HUGETLB_PAGE=y

# uname -r
3.10.0-*.el7.ppc64le
?

> VmallocChunk:?? 8589850624 kB
> HardwareCorrupted:???? 0 kB

> AnonHugePages:???????? 0 kB

This tells that your kernel support THP.

?
yes, the reason is that my kvm guest XML was not added these below line:

guest XML:
?<memoryBacking>
????? <hugepages/>
?</memoryBacking>

after adding them, the kvm guest can works well with hugepages.

it is a configuration issue of guest, not a kernel bug.? so, I propose my patch as previously.

Quoted 6 lines

IMO, if we use the original "/proc/sys/vm/nr_hugepages" to check the hugetlb support, it does not work on the situation which I mentioned above.

So, I suggest to add new Marco 'PATH_SYS_HUGEPAGES'? to skip the testcase.

what do you think?

It's just a workaround, anyway, I have no objection.

Thanks,
Wanlong Gao

Quoted 5 lines

--
Regards,
Li Wang
Email: [email protected]