From: "Jan Beulich" Subject: Re: [PATCH v2 01/13] Export hypervisor symbols Date: Wed, 25 Sep 2013 15:53:43 +0100 Message-ID: <5243151702000078000F6567@nat28.tlf.novell.com> References: <1379670132-1748-1-git-send-email-boris.ostrovsky@oracle.com> <1379670132-1748-2-git-send-email-boris.ostrovsky@oracle.com> <5242FE2902000078000F63F9@nat28.tlf.novell.com> <5242ED2B.8060803@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VOqSy-000686-Jg for xen-devel@lists.xenproject.org; Wed, 25 Sep 2013 14:53:24 +0000 In-Reply-To: <5242ED2B.8060803@oracle.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Boris Ostrovsky Cc: suravee.suthikulpanit@amd.com, George.Dunlap@eu.citrix.com, jacob.shin@amd.com, eddie.dong@intel.com, dietmar.hahn@ts.fujitsu.com, jun.nakajima@intel.com, xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 25.09.13 at 16:03, Boris Ostrovsky wrote: > On 09/25/2013 09:15 AM, Jan Beulich wrote: >>>>> On 20.09.13 at 11:42, Boris Ostrovsky wrote: >>> + case XENPF_get_symbols: >>> + { >>> + ret = xensyms_read(&op->u.symdata); >>> + if ( ret >= 0 && __copy_field_to_guest(u_xenpf_op, op, u.symdata) ) >>> + ret = -EFAULT; >>> + } >>> + break; >> This yields a positive return value if a symbol was found, 0 if none >> was found, and negative on error. Can we avoid this non-standard >> first aspect? > > We need to know on the caller side when EOF is reached. There is no good > error code that I can see that would be appropriate here. ERANGE or ENFILE > are the closest I can imagine but EOF is not really an error so I am not > sure > this would be the right thing. > > We could look at first byte of the string and see where it's a 0 but > that's also > somewhat non-standard. Encoding type or address as an invalid token also > doesn't look nice. Why don't you simply have the hypercall increment the passed in symbol index. And if it didn't get incremented the called will know there was no data returned. >>> + >>> +struct xenpf_symdata { >>> + /* IN variables */ >>> + uint64_t xen_symnum; >>> + >>> + /* OUT variables */ >>> + uint64_t address; >>> + uint64_t type; >> "type" and "xen_symnum" could easily be less than 64 bits wide. > > I am trying to avoid 32-bit compatibility issues here. You will see > sometimes > unnecessary uint64_t in other structures well for the same reason. I'd encourage you to avoid that, and use padding fields instead. Jan