From 570cd57fe62d8ba820a51604b956fb1003fdff06 Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Wed, 20 Nov 2019 12:01:56 +1100 Subject: [PATCH] LU-13005 lnet: remove LNetEQPoll There are no longer any users for LNetEQPoll, so remove it and any mention of it. Also remove the ln_eq_waitq which is no longer used. Signed-off-by: Mr NeilBrown Change-Id: If0c1a2634e879c62925314a55b4c2ae0512d1837 Reviewed-on: https://review.whamcloud.com/36843 Reviewed-by: Chris Horn Reviewed-by: Serguei Smirnov Reviewed-by: Amir Shehata Reviewed-by: James Simmons Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lnet/include/lnet/api.h | 10 +-- lnet/include/lnet/lib-types.h | 1 - lnet/lnet/api-ni.c | 1 - lnet/lnet/lib-eq.c | 144 ------------------------------------------ 4 files changed, 2 insertions(+), 154 deletions(-) diff --git a/lnet/include/lnet/api.h b/lnet/include/lnet/api.h index d89294a..9ec8948 100644 --- a/lnet/include/lnet/api.h +++ b/lnet/include/lnet/api.h @@ -145,10 +145,9 @@ int LNetMDUnlink(struct lnet_handle_md md_in); * that can be stored in an EQ. The struct lnet_event defines a structure that * holds the information about with an event. * - * There are three functions for dealing with EQs: LNetEQAlloc() is used + * There are two functions for dealing with EQs: LNetEQAlloc() is used * to create an EQ and allocate the resources needed, while LNetEQFree() - * releases these resources and free the EQ. LNetEQPoll() can be used - * to test or wait on multiple EQs. + * releases these resources and frees the EQ. * @{ */ struct lnet_eq * LNetEQAlloc(unsigned int count_in, @@ -156,11 +155,6 @@ LNetEQAlloc(unsigned int count_in, int LNetEQFree(struct lnet_eq *eventq_in); -int LNetEQPoll(struct lnet_eq **eventqs_in, - int neq_in, - signed long timeout, - struct lnet_event *event_out, - int *which_eq_out); /** @} lnet_eq */ /** \defgroup lnet_data Data movement operations diff --git a/lnet/include/lnet/lib-types.h b/lnet/include/lnet/lib-types.h index d226dec..17f0bf5 100644 --- a/lnet/include/lnet/lib-types.h +++ b/lnet/include/lnet/lib-types.h @@ -1010,7 +1010,6 @@ struct lnet { /* Event Queue container */ struct lnet_res_container ln_eq_container; - wait_queue_head_t ln_eq_waitq; spinlock_t ln_eq_wait_lock; unsigned int ln_remote_nets_hbits; diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index bb5fc97..7235dc7 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -548,7 +548,6 @@ lnet_init_locks(void) { spin_lock_init(&the_lnet.ln_eq_wait_lock); spin_lock_init(&the_lnet.ln_msg_resend_lock); - init_waitqueue_head(&the_lnet.ln_eq_waitq); init_completion(&the_lnet.ln_mt_wait_complete); mutex_init(&the_lnet.ln_lnd_mutex); } diff --git a/lnet/lnet/lib-eq.c b/lnet/lnet/lib-eq.c index db6bd52..b479a1f 100644 --- a/lnet/lnet/lib-eq.c +++ b/lnet/lnet/lib-eq.c @@ -40,10 +40,6 @@ /** * Create an event queue that has room for \a count number of events. * - * The event queue is circular and older events will be overwritten by - * new ones if they are not removed in time by the user using the - * function LNetEQPoll(). It is up to the user to determine the - * appropriate size of the event queue to prevent this loss of events. * Note that when EQ handler is specified in \a callback, no event loss * can happen, since the handler is run for each event deposited into * the EQ. @@ -200,145 +196,5 @@ lnet_eq_enqueue_event(struct lnet_eq *eq, struct lnet_event *ev) if (eq->eq_callback != LNET_EQ_HANDLER_NONE) eq->eq_callback(ev); - /* Wake anyone waiting in LNetEQPoll() */ - if (waitqueue_active(&the_lnet.ln_eq_waitq)) - wake_up_all(&the_lnet.ln_eq_waitq); lnet_eq_wait_unlock(); } - -static int -lnet_eq_dequeue_event(struct lnet_eq *eq, struct lnet_event *ev) -{ - int new_index = eq->eq_deq_seq & (eq->eq_size - 1); - struct lnet_event *new_event = &eq->eq_events[new_index]; - int rc; - ENTRY; - - /* must called with lnet_eq_wait_lock hold */ - if (LNET_SEQ_GT(eq->eq_deq_seq, new_event->sequence)) - RETURN(0); - - /* We've got a new event... */ - *ev = *new_event; - - CDEBUG(D_INFO, "event: %p, sequence: %lu, eq->size: %u\n", - new_event, eq->eq_deq_seq, eq->eq_size); - - /* ...but did it overwrite an event we've not seen yet? */ - if (eq->eq_deq_seq == new_event->sequence) { - rc = 1; - } else { - /* don't complain with CERROR: some EQs are sized small - * anyway; if it's important, the caller should complain */ - CDEBUG(D_NET, "Event Queue Overflow: eq seq %lu ev seq %lu\n", - eq->eq_deq_seq, new_event->sequence); - rc = -EOVERFLOW; - } - - eq->eq_deq_seq = new_event->sequence + 1; - RETURN(rc); -} - -static int -lnet_eq_wait_locked(signed long *timeout) -__must_hold(&the_lnet.ln_eq_wait_lock) -{ - signed long tms = *timeout; - wait_queue_entry_t wl; - int wait; - - if (tms == 0) - return -ENXIO; /* don't want to wait and no new event */ - - init_waitqueue_entry(&wl, current); - add_wait_queue(&the_lnet.ln_eq_waitq, &wl); - - lnet_eq_wait_unlock(); - - tms = schedule_timeout_interruptible(tms); - wait = tms != 0; /* might need to call here again */ - *timeout = tms; - - lnet_eq_wait_lock(); - remove_wait_queue(&the_lnet.ln_eq_waitq, &wl); - - return wait; -} - -/** - * Block the calling process until there's an event from a set of EQs or - * timeout happens. - * - * If an event handler is associated with the EQ, the handler will run before - * this function returns successfully, in which case the corresponding event - * is consumed. - * - * LNetEQPoll() provides a timeout to allow applications to poll, block for a - * fixed period, or block indefinitely. - * - * \param eventqs,neq An array of lnet_eq, and size of the array. - * \param timeout Time in jiffies to wait for an event to occur on - * one of the EQs. The constant MAX_SCHEDULE_TIMEOUT can be used to indicate an - * infinite timeout. - * \param event,which On successful return (1 or -EOVERFLOW), \a event will - * hold the next event in the EQs, and \a which will contain the index of the - * EQ from which the event was taken. - * - * \retval 0 No pending event in the EQs after timeout. - * \retval 1 Indicates success. - * \retval -EOVERFLOW Indicates success (i.e., an event is returned) and that - * at least one event between this event and the last event obtained from the - * EQ indicated by \a which has been dropped due to limited space in the EQ. - * \retval -ENOENT If there's an invalid handle in \a eventqs. - */ -int -LNetEQPoll(struct lnet_eq **eventqs, int neq, signed long timeout, - struct lnet_event *event, int *which) -{ - int wait = 1; - int rc; - int i; - ENTRY; - - LASSERT(the_lnet.ln_refcount > 0); - - if (neq < 1) - RETURN(-ENOENT); - - lnet_eq_wait_lock(); - - for (;;) { - for (i = 0; i < neq; i++) { - struct lnet_eq *eq = eventqs[i]; - - if (eq == NULL) { - lnet_eq_wait_unlock(); - RETURN(-ENOENT); - } - - rc = lnet_eq_dequeue_event(eq, event); - if (rc != 0) { - lnet_eq_wait_unlock(); - *which = i; - RETURN(rc); - } - } - - if (wait == 0) - break; - - /* - * return value of lnet_eq_wait_locked: - * -1 : did nothing and it's sure no new event - * 1 : sleep inside and wait until new event - * 0 : don't want to wait anymore, but might have new event - * so need to call dequeue again - */ - wait = lnet_eq_wait_locked(&timeout); - if (wait < 0) /* no new event */ - break; - } - - lnet_eq_wait_unlock(); - RETURN(0); -} -- 1.8.3.1