Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-14 Thread Arjun Roy
On Wed, Apr 14, 2021 at 1:25 PM Eric Dumazet wrote: > > On Wed, Apr 14, 2021 at 10:15 PM Arjun Roy wrote: > > > > On Wed, Apr 14, 2021 at 10:35 AM Eric Dumazet wrote: > > > > > > On Wed, Apr 14, 2021 at 7:15 PM Arjun Roy wrote: > > > > > > > > On Wed, Apr 14, 2021 at 9:10 AM Eric Dumazet > >

Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-14 Thread Eric Dumazet
On Wed, Apr 14, 2021 at 10:15 PM Arjun Roy wrote: > > On Wed, Apr 14, 2021 at 10:35 AM Eric Dumazet wrote: > > > > On Wed, Apr 14, 2021 at 7:15 PM Arjun Roy wrote: > > > > > > On Wed, Apr 14, 2021 at 9:10 AM Eric Dumazet wrote: > > > > > > > > On Wed, Apr 14, 2021 at 6:08 PM David Laight > >

Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-14 Thread Arjun Roy
On Wed, Apr 14, 2021 at 10:35 AM Eric Dumazet wrote: > > On Wed, Apr 14, 2021 at 7:15 PM Arjun Roy wrote: > > > > On Wed, Apr 14, 2021 at 9:10 AM Eric Dumazet wrote: > > > > > > On Wed, Apr 14, 2021 at 6:08 PM David Laight > > > wrote: > > > > > > > > From: Eric Dumazet > > > > > Sent: 14

Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-14 Thread Eric Dumazet
On Wed, Apr 14, 2021 at 7:15 PM Arjun Roy wrote: > > On Wed, Apr 14, 2021 at 9:10 AM Eric Dumazet wrote: > > > > On Wed, Apr 14, 2021 at 6:08 PM David Laight > > wrote: > > > > > > From: Eric Dumazet > > > > Sent: 14 April 2021 17:00 > > > ... > > > > > Repeated unsafe_get_user() calls are

Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-14 Thread Arjun Roy
On Wed, Apr 14, 2021 at 9:10 AM Eric Dumazet wrote: > > On Wed, Apr 14, 2021 at 6:08 PM David Laight wrote: > > > > From: Eric Dumazet > > > Sent: 14 April 2021 17:00 > > ... > > > > Repeated unsafe_get_user() calls are crying out for an optimisation. > > > > You get something like: > > > >

Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-14 Thread Eric Dumazet
On Wed, Apr 14, 2021 at 6:08 PM David Laight wrote: > > From: Eric Dumazet > > Sent: 14 April 2021 17:00 > ... > > > Repeated unsafe_get_user() calls are crying out for an optimisation. > > > You get something like: > > > failed = 0; > > > copy(); > > > if (failed) goto

RE: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-14 Thread David Laight
From: Eric Dumazet > Sent: 14 April 2021 17:00 ... > > Repeated unsafe_get_user() calls are crying out for an optimisation. > > You get something like: > > failed = 0; > > copy(); > > if (failed) goto error; > > copy(); > > if (failed) goto error; > > Where

Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-14 Thread Eric Dumazet
On Wed, Apr 14, 2021 at 9:55 AM David Laight wrote: > > From: Arjun Roy > > Sent: 13 April 2021 23:04 > > > > On Tue, Apr 13, 2021 at 2:19 PM David Laight > > wrote: > > > > > > > If we're special-casing 64-bit architectures anyways - unrolling the > > > > 32B copy_from_user() for struct

RE: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-14 Thread David Laight
From: Arjun Roy > Sent: 13 April 2021 23:04 > > On Tue, Apr 13, 2021 at 2:19 PM David Laight wrote: > > > > > If we're special-casing 64-bit architectures anyways - unrolling the > > > 32B copy_from_user() for struct rseq_cs appears to be roughly 5-10% > > > savings on x86-64 when I measured it

Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-13 Thread Arjun Roy
On Tue, Apr 13, 2021 at 2:19 PM David Laight wrote: > > > If we're special-casing 64-bit architectures anyways - unrolling the > > 32B copy_from_user() for struct rseq_cs appears to be roughly 5-10% > > savings on x86-64 when I measured it (well, in a microbenchmark, not > > in rseq_get_rseq_cs()

