Re: Serious problem with ticket spinlocks on ia64

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Petr Tesarik
Date: Friday, September 3, 2010 - 7:35 am

On Friday 03 of September 2010 11:04:37 Petr Tesarik wrote:

I did this and I feel dumber than ever. Basically, I replaced this snippet:

	ticket = ia64_fetchadd(1, p, acq);

with:

	int	tmp;
	do {
		ticket = ACCESS_ONCE(lock->lock);
		asm volatile (
			"mov ar.ccv=%1\n"
			"add %0=1,%1;;\n"
			"cmpxchg4.acq %0=[%2],%0,ar.ccv\n"
			: "=r" (tmp)
			: "r" (ticket), "r" (&lock->lock)
			: "ar.ccv");
	} while (tmp != ticket);

Just to make sure I didn't miss something, this compiled to:

0xa0000001008dacb0: [MMI]       nop.m 0x0
0xa0000001008dacb1:             ld4.acq r15=[r32]
0xa0000001008dacb2:             nop.i 0x0;;
0xa0000001008dacc0: [MII]       mov.m ar.ccv=r15
0xa0000001008dacc1:             adds r14=1,r15;;
0xa0000001008dacc2:             nop.i 0x0
0xa0000001008dacd0: [MII]       cmpxchg4.acq r14=[r32],r14,ar.ccv
0xa0000001008dacd1:             nop.i 0x0
0xa0000001008dacd2:             nop.i 0x0;;
0xa0000001008dace0: [MIB]       nop.m 0x0
0xa0000001008dace1:             cmp4.eq p7,p6=r14,r15
0xa0000001008dace2:       (p06) br.cond.dptk.few 0xa0000001008dacb0

