Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Assembly errors with lockmeter
@ 1999-11-02 19:24 Peter Rival
  1999-11-02 20:19 ` Richard Henderson
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Rival @ 1999-11-02 19:24 UTC (permalink / raw)
  To: rth; +Cc: axp-list

[-- Attachment #1: Type: text/plain, Size: 2232 bytes --]

Hi Richard,

    I've now ported most of the lockmeter code that was written at SGI
for the x86 platform over to alpha.  My last stumbling block has been
the rwlocks, as they had written some cute code that worked nicely on
x86's rwlocks.  I've tried to rewrite it in Alpha assembly, but am now
tripping over this one and have no clue why it's doing this.  This is
done with "egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)".  The code
segment is below, it's basically supposed to try once to get the read
lock so we can start a timer if it fails (to keep track of our mean and
total lock wait times):

static __inline__ int _read_try_lock_(volatile rwlock_t *lock)
{
        long temp,result;
        __asm__ __volatile__(
        "1:     ldl_l %1,%0\n"
        "       blbs %1,6f\n"
        "       subl %1,2,%1\n"
        "       mov %1,%2\n"
        "       stl_c %1,6f\n"
        "       beq %1,6f\n"
        "       mb\n"
        ".section .text2,\"ax\"\n"
        "6:\n"
        ".previous"
        : "=m" (__dummy_lock(lock)), "=&r" (temp), "=&r" (result)
        : "m" (__dummy_lock(lock))
        );
        return (result);        /* Was the lock grabbed? */
}

This is the error I get:

[frival@av8r kernel]$ gcc -D__KERNEL__
-I/home/frival/lockwork/linux-2.3.22/include -Wall -Wstrict-prototypes
-O2 -fno-strict-aliasing -D__SMP__ -pipe -mno-fp-regs -ffixed-8   -c -o
lockmeter.o lockmeter.c
{standard input}: Assembler messages:
{standard input}:649: Error: macro requires $at register while noat in
effect
{standard input}:655: Internal error!
Assertion failure in alpha_align at ./config/tc-alpha.c line 4518.
Please report this bug.

And finally, this is the final assembly code I get (with gcc -S):

<snip>
$_read_lock_..ng:
        subq $30,32,$30
        stq $26,0($30)
        .prologue 1
        bic $26,3,$26
        stq $16,16($30)
        bis $26,1,$17
        1:      ldl_l $2,0($16)
        blbs $2,6f
        subl $2,2,$2
        mov $2,$1
        stl_c $2,6f <-- line 649
        beq $2,6f
        mb
.section .text2,"ax"
6:
.previous
        addl $1,$31,$1 <-- line 655
        beq $1,$L944
        ldq $16,16($30)
        bis $31,$31,$18
        bsr $26,$lstat_update..ng
        br $31,$L943
<snip>

[-- Attachment #2: Type: text/html, Size: 4527 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Assembly errors with lockmeter
  1999-11-02 19:24 Assembly errors with lockmeter Peter Rival
@ 1999-11-02 20:19 ` Richard Henderson
  1999-11-02 20:41   ` Peter Rival
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Henderson @ 1999-11-02 20:19 UTC (permalink / raw)
  To: Peter Rival; +Cc: axp-list

On Tue, Nov 02, 1999 at 07:24:09PM +0000, Peter Rival wrote:
>         "       stl_c %1,6f\n"
>         "6:\n"

Look close and think carefully.

You shouldn't be storing to a label, but instead to %0.


r~


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Assembly errors with lockmeter
  1999-11-02 20:19 ` Richard Henderson
