From: Anshuman Khandual <khandual@linux.vnet.ibm.com>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au,
Scott Wood <scottwood@freescale.com>,
Denis Kirjanov <kda@linux-powerpc.org>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH V5 26/31] powerpc/mm: Remove the dependency on pte bit position in asm code
Date: Thu, 26 Nov 2015 19:02:59 +0530 [thread overview]
Message-ID: <56570A0B.6040209@linux.vnet.ibm.com> (raw)
In-Reply-To: <1448274160-28446-27-git-send-email-aneesh.kumar@linux.vnet.ibm.com>
On 11/23/2015 03:52 PM, Aneesh Kumar K.V wrote:
> We should not expect pte bit position in asm code. Simply
> by moving part of that to C
There is a full stop missing in the second sentence. The commit
message here does not tell about why we would want to process the
page access flags or other PTE flags in the C code. Was it needed
at this stage of this series during PTE change or its just an
improvement which could have segregated out before.
>
> Acked-by: Scott Wood <scottwood@freescale.com>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
> arch/powerpc/kernel/exceptions-64s.S | 16 +++-------------
> arch/powerpc/mm/hash_utils_64.c | 29 +++++++++++++++++++++++++++++
> 2 files changed, 32 insertions(+), 13 deletions(-)
>
> diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
> index 0a0399c2af11..34920f11dbdd 100644
> --- a/arch/powerpc/kernel/exceptions-64s.S
> +++ b/arch/powerpc/kernel/exceptions-64s.S
> @@ -1556,28 +1556,18 @@ do_hash_page:
> lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */
> andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */
> bne 77f /* then don't call hash_page now */
> - /*
> - * We need to set the _PAGE_USER bit if MSR_PR is set or if we are
> - * accessing a userspace segment (even from the kernel). We assume
> - * kernel addresses always have the high bit set.
> - */
> - rlwinm r4,r4,32-25+9,31-9,31-9 /* DSISR_STORE -> _PAGE_RW */
> - rotldi r0,r3,15 /* Move high bit into MSR_PR posn */
> - orc r0,r12,r0 /* MSR_PR | ~high_bit */
> - rlwimi r4,r0,32-13,30,30 /* becomes _PAGE_USER access bit */
> - ori r4,r4,1 /* add _PAGE_PRESENT */
> - rlwimi r4,r5,22+2,31-2,31-2 /* Set _PAGE_EXEC if trap is 0x400 */
>
> /*
> * r3 contains the faulting address
> - * r4 contains the required access permissions
> + * r4 msr
> * r5 contains the trap number
> * r6 contains dsisr
> *
> * at return r3 = 0 for success, 1 for page fault, negative for error
> */
> + mr r4,r12
> ld r6,_DSISR(r1)
> - bl hash_page /* build HPTE if possible */
> + bl __hash_page /* build HPTE if possible */
> cmpdi r3,0 /* see if hash_page succeeded */
The comment needs to change to __hash_page ^^^^^^^^^^^^^^^^^^^^^^^^.
>
> /* Success */
> diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
> index db35e7d83088..04d549527eaa 100644
> --- a/arch/powerpc/mm/hash_utils_64.c
> +++ b/arch/powerpc/mm/hash_utils_64.c
> @@ -1162,6 +1162,35 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap,
> }
> EXPORT_SYMBOL_GPL(hash_page);
So we are still keeping hash_page as an exported symbol here as
there are consumers for it ?
>
> +int __hash_page(unsigned long ea, unsigned long msr, unsigned long trap,
> + unsigned long dsisr)
> +{
> + unsigned long access = _PAGE_PRESENT;
> + unsigned long flags = 0;
> + struct mm_struct *mm = current->mm;
> +
> + if (REGION_ID(ea) == VMALLOC_REGION_ID)
> + mm = &init_mm;
> +
> + if (dsisr & DSISR_NOHPTE)
> + flags |= HPTE_NOHPTE_UPDATE;
> +
> + if (dsisr & DSISR_ISSTORE)
> + access |= _PAGE_RW;
> + /*
> + * We need to set the _PAGE_USER bit if MSR_PR is set or if we are
> + * accessing a userspace segment (even from the kernel). We assume
> + * kernel addresses always have the high bit set.
> + */
> + if ((msr & MSR_PR) || (REGION_ID(ea) == USER_REGION_ID))
> + access |= _PAGE_USER;
> +
> + if (trap == 0x400)
> + access |= _PAGE_EXEC;
> +
> + return hash_page_mm(mm, ea, access, trap, flags);
> +}
There are some code similarity between hash_page and __hash_page
above. Cant we consolidate some part of it ?
next prev parent reply other threads:[~2015-11-26 13:33 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-23 10:22 [PATCH V5 00/31] powerpc/mm: Update page table format for book3s 64 Aneesh Kumar K.V
2015-11-23 10:22 ` [PATCH V5 01/31] powerpc/mm: move pte headers to book3s directory Aneesh Kumar K.V
2015-11-23 10:22 ` [PATCH V5 02/31] powerpc/mm: move pte headers to book3s directory (part 2) Aneesh Kumar K.V
2015-11-24 8:58 ` Anshuman Khandual
2015-11-23 10:22 ` [PATCH V5 03/31] powerpc/mm: make a separate copy for book3s Aneesh Kumar K.V
2015-11-24 9:13 ` Anshuman Khandual
2015-11-23 10:22 ` [PATCH V5 04/31] powerpc/mm: make a separate copy for book3s (part 2) Aneesh Kumar K.V
2015-11-24 11:22 ` Anshuman Khandual
2015-11-23 10:22 ` [PATCH V5 05/31] powerpc/mm: Move hash specific pte width and other defines to book3s Aneesh Kumar K.V
2015-11-24 11:19 ` Anshuman Khandual
2015-11-23 10:22 ` [PATCH V5 06/31] powerpc/mm: Delete booke bits from book3s Aneesh Kumar K.V
2015-11-23 10:22 ` [PATCH V5 07/31] powerpc/mm: Don't have generic headers introduce functions touching pte bits Aneesh Kumar K.V
2015-11-23 10:22 ` [PATCH V5 08/31] powerpc/mm: Drop pte-common.h from BOOK3S 64 Aneesh Kumar K.V
2015-11-25 5:26 ` Anshuman Khandual
2015-11-23 10:22 ` [PATCH V5 09/31] powerpc/mm: Don't use pte_val as lvalue Aneesh Kumar K.V
2015-11-23 10:22 ` [PATCH V5 10/31] powerpc/mm: Don't use pmd_val, pud_val and pgd_val " Aneesh Kumar K.V
2015-11-23 10:22 ` [PATCH V5 11/31] powerpc/mm: Move hash64 PTE bits from book3s/64/pgtable.h to hash.h Aneesh Kumar K.V
2015-11-25 6:22 ` Anshuman Khandual
2015-11-23 10:22 ` [PATCH V5 12/31] powerpc/mm: Move PTE bits from generic functions to hash64 functions Aneesh Kumar K.V
2015-11-23 10:22 ` [PATCH V5 13/31] powerpc/booke: Move nohash headers (part 1) Aneesh Kumar K.V
2015-11-23 10:22 ` [PATCH V5 14/31] powerpc/booke: Move nohash headers (part 2) Aneesh Kumar K.V
2015-11-25 6:35 ` Anshuman Khandual
2015-11-23 10:22 ` [PATCH V5 15/31] powerpc/booke: Move nohash headers (part 3) Aneesh Kumar K.V
2015-11-23 10:22 ` [PATCH V5 16/31] powerpc/booke: Move nohash headers (part 4) Aneesh Kumar K.V
2015-11-23 10:22 ` [PATCH V5 17/31] powerpc/booke: Move nohash headers (part 5) Aneesh Kumar K.V
2015-11-25 9:44 ` Anshuman Khandual
2015-11-23 10:22 ` [PATCH V5 18/31] powerpc/mm: Increase the pte frag size Aneesh Kumar K.V
2015-11-23 10:22 ` [PATCH V5 19/31] powerpc/mm: Convert 4k hash insert to C Aneesh Kumar K.V
2015-11-23 10:22 ` [PATCH V5 20/31] powerpc/mm: update __real_pte to take address as argument Aneesh Kumar K.V
2015-11-23 10:22 ` [PATCH V5 21/31] powerpc/mm: make pte page hash index slot 8 bits Aneesh Kumar K.V
2015-11-27 6:52 ` Anshuman Khandual
2015-11-23 10:22 ` [PATCH V5 22/31] powerpc/mm: Don't track subpage valid bit in pte_t Aneesh Kumar K.V
2015-11-23 10:22 ` [PATCH V5 23/31] powerpc/mm: Increase the width of #define Aneesh Kumar K.V
2015-11-26 5:42 ` Anshuman Khandual
2015-11-23 10:22 ` [PATCH V5 24/31] powerpc/mm: Convert __hash_page_64K to C Aneesh Kumar K.V
2015-11-23 10:22 ` [PATCH V5 25/31] powerpc/mm: Convert 4k insert from asm " Aneesh Kumar K.V
2015-11-23 10:22 ` [PATCH V5 26/31] powerpc/mm: Remove the dependency on pte bit position in asm code Aneesh Kumar K.V
2015-11-26 13:32 ` Anshuman Khandual [this message]
2015-11-23 10:22 ` [PATCH V5 27/31] powerpc/mm: Add helper for converting pte bit to hpte bits Aneesh Kumar K.V
2015-11-23 10:22 ` [PATCH V5 28/31] powerpc/mm: Move WIMG update to helper Aneesh Kumar K.V
2015-11-26 13:49 ` Anshuman Khandual
2015-11-23 10:22 ` [PATCH V5 29/31] powerpc/mm: Move hugetlb related headers Aneesh Kumar K.V
2015-11-23 10:22 ` [PATCH V5 30/31] powerpc/mm: Move THP headers around Aneesh Kumar K.V
2015-11-24 10:16 ` Denis Kirjanov
2015-11-24 11:20 ` Aneesh Kumar K.V
2015-11-24 13:58 ` Denis Kirjanov
2015-11-23 10:22 ` [PATCH V5 31/31] powerpc/mm: Add a _PAGE_PTE bit Aneesh Kumar K.V
2015-11-24 9:36 ` Denis Kirjanov
2015-11-23 23:28 ` [PATCH V5 00/31] powerpc/mm: Update page table format for book3s 64 Benjamin Herrenschmidt
2015-11-24 3:31 ` Aneesh Kumar K.V
2015-11-24 6:48 ` Anshuman Khandual
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56570A0B.6040209@linux.vnet.ibm.com \
--to=khandual@linux.vnet.ibm.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=kda@linux-powerpc.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=scottwood@freescale.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).