Re: Serious problem with ticket spinlocks on ia64

From: Petr Tesarik
Date: Fri Aug 27 2010 - 12:36:43 EST


On Friday 27 of August 2010 16:52:31 Hedi Berriche wrote:
> On Fri, Aug 27, 2010 at 15:40 Petr Tesarik wrote:
> | On Friday 27 of August 2010 16:31:35 Hedi Berriche wrote:
> | > That said, I'm letting my already over 36 hours run carry on chewing
> | > CPU time, and see if it will eventually trip the same problem seen with
> | > 4-byte ticket locks.
> |
> | Hm, this doesn't sound like a viable approach. Since the siglock gets
> | initialized to 0 when a new process is started, it may never actually
> | wrap around.
> |
> | I would rather attach a SystemTap probe somewhere during process fork and
> | add a bias to the siglock. That should work fine. Let me knock up the
> | SystemTap script...
>
> That would be nice. Ta!

Here it is. I don't have a system with the old 64-bit ticket spinlocks at
hand, so this is completely untested, but it should work fine.

Adjust if needed.

Petr
/* Bias the spin lock on fork */

%{
#define LOCK_BIAS ((1ULL << 32) - (1ULL << 15))
%}

function bias_siglock (task:long)
%{
struct task_struct *tsk = (struct task_struct*)THIS->task;
tsk->sighand->siglock.raw_lock.lock = LOCK_BIAS + (LOCK_BIAS << 32);
%}

function is_err (value:long)
%{
THIS->__retvalue = IS_ERR_VALUE((unsigned long)THIS->value);
%}

probe kernel.function("copy_process").return
{
if (!is_err($return))
bias_siglock($return);
}