Re: [PATCHv8 00/11] Linear Address Masking enabling

From: Kirill A. Shutemov
Date: Wed Sep 14 2022 - 11:45:46 EST


On Wed, Sep 14, 2022 at 08:31:56AM -0700, Ashok Raj wrote:
> On Wed, Sep 14, 2022 at 06:18:18PM +0300, Kirill A. Shutemov wrote:
> > > > > >
> > > > > > The patch below implements something like this. It is PoC, build-tested only.
> > > > > >
> > > > > > To be honest, I hate it. It is clearly a layering violation. It feels
> > > > > > dirty. But I don't see any better way as we tie orthogonal features
> > > > > > together.
> > > > > >
> > > > > > Also I have no idea how to make forced PASID allocation if LAM enabled.
> > > > > > What the API has to look like?
> > > > >
> > > > > Jacob, Ashok, any comment on this part?
> > > > >
> > > > > I expect in many cases LAM will be enabled very early (like before malloc
> > > > > is functinal) in process start and it makes PASID allocation always fail.
> > > > >
> > > > > Any way out?
> > > >
> > > > We need closure on this to proceed. Any clue?
> > >
> > > Failing PASID allocation seems like the right thing to do here. If the
> > > application is explicitly allocating PASID's it can opt-out using the
> > > similar mechanism you have for LAM enabling. So user takes
> > > responsibility for sanitizing pointers.
> > >
> > > If some library is using an accelerator without application knowledge,
> > > that would use the failure as a mechanism to use an alternate path if
> > > one exists.
> > >
> > > I don't know if both LAM and SVM need a separate forced opt-in (or i
> > > don't have an opinion rather). Is this what you were asking?
> > >
> > > + Joerg, JasonG in case they have an opinion.
> >
> > My point is that the patch provides a way to override LAM vs. PASID mutual
> > exclusion, but only if PASID allocated first. If we enabled LAM before
> > PASID is allcoated there's no way to forcefully allocate PASID, bypassing
> > LAM check. I think there should be one, no?
>
> Yes, we should have one for force enabling SVM too if the application
> asks for forgiveness.

What is the right API here?

--
Kiryl Shutsemau / Kirill A. Shutemov