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

Re: [PATCH 3/3] tools: add offsetof() to xen-tools/libs.h


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 27 Feb 2023 15:12:36 +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=WQ91IXZhrrx8D3X41KN6MM1VzZYrwKvYfNIp7BnIAt0=; b=Ewf1qV8EL5hkH/Illq4y8AuW9StEH+pUEPFjWPFs4bvUuwX1TQGZFtCO2NbwcC4jqsy5+Xsaa0+3ZiFFj4f0yMNtgLe+Z/p6MyNxPPWvPxW7/UtacpcYejizUYt0r33AO0N/xRK9nZvwTPZMXszyzbAUCpZfztkhEeVPPltl2Xa0HtVnSrrJ6uBYuTWDqOOQhexQGrgPktXqTcjYPTqJG+Vp2B+XvSu41UITjH8A0Llk4eYxGabsnS992iI4vwGj1wEzjEDoR6kJk/N2bIESyWXgAm8S5Xk6+ghxDF4YAdcKSDgYW0JP5qJECkjmvDa+8IXcYOYYhp/4XpLDhd1V0w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vg9npoC7ScTv/fZCCxnHmB5YgU+nK+JS1kmCVBiUl96+L0L798vdy9uVO2umSuwLp9AZhf4P3aoxpTkl4525D8Y06ItOGuM7AXS07vAhsEAj3r3wZmQuqmvJcSUah30gBu0sL2QtI0UZIVbq8OhqEyMzTkAi3L1drEm93cHxXSzLpqHcvq+HInNPDaPaGobCfj+i+DUSvhmRIyajXa9Zo9/FMB1LcCxGD/2f788n3aebXtIp/mWfEHd82VOKc3AoVJjEb40foWjNxrFGqNzH+ClJ5gEnanxkN9l6T3CLXZcliEeRfy9ehcFk2BUJE9QPg8tJNdxXxpIsS0Y0qJ6/4A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 27 Feb 2023 14:12:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27.02.2023 15:06, Andrew Cooper wrote:
> On 27/02/2023 12:43 pm, Jan Beulich wrote:
>> On 27.02.2023 13:34, Juergen Gross wrote:
>>> On 27.02.23 13:31, Jan Beulich wrote:
>>>> On 27.02.2023 13:09, Juergen Gross wrote:
>>>>> --- a/tools/firmware/hvmloader/util.h
>>>>> +++ b/tools/firmware/hvmloader/util.h
>>>>> @@ -30,9 +30,6 @@ enum {
>>>>>   #define SEL_DATA32          0x0020
>>>>>   #define SEL_CODE64          0x0028
>>>>>   
>>>>> -#undef offsetof
>>>>> -#define offsetof(t, m) ((unsigned long)&((t *)0)->m)
>>>>> -
>>>>>   #undef NULL
>>>>>   #define NULL ((void*)0)
>>>>>   
>>>>> diff --git a/tools/firmware/include/stddef.h 
>>>>> b/tools/firmware/include/stddef.h
>>>>> index c7f974608a..926ae12fa5 100644
>>>>> --- a/tools/firmware/include/stddef.h
>>>>> +++ b/tools/firmware/include/stddef.h
>>>>> @@ -1,10 +1,10 @@
>>>>>   #ifndef _STDDEF_H_
>>>>>   #define _STDDEF_H_
>>>>>   
>>>>> +#include <xen-tools/libs.h>
>>>> I'm not convinced firmware/ files can validly include this header.
>>> This file only contains macros which don't call any external functions.
>>>
>>> Would you be fine with me adding a related comment to it?
>> If it was to be usable like this, that would be a prereq, but personally
>> I don't view this as sufficient. The environment code runs in that lives
>> under firmware/ is simply different (hvmloader, for example, is 32-bit
>> no matter that the toolstack would normally be 64-bit), so to me it
>> feels like setting up a trap for ourselves. If Andrew or Roger are fully
>> convinced this is a good move, I won't be standing in the way ...
> 
> We still support 32bit builds of the toolstack on multiple
> architectures, so I don't see bitness as an argument against.

Bitness by itself wasn't the argument. Mixed bitness is what concerns
me.

> I am slightly uneasy adding a header like this, but it really is only
> common macros and I don't see how it could possibly change from that
> given the existing uses.  OTOH, removing things like the problematic
> definition of offsetof() is an improvement.
> 
> I'd probably tentatively ack this patch, seeing as it is a minor
> improvlement, but I think there's a middle option too.  Rename libs.h to
> macros.h or common-macros.h?  IMO that would be something that's far
> more obviously safe to include into firmware/, and something rather more
> descriptive at all of its include sites.
> 
> Thoughts?

Maybe. One fundamental requirement would need to be made prominently
visible in such a header: It has to be entirely self-contained, i.e.
it may in particular not gain any dependencies on configure's output.

Jan



 


Rackspace

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