My test module recorded the following sequence on the failing CPU:

  }, {
    ip = 0xa00000010012f7b0,
    addr = 0xe000000181925c08,
    oldvalue = 0xffff0000,
    newvalue = 0x0,
    task = 0xe000000186930000
  }, {
    ip = 0xa0000001008dacd0,
    addr = 0xe000000181925c08,
    oldvalue = 0x0,
    newvalue = 0x0,
    task = 0xe000000186930000
  }, {
    ip = 0xa0000001008dacd0,
    addr = 0xe000000181925c08,
    oldvalue = 0x1,
    newvalue = 0x0,
    task = 0xe000000186930000
  }, {
    ip = 0xa0000001008dacd0,
    addr = 0xe000000181925c08,
    oldvalue = 0x1,
    newvalue = 0x0,
    task = 0xe000000186930000
  }, {
    ip = 0xa0000001008dacd0,
    addr = 0xe000000181925c08,
    oldvalue = 0x0,
    newvalue = 0x0,
    task = 0xe000000186930000
  }, {
    ip = 0xa0000001008dacd0,
    addr = 0xe000000181925c08,
    oldvalue = 0x1,
    newvalue = 0x1,
    task = 0xe000000186930000
  }, {

I didn't see values around zero on any other CPU in the system. So, either 
there is something seriously broken in hardware, or I made a silly mistake in 
the monitoring code.

I'm attaching my SystemTap script. I know it's hacky, but it worked for me.

Oh, I had to make two modification to the running kernel:

1. in ia64_fault()
By default the value of cr.ifa is not passed to the die notifiers, so I 
(mis)used the ar_ssd field to store the ifa before calling notify_die() for 
the debug faults.

2. in ivt.S
On all interrupt entries I added code similar to this (just using different 
registers if appropriate):

	movl r3 = (1 << 24)
	mov r15 = psr
	;;
	or  r3 = r3,r15
	;;
	mov psr.l = r3
	;;
	srlz.d
	;;

Am I blind and did I do something obviously wrong?

Petr Tesarik
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Serious problem with ticket spinlocks on ia64, Petr Tesarik, (Fri Aug 27, 6:37 am)
Re: Serious problem with ticket spinlocks on ia64, Hedi Berriche, (Fri Aug 27, 6:48 am)
Re: Serious problem with ticket spinlocks on ia64, Petr Tesarik, (Fri Aug 27, 7:09 am)
Re: Serious problem with ticket spinlocks on ia64, Hedi Berriche, (Fri Aug 27, 7:31 am)
Re: Serious problem with ticket spinlocks on ia64, Petr Tesarik, (Fri Aug 27, 7:40 am)
Re: Serious problem with ticket spinlocks on ia64, Hedi Berriche, (Fri Aug 27, 7:52 am)
RE: Serious problem with ticket spinlocks on ia64, Luck, Tony, (Fri Aug 27, 9:08 am)
Re: Serious problem with ticket spinlocks on ia64, Petr Tesarik, (Fri Aug 27, 9:37 am)
Re: Serious problem with ticket spinlocks on ia64, Petr Tesarik, (Fri Aug 27, 10:16 am)
Re: Serious problem with ticket spinlocks on ia64, Hedi Berriche, (Fri Aug 27, 11:20 am)
Re: Serious problem with ticket spinlocks on ia64, Petr Tesarik, (Fri Aug 27, 12:40 pm)
RE: Serious problem with ticket spinlocks on ia64, Luck, Tony, (Fri Aug 27, 1:29 pm)
Re: Serious problem with ticket spinlocks on ia64, Petr Tesarik, (Fri Aug 27, 1:41 pm)
Re: Serious problem with ticket spinlocks on ia64, Petr Tesarik, (Fri Aug 27, 2:03 pm)
RE: Serious problem with ticket spinlocks on ia64, Luck, Tony, (Fri Aug 27, 2:11 pm)
Re: Serious problem with ticket spinlocks on ia64, Petr Tesarik, (Fri Aug 27, 3:13 pm)
RE: Serious problem with ticket spinlocks on ia64, Luck, Tony, (Fri Aug 27, 4:26 pm)
RE: Serious problem with ticket spinlocks on ia64, Luck, Tony, (Fri Aug 27, 4:55 pm)
Re: Serious problem with ticket spinlocks on ia64, Hedi Berriche, (Fri Aug 27, 5:28 pm)
RE: Serious problem with ticket spinlocks on ia64, Luck, Tony, (Fri Aug 27, 10:01 pm)
RE: Serious problem with ticket spinlocks on ia64, Luck, Tony, (Mon Aug 30, 11:17 am)
Re: Serious problem with ticket spinlocks on ia64, Petr Tesarik, (Mon Aug 30, 2:41 pm)
Re: Serious problem with ticket spinlocks on ia64, Tony Luck, (Mon Aug 30, 3:43 pm)
Re: Serious problem with ticket spinlocks on ia64, Tony Luck, (Tue Aug 31, 3:17 pm)
Re: Serious problem with ticket spinlocks on ia64, Tony Luck, (Wed Sep 1, 4:09 pm)
Re: Serious problem with ticket spinlocks on ia64, Hedi Berriche, (Wed Sep 1, 5:26 pm)
Re: Serious problem with ticket spinlocks on ia64, Tony Luck, (Thu Sep 2, 5:06 pm)
Re: Serious problem with ticket spinlocks on ia64, Petr Tesarik, (Fri Sep 3, 2:04 am)
Re: Serious problem with ticket spinlocks on ia64, Petr Tesarik, (Fri Sep 3, 7:35 am)
Re: Serious problem with ticket spinlocks on ia64, Petr Tesarik, (Fri Sep 3, 7:52 am)
Re: Serious problem with ticket spinlocks on ia64, Tony Luck, (Fri Sep 3, 8:50 am)
Re: Serious problem with ticket spinlocks on ia64, Petr Tesarik, (Mon Sep 6, 7:47 am)
Re: Serious problem with ticket spinlocks on ia64, Petr Tesarik, (Tue Sep 7, 6:17 am)
Re: Serious problem with ticket spinlocks on ia64, Tony Luck, (Tue Sep 7, 10:35 am)
Re: Serious problem with ticket spinlocks on ia64, Tony Luck, (Wed Sep 8, 8:55 am)
Re: Serious problem with ticket spinlocks on ia64, Dave Jones, (Thu Sep 9, 7:55 pm)