Re: [PATCH 1/3] selftests: kvm: s390: Add uc_map_unmap VM test case

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

 



On Fri Aug 16, 2024 at 4:29 PM CEST, Janosch Frank wrote:
> On 8/15/24 5:45 PM, Christoph Schlameuss wrote:
> > Add a test case verifying basic running and interaction of ucontrol VMs.
> > Fill the segment and page tables for allocated memory and map memory on
> > first access.
> > 
> > * uc_map_unmap
> >    Store and load data to mapped and unmapped memory and use pic segment
> >    translation handling to map memory on access.
> > 
> > Signed-off-by: Christoph Schlameuss <schlameuss@xxxxxxxxxxxxx>
> > ---
> >   .../selftests/kvm/s390x/ucontrol_test.c       | 120 +++++++++++++++++-
> >   1 file changed, 119 insertions(+), 1 deletion(-)
> > 
>
> > +static void uc_handle_exit_ucontrol(FIXTURE_DATA(uc_kvm) * self)
> > +{
> > +	struct kvm_run *run = self->run;
> > +
> > +	TEST_ASSERT_EQ(KVM_EXIT_S390_UCONTROL, run->exit_reason);
> > +	switch (run->s390_ucontrol.pgm_code) {
> > +	case PGM_SEGMENT_TRANSLATION:
> > +		pr_info("ucontrol pic segment translation 0x%llx\n",
> > +			run->s390_ucontrol.trans_exc_code);
> > +		/* map / make additional memory available */
> > +		struct kvm_s390_ucas_mapping map2 = {
> > +			.user_addr = (u64)gpa2hva(self, run->s390_ucontrol.trans_exc_code),
> > +			.vcpu_addr = run->s390_ucontrol.trans_exc_code,
> > +			.length = VM_MEM_EXT_SIZE,
> > +		};
> > +		pr_info("ucas map %p %p 0x%llx\n",
> > +			(void *)map2.user_addr, (void *)map2.vcpu_addr, map2.length);
> > +		TEST_ASSERT_EQ(0, ioctl(self->vcpu_fd, KVM_S390_UCAS_MAP, &map2));
> > +		break;
>
> Why is this necessary if you fix up the mapping in the test?
>

I did split this out here to have an automatic and clean way to do the map for
other test cases as well. Other test cases would likely not bother with the
unmap. This is also used within the uc_skey test to make sure the remap does
work after the unmap.

I could change this to use uc_handle_exit_ucontrol for both, the map and the
remap. But looking at the test code I felt that was more confusing than this
within the uc_skey test.

> [...]
>

Thanks for finding the typos.




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux