All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Hirst <rhirst@linuxcare.com>
To: parisc-linux@thepuffingroup.com
Subject: Re: tar hangs on 715/75 (spinlock problem)
Date: Mon, 22 Jan 2001 21:32:19 +0000	[thread overview]
Message-ID: <20010122213219.Q3571@linuxcare.com> (raw)
In-Reply-To: <20010122165014.O3571@linuxcare.com>; from rhirst@linuxcare.com on Mon, Jan 22, 2001 at 04:50:14PM +0000

On Mon, Jan 22, 2001 at 04:50:14PM +0000, Richard Hirst wrote:
> Hi,
>   tar (and nscd) hang on my 715/75.  Same binaries/libraries work on
> the B180.  The hang is in __pthread_acquire() called from

This is because ldcw behaves differently on the 715/75 and the B180.

Take this code (which is basically a bit of libpthread):


========================= ldcw.c =============================
#include <stdio.h>
#include <time.h>

#define MAX_SPIN_COUNT  32
#define SPIN_SLEEP_DURATION     2000000

extern inline long int
testandset (int *spinlock)
{
  int ret;

  __asm__ __volatile__(
       "ldcw 0(%2),%0"
       : "=r"(ret), "=m"(*spinlock)
       : "r"(spinlock));

  return ret == 0;
}


static void __pthread_acquire(int * spinlock)
{
  int cnt = 0;
  struct timespec tm;

  while (testandset(spinlock)) {
    if (cnt < MAX_SPIN_COUNT) {
      sched_yield();
      cnt++;
    } else {
      tm.tv_sec = 0;
      tm.tv_nsec = SPIN_SLEEP_DURATION;
      nanosleep(&tm, NULL);
      cnt = 0;
    }
  }
}

int s = 1;

int main(int argc, char **argv)
{
//      printf("&s = %p\n", &s);
        __pthread_acquire(&s);

        return 0;
}
================================================================


and compile with "gcc -O -Wall -o ldcw ldcw.c"

Run it on a B180 and it completes; run it on a 715/75 and it loops
in __pthread_acquire().

If you uncomment the printf at the beginning of main() it completes
on the 715/75 also.

Is there some cacheline requirements on spinlocks that libpthread needs
to take in to account?

Richard

  parent reply	other threads:[~2001-01-22 21:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-22 16:50 [parisc-linux] tar hangs on 715/75 Richard Hirst
2001-01-22 17:44 ` Greg Ingram
2001-01-22 21:32 ` Richard Hirst [this message]
2001-01-22 22:17   ` tar hangs on 715/75 (spinlock problem) Richard Hirst
2001-01-23  0:17     ` Grant Grundler
2001-01-23  0:38       ` Ulrich Drepper
  -- strict thread matches above, loose matches on Subject: below --
2001-01-23  0:41 John Marvin

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=20010122213219.Q3571@linuxcare.com \
    --to=rhirst@linuxcare.com \
    --cc=parisc-linux@thepuffingroup.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.