linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v12 0/6] implement getrandom() in vDSO
       [not found] <20221212185347.1286824-1-Jason@zx2c4.com>
@ 2022-12-20 17:17 ` Christophe Leroy
  2022-12-20 20:13   ` Eric Biggers
  2022-12-21 14:04   ` Jason A. Donenfeld
  0 siblings, 2 replies; 5+ messages in thread
From: Christophe Leroy @ 2022-12-20 17:17 UTC (permalink / raw)
  To: Jason A. Donenfeld, linux-kernel@vger.kernel.org,
	patches@lists.linux.dev, tglx@linutronix.de
  Cc: Florian Weimer, Christian Brauner, Arnd Bergmann, Jann Horn,
	Carlos O'Donell, linux-api@vger.kernel.org, x86@kernel.org,
	linux-crypto@vger.kernel.org, Adhemerval Zanella Netto,
	Greg Kroah-Hartman, linuxppc-dev@lists.ozlabs.org

Hi Jason,

Le 12/12/2022 à 19:53, Jason A. Donenfeld a écrit :
> Changes v11->v12:
> ----------------
> - In order to avoid mlock()ing pages, and the related rlimit and fork
>    inheritance issues there, Introduce VM_DROPPABLE to prevent swapping
>    while meeting the cache-like requirements of vDSO getrandom().
> 
>    This has some tenticles in mm/ and arch/x86/ code, so I've marked the
>    two patches for that as still RFC, while the rest of the series is not
>    RFC.
> 
> - Mandate that opaque state blobs don't straddle page boundaries, so
>    that VM_DROPPABLE can work on page-level granularity rather than
>    allocation-level granularity.
> 
> - Add compiler barriers to vDSO getrandom() to prevent theoretical
>    reordering potential.
> 
> - Initialize the trials loop counter in the chacha test.

I would have liked to give it a try on powerpc, but the series 
conflicts. I tried both on v6.1 and on linus/master from now:

--------------------------------------------------------------------------

$ LANG= git reset --hard linus/master
HEAD is now at b6bb9676f216 Merge tag 'm68knommu-for-v6.2' of 
git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu

$ LANG= git am -3 ~/Téléchargements/implement-getrandom-in-vDSO.patch
Applying: mm: add VM_DROPPABLE for designating always lazily freeable 
mappings
Using index info to reconstruct a base tree...
M	fs/proc/task_mmu.c
M	include/linux/mm.h
M	include/trace/events/mmflags.h
M	mm/Kconfig
M	mm/memory.c
M	mm/mprotect.c
M	mm/rmap.c
Falling back to patching base and 3-way merge...
Auto-merging mm/rmap.c
CONFLICT (content): Merge conflict in mm/rmap.c
Auto-merging mm/mprotect.c
Auto-merging mm/memory.c
Auto-merging mm/Kconfig
Auto-merging include/trace/events/mmflags.h
Auto-merging include/linux/mm.h
Auto-merging fs/proc/task_mmu.c
error: Failed to merge in the changes.
Patch failed at 0001 mm: add VM_DROPPABLE for designating always lazily 
freeable mappings
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
[chleroy@PO20335 linux-powerpc]$ git diff
diff --cc mm/rmap.c
index b616870a09be,9fabd7affd3a..000000000000
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@@ -1291,16 -1256,13 +1291,22 @@@ void page_add_anon_rmap(struct page *pa
   void page_add_new_anon_rmap(struct page *page,
         struct vm_area_struct *vma, unsigned long address)
   {
  -      const bool compound = PageCompound(page);
  -      int nr = compound ? thp_nr_pages(page) : 1;
  +      int nr;

         VM_BUG_ON_VMA(address < vma->vm_start || address >= 
vma->vm_end, vma);
++<<<<<<< HEAD
  +      __SetPageSwapBacked(page);
  +
  +      if (likely(!PageCompound(page))) {
  +              /* increment count (starts at -1) */
  +              atomic_set(&page->_mapcount, 0);
  +              nr = 1;
  +      } else {
++=======
+       if (!(vma->vm_flags & VM_DROPPABLE))
+               __SetPageSwapBacked(page);
+       if (compound) {
++>>>>>>> mm: add VM_DROPPABLE for designating always lazily freeable 
mappings
                 VM_BUG_ON_PAGE(!PageTransHuge(page), page);
                 /* increment count (starts at -1) */
                 atomic_set(compound_mapcount_ptr(page), 0);

----------------------------------------------------------------------

$ LANG= git reset --hard v6.1
Updating files: 100% (12634/12634), done.
HEAD is now at 830b3c68c1fb Linux 6.1

$ LANG= git am -3 ~/Téléchargements/implement-getrandom-in-vDSO.patch
Applying: mm: add VM_DROPPABLE for designating always lazily freeable 
mappings
Applying: x86: mm: Skip faulting instruction for VM_DROPPABLE faults
Applying: random: add vgetrandom_alloc() syscall
Using index info to reconstruct a base tree...
M	MAINTAINERS
M	drivers/char/random.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/char/random.c
Auto-merging MAINTAINERS
Applying: arch: allocate vgetrandom_alloc() syscall number
Applying: random: introduce generic vDSO getrandom() implementation
Using index info to reconstruct a base tree...
M	MAINTAINERS
M	drivers/char/random.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/char/random.c
CONFLICT (content): Merge conflict in drivers/char/random.c
Auto-merging MAINTAINERS
error: Failed to merge in the changes.
Patch failed at 0005 random: introduce generic vDSO getrandom() 
implementation
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

-----------------------------------------------------------------------

Christophe

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v12 0/6] implement getrandom() in vDSO
  2022-12-20 17:17 ` [PATCH v12 0/6] implement getrandom() in vDSO Christophe Leroy
