From: Jordan Niethe <jniethe5@gmail.com>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: Alistair Popple <alistair@popple.id.au>,
Daniel Axtens <dja@axtens.net>,
linuxppc-dev@lists.ozlabs.org,
Balamuruhan S <bala24@linux.ibm.com>
Subject: Re: [PATCH v3 08/14] powerpc/xmon: Remove store_inst() for patch_instruction()
Date: Thu, 27 Feb 2020 10:54:59 +1100 [thread overview]
Message-ID: <CACzsE9qiRGEGHdk5sv3V043RsF31tF=EgzH7O0SaUV=p3ojrtQ@mail.gmail.com> (raw)
In-Reply-To: <1582699938.333f3hx0ka.astroid@bobo.none>
On Wed, Feb 26, 2020 at 6:04 PM Nicholas Piggin <npiggin@gmail.com> wrote:
>
> Jordan Niethe's on February 26, 2020 2:07 pm:
> > For modifying instructions in xmon, patch_instruction() can serve the
> > same role that store_inst() is performing with the advantage of not
> > being specific to xmon. In some places patch_instruction() is already
> > being using followed by store_inst(). In these cases just remove the
> > store_inst(). Otherwise replace store_inst() with patch_instruction().
> >
> > Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
> > ---
> > arch/powerpc/xmon/xmon.c | 13 ++-----------
> > 1 file changed, 2 insertions(+), 11 deletions(-)
> >
> > diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> > index 897e512c6379..a673cf55641c 100644
> > --- a/arch/powerpc/xmon/xmon.c
> > +++ b/arch/powerpc/xmon/xmon.c
> > @@ -325,11 +325,6 @@ static inline void sync(void)
> > asm volatile("sync; isync");
> > }
> >
> > -static inline void store_inst(void *p)
> > -{
> > - asm volatile ("dcbst 0,%0; sync; icbi 0,%0; isync" : : "r" (p));
> > -}
> > -
> > static inline void cflush(void *p)
> > {
> > asm volatile ("dcbf 0,%0; icbi 0,%0" : : "r" (p));
> > @@ -882,8 +877,7 @@ static struct bpt *new_breakpoint(unsigned long a)
> > for (bp = bpts; bp < &bpts[NBPTS]; ++bp) {
> > if (!bp->enabled && atomic_read(&bp->ref_count) == 0) {
> > bp->address = a;
> > - bp->instr[1] = bpinstr;
> > - store_inst(&bp->instr[1]);
> > + patch_instruction(&bp->instr[1], bpinstr);
> > return bp;
> > }
> > }
> > @@ -913,7 +907,7 @@ static void insert_bpts(void)
> > bp->enabled = 0;
> > continue;
> > }
> > - store_inst(&bp->instr[0]);
> > + patch_instruction(&bp->instr[0], bp->instr[0]);
>
> Hmm that's a bit weird. Can you read instructions into a local variable
> first, do the checks on them, then patch them into their execution
> location?
I agree it is weird, local variables would be better.
>
> Otherwise, good cleanup.
>
> Thanks,
> Nick
next prev parent reply other threads:[~2020-02-26 23:57 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-26 4:07 [PATCH v3 00/14] Initial Prefixed Instruction support Jordan Niethe
2020-02-26 4:07 ` [PATCH v3 01/14] powerpc: Enable Prefixed Instructions Jordan Niethe
2020-02-26 6:46 ` Nicholas Piggin
2020-02-28 2:52 ` Jordan Niethe
2020-02-28 4:48 ` Nicholas Piggin
2020-03-03 23:20 ` Alistair Popple
2020-02-26 4:07 ` [PATCH v3 02/14] powerpc: Define new SRR1 bits for a future ISA version Jordan Niethe
2020-03-03 23:31 ` Alistair Popple
2020-02-26 4:07 ` [PATCH v3 03/14] powerpc sstep: Prepare to support prefixed instructions Jordan Niethe
2020-02-26 4:07 ` [PATCH v3 04/14] powerpc sstep: Add support for prefixed load/stores Jordan Niethe
2020-02-26 4:07 ` [PATCH v3 05/14] powerpc sstep: Add support for prefixed fixed-point arithmetic Jordan Niethe
2020-02-26 4:07 ` [PATCH v3 06/14] powerpc: Support prefixed instructions in alignment handler Jordan Niethe
2020-02-26 4:07 ` [PATCH v3 07/14] powerpc/traps: Check for prefixed instructions in facility_unavailable_exception() Jordan Niethe
2020-02-26 6:49 ` Nicholas Piggin
2020-02-26 23:52 ` Jordan Niethe
2020-02-28 1:57 ` Nicholas Piggin
2020-02-26 4:07 ` [PATCH v3 08/14] powerpc/xmon: Remove store_inst() for patch_instruction() Jordan Niethe
2020-02-26 7:00 ` Nicholas Piggin
2020-02-26 23:54 ` Jordan Niethe [this message]
2020-02-26 4:07 ` [PATCH v3 09/14] powerpc/xmon: Add initial support for prefixed instructions Jordan Niethe
2020-02-26 7:06 ` Nicholas Piggin
2020-02-27 0:11 ` Jordan Niethe
2020-02-27 7:14 ` Christophe Leroy
2020-02-28 0:37 ` Jordan Niethe
2020-02-28 1:23 ` Nicholas Piggin
2020-02-26 4:07 ` [PATCH v3 10/14] powerpc/xmon: Dump " Jordan Niethe
2020-02-26 4:07 ` [PATCH v3 11/14] powerpc/kprobes: Support kprobes on " Jordan Niethe
2020-02-26 7:14 ` Nicholas Piggin
2020-02-27 0:58 ` Jordan Niethe
2020-02-28 1:47 ` Nicholas Piggin
2020-02-28 1:56 ` Nicholas Piggin
2020-02-28 3:23 ` Jordan Niethe
2020-02-28 4:53 ` Nicholas Piggin
2020-02-26 4:07 ` [PATCH v3 12/14] powerpc/uprobes: Add support for " Jordan Niethe
2020-02-26 4:07 ` [PATCH v3 13/14] powerpc/hw_breakpoints: Initial " Jordan Niethe
2020-02-26 4:07 ` [PATCH v3 14/14] powerpc: Add prefix support to mce_find_instr_ea_and_pfn() Jordan Niethe
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='CACzsE9qiRGEGHdk5sv3V043RsF31tF=EgzH7O0SaUV=p3ojrtQ@mail.gmail.com' \
--to=jniethe5@gmail.com \
--cc=alistair@popple.id.au \
--cc=bala24@linux.ibm.com \
--cc=dja@axtens.net \
--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).