[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: Jan Beulich <jbeulich@xxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 27 Feb 2023 14:17:02 +0000
  • 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=ueNVcfBc8YyM5ix0ulceWEu3ffLjDMdmh/rKYiuR8Qo=; b=C6yoCAZE5LOeS7EAO44AxS1X0GxW22sAKBd6Fzx2OnmJRQRW8dB1lT23IiW11zMUA36mHWuVs6QZ3eHcnVje1bDkY3VqJ1Zz0tcPNaWJqwZEpHlmXeUZPq43tKsONz7k93FzLU89wlY2rIf3IXeNWmuxo7QjHT+RTPryQFlHntG0/DRbCLi5+pK0Q62wQiRhx2wUUgxkCsDoIZLtZ2g02Q5XyUyRN+ss10lvZ1nVZJhIUuwscJxpp4zCEe+tXBx4xWlfVDDeZauUepn/rt5iXT7D0bjMDCMR453a1lqg9igjb0x+xprlKk9rQVDID/vwOn0O5whQkrK7aY3xy6b8GA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ik2WYiAo8gD+Bcs+j0ef38uU4N7HXr9K3n9mrUsrGbpkkT1BxzWyNE1mS+UK7SMjAnL/HSddW769YxngJf1D+0M2sz4dBUMKqDS1Xka2MpgbOWfwi2YhpkcyJwCULeTrxXDQxQbBynEhcGoLjjnX8Jl8hbj70Y6xYcrdF8LhhMnroWSgApSZTA7py1p/fOi1CH/45n6fdUNTNPKmMd6brr2tbVttNy1OJS9CwROg7DBWLZUfcohXY8kk6gnCwu0qloNOkqdVCpjjZ7hhIJdeq1OzLmhBme2O5/4XOLaprHA/WPXxEU5gGVFUjg5pNIuHoQBrJml2taGKy2QNesz6pw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.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:17:29 +0000
  • Ironport-data: A9a23:6nlmP67X7Tu+DjEsEOguowxRtAXGchMFZxGqfqrLsTDasY5as4F+v jYWWWGFbvnZNzOkKNpwbIrl8xlUuZ/WytRhTlQ6qX1nHi5G8cbLO4+Ufxz6V8+wwm8vb2o8t plDNYOQRCwQZiWBzvt4GuG59RGQ7YnRGvynTraCYnsrLeNdYH9JoQp5nOIkiZJfj9G8Agec0 fv/uMSaM1K+s9JOGjt8B5mr9VU+7JwehBtC5gZlPaoR4weE/5UoJMl3yZ+ZfiOQrrZ8RoZWd 86bpJml82XQ+QsaC9/Nut4XpWVTH9Y+lSDX4pZnc/DKbipq/0Te4Y5iXBYoUm9Fii3hojxE4 I4lWapc6+seFvakdOw1C3G0GszlVEFM0OevzXOX6aR/w6BaGpdFLjoH4EweZOUlFuhL7W5m7 rsfKQ4QSRu/msmyyayjYLQvh/5gM5y+VG8fkikIITDxK98DGcqGaYOToNhS0XE3m9xEGuvYa 4wBcz1zYR/cYhpJfFAKFJY5m+TujX76G9FagAvN+exrvC6OlUotitABM/KMEjCObexTklyVu STt+GPhDwtBHNee1SCE4jSngeqncSbTAdpLTeTgp6E26LGV7i8eGEY/cH64ndfjjg2lcupzL U8w4hN7+MDe82TuFLERRSaQonSJoxodUNp4CPAh5UeGza+8ywSWHG8fVRZadccr8sQxQ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: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27/02/2023 2:12 pm, Jan Beulich wrote:
> 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 still don't see how that would matter.  The bitness would always be
consistent inside a single translation.

>
>> 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.

That's a reasonable restriction IMO.  Again, I don't see how we'd ever
come to violate that in the future, given the current use here.

~Andrew



 


Rackspace

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