[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] xen/mm: Remove claim that INVALID_{MFN,GFN}_INITIALIZER is for older toolchains
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- Date: Wed, 25 Feb 2026 16:35:47 +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=arcselector10001; 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=SPJVgF7rbAxnethkzzJ4tlojtoPfMuwx9dLhByowQZU=; b=OErAdCDT6+lG/gaiMOdPukdzIw2KU/J8r0k0MZYG9c+jYDb+/Zzln+DBaS305pZbLuvaBaRhE/JsW6I57ZZ1Kts6teuX4Kbp/kJ2Ue36iMv8Z9FnpJboicrZxOWjjzGxovICjZdf8on0av4NhubkcqnVvdP7I5YIYBjBvWZsK8WKiu4qQSP55Z5Q2oIdphSdS4FzKcOneHK2LKD4e16/nSHMyRRS4C+UikC4uuZVy1NQGr/G91Af+7HWFwlo8AMClQOYF7W3rL4h6PO47cJGsS7isqBkOf7itxH8ly6fmw/DldOBk9PwevnRwIFiZjRd1rI/tiwexqL9ODRzDsN2Ig==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=intaMP0SKUklSmhmeZghzwnwDD55hihskJiJezk9JSMdQMZZTTv1NnXAUGnaB0vR0CtrU+drEOE1nHSc2HaRyliF18UI16MKIfkxnr7/1oHGhkzEuyV/YiKDda1lnTRhdJzbpQOFLKiquTqxdqrrxJ4vhJeL2+EXp1t29R4bpavtmmsRDje+8k+FgW+d988RtoqOl8s9aV7yL1O/ajm0HOHMv3SzpBTciU7y70q4c4BTUtzOvPtSA+cbBD1mq5INQ/dootpwe0ePYLSCOEF2xgFIrzH6fY4x9B3JbqtQdt/qqyqlbF0O3jop5WIcsb7a6Tzyt4uDIWOE8iWmEAnABw==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Wed, 25 Feb 2026 16:36:01 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 25/02/2026 2:34 pm, Jan Beulich wrote:
> On 25.02.2026 13:59, Andrew Cooper wrote:
>> This was never because of a bug in GCC.
>>
>> C requires that static objects are initialised with constant expressions;
>> _mfn(), as a static inline, is not and cannot be made to be.
> Of course, and I think the comments were meant differently. What wasn't
> possible
> to use (with -std=gnu99) due to the referenced bug is apparently
>
> #define INVALID_GFN ((gfn_t){ ~0UL })
>
> Now that gcc5 is our baseline, do we perhaps want to use that and do away with
> INVALID_GFN_INITIALIZER?
Oh. Yeah that's very much not what the comment suggested.
Changing like that almost works, but there's one snag. common/memory.c has
BUILD_BUG_ON(INVALID_GFN_RAW + 1);
and with the _RAW constant wanting to go, the obvious:
BUILD_BUG_ON(gfn_x(INVALID_GFN) + 1);
doesn't compile as it's no longer a constant expression.
It's not clear what to do here. I don't think we want to keep
INVALID_GFN_RAW around for just this, but nor am I completely happy
dropping the BUILD_BUG_ON() either.
Thoughts?
~Andrew
|