@ 2022-12-20 20:13   ` Eric Biggers
  2022-12-21 14:25     ` Jason A. Donenfeld
  2022-12-21 14:04   ` Jason A. Donenfeld
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Biggers @ 2022-12-20 20:13 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Florian Weimer, Jason A. Donenfeld, Arnd Bergmann, Jann Horn,
	Carlos O'Donell, linux-api@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org, patches@lists.linux.dev,
	linux-crypto@vger.kernel.org, Adhemerval Zanella Netto,
	Greg Kroah-Hartman, Christian Brauner, tglx@linutronix.de,
	linuxppc-dev@lists.ozlabs.org

On Tue, Dec 20, 2022 at 05:17:52PM +0000, Christophe Leroy wrote:
> Hi Jason,
> 
> Le 12/12/2022 à 19:53, Jason A. Donenfeld a écrit :
> > Changes v11->v12:
> > ----------------
> > - In order to avoid mlock()ing pages, and the related rlimit and fork
> >    inheritance issues there, Introduce VM_DROPPABLE to prevent swapping
> >    while meeting the cache-like requirements of vDSO getrandom().
> > 
> >    This has some tenticles in mm/ and arch/x86/ code, so I've marked the
> >    two patches for that as still RFC, while the rest of the series is not
> >    RFC.
> > 
> > - Mandate that opaque state blobs don't straddle page boundaries, so
> >    that VM_DROPPABLE can work on page-level granularity rather than
> >    allocation-level granularity.
> > 
> > - Add compiler barriers to vDSO getrandom() to prevent theoretical
> >    reordering potential.
> > 
> > - Initialize the trials loop counter in the chacha test.
> 
> I would have liked to give it a try on powerpc, but the series 
> conflicts. I tried both on v6.1 and on linus/master from now:
> 

Same here, I can't figure out how to apply this series.

It would help if people always used the --base option to git format-patch...

- Eric

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v12 0/6] implement getrandom() in vDSO
  2022-12-20 17:17 ` [PATCH v12 0/6] implement getrandom() in vDSO Christophe Leroy
  2022-12-20 20:13   ` Eric Biggers
@ 2022-12-21 14:04   ` Jason A. Donenfeld
  1 sibling, 0 replies; 5+ messages in thread
From: Jason A. Donenfeld @ 2022-12-21 14:04 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Florian Weimer, Christian Brauner, Arnd Bergmann, Jann Horn,
	Carlos O'Donell, linux-api@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org, patches@lists.linux.dev,
	linux-crypto@vger.kernel.org, Adhemerval Zanella Netto,
	Greg Kroah-Hartman, tglx@linutronix.de,
	linuxppc-dev@lists.ozlabs.org

On Tue, Dec 20, 2022 at 05:17:52PM +0000, Christophe Leroy wrote:
> I would have liked to give it a try on powerpc, but the series 
> conflicts. I tried both on v6.1 and on linus/master from now:

I'll send a rebased v+1 shortly.