RE: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-13 Thread David Laight
> If we're special-casing 64-bit architectures anyways - unrolling the > 32B copy_from_user() for struct rseq_cs appears to be roughly 5-10% > savings on x86-64 when I measured it (well, in a microbenchmark, not > in rseq_get_rseq_cs() directly). Perhaps that could be an additional > avenue for

Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-13 Thread Mathieu Desnoyers
- On Apr 13, 2021, at 2:22 PM, Eric Dumazet eduma...@google.com wrote: > On Tue, Apr 13, 2021 at 8:00 PM Mathieu Desnoyers > wrote: >> > >> As long as the ifdefs are localized within clearly identified wrappers in the >> rseq code I don't mind doing the special-casing there. >> >> The

Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-13 Thread Arjun Roy
On Tue, Apr 13, 2021 at 11:22 AM Eric Dumazet wrote: > > On Tue, Apr 13, 2021 at 8:00 PM Mathieu Desnoyers > wrote: > > > > > As long as the ifdefs are localized within clearly identified wrappers in > > the > > rseq code I don't mind doing the special-casing there. > > > > The point which

Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-13 Thread Eric Dumazet
On Tue, Apr 13, 2021 at 8:00 PM Mathieu Desnoyers wrote: > > As long as the ifdefs are localized within clearly identified wrappers in the > rseq code I don't mind doing the special-casing there. > > The point which remains is that I don't think we want to optimize for speed > on 32-bit

Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-13 Thread Mathieu Desnoyers
- On Apr 13, 2021, at 1:33 PM, Eric Dumazet eduma...@google.com wrote: > On Tue, Apr 13, 2021 at 7:20 PM Mathieu Desnoyers > wrote: >> >> - On Apr 13, 2021, at 1:07 PM, Eric Dumazet eduma...@google.com wrote: >> >> > On Tue, Apr 13, 2021 at 7:01 PM Eric Dumazet wrote: >> >> >> >> On

Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-13 Thread Eric Dumazet
On Tue, Apr 13, 2021 at 7:20 PM Mathieu Desnoyers wrote: > > - On Apr 13, 2021, at 1:07 PM, Eric Dumazet eduma...@google.com wrote: > > > On Tue, Apr 13, 2021 at 7:01 PM Eric Dumazet wrote: > >> > >> On Tue, Apr 13, 2021 at 6:57 PM Eric Dumazet wrote: > >> > > >> > On Tue, Apr 13, 2021 at

Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-13 Thread Mathieu Desnoyers
- On Apr 13, 2021, at 1:07 PM, Eric Dumazet eduma...@google.com wrote: > On Tue, Apr 13, 2021 at 7:01 PM Eric Dumazet wrote: >> >> On Tue, Apr 13, 2021 at 6:57 PM Eric Dumazet wrote: >> > >> > On Tue, Apr 13, 2021 at 6:54 PM Mathieu Desnoyers >> > wrote: >> > > >> > > - On Apr 13,

Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-13 Thread Eric Dumazet
On Tue, Apr 13, 2021 at 7:01 PM Eric Dumazet wrote: > > On Tue, Apr 13, 2021 at 6:57 PM Eric Dumazet wrote: > > > > On Tue, Apr 13, 2021 at 6:54 PM Mathieu Desnoyers > > wrote: > > > > > > - On Apr 13, 2021, at 12:22 PM, Eric Dumazet eric.duma...@gmail.com > > > wrote: > > > > > > > From:

Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-13 Thread Mathieu Desnoyers
- On Apr 13, 2021, at 12:57 PM, Eric Dumazet eduma...@google.com wrote: > On Tue, Apr 13, 2021 at 6:54 PM Mathieu Desnoyers > wrote: >> >> - On Apr 13, 2021, at 12:22 PM, Eric Dumazet eric.duma...@gmail.com >> wrote: >> >> > From: Eric Dumazet >> > >> > Commit ec9c82e03a74 ("rseq:

Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-13 Thread Eric Dumazet
On Tue, Apr 13, 2021 at 6:57 PM Eric Dumazet wrote: > > On Tue, Apr 13, 2021 at 6:54 PM Mathieu Desnoyers > wrote: > > > > - On Apr 13, 2021, at 12:22 PM, Eric Dumazet eric.duma...@gmail.com > > wrote: > > > > > From: Eric Dumazet > > > > > > Commit ec9c82e03a74 ("rseq: uapi: Declare

Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-13 Thread Eric Dumazet
On Tue, Apr 13, 2021 at 6:54 PM Mathieu Desnoyers wrote: > > - On Apr 13, 2021, at 12:22 PM, Eric Dumazet eric.duma...@gmail.com wrote: > > > From: Eric Dumazet > > > > Commit ec9c82e03a74 ("rseq: uapi: Declare rseq_cs field as union, > > update includes") added regressions for our servers.

Re: [PATCH v2 3/3] rseq: optimise rseq_get_rseq_cs() and clear_rseq_cs()

2021-04-13 Thread Mathieu Desnoyers
- On Apr 13, 2021, at 12:22 PM, Eric Dumazet eric.duma...@gmail.com wrote: > From: Eric Dumazet > > Commit ec9c82e03a74 ("rseq: uapi: Declare rseq_cs field as union, > update includes") added regressions for our servers. > > Using copy_from_user() and clear_user() for 64bit values > is