All of lore.kernel.org
 help / color / mirror / Atom feed
* [parisc-linux] tar hangs on 715/75
@ 2001-01-22 16:50 Richard Hirst
  2001-01-22 17:44 ` Greg Ingram
  2001-01-22 21:32 ` tar hangs on 715/75 (spinlock problem) Richard Hirst
  0 siblings, 2 replies; 7+ messages in thread
From: Richard Hirst @ 2001-01-22 16:50 UTC (permalink / raw)
  To: parisc-linux

Hi,
  tar (and nscd) hang on my 715/75.  Same binaries/libraries work on
the B180.  The hang is in __pthread_acquire() called from
pthread_initialize().  On the B180 the code sequence goes like this
(tracing branches):

IAOQ: 40161eff 4015df47         <pthread_initialize+348>
IAOQ: 4015df53 4006b63f         <_init+1136>
IAOQ: 4006b65f 00000103         <__sigprocmask+32>
>>>> Heading for space 0 <<<<
IAOQ: 4006b66f 4006b687         <__sigprocmask+48>
IAOQ: 4006b693 40161f03         <__sigprocmask+84>
IAOQ: 40161f37 4015df37         <pthread_initialize+404>
IAOQ: 4015df43 4006e983         <_init+1120>
IAOQ: 4006e9af 4006e82f         <__cxa_atexit+44>
IAOQ: 4006e867 400860cf         <__new_exitfn+56>
IAOQ: 400860db 40160ed7         <____strtod_l_internal+15484>
IAOQ: 40160f07 40160f0b         <__pthread_mutex_lock+48>
IAOQ: 40160f0f 4016107f         <__pthread_mutex_lock+56>
IAOQ: 40161083 40164c63         <__pthread_mutex_lock+428>
IAOQ: 40164c93 4016508f         <__pthread_alt_lock+48>
IAOQ: 401650cf 40165107         <__pthread_acquire+64>
IAOQ: 4016511f 40164c97         <__pthread_acquire+144>
IAOQ: 40164cab 40164d53         <__pthread_alt_lock+72>
IAOQ: 40164d57 40164d63         <__pthread_alt_lock+244>
IAOQ: 40164d7b 40161087         <__pthread_alt_lock+280>
IAOQ: 4016109b 4006e86b         <__pthread_mutex_lock+452>
IAOQ: 4006e893 4006e8c7         <__new_exitfn+100>
etc

while on the 715/75 it goes like this:

IAOQ: 40161eff 4015df47         <pthread_initialize+348>
IAOQ: 4015df53 4006b63f         <_init+1136>
IAOQ: 4006b65f 00000103         <__sigprocmask+32>
>>>> Heading for space 0 <<<<
IAOQ: 4006b66f 4006b687
IAOQ: 4006b693 40161f03
IAOQ: 40161f37 4015df37
IAOQ: 4015df43 4006e983
IAOQ: 4006e9af 4006e82f
IAOQ: 4006e867 400860cf
IAOQ: 400860db 40160ed7
IAOQ: 40160f07 40160f0b
IAOQ: 40160f0f 4016107f
IAOQ: 40161083 40164c63
IAOQ: 40164c93 4016508f         <__pthread_alt_lock+48>
IAOQ: 401650df 4015dba7         <__pthread_acquire+80>
IAOQ: 4015dbb3 400f546f         <_init+208>
IAOQ: 400f5473 00000103         <sched_yield+4>
>>>> Heading for space 0 <<<<


from which I conclude that __pthread_acquire(int *spinlock) found the
spinlock held.

Relevant bit of pthread_initialize() looks like this:

  sigprocmask(SIG_BLOCK, &mask, NULL);
  /* Register an exit function to kill all other threads. */
  /* Do it early so that user-registered atexit functions are called
     before pthread_*exit_process. */
#ifndef HAVE_Z_NODELETE
  if (__builtin_expect (&__dso_handle != NULL, 1))
    __cxa_atexit ((void (*) (void *)) pthread_atexit_process, NULL,
                  __dso_handle);
  else
#endif
    __on_exit (pthread_onexit_process, NULL);


Do other people see this problem on 715/old machines?  Just type 'tar';
if you have the problem you'll never see the usage message.

Even better, does anyone have any suggestions as to what might be
causing it?  I am using taggarts new tarball nfsroot.

Richard

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: tar hangs on 715/75 (spinlock problem)
@ 2001-01-23  0:41 John Marvin
  0 siblings, 0 replies; 7+ messages in thread
From: John Marvin @ 2001-01-23  0:41 UTC (permalink / raw)
  To: parisc-linux

> On Mon, Jan 22, 2001 at 04:50:14PM +0000, Richard Hirst wrote:
>
> This is because ldcw behaves differently on the 715/75 and the B180.
>
> Grant tells me spinlock words have to be the first word of a cacheline,

Both the PARISC 1.1 and PARISC 2.0 architecture specifications require
that ldcw and ldcd targets be 16 byte aligned. What actually happens
when the target is not 16 byte aligned is unspecified. I believe that
on PCXT' processors you get an unaligned fault. I think ldcw works
on 4 byte boundaries on PCXL2, PCXU and PCXW, but I am not certain of
that. As you can already see, it does not work on other processors like
PCXS, PCXT and PCXL, and the behaviour may be different on each one.

> so that would be why my example code broke.  However, libpthreads uses
> spinlocks and doesn't appear to force any alignment.
>
> I think the libpthreads spinlock definitions come from
> glibc/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h, struct
> pthread_mutex_t, spinlock is inside __m_lock.  No alignment is
> specified.  When debugging tar, I found the spinlock word at
> 0x4014df4c.

I brought this whole issue up a month ago (See "ldcw in __pthread_acquire"
in the December archive of the parisc-linux mailing list). Matthew Wilcox
suggested adding a 16 byte aligned attribute to fix the problem. Then
a long discussion ensued, discussing the advantages and disadvantages
of doing spinlocks in user space. I think the general consensus was
that we should eventually do an implementation that spins for a while
in user space and then goes to the kernel for arbitration.

So, the long term correct solution should be put on the todo list. But,
for now, Matt Taggart is going to create a hppa specific version of
pthreadtypes.h and make the following changes:

    1) move the __spinlock field in the _pthread_fastlock definition
    to be the first field in the structure.
    2) Add an __attribute__((aligned(16))) to that structure.
    3) Add an __attribute__((aligned(16))) to the pthread_spinlock_t
       type definition.

He'll test this on a C110 to see if the unaligned fault goes away, and
if it does he will check it in. This should also fix the problems with
the same root cause on other processors.

John Marvin
jsm@fc.hp.com

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

end of thread, other threads:[~2001-01-23  0:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` tar hangs on 715/75 (spinlock problem) Richard Hirst
2001-01-22 22:17   ` 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

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.