[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <7299839b-06e6-40eb-8024-93ed5f9b733f@app.fastmail.com>
Date: Mon, 19 Feb 2024 10:57:46 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Kent Overstreet" <kent.overstreet@...ux.dev>,
"Russell King" <linux@...linux.org.uk>
Cc: "Calvin Owens" <jcalvinowens@...il.com>,
"Dave Martin" <Dave.Martin@....com>, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
"linux-bcachefs@...r.kernel.org" <linux-bcachefs@...r.kernel.org>
Subject: Re: [PATCH] arm: Silence gcc warnings about arch ABI drift
On Mon, Feb 19, 2024, at 10:40, Kent Overstreet wrote:
> On Mon, Feb 19, 2024 at 09:26:51AM +0000, Russell King (Oracle) wrote:
>> On Mon, Feb 19, 2024 at 07:21:11AM +0100, Arnd Bergmann wrote:
>>
>> +1 - bcachefs definitely needs fixing. Passing all that as an argument
>> not only means that it has to be read into registers, but also when
>> accessing members, it has to be extracted from those registers as well.
>>
>> Passing that by argument is utterly insane.
>
> If the compiler people can't figure out a vaguely efficient way to pass
> a small struct by value, that's their problem - from the way you
> describe it, I have to wonder at what insanity is going on there.
On most ABIs, there are only six argument registers (24 bytes)
for function calls. The compiler has very little choice here if
it tries to pass 32 bytes worth of data.
On both x86_64 and arm64, there are theoretically enough
registers to pass the data, but kernel disallows using the
vector and floating point registers for passing large
compounds arguments.
The integer registers on x86 apparently allow passing compounds
up to 16 bytes, but only if all members are naturally aligned.
Since you have both __packed members and bitfields, the compiler
would not even be allowed to pass the structure efficiently
even if it was small enough.
Arnd
Powered by blists - more mailing lists