linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
To: mpe@ellerman.id.au, Ravi Bangoria <ravi.bangoria@linux.ibm.com>,
	Michael Neuling <mikey@neuling.org>
Cc: anton@samba.org, cyrilbur@gmail.com,
	linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	matthew.brown.dev@gmail.com, paulus@samba.org,
	sandipan@linux.vnet.ibm.com
Subject: Re: [RFC] powerpc/emulate_step: Fix kernel crash when VSX is not present
Date: Wed, 16 May 2018 12:38:35 +0530	[thread overview]
Message-ID: <1526454049.ztv236j5bs.naveen@linux.ibm.com> (raw)
In-Reply-To: <20180516054021.5328-1-ravi.bangoria@linux.ibm.com>

[Adding Mikey]

Ravi Bangoria wrote:
> emulate_step() is not checking runtime VSX feature flag before
> emulating an instruction. This can cause kernel oops when kernel
> is compiled with CONFIG_VSX=3Dy but running on machine where VSX is
> not supported or disabled. Ex, while running emulate_step tests on
> P6 machine:
>=20
>   ...
>   emulate_step_test: lvx            : PASS
>   emulate_step_test: stvx           : PASS
>   Oops: Exception in kernel mode, sig: 4 [#1]
>   NIP [c000000000095c24] .load_vsrn+0x28/0x54
>   LR [c000000000094bdc] .emulate_loadstore+0x167c/0x17b0
>   Call Trace:
>   [c0000000494c3770] [40fe240c7ae147ae] 0x40fe240c7ae147ae (unreliable)
>   [c0000000494c37f0] [c000000000094bdc] .emulate_loadstore+0x167c/0x17b0
>   [c0000000494c3900] [c000000000094f6c] .emulate_step+0x25c/0x5bc
>   [c0000000494c39b0] [c000000000ec90dc] .test_lxvd2x_stxvd2x+0x64/0x154
>   [c0000000494c3b90] [c000000000ec9204] .test_emulate_step+0x38/0x4c
>   [c0000000494c3c00] [c00000000000de2c] .do_one_initcall+0x5c/0x2c0
>   [c0000000494c3cd0] [c000000000eb4bf8] .kernel_init_freeable+0x314/0x4cc
>   [c0000000494c3db0] [c00000000000e1e4] .kernel_init+0x24/0x160
>   [c0000000494c3e30] [c00000000000bc24] .ret_from_kernel_thread+0x58/0xb4
>=20
> With fix:
>   ...
>   emulate_step_test: stvx           : PASS
>   emulate_step_test: lxvd2x         : FAIL
>   emulate_step_test: stxvd2x        : FAIL

Those tests should also be updated to skip testing these instructions if=20
!CPU_FTR_VSX.

>=20
> Fixes: https://github.com/linuxppc/linux/issues/148
>=20
> Reported-by: Michael Ellerman <mpe@ellerman.id.au>
> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> ---
> Note: VSX was first introduced on P6. But there are many VSX instructions
>       which were introduced in later versions. So ideally, analyse_instr(=
)
>       should check for ISA version along with opcode.

Yes, this patch should be useful for when VSX is not present. For=20
specific instructions, we should add a cpu feature check.

- Naveen

=

      reply	other threads:[~2018-05-16  7:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-16  5:40 [RFC] powerpc/emulate_step: Fix kernel crash when VSX is not present Ravi Bangoria
2018-05-16  7:08 ` Naveen N. Rao [this message]

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=1526454049.ztv236j5bs.naveen@linux.ibm.com \
    --to=naveen.n.rao@linux.vnet.ibm.com \
    --cc=anton@samba.org \
    --cc=cyrilbur@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=matthew.brown.dev@gmail.com \
    --cc=mikey@neuling.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=ravi.bangoria@linux.ibm.com \
    --cc=sandipan@linux.vnet.ibm.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).