From: Roman Kagan Subject: Re: [PATCH 2/2] x86:kvm:hyperv: guest->host event signaling via eventfd Date: Wed, 6 Dec 2017 19:37:05 +0300 Message-ID: <20171206163704.GG2265@rkaganb.sw.ru> References: <20171204190044.14125-1-rkagan@virtuozzo.com> <20171204190044.14125-3-rkagan@virtuozzo.com> <20171206152833.GK28074@char.us.oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , "Denis V. Lunev" To: Konrad Rzeszutek Wilk Return-path: Received: from mail-he1eur01hn0243.outbound.protection.outlook.com ([104.47.0.243]:45388 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751946AbdLFQhT (ORCPT ); Wed, 6 Dec 2017 11:37:19 -0500 Content-Disposition: inline In-Reply-To: <20171206152833.GK28074@char.us.oracle.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Dec 06, 2017 at 10:28:33AM -0500, Konrad Rzeszutek Wilk wrote: > .snip.. > > +static u16 hvcall_sigevent_param(struct kvm_vcpu *vcpu, gpa_t gpa, u32 *conn_id) > > +{ > > + struct page *page; > > + void *pg; > > + struct hv_input_signal_event *msg; > > + > > + if ((gpa & (__alignof__(*msg) - 1)) || > > + offset_in_page(gpa) + sizeof(*msg) > PAGE_SIZE) > > + return HV_STATUS_INVALID_ALIGNMENT; > > + > > + page = kvm_vcpu_gfn_to_page(vcpu, gpa >> PAGE_SHIFT); > > + if (is_error_page(page)) > > + return HV_STATUS_INSUFFICIENT_MEMORY; > > + > > + pg = kmap_atomic(page); > > + msg = pg + offset_in_page(gpa); > > + *conn_id = msg->connectionid.u.id + msg->flag_number; > > Here it is u32.. > > > + kunmap_atomic(pg); > > + return HV_STATUS_SUCCESS; > > +} > > + > .. snip.. > > > +static int kvm_hv_eventfd_assign(struct kvm *kvm, int conn_id, int fd) > > It is uint32 in the hypercall, but here you are making it an 'int'. > > Is that intentional? Or could it be the same type? Yes it should have been u32 everywhere. Thanks for spotting! (The actual values allowed there are 24bit wide, nonetheless different types are confusing indeed so I'd better make them consistent.) Thanks, Roman.