[openib-general] [PATCH][kdapl] fix spin_lock_irqsave/spin_unlock_irqrestore implementation
Itamar
itamar at mellanox.co.il
Wed May 18 04:39:48 PDT 2005
when spin_lock_irqsave and spin_unlock_irqrestore are not called in the same function
need to pass the flags form the save the store
Signed-off-by: Itamar Rabenstein <itamar at mellanox.co.il>
Index: dapl_evd_util.c
===================================================================
--- dapl_evd_util.c (revision 2374)
+++ dapl_evd_util.c (working copy)
@@ -378,20 +378,19 @@
* that the lock is held.
*/
-static struct dat_event *dapl_evd_get_event(DAPL_EVD * evd_ptr)
+static struct dat_event *dapl_evd_get_event(DAPL_EVD * evd_ptr, unsigned long *flags)
{
struct dat_event *event;
- unsigned long flags;
if (evd_ptr->evd_producer_locking_needed) {
- spin_lock_irqsave(&evd_ptr->header.lock, flags);
+ spin_lock_irqsave(&evd_ptr->header.lock, *flags);
}
event = (struct dat_event *) dapl_rbuf_remove(&evd_ptr->free_event_queue);
/* Release the lock if it was taken and the call failed. */
if (!event && evd_ptr->evd_producer_locking_needed) {
- spin_unlock_irqrestore(&evd_ptr->header.lock, flags);
+ spin_unlock_irqrestore(&evd_ptr->header.lock, *flags);
}
return event;
@@ -406,10 +405,10 @@
*/
static void dapl_evd_post_event(DAPL_EVD *evd_ptr,
- const struct dat_event *event_ptr)
+ const struct dat_event *event_ptr,
+ unsigned long flags)
{
u32 dat_status;
- unsigned long flags;
DAPL_CNO * cno_to_trigger = NULL;
dapl_dbg_log(DAPL_DBG_TYPE_EVD,
@@ -459,7 +458,7 @@
DAPL_EVD * overflow_evd_ptr)
{
struct dat_event *overflow_event;
-
+ unsigned long flags;
/* The overflow_evd_ptr mght be the same as evd.
* In that case we've got a catastrophic overflow.
*/
@@ -469,7 +468,7 @@
return;
}
- overflow_event = dapl_evd_get_event(overflow_evd_ptr);
+ overflow_event = dapl_evd_get_event(overflow_evd_ptr, &flags);
if (!overflow_event) {
/* this is not good */
overflow_evd_ptr->catastrophic_overflow = TRUE;
@@ -477,17 +476,18 @@
return;
}
dapl_evd_format_overflow_event(overflow_evd_ptr, overflow_event);
- dapl_evd_post_event(overflow_evd_ptr, overflow_event);
+ dapl_evd_post_event(overflow_evd_ptr, overflow_event, flags);
return;
}
static struct dat_event *dapl_evd_get_and_init_event(DAPL_EVD *evd_ptr,
- enum dat_event_number evno)
+ enum dat_event_number evno,
+ unsigned long *flags)
{
struct dat_event *event_ptr;
- event_ptr = dapl_evd_get_event(evd_ptr);
+ event_ptr = dapl_evd_get_event(evd_ptr, flags);
if (!event_ptr)
dapl_evd_post_overflow_event(evd_ptr->header.owner_ia->
async_error_evd, evd_ptr);
@@ -507,7 +507,8 @@
DAT_CR_HANDLE cr_handle)
{
struct dat_event *event_ptr;
- event_ptr = dapl_evd_get_and_init_event(evd_ptr, event_number);
+ unsigned long flags;
+ event_ptr = dapl_evd_get_and_init_event(evd_ptr, event_number, &flags);
/*
* Note event lock may be held on successful return
* to be released by dapl_evd_post_event(), if provider side locking
@@ -525,7 +526,7 @@
event_ptr->event_data.cr_arrival_event_data.conn_qual = conn_qual;
event_ptr->event_data.cr_arrival_event_data.cr_handle = cr_handle;
- dapl_evd_post_event(evd_ptr, event_ptr);
+ dapl_evd_post_event(evd_ptr, event_ptr, flags);
return DAT_SUCCESS;
}
@@ -537,7 +538,8 @@
void *private_data)
{
struct dat_event *event_ptr;
- event_ptr = dapl_evd_get_and_init_event(evd_ptr, event_number);
+ unsigned long flags;
+ event_ptr = dapl_evd_get_and_init_event(evd_ptr, event_number, &flags);
/*
* Note event lock may be held on successful return
* to be released by dapl_evd_post_event(), if provider side locking
@@ -554,7 +556,7 @@
= private_data_size;
event_ptr->event_data.connect_event_data.private_data = private_data;
- dapl_evd_post_event(evd_ptr, event_ptr);
+ dapl_evd_post_event(evd_ptr, event_ptr, flags);
return DAT_SUCCESS;
}
@@ -564,7 +566,8 @@
DAT_IA_HANDLE ia_handle)
{
struct dat_event *event_ptr;
- event_ptr = dapl_evd_get_and_init_event(evd_ptr, event_number);
+ unsigned long flags;
+ event_ptr = dapl_evd_get_and_init_event(evd_ptr, event_number, &flags);
/*
* Note event lock may be held on successful return
* to be released by dapl_evd_post_event(), if provider side locking
@@ -579,7 +582,7 @@
event_ptr->event_data.asynch_error_event_data.dat_handle =
(DAT_HANDLE) ia_handle;
- dapl_evd_post_event(evd_ptr, event_ptr);
+ dapl_evd_post_event(evd_ptr, event_ptr, flags);
return DAT_SUCCESS;
}
@@ -589,7 +592,8 @@
void *pointer)
{
struct dat_event *event_ptr;
- event_ptr = dapl_evd_get_and_init_event(evd_ptr, event_number);
+ unsigned long flags;
+ event_ptr = dapl_evd_get_and_init_event(evd_ptr, event_number, &flags);
/*
* Note event lock may be held on successful return
* to be released by dapl_evd_post_event(), if provider side locking
@@ -603,7 +607,7 @@
event_ptr->event_data.software_event_data.pointer = pointer;
- dapl_evd_post_event(evd_ptr, event_ptr);
+ dapl_evd_post_event(evd_ptr, event_ptr, flags);
return DAT_SUCCESS;
}
--
Itamar
More information about the general
mailing list