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

Re: [PATCH v4 1/4] xen/riscv: introduce asm/types.h header file


  • To: Oleksii <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 17 Jan 2023 11:04:33 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=DOYL/pwjgxYdBPQJ9GXZrtMBPjHT5XydBbCvvp9E1TA=; b=P4RFG9YLTTT7rKFxCz85Ydwbxt1RUUikk/X+DKbo+Eu7xVl8VPp0IWi/ljf1NRc671shDD82w52U+f65HBrljkzhSl4MIupl2K4LUbEVDQeXMjoIPX+ZSYiD7zPTzhmhIVdcOOhdC/OuT6kpJbWgE3hqnIbVHmM3t5geIbEFm3LGt6GGhPBt6Pkq5zXJcMYvADBocMpPcmbseok6bMwYvrnSX9jGJz8So4vbgZp1hNtzpMk8hCV9Sb9vCsQdF5DF3UY00EnzuOYUctFUX4q8WPz3hKaflb331mWGeqKYu4zL5/xEeMk2yAkfokRNIXz0beWwkDjBAdrM3oDEe6nSEg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=avxZnmcHN59KSNDwIO1cIZV5JUiJl6lkHNYrq3r6xCOz949gh8CWAshmAuWXxvWHKGr7EzelAPJZw2dN1igVmfmam7McCtuAvANJtnUyliSwUzn29w8oPupvnyERaJPRqAvbX9Jxm7tYAkHziKaAhCijxQNdn4V5Q1d2YfCBTZdD+m3Ct5/ikMFs1XHBcwkgHsijBJ/uvk5XUpyWBfEaZ4hhF/skApipXcuM30nzrfiMR0bYggc62hPndwDvYiH3gNMGaQi0hAvdbavSihE5vMp56Zn4GJm0L1bootyF69WwyaxLTjtYeklNqPqmB5VpjmvVUjAewa45Vsdro3nVRA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Julien Grall <julien@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Gianluca Guida <gianluca@xxxxxxxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 17 Jan 2023 10:04:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 17.01.2023 10:29, Oleksii wrote:
> On Mon, 2023-01-16 at 15:59 +0100, Jan Beulich wrote:
>> On 16.01.2023 15:39, Oleksii Kurochko wrote:
>>> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
>>> ---
>>> Changes in V4:
>>>     - Clean up types in <asm/types.h> and remain only necessary.
>>>       The following types was removed as they are defined in
>>> <xen/types.h>:
>>>       {__|}{u|s}{8|16|32|64}
>>
>> For one you still typedef u32 and u64. And imo correctly so, until we
>> get around to move the definition basic types into xen/types.h. Plus
>> I can't see how things build for you: xen/types.h expects __{u,s}<N>
> It builds because nothing is used <xen/types.h> now so that's why I
> missed them but you are right __{u,s}<N> should be backed.
> It looks like {__,}{u,s}{8,16,32} are the same for all available in Xen
> architectures so probably can I move them to <xen/types.h> instead of
> remain them in <asm/types.h>?

This next step isn't quite as obvious, i.e. has room for being
contentious. In particular deriving fixed width types from C basic
types is setting us up for future problems (especially in the
context of RISC-V think of RV128). Therefore, if we touch and
generalize this, I'd like to sanitize things at the same time.

I'd then prefer to typedef {u,}int<N>_t by using either the "mode"
attribute (requiring us to settle on a prereq of there always being
8 bits per char) or the compiler supplied __{U,}INT<N>_TYPE__
(taking gcc 4.7 as a prereq; didn't check clang yet). Both would
allow {u,}int64_t to also be put in the common header. Yet if e.g.
a prereq assumption faced opposition, some other approach would
need to be found. Plus using either of the named approaches has
issues with the printf() format specifiers, for which I'm yet to
figure out a solution (or maybe someone else knows a good way to
deal with that; using compiler provided headers isn't an option
afaict, as gcc provides stdint.h but not inttypes.h, but maybe
glibc's simplistic approach is good enough - they're targeting
far more architectures than we do and get away with that).

Jan



 


Rackspace

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