Hello, On Thu, Nov 15, 2018 at 4:50 PM Andrew Jones drjones@redhat.com wrote:
On Thu, Nov 15, 2018 at 03:36:44PM +0200, Ahmed Soliman wrote:
mmap(NULL, 6291456, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f46ea2a1000 madvise(0x7f46ea2a1000, 6291456, MADV_NOHUGEPAGE) = -1 EINVAL (Invalid argument)
For comprehension, this is done on intel core i7-4500U CPU @ 1.80GHz
Argh. I see what it is. Your config doesn't have CONFIG_TRANSPARENT_HUGEPAGE=y, so madvise_behavior_valid() returns false, which causes madvise() to immediately return EINVAL. We should be more careful in kvm selftests with our madvise behavior use.
As for now I will comment the madvise line and the assert when writing my own kvm self test. I think it wouldn't cause any trouble?, If it is not the case, please let me know.
You may not need madvise() at all for your test, depending on what you're doing. So leaving it out may be fine. Reworking kvm selftests to ensure only valid madvise behaviors are used (and only when necessary), before adding new tests, would be best.
Confirmed it worked after CONFIG_TRANSPARENT_HUGEPAGE=y I will send a patch soon that should make the self test check if Transparent huge pages are enabled first before issuing the related madvise()
Thanks,