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

Re: [PATCH v1 3/5] tools/ocaml/libs/xc: add hvm_param_get binding


  • To: Christian Lindig <christian.lindig@xxxxxxxxxx>
  • From: Edwin Torok <edvin.torok@xxxxxxxxxx>
  • Date: Thu, 1 Dec 2022 14:16:53 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=r3gpdYtysnz1aSDNjr62zKpdVXvwyrys4yV22BUop9E=; b=FybKyNLCZu41MaOGzrawmOqVKDc7eZYGtMqROivj+4x2NKOtGQrWhJEXenrF/yQkdi1wt350tPg6Zp83yPZT3Gzd+kyUzPDS3oNdsVEH0Q2ikv8Klu+siqrlW8hu2L4s8UOpm+OxyQsNGNTAFJ+d9qLMZsbcDDY8LONSZBZVczmS8BbX9owTrwrGQ2fR4W/7F8JxbfN+0QwhAeAhCbMmfl8uD7qBc6NtnkAwIe2pb3irhU5ZTwLM+RVeslSAwj9ikDFOakvp15kuI/R9a1CqNAd0ZIdS3SkFALCk7aJLIMfkxPicdr+1zq5F9lmY6J8wuik7SErnjkBpJGy2xhYV6g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QuSPedb8Gzk0sgw8sJwrEbdAGA0qROw9jnsPNkbE2SFTN93UbtqQHqr0i5a/ujhUuiEVVKkQx0jFSmz4lNNYbkSfmBrz5WOoA7QYmjRSFcGH6VtvZvZxQyQ9bVEYG9vw8NFcBOTLfNvLxPPE7qdmbIyg1adjVlxfufHXPGvWZujtnMsbcvASeCWOd2Bse9aLu/0AX2kM0sK8tq8cBnYACWAdZFnCLY0vjVkAac1UQoVd0xD6iWcZnTOXBHNeSrmJDE0H8g9PiC3E+9+Doblz0DH6XP892p5hylBpJRzEZoS/zvVFrfVVyxXIODrhY36y5Iyp+MtU9yLmCgG5C1iJ+A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, David Scott <dave@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Thu, 01 Dec 2022 14:17:26 +0000
  • Ironport-data: A9a23:buAcCajuLSDO7QSV3aO5Mv1TX161RxEKZh0ujC45NGQN5FlHY01je htvXT2BMqvcYjD1etwnb9+w90kHvZLQz9I3QAA//ywzHy4b9cadCdqndUqhZCn6wu8v7q5Ex 55HNoSfdpBcolv0/ErF3m3J9CEkvU2wbuOgTrWCYmUpH1QMpB4J0XpLg/Q+jpNjne+3CgaMv cKai8DEMRqu1iUc3lg8sspvkzsy+qWs0N8klgZmP6oS5geHzyN94K83fsldEVOpGuG4IcbiL wrz5OnR1n/U+R4rFuSknt7TGqHdauePVeQmoiM+t5mK2nCulARrukoIHKN0hXNsoyeIh7hMJ OBl7vRcf+uL0prkw4zxWzEAe8130DYvFLXveRBTuuTLp6HKnueFL1yDwyjaMKVBktubD12i+ tQ4A2gDUhqRrtuLzaykWudQhc49IuL0adZ3VnFIlVk1DN4AaLWaGuDmwIEd2z09wMdTAfzZe swVLyJ1awjNaAFOPVFRD48imOCvhT/0dDgwRFC9/PJrpTSMilEuluGya7I5efTTLSlRtkuUu GPAuXj+GBYZHNee1SCE4jSngeqncSbTCNxKSuTpr6YCbFu7300WUxsLD1WHp6eG11eABe90N 2Epw397xUQ13AnxJjXnZDWorXjBshMCVt54F+wh9BrL2qfS+xyeBGUPUnhGctNOnMM/WzECz FKCmNLtQzt1v9W9Vna15rqS6zSoNkAowXQqYCYFSU4J5oflqYRq1xbXFI88S+iyk8H/Hiz2z 3aSti8iir4PjMkNkaKm4VTAhDHqrZ/MJuIo2jjqsquexlsRTOaYi0aAszA3Md4owF6lc2S8
  • Ironport-hdrordr: A9a23:PLDTRK2bvtmzt8m1dCP9KgqjBLEkLtp133Aq2lEZdPU1SL36qy nKpp8mPHDP4gr5J0tQ/uxoVJPtfZqkz+8Q3WBzB9eftWvd1VdARbsKhbcLqVbbakjDH4hmup uIGJIeNDSfNzZHZauQ2njbL+od
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHZBOHXDfX2gYxBg0iCW8c7bxa9Ka5Y7MWAgAAhD4CAAAIsgIAABU4A
  • Thread-topic: [PATCH v1 3/5] tools/ocaml/libs/xc: add hvm_param_get binding


> On 1 Dec 2022, at 13:57, Christian Lindig <christian.lindig@xxxxxxxxxx> wrote:
> 
> 
> 
>> On 1 Dec 2022, at 13:50, Edwin Torok <edvin.torok@xxxxxxxxxx> wrote:
>> 
>> Should we instead switch to using ctypes to generate these constants?
> 
> I would not advocate this. Ctypes is the kind of meta programming that is 
> great when it works but hell if it does not and it adds more dependencies. 

Perhaps use it to just generate the constant mappings?
Here is an example of how I used it elsewhere:
https://github.com/xapi-project/ocaml-dlm/blob/master/lib_gen/types/bindings_structs.ml#L30-L55

> 
> I just had a discussion with Andrew about other tricks how to bring C 
> constants to the ML side in order to decouple them. I’m using it in my Polly 
> library - it might not be the solution for Xen but worth knowing.
> 
> https://github.com/lindig/polly/blob/master/lib/polly_stubs.c#L23-L39


The disadvantage is that we can't pattern match on it anymore.

Although we could have some OCaml code that does the pattern matching on 
another type and maps it to these private integer types.
However at that point we've manually reinvented what ctypes would already do, 
and we have an additional mapping step (which may not matter from a performance 
point of view but would be nice if we could avoid it).

I'll have to do some experiments to see how the code generated by ctypes looks 
like in this case (actually the 'cstubs' part of it), and how different it 
would be from manually writing it
(i.e. can we still reasonably review the generated code, and would it look like 
something that we'd write ourselves?)

Best regards,
--Edwin


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.