Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab26f345 authored by Chris Lew's avatar Chris Lew
Browse files

rpmsg: glink: Deny intent request if reusable intent fits



In high traffic scenarios a remote may request extra intents to send
data faster. If the work thread that handles these intent requests is
starved of cpu time, then these requests can build up. Some remote
procs may not be able to handle this burst of built up intent requests.

In order to prevent intent build up, deny intent requests that can be
fulfilled by default intents that are reusable.

Change-Id: I0932b458eb5694bdd5f92f1b4dc19b578da1e4da
Signed-off-by: default avatarChris Lew <clew@codeaurora.org>
parent bb043ade
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -813,9 +813,11 @@ static void qcom_glink_handle_rx_done(struct qcom_glink *glink,
static void qcom_glink_handle_intent_req(struct qcom_glink *glink,
					 u32 cid, size_t size)
{
	struct glink_core_rx_intent *intent;
	struct glink_core_rx_intent *intent = NULL;
	struct glink_core_rx_intent *tmp;
	struct glink_channel *channel;
	unsigned long flags;
	int iid;

	spin_lock_irqsave(&glink->idr_lock, flags);
	channel = idr_find(&glink->rcids, cid);
@@ -826,6 +828,19 @@ static void qcom_glink_handle_intent_req(struct qcom_glink *glink,
		return;
	}

	spin_lock_irqsave(&channel->intent_lock, flags);
	idr_for_each_entry(&channel->liids, tmp, iid) {
		if (tmp->size >= size && tmp->reuse) {
			intent = tmp;
			break;
		}
	}
	spin_unlock_irqrestore(&channel->intent_lock, flags);
	if (intent) {
		qcom_glink_send_intent_req_ack(glink, channel, !!intent);
		return;
	}

	intent = qcom_glink_alloc_intent(glink, channel, size, false);
	if (intent)
		qcom_glink_advertise_intent(glink, channel, intent);