@ 1999-11-02 20:41   ` Peter Rival
  1999-11-02 20:57     ` Richard Henderson
  1999-11-08  0:47     ` Assembly errors with lockmeter Richard Henderson
  0 siblings, 2 replies; 10+ messages in thread
From: Peter Rival @ 1999-11-02 20:41 UTC (permalink / raw)
  To: Richard Henderson; +Cc: axp-list

[-- Attachment #1: Type: text/plain, Size: 1354 bytes --]

Richard Henderson wrote:

> On Tue, Nov 02, 1999 at 07:24:09PM +0000, Peter Rival wrote:
> >         "       stl_c %1,6f\n"
> >         "6:\n"
>
> Look close and think carefully.
>
> You shouldn't be storing to a label, but instead to %0.
>

Oh my God, I'm a moron.  I was reading from something I had scratched
together earlier and the paper was at an angle and I combined the stl_c
with the following beq and came up with junk.

After feeling stupid (and grabbing more coffee) I fixed it up as shown
but now I still get the second error:

[frival@av8r kernel]$ gcc -D__KERNEL__
-I/home/frival/lockwork/linux-2.3.22/include -Wall -Wstrict-prototypes
-O2 -fno-strict-aliasing -D__SMP__ -pipe -mno-fp-regs -ffixed-8   -c
lockmeter.c -o lockmeter.o
{standard input}: Assembler messages:
{standard input}:655: Internal error!
Assertion failure in alpha_align at ./config/tc-alpha.c line 4518.
Please report this bug.

Where this is what we see:

        mov $2,$1
        stl_c $2,0($16)
        beq $2,6f
        mb
.section .text2,"ax"
6:
.previous
        addl $1,$31,$1    <-- Line 655
        beq $1,$L944
        ldq $16,16($30)
        bis $31,$31,$18
        bsr $26,$lstat_update..ng
        br $31,$L943
$L944:
        rpcc $1

Is this an "upgrade to GCC 2.95" thing, or is something else wrong?
This is a "stock" RH6.1 installed system.

 - Pete

[-- Attachment #2: Type: text/html, Size: 2281 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Assembly errors with lockmeter
  1999-11-02 20:41   ` Peter Rival
@ 1999-11-02 20:57     ` Richard Henderson
  1999-11-02 21:49       ` Cross Platform IDE Jonas Gustavsson
  1999-11-08  0:47     ` Assembly errors with lockmeter Richard Henderson
  1 sibling, 1 reply; 10+ messages in thread
From: Richard Henderson @ 1999-11-02 20:57 UTC (permalink / raw)
  To: Peter Rival; +Cc: axp-list

On Tue, Nov 02, 1999 at 08:41:15PM +0000, Peter Rival wrote:
> Is this an "upgrade to GCC 2.95" thing, or is something else wrong?

It's an assembler bug of some sort.  I can reproduce it
from the fragment you sent.  I'll look at it shortly.


r~


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Cross Platform IDE
  1999-11-02 20:57     ` Richard Henderson
@ 1999-11-02 21:49       ` Jonas Gustavsson
  1999-11-03 21:32         ` Adam C Powell IV
  0 siblings, 1 reply; 10+ messages in thread
From: Jonas Gustavsson @ 1999-11-02 21:49 UTC (permalink / raw)
  To: axp-list

As we´re starting to move some of our alphas over to Linux/Tru64(from NT)
 it would be realy nice to have a Cross Platform IDE(Intergrated Development 
Enviroment), and I suppose I´m not the only one.
It would be especialy usefull if the IDE was based on either GCC or the GEM 
stuff from compaq.

Any ideas??

later

Jonas Gustavsson
n Factory




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Cross Platform IDE
  1999-11-02 21:49       ` Cross Platform IDE Jonas Gustavsson
@ 1999-11-03 21:32         ` Adam C Powell IV
  1999-11-04  0:00           ` SV: " Jonas Gustavsson
  0 siblings, 1 reply; 10+ messages in thread
From: Adam C Powell IV @ 1999-11-03 21:32 UTC (permalink / raw)
  To: axp-list

Jonas Gustavsson wrote:

> As we´re starting to move some of our alphas over to Linux/Tru64(from NT)
>  it would be realy nice to have a Cross Platform IDE(Intergrated Development
> Enviroment), and I suppose I´m not the only one.
> It would be especialy usefull if the IDE was based on either GCC or the GEM
> stuff from compaq.
>
> Any ideas??

Hmm, there's Code Warrior, but that's only for Intel.  Maybe Cygnus Code
Fusion, but that's for Linux and there's no indication it runs on other (OS)
platforms.  On the other hand, combined with Cygwin libraries/tools, it should
be possible to build Code Fusion for NT.  I would think they would have thought
of that and done it already.

For that matter, using Cygwin it should be possible to compile kIDE (KDE) or
glade (GNOME) on NT as well.

That's all I can think of.

FWIW, you really should not start a new thread on a list by replying to another
message.  For those of us with threaded email clients, it sticks your post in
the middle of the other thread, so we never see it unless we open that thread,
even if you use a new subject.  Just retype the email address, or set an alias
so you don't have to type the whole thing.

-Adam P.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* SV: Cross Platform IDE
  1999-11-03 21:32         ` Adam C Powell IV
