[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <cfce9ad9-c518-44c7-a602-8ce7c3fffb2b@arm.com>
Date: Mon, 1 Dec 2025 13:55:34 +0000
From: Robin Murphy <robin.murphy@....com>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, Will Deacon <will@...nel.org>,
Daniel Almeida <daniel.almeida@...labora.com>,
Boris Brezillon <boris.brezillon@...labora.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>,
Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>,
Joerg Roedel <joro@...tes.org>, Lorenzo Stoakes
<lorenzo.stoakes@...cle.com>, "Liam R. Howlett" <Liam.Howlett@...cle.com>,
Asahi Lina <lina+kernel@...hilina.net>, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org, iommu@...ts.linux.dev, linux-mm@...ck.org
Subject: Re: [PATCH v3] io: add io_pgtable abstraction
On 2025-12-01 9:58 am, Alice Ryhl wrote:
[...]
>>> We need a different signature if it's possible to have mapped != 0 when
>>> returning an error.
>>
>> Aha, thanks for clarifying - indeed this is not the common "value or error"
>> case, it is two (almost) orthogonal return values. However if we're not
>> permitting callers to try to do anything clever with -EEXIST then it might
>> make sense to just embed the inevitable cleanup-on-failure boilerplate here
>> anyway (even if we still leave retry-on-partial-success to the caller).
>
> Is the only possible error -EEXIST? I could encode that in the API if
> that is the case.
No, I was just calling out -EEXIST as the only error where I imagine a
caller *might* want to continue without cleaning up a partial mapping,
if for instance they were playing clever tricks like a background
mapping of a large buffer while already allowing other threads to
eagerly demand-page bits of it, so the "main" mapping thread just
adjusts and restarts to skip over already-present pages. Other errors
are still possible, but generally represent terminal failure conditions
at the caller's level too - in practice things like -EINVAL and -ENOMEM
are likely to happen before any mappings can be made, but io-pgtable
doesn't guarantee any particular behaviour here, so a well-behaved
caller should still generally handle cleaning up after an error (at
least if they intend to keep trying to use the pagetable beyond that point).
Cheers,
Robin.
Powered by blists - more mailing lists