linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Hari Bathini <hbathini@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2] powerpc/mm: export current mmu mode info
Date: Thu, 22 Sep 2016 21:51:47 +0530	[thread overview]
Message-ID: <1e0922fe-0735-aa9f-d0bf-1420aee9f2bf@linux.vnet.ibm.com> (raw)
In-Reply-To: <147456009252.14735.18189822731283851598.stgit@hbathini.in.ibm.com>



On Thursday 22 September 2016 09:32 PM, Hari Bathini wrote:
> The kernel now supports both radix and hash MMU modes. Tools like crash
> and makedumpfile need to know the current MMU mode the kernel is using,
> to debug/analyze it.  The current MMU mode depends on hardware support
> and also whether disable_radix cmdline parameter is passed to the kernel.
> The mmu_features member of cpu_spec structure holds the current MMU mode
> a cpu is using. But the above mentioned tools need to know the MMU mode
> early in their init process, when they may not have access to offset info
> of structure members. A hard-coded offset may help but it won't be robust.
>
> This patch introduces a new global variable, which holds the current MMU
> mode the kernel is running in and can be accessed by tools early in thier
> init process, helping tools to initialize accurately for each MMU mode.
> This patch also optimizes the radix_enabled() function call.
>
> Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
> ---
>
> Changes from v1:
> * Patch name changed from "ppc64/book3s: export mmu type info"
> * Optimized radix_enabled() function
>
>
>   arch/powerpc/include/asm/mmu.h      |   22 +++++++++++++++++++++-
>   arch/powerpc/kernel/machine_kexec.c |    3 +++
>   arch/powerpc/mm/hash_utils_64.c     |    2 ++
>   arch/powerpc/mm/pgtable-radix.c     |    2 ++
>   arch/powerpc/mm/pgtable.c           |    6 ++++++
>   arch/powerpc/mm/tlb_hash32.c        |    1 +
>   arch/powerpc/mm/tlb_nohash.c        |    2 ++
>   7 files changed, 37 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
> index e2fb408..558987c 100644
> --- a/arch/powerpc/include/asm/mmu.h
> +++ b/arch/powerpc/include/asm/mmu.h
> @@ -199,6 +199,21 @@ static inline void mmu_clear_feature(unsigned long feature)
>
>   extern unsigned int __start___mmu_ftr_fixup, __stop___mmu_ftr_fixup;
>
> +/*
> + * Possible MMU modes
> + */
> +#define MMU_MODE_NONE           0
> +#define MMU_MODE_RADIX          1
> +#define MMU_MODE_HASH           2
> +#define MMU_MODE_HASH32         3
> +#define MMU_MODE_NOHASH         4
> +#define MMU_MODE_NOHASH32       5
> +
> +/*
> + * current MMU mode
> + */
> +extern unsigned int current_mmu_mode __read_mostly;
> +
>   #ifdef CONFIG_PPC64
>   /* This is our real memory area size on ppc64 server, on embedded, we
>    * make it match the size our of bolted TLB area
> @@ -218,7 +233,12 @@ static inline void assert_pte_locked(struct mm_struct *mm, unsigned long addr)
>   #ifdef CONFIG_PPC_RADIX_MMU
>   static inline bool radix_enabled(void)
>   {
> -	return mmu_has_feature(MMU_FTR_TYPE_RADIX);
> +	if (current_mmu_mode == MMU_MODE_RADIX)
> +		return true;
> +	else if (current_mmu_mode != MMU_MODE_NONE)
> +		return false;
> +	else
> +		return mmu_has_feature(MMU_FTR_TYPE_RADIX);
>   }
>
>   static inline bool early_radix_enabled(void)
> diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
> index 2694d07..4ecc184 100644
> --- a/arch/powerpc/kernel/machine_kexec.c
> +++ b/arch/powerpc/kernel/machine_kexec.c
> @@ -77,6 +77,9 @@ void arch_crash_save_vmcoreinfo(void)
>   	VMCOREINFO_SYMBOL(contig_page_data);
>   #endif
>   #if defined(CONFIG_PPC64) && defined(CONFIG_SPARSEMEM_VMEMMAP)
> +#ifdef CONFIG_PPC_BOOK3S
> +	VMCOREINFO_SYMBOL(current_mmu_mode);

Oops! This doesn't have to be under any flag. Let me resend.

Thanks
Hari

  reply	other threads:[~2016-09-22 16:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22 16:02 [PATCH v2] powerpc/mm: export current mmu mode info Hari Bathini
2016-09-22 16:21 ` Hari Bathini [this message]
2016-09-22 16:24 ` Aneesh Kumar K.V
2016-09-22 16:53   ` Hari Bathini
2016-09-23  4:44     ` Aneesh Kumar K.V
2016-09-23  6:18       ` Hari Bathini
2016-09-23 11:10 ` Michael Ellerman
2016-09-26 18:44   ` Hari Bathini

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=1e0922fe-0735-aa9f-d0bf-1420aee9f2bf@linux.vnet.ibm.com \
    --to=hbathini@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /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).