Skip to contentSkip to conversation

two SCSI HBAs having same host no in Linux 2.4 kernel

DISCUSSION N.C.Krishna Murthy 2 participants 3 messages Mar 17, 2004 SCSI

lore
Share & tools
lore
#0 lore raw

Hi,
In 2.4 kernel ,a scsi HBA driver gets it's host no after scsi_register() call
returns.
The call to scsi_register is made from the driver's 'detect' routine. scsi_register_host calls the driver's 'detect' routine.

The following is an excerpt from scsi_register_host which does the above job.
-----------------------------------------------------------------------------

if (tpnt->use_new_eh_code) {
                spin_lock_irqsave(&io_request_lock, flags);
                tpnt->present = tpnt->detect(tpnt);
                spin_unlock_irqrestore(&io_request_lock, flags);
        } else
                tpnt->present = tpnt->detect(tpnt);

-----------------------------------------------------------------------------
In case of drivers which do not support new_eh_code, 'detect' is called without any locks. Is this SMP safe?

We were testing our iSCSI driver on an SMP machine which had a FC HBA as well. Both iSCSI driver and FC HBA had the same host no allocated. The behaviour could not be reproduced consistently though.

Please let me know in case I am missing something.

Thanx
N.C.Krishna Murthy

#1 lore raw
Quoted 2 lines · N.C.Krishna Murthy

In case of drivers which do not support new_eh_code, 'detect' is called without any locks. Is this SMP safe?

... why aren't you using the new_eh_code?

I suspect the answer is that this is part of the transition; that old drivers were expected to have their own lock inside ->detect and new ones don't. But I wasn't around for that, so I'm not sure.

Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain
#2 lore raw

Hi,
Our iSCSI driver does use new_eh_code.
Thanx
N.C.Krishna Murthy

Quoted 9 lines · Matthew Wilcox
Quoted 2 lines · N.C.Krishna Murthy

In case of drivers which do not support new_eh_code, 'detect' is called without any locks. Is this SMP safe?

... why aren't you using the new_eh_code?

I suspect the answer is that this is part of the transition; that old drivers were expected to have their own lock inside ->detect and new ones don't. But I wasn't around for that, so I'm not sure.