@ 1999-11-04  0:00           ` Jonas Gustavsson
  0 siblings, 0 replies; 10+ messages in thread
From: Jonas Gustavsson @ 1999-11-04  0:00 UTC (permalink / raw)
  To: axp-list

> Hmm, there's Code Warrior, but that's only for Intel.  Maybe Cygnus Code
> Fusion, but that's for Linux and there's no indication it runs on other (OS)
> platforms.  On the other hand, combined with Cygwin libraries/tools, it should
> be possible to build Code Fusion for NT.  I would think they would have thought
> of that and done it already.
> 
Thanks for the tips :-)

> For that matter, using Cygwin it should be possible to compile kIDE (KDE) or
> glade (GNOME) on NT as well.
> 
I´ll see what I can do about KDE and GNOME

> That's all I can think of.
> 
> FWIW, you really should not start a new thread on a list by replying to another
> message.  For those of us with threaded email clients, it sticks your post in
> the middle of the other thread, so we never see it unless we open that thread,
> even if you use a new subject.  Just retype the email address, or set an alias
> so you don't have to type the whole thing.
> 
Sorry!! for the thread mess :-(

Later

Jonas Gustavsson
n Factory




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Assembly errors with lockmeter
  1999-11-02 20:41   ` Peter Rival
  1999-11-02 20:57     ` Richard Henderson
@ 1999-11-08  0:47     ` Richard Henderson
  1999-11-08 14:03       ` Peter Rival
  1 sibling, 1 reply; 10+ messages in thread
From: Richard Henderson @ 1999-11-08  0:47 UTC (permalink / raw)
  To: frival; +Cc: axp-list

On Tue, Nov 02, 1999 at 08:41:15PM +0000, Peter Rival wrote:
>         mb
> .section .text2,"ax"
> 6:
> .previous
>         addl $1,$31,$1    <-- Line 655

This fixes it.  I do wonder what exactly you're doing with
labels in sections with no code attached to them...


r~



        * config/tc-alpha.c (alpha_align): Check, don't assert, that
        the previous label was in the current section before playing
        with auto-alignment.

Index: gas/config/tc-alpha.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/config/tc-alpha.c,v
retrieving revision 1.6
diff -c -p -d -r1.6 tc-alpha.c
*** tc-alpha.c	1999/10/18 22:29:14	1.6
--- tc-alpha.c	1999/11/08 00:42:40
*************** alpha_align (n, pfill, label, force)
*** 4756,4769 ****
  
    alpha_current_align = n;
  
!   if (label != NULL)
      {
-       assert (S_GET_SEGMENT (label) == now_seg);
        symbol_set_frag (label, frag_now);
        S_SET_VALUE (label, (valueT) frag_now_fix ());
      }
  
!   record_alignment(now_seg, n);
  
    /* ??? if alpha_flag_relax && force && elf, record the requested alignment
       in a reloc for the linker to see.  */
--- 4756,4768 ----
  
    alpha_current_align = n;
  
!   if (label != NULL && S_GET_SEGMENT (label) == now_seg)
      {
        symbol_set_frag (label, frag_now);
        S_SET_VALUE (label, (valueT) frag_now_fix ());
      }
  
!   record_alignment (now_seg, n);
  
    /* ??? if alpha_flag_relax && force && elf, record the requested alignment
       in a reloc for the linker to see.  */


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Assembly errors with lockmeter
  1999-11-08  0:47     ` Assembly errors with lockmeter Richard Henderson
@ 1999-11-08 14:03       ` Peter Rival
  1999-11-24  5:27         ` Richard Henderson
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Rival @ 1999-11-08 14:03 UTC (permalink / raw)
  To: axp-list

[-- Attachment #1: Type: text/plain, Size: 2921 bytes --]

Richard Henderson wrote:

> On Tue, Nov 02, 1999 at 08:41:15PM +0000, Peter Rival wrote:
> >         mb
> > .section .text2,"ax"
> > 6:
> > .previous
> >         addl $1,$31,$1    <-- Line 655
>
> This fixes it.  I do wonder what exactly you're doing with
> labels in sections with no code attached to them...
>

I wonder myself sometimes...;)  Basically I was trying to do something like "try
to grab the read lock once, and if you fail, bail out".  I was just trying to
modify read_lock to do something like that.  I suppose it would have been better
to write it more like this:

