linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Ganesh <ganeshgr@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au
Cc: msuchanek@suse.de, keescook@chromium.org, npiggin@gmail.com,
	mahesh@linux.ibm.com
Subject: Re: [PATCH v3 1/2] powerpc/mce: remove nmi_enter/exit from real mode handler
Date: Fri, 9 Oct 2020 12:03:58 +0530	[thread overview]
Message-ID: <af9703e0-f92c-0e6f-9020-be60213b755c@linux.ibm.com> (raw)
In-Reply-To: <20201001175144.286189-2-ganeshgr@linux.ibm.com>

On 10/1/20 11:21 PM, Ganesh Goudar wrote:

> Use of nmi_enter/exit in real mode handler causes the kernel to panic
> and reboot on injecting slb mutihit on pseries machine running in hash
> mmu mode, As these calls try to accesses memory outside RMO region in
> real mode handler where translation is disabled.
>
> Add check to not to use these calls on pseries machine running in hash
> mmu mode.
>
> Fixes: 116ac378bb3f ("powerpc/64s: machine check interrupt update NMI accounting")
> Signed-off-by: Ganesh Goudar <ganeshgr@linux.ibm.com>
> ---
>   arch/powerpc/kernel/mce.c | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c
> index ada59f6c4298..3bf39dd5dd43 100644
> --- a/arch/powerpc/kernel/mce.c
> +++ b/arch/powerpc/kernel/mce.c
> @@ -591,12 +591,14 @@ EXPORT_SYMBOL_GPL(machine_check_print_event_info);
>   long notrace machine_check_early(struct pt_regs *regs)
>   {
>   	long handled = 0;
> -	bool nested = in_nmi();
> +	bool is_pseries_hpt_guest;
>   	u8 ftrace_enabled = this_cpu_get_ftrace_enabled();
>   
>   	this_cpu_set_ftrace_enabled(0);
> -
> -	if (!nested)
> +	is_pseries_hpt_guest = machine_is(pseries) &&
> +			       mmu_has_feature(MMU_FTR_HPTE_TABLE);
> +	/* Do not use nmi_enter/exit for pseries hpte guest */
> +	if (!is_pseries_hpt_guest)

In an offline discussion mpe suggested to use radix_enabled() to check if it is
radix or hash, as MMU_FTR_HPTE_TABLE may be true on radix machines also and use
of FW_FEATURE_LPAR better than machine_is(pseries), sending v4 with these changes.

>   		nmi_enter();
>   
>   	hv_nmi_check_nonrecoverable(regs);
> @@ -607,7 +609,7 @@ long notrace machine_check_early(struct pt_regs *regs)
>   	if (ppc_md.machine_check_early)
>   		handled = ppc_md.machine_check_early(regs);
>   
> -	if (!nested)
> +	if (!is_pseries_hpt_guest)
>   		nmi_exit();
>   
>   	this_cpu_set_ftrace_enabled(ftrace_enabled);

  reply	other threads:[~2020-10-09  6:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01 17:51 [PATCH v3 0/2] powerpc/mce: Fix mce handler and add selftest Ganesh Goudar
2020-10-01 17:51 ` [PATCH v3 1/2] powerpc/mce: remove nmi_enter/exit from real mode handler Ganesh Goudar
2020-10-09  6:33   ` Ganesh [this message]
2020-10-01 17:51 ` [PATCH v3 2/2] lkdtm/powerpc: Add SLB multihit test Ganesh Goudar

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=af9703e0-f92c-0e6f-9020-be60213b755c@linux.ibm.com \
    --to=ganeshgr@linux.ibm.com \
    --cc=keescook@chromium.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mahesh@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=msuchanek@suse.de \
    --cc=npiggin@gmail.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).