public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Michael Ellerman <mpe@ellerman.id.au>,
	Alistair Popple <alistair@popple.id.au>,
	Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Subject: [PATCH 5.7 14/15] powerpc/64s: Dont init FSCR_DSCR in __init_FSCR()
Date: Wed, 26 Aug 2020 14:02:42 +0200	[thread overview]
Message-ID: <20200826114849.985021708@linuxfoundation.org> (raw)
In-Reply-To: <20200826114849.295321031@linuxfoundation.org>

From: Michael Ellerman <mpe@ellerman.id.au>

commit 0828137e8f16721842468e33df0460044a0c588b upstream.

__init_FSCR() was added originally in commit 2468dcf641e4 ("powerpc:
Add support for context switching the TAR register") (Feb 2013), and
only set FSCR_TAR.

At that point FSCR (Facility Status and Control Register) was not
context switched, so the setting was permanent after boot.

Later we added initialisation of FSCR_DSCR to __init_FSCR(), in commit
54c9b2253d34 ("powerpc: Set DSCR bit in FSCR setup") (Mar 2013), again
that was permanent after boot.

Then commit 2517617e0de6 ("powerpc: Fix context switch DSCR on
POWER8") (Aug 2013) added a limited context switch of FSCR, just the
FSCR_DSCR bit was context switched based on thread.dscr_inherit. That
commit said "This clears the H/FSCR DSCR bit initially", but it
didn't, it left the initialisation of FSCR_DSCR in __init_FSCR().
However the initial context switch from init_task to pid 1 would clear
FSCR_DSCR because thread.dscr_inherit was 0.

That commit also introduced the requirement that FSCR_DSCR be clear
for user processes, so that we can take the facility unavailable
interrupt in order to manage dscr_inherit.

Then in commit 152d523e6307 ("powerpc: Create context switch helpers
save_sprs() and restore_sprs()") (Dec 2015) FSCR was added to
thread_struct. However it still wasn't fully context switched, we just
took the existing value and set FSCR_DSCR if the new thread had
dscr_inherit set. FSCR was still initialised at boot to FSCR_DSCR |
FSCR_TAR, but that value was not propagated into the thread_struct, so
the initial context switch set FSCR_DSCR back to 0.

Finally commit b57bd2de8c6c ("powerpc: Improve FSCR init and context
switching") (Jun 2016) added a full context switch of the FSCR, and
added an initialisation of init_task.thread.fscr to FSCR_TAR |
FSCR_EBB, but omitted FSCR_DSCR.

The end result is that swapper runs with FSCR_DSCR set because of the
initialisation in __init_FSCR(), but no other processes do, they use
the value from init_task.thread.fscr.

Having FSCR_DSCR set for swapper allows it to access SPR 3 from
userspace, but swapper never runs userspace, so it has no useful
effect. It's also confusing to have the value initialised in two
places to two different values.

So remove FSCR_DSCR from __init_FSCR(), this at least gets us to the
point where there's a single value of FSCR, even if it's still set in
two places.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Tested-by: Alistair Popple <alistair@popple.id.au>
Link: https://lore.kernel.org/r/20200527145843.2761782-1-mpe@ellerman.id.au
Cc: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/kernel/cpu_setup_power.S |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/powerpc/kernel/cpu_setup_power.S
+++ b/arch/powerpc/kernel/cpu_setup_power.S
@@ -184,7 +184,7 @@ __init_LPCR_ISA300:
 
 __init_FSCR:
 	mfspr	r3,SPRN_FSCR
-	ori	r3,r3,FSCR_TAR|FSCR_DSCR|FSCR_EBB
+	ori	r3,r3,FSCR_TAR|FSCR_EBB
 	mtspr	SPRN_FSCR,r3
 	blr
 



  parent reply	other threads:[~2020-08-26 12:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26 12:02 [PATCH 5.7 00/15] 5.7.19-rc1 review Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.7 01/15] gre6: Fix reception with IP6_TNL_F_RCV_DSCP_COPY Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.7 02/15] net: Fix potential wrong skb->protocol in skb_vlan_untag() Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.7 03/15] net: nexthop: dont allow empty NHA_GROUP Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.7 04/15] net: qrtr: fix usage of idr in port assignment to socket Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.7 05/15] net/sched: act_ct: Fix skb double-free in tcf_ct_handle_fragments() error flow Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.7 06/15] net: sctp: Fix negotiation of the number of data streams Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.7 07/15] net/smc: Prevent kernel-infoleak in __smc_diag_dump() Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.7 08/15] tipc: call rcu_read_lock() in tipc_aead_encrypt_done() Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.7 09/15] tipc: fix uninit skb->data in tipc_nl_compat_dumpit() Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.7 10/15] net: ena: Make missed_tx stat incremental Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.7 11/15] ethtool: Fix preserving of wanted feature bits in netlink interface Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.7 12/15] ethtool: Account for hw_features " Greg Kroah-Hartman
2020-08-26 12:02 ` [PATCH 5.7 13/15] ethtool: Dont omit the netlink reply if no features were changed Greg Kroah-Hartman
2020-08-26 12:02 ` Greg Kroah-Hartman [this message]
2020-08-26 12:02 ` [PATCH 5.7 15/15] binfmt_flat: revert "binfmt_flat: dont offset the data start" Greg Kroah-Hartman
2020-08-26 14:49 ` [PATCH 5.7 00/15] 5.7.19-rc1 review David K. Kahurani
2020-08-26 14:53   ` Greg KH
2020-08-26 20:48 ` Guenter Roeck
2020-08-27  8:09 ` Naresh Kamboju

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=20200826114849.985021708@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=alistair@popple.id.au \
    --cc=cascardo@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=stable@vger.kernel.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