Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1625035

Re: [PATCH] powerpc/mm: some cleanup of do_page_fault()

From Michael Ellerman <mpe@ellerman.id.au>
Newsgroups linux.kernel
Subject Re: [PATCH] powerpc/mm: some cleanup of do_page_fault()
Date 2017-04-18 07:50 +0200
Message-ID <txubv-2jT-3@gated-at.bofh.it> (permalink)
References <tvOo3-4nr-33@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Christophe Leroy <christophe.leroy@c-s.fr> writes:

> This patch is a bunch of small cleanups of the do_page_fault()
> function:
> 1/ Function store_updates_sp() checks whether the faulting
> instruction is a store updating r1. Therefore we can limit its calls
> to stores exceptions
> 2/ Only the get_user() in store_updates_sp() has to be done outside
> the mm semaphore. All the comparison can be done within the semaphore,
> so only when really needed.
> 3/ As we got a DSI exception, the address pointed by regs->nip is
> obviously valid, otherwise we would have had a instruction exception.
> So __get_user() can be used instead of get_user()
> 4/ Replaced one duplicate 'trap == 0x400' by 'is_exec'
> 5/ Created a 'is_user = user_mode(regs)' and replaced all
> 'user_mode(regs)'.
> Analysis of the assembly code shows that when using user_mode(regs),
> at least the 'andi. r7,r8,16384' is redone several times, and also
> the 'lwz r8,132(r31)' at times. With the new form, the 'is_user'
> is mapped to cr4, then all further use of is_user results in just
> things like 'beq cr4,218 <do_page_fault+0x218>'
> 6/ The 8xx has a dedicated exception for breakpoints, that directly
> calls do_break()

Those are probably all OK, if you send them as separate patches.

> 7/ stdu and stdux only exist on PPC64, so no need to check for them
> on PPC32

I don't love that, because it adds two ifdefs in the C code and the gain
must be pretty small.

cheers

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] powerpc/mm: some cleanup of do_page_fault() Christophe Leroy <christophe.leroy@c-s.fr> - 2017-04-13 17:00 +0200
  Re: [PATCH] powerpc/mm: some cleanup of do_page_fault() "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> - 2017-04-17 10:40 +0200
  Re: [PATCH] powerpc/mm: some cleanup of do_page_fault() Michael Ellerman <mpe@ellerman.id.au> - 2017-04-18 07:50 +0200

csiph-web