[<prev] [next>] [day] [month] [year] [list]
Message-ID: <0184EA26B2509940AA629AE1405DD7F201CE36DC@DGGEMA503-MBX.china.huawei.com>
Date: Sun, 17 Jun 2018 02:37:12 +0000
From: gengdongjiu <gengdongjiu@...wei.com>
To: James Morse <james.morse@....com>
CC: "rkrcmar@...hat.com" <rkrcmar@...hat.com>,
"corbet@....net" <corbet@....net>,
"christoffer.dall@....com" <christoffer.dall@....com>,
"marc.zyngier@....com" <marc.zyngier@....com>,
"linux@...linux.org.uk" <linux@...linux.org.uk>,
"catalin.marinas@....com" <catalin.marinas@....com>,
"will.deacon@....com" <will.deacon@....com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>
Subject: Re: [PATCH RESEND v4 2/2] arm/arm64: KVM: Add
KVM_GET/SET_VCPU_EVENTS
>
> > >>>>> --- a/arch/arm/include/uapi/asm/kvm.h
> > >>>>> +++ b/arch/arm/include/uapi/asm/kvm.h
> > >>>>> @@ -124,6 +124,18 @@ struct kvm_sync_regs { struct
> > >>>>> kvm_arch_memory_slot { };
> > >>>>>
> > >>>>> +/* for KVM_GET/SET_VCPU_EVENTS */ struct kvm_vcpu_events {
> > >>>>> + struct {
> > >>>>> + __u8 serror_pending;
> > >>>>> + __u8 serror_has_esr;
> > >>>>> + /* Align it to 8 bytes */
> > >>>>> + __u8 pad[6];
> > >>>>> + __u64 serror_esr;
> > >>>>> + } exception;
> > >>>>> + __u32 reserved[12];
> > >>>>> +};
> > >>>>> +
> > >>>>
> > >>>> You haven't defined __KVM_HAVE_VCPU_EVENTS for 32bit, so
> > >>>> presumably this struct will never be used. Why is it here?
> > >>
> > >>> if not add it for 32 bits. the 32 arm platform will build Fail, whether you have good
> > >>> idea to avoid this Failure if not add this struct for the 32 bit?
> > >>
> > >> How does this 32bit code build without this patch?
> > >> If do you provide the struct, how will that code build with older headers?
> > >>
> > >> As far as I can see, this is what the __KVM_HAVE_VCPU_EVENTS define is for.
> > >>
> > >> This should be both, or neither. Having just the struct is useless.
> > > It because the caller of kvm_arm_vcpu_get/set_events() is in "virt/kvm/arm/arm.c".
> > > the virt/kvm/arm/arm.c will used by both arm64 and arm.
> > > so It needs to add kvm_arm_vcpu_get/set_events() for the 32 bits,
> > > however, kvm_arm_vcpu_get/set_events() will directly return,
> >
> > So you are adding a uapi struct that user-space can't actually use, to avoid a kernel build-error. Fine, it just looks really strange.
> >
> > 32bit user-space shouldn't try to call this as check-extension reports
> > it as not present. If it does, it gets -EINVAL back, which is also the default for kvm_arch_vcpu_ioctl().
Just think out a method to avoid adding the structure for the arm32.
Using below methods:
#Ifdef __KVM_HAVE_VCPU_EVENTS
xxxxxxxxxxxxxxxxxxxxx
#else
Xxxxxxxxxxxxxxxx
#endif
>
> It indeed looks strange. Because "virt/kvm/arm/arm.c" is shared by arm64 and arm32, if not adding, it will build-error. Do you have a better
> idea to avoid adding in arm32?
> I still not think out a good method. 32 user-space will not call this KVM_GET/SET_VCPU_EVENTS IOCTL as check-extension reports it as not
> present.
>
> >
> >
> > Thanks,
> >
> > James
Powered by blists - more mailing lists