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

Commit 37fd1329 authored by Edgar Flores's avatar Edgar Flores
Browse files

msm: adsprpc: ignoring error messages for duplicate RPC respond packets



Ignoring duplicate packets in high concurrency scenarios when using
early_wake feature. This will avoid system restart since duplicate
packets are causing many error messages to be send to kernel logs.

Change-Id: I214d415c6df016268459bb5dad33e73d20dac925
Signed-off-by: default avatarEdgar Flores <edgarf@codeaurora.org>
parent 485cd699
Loading
Loading
Loading
Loading
+20 −11
Original line number Original line Diff line number Diff line
@@ -447,6 +447,7 @@ struct fastrpc_apps {
	struct wakeup_source *wake_source_secure;
	struct wakeup_source *wake_source_secure;
	/* Non-secure subsystem like CDSP will use regular client */
	/* Non-secure subsystem like CDSP will use regular client */
	struct wakeup_source *wake_source;
	struct wakeup_source *wake_source;
	uint32_t duplicate_rsp_err_cnt;
};
};


struct fastrpc_mmap {
struct fastrpc_mmap {
@@ -4517,7 +4518,7 @@ static int fastrpc_rpmsg_callback(struct rpmsg_device *rpdev, void *data,
	struct smq_invoke_ctx *ctx = NULL;
	struct smq_invoke_ctx *ctx = NULL;
	struct fastrpc_apps *me = &gfa;
	struct fastrpc_apps *me = &gfa;
	uint32_t index, rsp_flags = 0, early_wake_time = 0;
	uint32_t index, rsp_flags = 0, early_wake_time = 0;
	int err = 0, cid = -1;
	int err = 0, cid = -1, ignore_rpmsg_err = 0;
	struct fastrpc_channel_ctx *chan = NULL;
	struct fastrpc_channel_ctx *chan = NULL;
	unsigned long irq_flags = 0;
	unsigned long irq_flags = 0;


@@ -4550,14 +4551,18 @@ static int fastrpc_rpmsg_callback(struct rpmsg_device *rpdev, void *data,


	spin_lock_irqsave(&chan->ctxlock, irq_flags);
	spin_lock_irqsave(&chan->ctxlock, irq_flags);
	ctx = chan->ctxtable[index];
	ctx = chan->ctxtable[index];
	VERIFY(err, !IS_ERR_OR_NULL(ctx));
	VERIFY(err, !IS_ERR_OR_NULL(ctx) &&
	if (err)
		(ctx->ctxid == (rsp->ctx & ~CONTEXT_PD_CHECK)) &&
		goto bail_unlock;
		ctx->magic == FASTRPC_CTX_MAGIC);

	if (err) {
	VERIFY(err, ((ctx->ctxid == (rsp->ctx & ~CONTEXT_PD_CHECK)) &&
		/*
			ctx->magic == FASTRPC_CTX_MAGIC));
		 * Received an anticipatory COMPLETE_SIGNAL from DSP for a
	if (err)
		 * context after CPU successfully polling on memory and
		 * completed processing of context. Ignore the message.
		 */
		ignore_rpmsg_err = (rsp_flags == COMPLETE_SIGNAL) ? 1 : 0;
		goto bail_unlock;
		goto bail_unlock;
	}


	if (rspv2) {
	if (rspv2) {
		VERIFY(err, rspv2->version == FASTRPC_RSP_VERSION2);
		VERIFY(err, rspv2->version == FASTRPC_RSP_VERSION2);
@@ -4569,11 +4574,15 @@ static int fastrpc_rpmsg_callback(struct rpmsg_device *rpdev, void *data,
	spin_unlock_irqrestore(&chan->ctxlock, irq_flags);
	spin_unlock_irqrestore(&chan->ctxlock, irq_flags);
bail:
bail:
	if (err) {
	if (err) {
		err = -ENOKEY;
		if (!ignore_rpmsg_err)
			ADSPRPC_ERR(
			ADSPRPC_ERR(
				"invalid response data %pK, len %d from remote subsystem err %d\n",
				"invalid response data %pK, len %d from remote subsystem err %d\n",
				data, len, err);
				data, len, err);
		err = -ENOKEY;
		else
			me->duplicate_rsp_err_cnt++;
	}
	}

	return err;
	return err;
}
}