From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B2B21848 for ; Tue, 26 Mar 2024 12:06:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711454776; cv=none; b=Vhhbou4fXOLwelTEkzsPpG9vg4N7f+Te38lVHJIpVsoIJV+xHXKGxPv9EthWYuKJ/LYP5Dh9k6W9Zt8LYfDj3wGaRpk1RFR/M3D11y86/bEvyVTrr1BFqCfeyE6QoCh0UIYlvo3E6GESVl9V7erXaBVt6AJ/fNEViYlZSMpSEL4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711454776; c=relaxed/simple; bh=v0uf5GrWsHyZm/0Bj5GWJXfRRxuPFhvK7S79fvE7I5o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BUSs892XOULiLScceVIsgWI20KlSkG39zKpi4vxyAbQ+bQLtZK4/aPrPDqGbGT9OfgBcad95AAPU37ws81+xkEvnDCUwjG4QE1W+76xDi3kuGBKRfqkZmMZF+0NYxJ5OF12rbF/8NqbKgQs61e2GrTMW8qPITjZr/tOKAdRzU6U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F3E712F4; Tue, 26 Mar 2024 05:06:46 -0700 (PDT) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DE3483F64C; Tue, 26 Mar 2024 05:06:12 -0700 (PDT) Date: Tue, 26 Mar 2024 12:06:10 +0000 From: Sudeep Holla To: Cristian Marussi Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 3/5] firmware: arm_scmi: Add message dump traces for bad and unexpected replies Message-ID: References: <20240325204620.1437237-1-cristian.marussi@arm.com> <20240325204620.1437237-4-cristian.marussi@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Mar 26, 2024 at 11:57:23AM +0000, Cristian Marussi wrote: > On Tue, Mar 26, 2024 at 11:24:38AM +0000, Sudeep Holla wrote: > > On Mon, Mar 25, 2024 at 08:46:18PM +0000, Cristian Marussi wrote: > > > Trace also late-timed-out, out-of-order and unexpected/spurious messages. > > > > > > Signed-off-by: Cristian Marussi > > > --- > > > drivers/firmware/arm_scmi/driver.c | 10 ++++++++++ > > > drivers/firmware/arm_scmi/mailbox.c | 4 +++- > > > 2 files changed, 13 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c > > > index 7fc1c5b1a2a4..207ed1a52d69 100644 > > > --- a/drivers/firmware/arm_scmi/driver.c > > > +++ b/drivers/firmware/arm_scmi/driver.c > > > @@ -861,6 +861,9 @@ scmi_xfer_command_acquire(struct scmi_chan_info *cinfo, u32 msg_hdr) > > > "Message for %d type %d is not expected!\n", > > > xfer_id, msg_type); > > > spin_unlock_irqrestore(&minfo->xfer_lock, flags); > > > + > > > + scmi_bad_message_trace(cinfo, msg_hdr, MSG_UNEXPECTED); > > > + > > > return xfer; > > > } > > > refcount_inc(&xfer->users); > > > @@ -885,6 +888,9 @@ scmi_xfer_command_acquire(struct scmi_chan_info *cinfo, u32 msg_hdr) > > > dev_err(cinfo->dev, > > > "Invalid message type:%d for %d - HDR:0x%X state:%d\n", > > > msg_type, xfer_id, msg_hdr, xfer->state); > > > + > > > + scmi_bad_message_trace(cinfo, msg_hdr, MSG_INVALID); > > > + > > > /* On error the refcount incremented above has to be dropped */ > > > __scmi_xfer_put(minfo, xfer); > > > xfer = ERR_PTR(-EINVAL); > > > @@ -921,6 +927,9 @@ static void scmi_handle_notification(struct scmi_chan_info *cinfo, > > > if (IS_ERR(xfer)) { > > > dev_err(dev, "failed to get free message slot (%ld)\n", > > > PTR_ERR(xfer)); > > > + > > > + scmi_bad_message_trace(cinfo, msg_hdr, MSG_NOMEM); > > > + > > > scmi_clear_channel(info, cinfo); > > > return; > > > } > > > @@ -1040,6 +1049,7 @@ void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr, void *priv) > > > break; > > > default: > > > WARN_ONCE(1, "received unknown msg_type:%d\n", msg_type); > > > + scmi_bad_message_trace(cinfo, msg_hdr, MSG_UNKNOWN); > > > break; > > > } > > > } > > > diff --git a/drivers/firmware/arm_scmi/mailbox.c b/drivers/firmware/arm_scmi/mailbox.c > > > index b8d470417e8f..fb0824af7180 100644 > > > --- a/drivers/firmware/arm_scmi/mailbox.c > > > +++ b/drivers/firmware/arm_scmi/mailbox.c > > > @@ -56,7 +56,9 @@ static void rx_callback(struct mbox_client *cl, void *m) > > > */ > > > if (cl->knows_txdone && !shmem_channel_free(smbox->shmem)) { > > > dev_warn(smbox->cinfo->dev, "Ignoring spurious A2P IRQ !\n"); > > > - return; > > > + return scmi_bad_message_trace(smbox->cinfo, > > > + shmem_read_header(smbox->shmem), > > > + MSG_MBOX_SPURIOUS); > > > > From previous patch, IIUC scmi_bad_message_trace is a void func and doesn't > > return anything. Did you not get any build error/warning for this ? > > > > No...I am building with W=1....but note that the caller itself here > rx_callback() is supposed to return a void... > > ...in V3 I may just split this into 2 lines and leave the return; alone on its > own line to avoid any confusion... Not need to respin unless I find something that needs reposting, can fix this myself. -- Regards, Sudeep