Re: [PATCH v8 10/14] KVM: selftests: aarch64: Add aarch64/page_fault_test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 28, 2022 at 04:58:53PM +0000, Sean Christopherson wrote:
> On Tue, Sep 27, 2022, Ricardo Koller wrote:
> > On Tue, Sep 27, 2022 at 10:06:23PM +0000, Sean Christopherson wrote:
> > > On Mon, Sep 26, 2022, Ricardo Koller wrote:
> > > > On Thu, Sep 22, 2022 at 07:32:42PM +0000, Sean Christopherson wrote:
> > > > > On Thu, Sep 22, 2022, Ricardo Koller wrote:
> > > > > > +	void *hva = (void *)region->region.userspace_addr;
> > > > > > +	uint64_t paging_size = region->region.memory_size;
> > > > > > +	int ret, fd = region->fd;
> > > > > > +
> > > > > > +	if (fd != -1) {
> > > > > > +		ret = fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
> > > > > > +				0, paging_size);
> > > > > > +		TEST_ASSERT(ret == 0, "fallocate failed, errno: %d\n", errno);
> > > > > > +	} else {
> > > > > > +		if (is_backing_src_hugetlb(region->backing_src_type))
> > > > > > +			return false;
> > > > > 
> > > > > Why is hugetlb disallowed?  I thought anon hugetlb supports MADV_DONTNEED?
> > > > > 
> > > > 
> > > > It fails with EINVAL (only tried on arm) for both the PAGE_SIZE and the huge
> > > > page size. And note that the address is aligned as well.
> > > > 
> > > > madvise(0xffffb7c00000, 2097152, MADV_DONTNEED) = -1 EINVAL (Invalid argument)
> > > > 	^^^^^^^^^^^^^^	^^^^^^^
> > > > 	2M aligned	2M (hugepage size)
> > > > 			
> > > > madvise(0xffff9e800000, 4096, MADV_DONTNEED) = -1 EINVAL (Invalid argument)   
> > > > 			^^^^
> > > > 			PAGE_SIZE
> > > 
> > > I think this needs to be root caused before merging.  Unless I'm getting turned
> > > around, MADV_DONTEED should work, i.e. there is a test bug lurking somewhere.
> > 
> > Turns out that the failure is documented. Found this in the madvise manpage:
> > 
> >   MADV_DONTNEED cannot be applied to locked pages, Huge TLB pages, or VM_PFNMAP pages.
> 
> The manpages are stale:
> 
>    c4b6cb884011 ("selftests/vm: add hugetlb madvise MADV_DONTNEED MADV_REMOVE test")
>    90e7e7f5ef3f ("mm: enable MADV_DONTNEED for hugetlb mappings")
> 
> The tools/testing/selftests/vm/hugetlb-madvise.c selftest effectively tests what
> is being done here, so _something_ is broken.

Thanks for the pointers. I was using old kernels (~5.15) for these
latest tests. Testing on a 6.0-rc3 kernel fixed things: now able to
madvise(MADV_DONTNEED) on anon-hugetlb from the selftest (arm).

Will remove the check (for skppping the test) in v9.

Thanks!
Ricardo
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm



[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux