2000-12-18 20:30:45

by Boerner, Brian

[permalink] [raw]
Subject: Disabling interrupts in 2.4.x

I'm still trying to get the aacraid driver up and running on 2.4 and have
worked it down to this final problem. It appears that interrupts are not
being disabled properly using spin_lock_irqsave. I'm using 2.4.0-test11.

I make this call:
spin_lock_irqsave ( &(SpinLock->spin_lock), SpinLock->cpu_flags);

where SpinLock is of type pointer to an OS_SPINLOCK structure defined as:

typedef _OS_SPINLOCK {
spinlock_t spin_lock;
unsigned cpu_lock_count[NR_CPUS];
long cpu_flag;
long lockout_count;
} OS_SPINLOCK;


This is the same call that I was making in 2.2.x kernel and don't have any
problems.

I would expect this function to disable interrupts, but given the scale of
change between 2.2.x spinlock.h and 2.4.x spinlock.h I'm just not sure
anymore.

The only thing I am sure of is that interrupts are simply not disabled.

I've also looked at some other scsi drivers that are disabling interrupts
and they appear to be making similar calls to spin_lock_irqsave.

Does anyone have any suggestions for debugging this? Is there a call that
can be made to find out if interrupts are actually disabled?

Brian M. Boerner
System Software Developer
Adaptec, Inc.
Nashua, NH 03060


2000-12-18 20:48:26

by Andi Kleen

[permalink] [raw]
Subject: Re: Disabling interrupts in 2.4.x

> The only thing I am sure of is that interrupts are simply not disabled.

They are only disabled on the local CPU, they could still occur on other
CPUs. This is not different from 2.2.

>
> I've also looked at some other scsi drivers that are disabling interrupts
> and they appear to be making similar calls to spin_lock_irqsave.
>
> Does anyone have any suggestions for debugging this? Is there a call that
> can be made to find out if interrupts are actually disabled?

unsigned flag;
asm volatile("pushfl ; popfl %0" : "=r" (flag));
printk(KERN_DEBUG "local interrupts are %s\n", (flag & (1<<9)) ? "enabled" : "disabled");

-Andi

2000-12-18 21:00:54

by Boerner, Brian

[permalink] [raw]
Subject: RE: Disabling interrupts in 2.4.x

It's a UP configured system.

-bmb-


> -----Original Message-----
> From: Andi Kleen [mailto:[email protected]]
> Sent: Monday, December 18, 2000 3:18 PM
> To: Boerner, Brian
> Cc: '[email protected]'
> Subject: Re: Disabling interrupts in 2.4.x
>
>
> > The only thing I am sure of is that interrupts are simply
> not disabled.
>
> They are only disabled on the local CPU, they could still
> occur on other
> CPUs. This is not different from 2.2.
>
> >
> > I've also looked at some other scsi drivers that are
> disabling interrupts
> > and they appear to be making similar calls to spin_lock_irqsave.
> >
> > Does anyone have any suggestions for debugging this? Is
> there a call that
> > can be made to find out if interrupts are actually disabled?
>
> unsigned flag;
> asm volatile("pushfl ; popfl %0" : "=r" (flag));
> printk(KERN_DEBUG "local interrupts are %s\n", (flag &
> (1<<9)) ? "enabled" : "disabled");
>
> -Andi
>

2000-12-18 22:08:03

by Alan

[permalink] [raw]
Subject: Re: Disabling interrupts in 2.4.x

> I would expect this function to disable interrupts, but given the scale of
> change between 2.2.x spinlock.h and 2.4.x spinlock.h I'm just not sure
> anymore.

spin_lock_irqsave disables interrupts but only on the CPU that the lock
is taken.