Re: [PATCH v3] io: add io_pgtable abstraction
From: Boris Brezillon
Date: Wed Nov 19 2025 - 03:59:46 EST
On Mon, 17 Nov 2025 16:34:06 +0000
Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
> On Wed, Nov 12, 2025 at 09:57:09AM -0300, Daniel Almeida wrote:
> > Hi Alice,
> >
> > > On 12 Nov 2025, at 07:15, Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
> > > + /// Map a physically contiguous range of pages of the same size.
> > > + ///
> > > + /// # Safety
> > > + ///
> > > + /// * This page table must not contain any mapping that overlaps with the mapping created by
> > > + /// this call.
> >
> > I don't think there is a restriction that forbids you from mapping a region that has already been mapped.
> >
> > If A->B->C are adjacent regions, and you try to map A -> C when B->C is already mapped, I think this
> > call will simply return length(A->B).
>
> I think that such overlapping ranges are not allowed. It triggers a
> warn:
>
> } else if (pte) {
> /* We require an unmap first */
> WARN_ON(!(cfg->quirks & IO_PGTABLE_QUIRK_NO_WARN));
> return -EEXIST;
I confirm the io_pgtable framework (or at least some of its
implementations) doesn't allow you to do that (remap without an
explicit unmap coming first).