From: Segher Boessenkool <segher@kernel.crashing.org>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: Eirik Fuller <efuller@redhat.com>, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2 1/2] powerpc/64s: system call scv tabort fix for corrupt irq soft-mask state
Date: Thu, 2 Sep 2021 16:52:03 -0500 [thread overview]
Message-ID: <20210902215203.GM1583@gate.crashing.org> (raw)
In-Reply-To: <1630553233.5hjr91skvz.astroid@bobo.none>
On Thu, Sep 02, 2021 at 01:33:10PM +1000, Nicholas Piggin wrote:
> Excerpts from Christophe Leroy's message of September 2, 2021 3:21 am:
> >> - /* Firstly we need to enable TM in the kernel */
> >> + /* We need to enable TM in the kernel, and disable EE (for scv) */
> >> mfmsr r10
> >> li r9, 1
> >> rldimi r10, r9, MSR_TM_LG, 63-MSR_TM_LG
> >> + LOAD_REG_IMMEDIATE(r9, MSR_EE)
> >> + andc r10, r10, r9
> >
> > Why not use 'rlwinm' to mask out MSR_EE ?
> >
> > Something like
> >
> > rlwinm r10, r10, 0, ~MSR_EE
>
> Mainly because I'm bad at powerpc assembly. Why do you think I'm trying
> to change as much as possible to C?
The actual bit (bit 31, i.e. with value 1UL << 32) cannot be cleared
with rlwinm (only the low 32 bits can). There are many ways to do it
using two insns of course.
> Actually there should really be no need for mfmsr either, I wanted to
> rewrite the thing entirely as
>
> ld r10,PACAKMSR(r13)
> LOAD_REG_IMMEDIATE(r9, MSR_TM)
> or r10,r10,r9
> mtmsrd r10
>
> But I thought that's not a minimal bug fix.
That (LOAD_REG_IMMEDIATE+or) can be done with just two insns, not three
as written:
li r0,1
rldimi r10,r0,32,31
(you can write that last insns as
rldimi r10,r0,MSR_TM_LG,MSR_TM_LG-1
if you insist :-) )
It isn't like a few integer computational insns will kill you here of
course, there are much more important cycles to shave off :-)
Segher
next prev parent reply other threads:[~2021-09-02 21:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-01 16:54 [PATCH v2 1/2] powerpc/64s: system call scv tabort fix for corrupt irq soft-mask state Nicholas Piggin
2021-09-01 16:54 ` [PATCH v2 2/2] selftests/powerpc: Add scv versions of the basic TM syscall tests Nicholas Piggin
2021-09-01 17:15 ` Christophe Leroy
2021-09-02 3:27 ` Nicholas Piggin
2021-09-02 3:44 ` Michael Ellerman
2021-09-02 5:36 ` Michael Ellerman
2021-09-01 17:21 ` [PATCH v2 1/2] powerpc/64s: system call scv tabort fix for corrupt irq soft-mask state Christophe Leroy
2021-09-02 3:33 ` Nicholas Piggin
2021-09-02 21:52 ` Segher Boessenkool [this message]
2021-09-02 22:20 ` Segher Boessenkool
2021-09-03 5:04 ` Christophe Leroy
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=20210902215203.GM1583@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=efuller@redhat.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--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).