Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1714489
| From | Ram Pai <linuxram@us.ibm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC v6 21/62] powerpc: introduce execute-only pkey |
| Date | 2017-08-18 01:50 +0200 |
| Message-ID | <ufCI1-3vO-7@gated-at.bofh.it> (permalink) |
| References | (2 earlier) <u8lLX-1lY-5@gated-at.bofh.it> <u9za9-8fB-9@gated-at.bofh.it> <u9I3L-6bX-7@gated-at.bofh.it> <u9YrU-89Z-15@gated-at.bofh.it> <ufCI1-3vO-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Aug 17, 2017 at 04:35:55PM -0700, Ram Pai wrote: > On Wed, Aug 02, 2017 at 07:40:46PM +1000, Michael Ellerman wrote: > > Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> writes: > > > > > Michael Ellerman <mpe@ellerman.id.au> writes: > > > > > >> Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> writes: > > >>> Ram Pai <linuxram@us.ibm.com> writes: > > >> ... > > >>>> + > > >>>> + /* We got one, store it and use it from here on out */ > > >>>> + if (need_to_set_mm_pkey) > > >>>> + mm->context.execute_only_pkey = execute_only_pkey; > > >>>> + return execute_only_pkey; > > >>>> +} > > >>> > > >>> If you follow the code flow in __execute_only_pkey, the AMR and UAMOR > > >>> are read 3 times in total, and AMR is written twice. IAMR is read and > > >>> written twice. Since they are SPRs and access to them is slow (or isn't > > >>> it?), > > >> > > >> SPRs read/writes are slow, but they're not *that* slow in comparison to > > >> a system call (which I think is where this code is being called?). > > > > > > Yes, this code runs on mprotect and mmap syscalls if the memory is > > > requested to have execute but not read nor write permissions. > > > > Yep. That's not in the fast path for key usage, ie. the fast path is > > userspace changing the AMR itself, and the overhead of a syscall is > > already hundreds of cycles. > > > > >> So we should try to avoid too many SPR read/writes, but at the same time > > >> we can accept more than the minimum if it makes the code much easier to > > >> follow. > > > > > > Ok. Ram had asked me to suggest a way to optimize the SPR reads and > > > writes and I came up with the patch below. Do you think it's worth it? > > > > At a glance no I don't think it is. Sorry you spent that much time on it. > > > > I think we can probably reduce the number of SPR accesses without > > needing to go to that level of complexity. > > > > But don't throw the patch away, I may eat my words once I have the full > > series applied and am looking at it hard - at the moment I'm just > > reviewing the patches piecemeal as I get time. > Thiago's patch does save some cycles. I dont feel like throwing his work. I agree, It should be considered after applying all the patches. RP -- Ram Pai
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [RFC v6 21/62] powerpc: introduce execute-only pkey Ram Pai <linuxram@us.ibm.com> - 2017-08-18 01:50 +0200
csiph-web