• David Hildenbrand's avatar
    KVM: s390x: selftests: Add shared zeropage test · 01c51a32
    David Hildenbrand authored
    Let's test that we can have shared zeropages in our process as long as
    storage keys are not getting used, that shared zeropages are properly
    unshared (replaced by anonymous pages) once storage keys are enabled,
    and that no new shared zeropages are populated after storage keys
    were enabled.
    
    We require the new pagemap interface to detect the shared zeropage.
    
    On an old kernel (zeropages always disabled):
    	# ./s390x/shared_zeropage_test
    	TAP version 13
    	1..3
    	not ok 1 Shared zeropages should be enabled
    	ok 2 Shared zeropage should be gone
    	ok 3 Shared zeropages should be disabled
    	# Totals: pass:2 fail:1 xfail:0 xpass:0 skip:0 error:0
    
    On a fixed kernel:
    	# ./s390x/shared_zeropage_test
    	TAP version 13
    	1..3
    	ok 1 Shared zeropages should be enabled
    	ok 2 Shared zeropage should be gone
    	ok 3 Shared zeropages should be disabled
    	# Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
    
    Testing of UFFDIO_ZEROPAGE can be added later.
    
    [ agordeev: Fixed checkpatch complaint, added ucall_common.h include ]
    
    Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
    Cc: Janosch Frank <frankja@linux.ibm.com>
    Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
    Cc: Thomas Huth <thuth@redhat.com>
    Cc: Alexander Gordeev <agordeev@linux.ibm.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Shuah Khan <shuah@kernel.org>
    Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
    Acked-by: default avatarChristian Borntraeger <borntraeger@linux.ibm.com>
    Acked-by: default avatarMuhammad Usama Anjum <usama.anjum@collabora.com>
    Tested-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
    Link: https://lore.kernel.org/r/20240412084329.30315-1-david@redhat.comSigned-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
    01c51a32
shared_zeropage_test.c 2.8 KB