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

Re: [PATCH 1/2] xen/kernel.h: Import __struct_group from Linux


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Thu, 2 May 2024 06:23:17 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; 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=SkpJDoPJAcjhomrzoWJJ+nLmvfL+EmAyZtxfxalFIaw=; b=Jy0QAdhrQ8EgpwynJvy9FcUNPvR9ipMkmA9xuyfKs6KwyFTE6AUADNEIQ25IU3jgTGYiaM/nZG8JXxhvTixdUHD2nb6Vb2mdAuV2D7H/bgvpfuC4B05s+cqSOoUvOMbOerBvZ3dimJIF3F0JMn9CnXM0b4TS9hbdoAGK8mmEjyBmKSM7utiYW37lBo3CM4BX5GV4vLTJi5ri0M4HOuVMA6HVmzmUEeM70nEPzyD99nBalwtAuyXOeLNZ0B9BD5DfidVEqmNkrSgz0JCzpaEq0tRjHp7pgmiDONJyAQUcC9Lim+gxYFbmpoySaMB27ct+sahyG+qFpWjOpPwnlmqpeA==
  • 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=SkpJDoPJAcjhomrzoWJJ+nLmvfL+EmAyZtxfxalFIaw=; b=iXG0AFhmsVHdYMvHtD5HRUHpgYpVxeLeuYBEtKd4rfr3WVrxSxmBDE3D/PoL+GjY+B1GEAqWi6JGgoHlovpQ5IEPh9H6xbCSbQdK20qOxax/cDjJzfvdoh7OSwM2SGgRYIjH/THvTQ/H/8Um61R1k06rHec+W8R/224R7mGgj5FaZb5gr4Q41DuF/akjdxHl5YsQmjjod0fxJAleBzaE+9fTvKnLH9umNHCRGXyoh4hYXLzwa/cYiAbT76lpV8GzQP1X/7so+dTvLi9v2lUDNDWj4wYclidkih/DhLc1GpslSIZAOZAxhmGqfybzCZHx3Y5IXBg/F4Uixf/sYDcz3A==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=NqDlpHHP8KsA8rXOJGVnC6RA8Ly0X+SjEZDfaRT+XMA4SpVKatRiDq2U7QmkhoIRbbU2a6PvmZt6q+JKE/3HDW8T10a+z0HnQIBaKcIlZZjWtLQsIHTYTjg+iUN7a+sRef7OFOAYSGQkj+U2hWC54vlnxBH5jzcCn/ftPKbe7aDDWqfwuh8bF6fHxVD9W4tzl/wo40ztHgNp9DZO0+Drp4c6kDC4RkWjVSBM5xA1MAX4FPI0rmKIOBlASjjHoee0V088XTBwP5ysv7zSgHws0Nwqcw1Y5zuuWRZeoGs6u084A24bHm5BwMsFuONN25bjfg4PP2gB10cbUlld9NaY8g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JwFish/pbUS3o95l4Cv+rMmxrK61WBNv284CfykR4HRj50GKqx06NSq9719kzmCTBKbG/TPIYcUYOTNNmbuqG0d4nGPdQqwq+dOY1dffb9ePaLXdxFYj10mlbgBPdmkwXYzfXFbGkElsJbLovj9ZyFZVlx377vKkBEYdcxyYW/CLqzmLGVwkxZvtJUoS3zlDd/nJeNQoYHtjEu0/UIuAm1xcf2rl2LGrYNaSviav/wml9RoPn2b5o/Em0AAtbngkbA6IAusRGbRWSyRssz0xNMDCJifgY4knUUhIgylVvmxWnLbwLWgCOoQ7SkZvgPaFsv/8GUHXp71gm/dmpJTVTA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "consulting @ bugseng . com" <consulting@xxxxxxxxxxx>, Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 02 May 2024 06:23:37 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHamu7vn3o+gufgI0eDMZNP6vgeorGAsTwAgAFBl4CAAYX0AIAAA74A
  • Thread-topic: [PATCH 1/2] xen/kernel.h: Import __struct_group from Linux


> On 2 May 2024, at 07:09, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> On 01.05.2024 08:54, Luca Fancellu wrote:
>>> On 30 Apr 2024, at 12:43, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>> On 30.04.2024 13:09, Luca Fancellu wrote:
>>>> --- a/xen/include/xen/kernel.h
>>>> +++ b/xen/include/xen/kernel.h
>>>> @@ -54,6 +54,27 @@
>>>>        typeof_field(type, member) *__mptr = (ptr);             \
>>>>        (type *)( (char *)__mptr - offsetof(type,member) );})
>>>> 
>>>> +/**
>>>> + * __struct_group() - Create a mirrored named and anonyomous struct
>>>> + *
>>>> + * @TAG: The tag name for the named sub-struct (usually empty)
>>>> + * @NAME: The identifier name of the mirrored sub-struct
>>>> + * @ATTRS: Any struct attributes (usually empty)
>>>> + * @MEMBERS: The member declarations for the mirrored structs
>>>> + *
>>>> + * Used to create an anonymous union of two structs with identical layout
>>>> + * and size: one anonymous and one named. The former's members can be used
>>>> + * normally without sub-struct naming, and the latter can be used to
>>>> + * reason about the start, end, and size of the group of struct members.
>>>> + * The named struct can also be explicitly tagged for layer reuse, as well
>>>> + * as both having struct attributes appended.
>>>> + */
>>>> +#define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \
>>>> +    union { \
>>>> +        struct { MEMBERS } ATTRS; \
>>>> +        struct TAG { MEMBERS } ATTRS NAME; \
>>>> +    } ATTRS
>>> 
>>> Besides my hesitance towards having this construct, can you explain why
>>> ATTR needs using 3 times, i.e. also on the wrapping union?
>> 
>> The original commit didn’t have the third ATTRS, but afterwards it was 
>> introduced due to
>> this:
>> 
>> https://patchwork.kernel.org/project/linux-wireless/patch/20231120110607.98956-1-dmantipov@xxxxxxxxx/#25610045
> 
> Hmm. Since generally packing propagates to containing compound types, I'd
> say this cannot go without a code comment, or at the very least a mention
> in the description. But: Do we use this old ABI in Xen at all? IOW can we
> get away without this 3rd instance?

Yes, I think it won’t be a problem for Xen, is it something that can be done on 
commit?
Anyway in case of comments on the second patch, I’ll push the change also for 
this one.

Cheers,
Luca


 


Rackspace

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