Re: [PATCH v10 04/19] KVM: s390: pv: refactor s390_reset_acc

From: Claudio Imbrenda
Date: Mon May 16 2022 - 12:11:48 EST


On Mon, 16 May 2022 10:04:54 +0200
Nico Boehr <nrb@xxxxxxxxxxxxx> wrote:

> On Thu, 2022-04-14 at 10:02 +0200, Claudio Imbrenda wrote:
> > Refactor s390_reset_acc so that it can be reused in upcoming patches.
> >
> > We don't want to hold all the locks used in a walk_page_range for too
> > long, and the destroy page UVC does take some time to complete.
> > Therefore we quickly gather the pages to destroy, and then destroy
> > them
> > without holding all the locks.
> >
> > The new refactored function optionally allows to return early without
> > completing if a fatal signal is pending (and return and appropriate
> > error code). Two wrappers are provided to call the new function.
> >
> > Signed-off-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>
> > Reviewed-by: Janosch Frank <frankja@xxxxxxxxxxxxx>
>
> Reviewed-by: Nico Boehr <nrb@xxxxxxxxxxxxx>
>
> But see below with one naming suggestion you might want to take into
> account.
>
> [...]
> > diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
> > index e8904cb9dc38..a3a1f90f6ec1 100644
> > --- a/arch/s390/mm/gmap.c
> > +++ b/arch/s390/mm/gmap.c
> > @@ -2676,44 +2676,81 @@ void s390_reset_cmma(struct mm_struct *mm)
> >  }
> >  EXPORT_SYMBOL_GPL(s390_reset_cmma);
> >  
> > -/*
> > - * make inaccessible pages accessible again
> > - */
> > -static int __s390_reset_acc(pte_t *ptep, unsigned long addr,
> > -                           unsigned long next, struct mm_walk *walk)
> > +#define DESTROY_LOOP_THRESHOLD 32
>
> maybe GATHER_NUM_PAGE_REFS_TO_TAKE?

what about GATHER_GET_PAGES ?