Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Marcus Shawcroft <marcus.shawcroft@gmail.com>
To: Kyle McMartin <kmcmarti@redhat.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCHv2] aarch64: detect atomic sequences like other ll/sc architectures
Date: Thu, 27 Mar 2014 14:07:00 -0000	[thread overview]
Message-ID: <CAFqB+Px4rL39pOqA8vxKOC7BDxRCUq8TTCixyk+aRoJ8MnNmMg@mail.gmail.com> (raw)
In-Reply-To: <20140327015125.GE3075@redacted.bos.redhat.com>

Hi,


On 27 March 2014 01:51, Kyle McMartin <kmcmarti@redhat.com> wrote:

> +  /* Look for a Load Exclusive instruction which begins the sequence.  */
> +  if (!decode_masked_match (insn, 0x3fc00000, 0x08400000))
> +    return 0;

Are you sure these masks and patterns are accurate? Looks to me that
this excludes many of the load exclusive instructions and includes
part of the unallocated encoding space. There are several different
encodings to match here covering ld[a]xr{b,h,} and ld[a]xp.  The masks
and patterns will be something like:

0xbfff7c00 0x085f7c00
0xbfff7c00 0x885f7c00
0xbfff0000 0x887f0000

> +      if (decode_masked_match (insn, 0x3fc00000, 0x08000000))

This also looks wrong.

> +  /* Test that we can step over ldxr/stxr. This sequence should step from
> +     ldxr to the following __asm __volatile.  */
> +  __asm __volatile ("1:     ldxr    %0,%2\n"                             \
> +                    "       cmp     %0,#1\n"                             \
> +                    "       b.eq    out\n"                               \
> +                    "       add     %0,%0,1\n"                           \
> +                    "       stxr    %w1,%0,%2\n"                         \
> +                    "       cbnz    %w1,1b"                              \
> +                    : "=&r" (tmp), "=&r" (cond), "+Q" (dword)            \
> +                    : : "memory");
> +
> +  /* This sequence should take the conditional branch and step from ldxr
> +     to the return dword line.  */
> +  __asm __volatile ("1:     ldxr    %0,%2\n"                             \
> +                    "       cmp     %0,#1\n"                             \
> +                    "       b.eq    out\n"                               \
> +                    "       add     %0,%0,1\n"                           \
> +                    "       stxr    %w1,%0,%2\n"                         \
> +                    "       cbnz    %w1,1b\n"                            \
> +                    : "=&r" (tmp), "=&r" (cond), "+Q" (dword)            \
> +                    : : "memory");
> +
> +  dword = -1;
> +__asm __volatile ("out:\n");
> +  return dword;
> +}

How about testing at least one instruction from each group of load
store exclusives?

Cheers
/Marcus


  parent reply	other threads:[~2014-03-27 14:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27  1:51 Kyle McMartin
2014-03-27 13:07 ` Joel Brobecker
2014-03-27 15:45   ` Kyle McMartin
2014-03-27 14:07 ` Marcus Shawcroft [this message]
2014-03-27 15:40   ` Kyle McMartin
2014-03-27 16:13     ` Marcus Shawcroft
2014-03-27 16:37       ` Kyle McMartin

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=CAFqB+Px4rL39pOqA8vxKOC7BDxRCUq8TTCixyk+aRoJ8MnNmMg@mail.gmail.com \
    --to=marcus.shawcroft@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=kmcmarti@redhat.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