Jason

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v12 0/6] implement getrandom() in vDSO
  2022-12-20 20:13   ` Eric Biggers
@ 2022-12-21 14:25     ` Jason A. Donenfeld
  2022-12-21 20:48       ` Eric Biggers
  0 siblings, 1 reply; 5+ messages in thread
From: Jason A. Donenfeld @ 2022-12-21 14:25 UTC (permalink / raw)
  To: Eric Biggers
  Cc: Florian Weimer, Christian Brauner, Arnd Bergmann, Jann Horn,
	Carlos O'Donell, linux-api@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org, patches@lists.linux.dev,
	linux-crypto@vger.kernel.org, Adhemerval Zanella Netto,
	Greg Kroah-Hartman, tglx@linutronix.de,
	linuxppc-dev@lists.ozlabs.org

On Tue, Dec 20, 2022 at 08:13:14PM +0000, Eric Biggers wrote:
> On Tue, Dec 20, 2022 at 05:17:52PM +0000, Christophe Leroy wrote:
> > Hi Jason,
> > 
> > Le 12/12/2022 à 19:53, Jason A. Donenfeld a écrit :
> > > Changes v11->v12:
> > > ----------------
> > > - In order to avoid mlock()ing pages, and the related rlimit and fork
> > >    inheritance issues there, Introduce VM_DROPPABLE to prevent swapping
> > >    while meeting the cache-like requirements of vDSO getrandom().
> > > 
> > >    This has some tenticles in mm/ and arch/x86/ code, so I've marked the
> > >    two patches for that as still RFC, while the rest of the series is not
> > >    RFC.
> > > 
> > > - Mandate that opaque state blobs don't straddle page boundaries, so
> > >    that VM_DROPPABLE can work on page-level granularity rather than
> > >    allocation-level granularity.
> > > 
> > > - Add compiler barriers to vDSO getrandom() to prevent theoretical
> > >    reordering potential.
> > > 
> > > - Initialize the trials loop counter in the chacha test.
> > 
> > I would have liked to give it a try on powerpc, but the series 
> > conflicts. I tried both on v6.1 and on linus/master from now:
> > 
> 
> Same here, I can't figure out how to apply this series.

Rebased v13 posted: https://lore.kernel.org/all/20221221142327.126451-1-Jason@zx2c4.com/

Jason

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v12 0/6] implement getrandom() in vDSO
  2022-12-21 14:25     ` Jason A. Donenfeld
@ 2022-12-21 20:48       ` Eric Biggers
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Biggers @ 2022-12-21 20:48 UTC (permalink / raw)
  To: Jason A. Donenfeld
  Cc: Florian Weimer, Christian Brauner, Arnd Bergmann, Jann Horn,
	Carlos O'Donell, linux-api@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org, patches@lists.linux.dev,
	linux-crypto@vger.kernel.org, Adhemerval Zanella Netto,
	Greg Kroah-Hartman, tglx@linutronix.de,
	linuxppc-dev@lists.ozlabs.org

On Wed, Dec 21, 2022 at 03:25:49PM +0100, Jason A. Donenfeld wrote:
> On Tue, Dec 20, 2022 at 08:13:14PM +0000, Eric Biggers wrote:
> > On Tue, Dec 20, 2022 at 05:17:52PM +0000, Christophe Leroy wrote:
> > > Hi Jason,
> > > 
> > > Le 12/12/2022 à 19:53, Jason A. Donenfeld a écrit :
> > > > Changes v11->v12:
> > > > ----------------
> > > > - In order to avoid mlock()ing pages, and the related rlimit and fork
> > > >    inheritance issues there, Introduce VM_DROPPABLE to prevent swapping
> > > >    while meeting the cache-like requirements of vDSO getrandom().
> > > > 
> > > >    This has some tenticles in mm/ and arch/x86/ code, so I've marked the
> > > >    two patches for that as still RFC, while the rest of the series is not
> > > >    RFC.
> > > > 
> > > > - Mandate that opaque state blobs don't straddle page boundaries, so
> > > >    that VM_DROPPABLE can work on page-level granularity rather than
> > > >    allocation-level granularity.
> > > > 
> > > > - Add compiler barriers to vDSO getrandom() to prevent theoretical
> > > >    reordering potential.
> > > > 
> > > > - Initialize the trials loop counter in the chacha test.
> > > 
> > > I would have liked to give it a try on powerpc, but the series 
> > > conflicts. I tried both on v6.1 and on linus/master from now:
> > > 
> > 
> > Same here, I can't figure out how to apply this series.
> 
> Rebased v13 posted: https://lore.kernel.org/all/20221221142327.126451-1-Jason@zx2c4.com/
> 

Thanks, it is always good to give the *actual* base commit though, preferably
with the --base option to git format-patch.  "Latest random.git master branch"
changes over time.

- Eric

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-12-21 20:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20221212185347.1286824-1-Jason@zx2c4.com>
2022-12-20 17:17 ` [PATCH v12 0/6] implement getrandom() in vDSO Christophe Leroy
2022-12-20 20:13   ` Eric Biggers
2022-12-21 14:25     ` Jason A. Donenfeld
2022-12-21 20:48       ` Eric Biggers
2022-12-21 14:04   ` Jason A. Donenfeld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).