static __inline__ int _read_try_lock_(void *lock)
{
        long temp,result=0;
        __asm__ __volatile__(
        "1:     ldl_l %1,%0\n"
        "       blbs %1,6f\n"
        "       subl %1,2,%1\n"
        "       stl_c %1,%0\n"
        "       beq %1,6f\n"
        "       mb\n"
        ".section .text2,\"ax\"\n"
        "6:     mov %1,%2\n"
        ".previous"
        : "=m" (__dummy_lock(lock)), "=&r" (temp), "=&r" (result)
        : "m" (__dummy_lock(lock))
        );
        return (result != 1);  /* Was the lock grabbed? */
}

But that looks kinda ugly.  I really don't want to unconditionally copy lock into
the result, as I've already set the result to zero.  Hmmm...any assembly experts
have a better take on it?  BTW, which tree is this against - 2.95.2 or egcs
1.1.2?  Thanks for looking into it!

 - Pete

>
>         * config/tc-alpha.c (alpha_align): Check, don't assert, that
>         the previous label was in the current section before playing
>         with auto-alignment.
>
> Index: gas/config/tc-alpha.c
> ===================================================================
> RCS file: /cvs/binutils/binutils/gas/config/tc-alpha.c,v
> retrieving revision 1.6
> diff -c -p -d -r1.6 tc-alpha.c
> *** tc-alpha.c  1999/10/18 22:29:14     1.6
> --- tc-alpha.c  1999/11/08 00:42:40
> *************** alpha_align (n, pfill, label, force)
> *** 4756,4769 ****
>
>     alpha_current_align = n;
>
> !   if (label != NULL)
>       {
> -       assert (S_GET_SEGMENT (label) == now_seg);
>         symbol_set_frag (label, frag_now);
>         S_SET_VALUE (label, (valueT) frag_now_fix ());
>       }
>
> !   record_alignment(now_seg, n);
>
>     /* ??? if alpha_flag_relax && force && elf, record the requested alignment
>        in a reloc for the linker to see.  */
> --- 4756,4768 ----
>
>     alpha_current_align = n;
>
> !   if (label != NULL && S_GET_SEGMENT (label) == now_seg)
>       {
>         symbol_set_frag (label, frag_now);
>         S_SET_VALUE (label, (valueT) frag_now_fix ());
>       }
>
> !   record_alignment (now_seg, n);
>
>     /* ??? if alpha_flag_relax && force && elf, record the requested alignment
>        in a reloc for the linker to see.  */
>
> --
> To unsubscribe: send e-mail to axp-list-request@redhat.com with
> 'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

[-- Attachment #2: Type: text/html, Size: 4847 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Assembly errors with lockmeter
  1999-11-08 14:03       ` Peter Rival
@ 1999-11-24  5:27         ` Richard Henderson
  0 siblings, 0 replies; 10+ messages in thread
From: Richard Henderson @ 1999-11-24  5:27 UTC (permalink / raw)
  To: axp-list

On Mon, Nov 08, 1999 at 09:03:46AM -0500, Peter Rival wrote:
> I wonder myself sometimes...;)  Basically I was trying to do something
> like "try to grab the read lock once, and if you fail, bail out".  I
> was just trying to modify read_lock to do something like that.  I
> suppose it would have been better to write it more like this:
> 
> static __inline__ int _read_try_lock_(void *lock)
> {
>         long temp,result=0;
>         __asm__ __volatile__(
>         "1:     ldl_l %1,%0\n"
>         "       blbs %1,6f\n"
>         "       subl %1,2,%1\n"
>         "       stl_c %1,%0\n"
>         "       beq %1,6f\n"
>         "       mb\n"
>         ".section .text2,\"ax\"\n"
>         "6:     mov %1,%2\n"
>         ".previous"
>         : "=m" (__dummy_lock(lock)), "=&r" (temp), "=&r" (result)
>         : "m" (__dummy_lock(lock))

You _do_ realize that you're _still_ missing the branch
back to label 1b?

> But that looks kinda ugly.  I really don't want to unconditionally
> copy lock into the result, as I've already set the result to zero.

What you have still doesn't make sense to me.  I don't know
what you're after.


r~


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~1999-11-24  5:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-11-02 19:24 Assembly errors with lockmeter Peter Rival
1999-11-02 20:19 ` Richard Henderson
1999-11-02 20:41   ` Peter Rival
1999-11-02 20:57     ` Richard Henderson
1999-11-02 21:49       ` Cross Platform IDE Jonas Gustavsson
1999-11-03 21:32         ` Adam C Powell IV
1999-11-04  0:00           ` SV: " Jonas Gustavsson
1999-11-08  0:47     ` Assembly errors with lockmeter Richard Henderson
1999-11-08 14:03       ` Peter Rival
1999-11-24  5:27         ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox