From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EE04C0650F for ; Mon, 5 Aug 2019 12:52:58 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 35EC82075B for ; Mon, 5 Aug 2019 12:52:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ci4vC1C3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 35EC82075B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yMU7PLs4Ds5L2jNS/AmN6Ys2NZXmRO187folh/r31SA=; b=ci4vC1C3aGajwY N1U3J5O+SThRtPbz/Z/a57dhOLLBW3iwwPyVAEg2Dl94YC8g9e0AAZXBxp5Zn+IC+V3gfsvUKpDZa L2O0ymQxiUi2XCr+sJ2px0Ma0BnaVTxnS1dbOSwGnvm8VzJg65QNn5OhaCNGUunrFdJyM+cK5EyXa ce7XUFG4lnsxa2inDvAEfRfSQeh7fiqZumogH2r1vo3ILBePBeTMidMONOoZRouVcAyvvi5ROcOVG 7APPz5zkRHbYjIGAaQJoj/cdeyxpupDsJy/dSW5+bY6KrpIhdZzs5d2DOsks2OtbvgdYVAYV1KInn eE7/tvLlcc8UHPpwLgNQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hucTx-0001yz-M4; Mon, 05 Aug 2019 12:52:57 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hucTu-0001y3-So for linux-arm-kernel@lists.infradead.org; Mon, 05 Aug 2019 12:52:56 +0000 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 3B39D337; Mon, 5 Aug 2019 05:52:52 -0700 (PDT) Received: from e107155-lin (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1D3BA3F706; Mon, 5 Aug 2019 05:52:51 -0700 (PDT) Date: Mon, 5 Aug 2019 13:52:45 +0100 From: Sudeep Holla To: Etienne Carriere Subject: Re: [PATCH v2 6/6] firmware: arm_scmi: Check if platform has released shmem before using Message-ID: <20190805125245.GA627@e107155-lin> References: <20190726134531.8928-1-sudeep.holla@arm.com> <20190726134531.8928-7-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190805_055254_967807_1AA3BB7C X-CRM114-Status: GOOD ( 19.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peng Fan , linux-kernel@vger.kernel.org, Bo Zhang , Jim Quinlan , Gaku Inami , Volodymyr Babchuk , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Aug 05, 2019 at 02:33:53PM +0200, Etienne Carriere wrote: > Hello Sudeep, > > On Fri, 26 Jul 2019 at 15:46, Sudeep Holla wrote: > > > > Sometimes platfom may take too long to respond to the command and OS > > might timeout before platform transfer the ownership of the shared > > memory region to the OS with the response. > > > > Since the mailbox channel associated with the channel is freed and new > > commands are dispatch on the same channel, OS needs to wait until it > > gets back the ownership. If not, either OS may end up overwriting the > > platform response for the last command(which is fine as OS timed out > > that command) or platform might overwrite the payload for the next > > command with the response for the old. > > > > The latter is problematic as platform may end up interpretting the > > response as the payload. In order to avoid such race, let's wait until > > the OS gets back the ownership before we prepare the shared memory with > > the payload for the next command. > > > > Reported-by: Jim Quinlan > > Signed-off-by: Sudeep Holla > > --- > > drivers/firmware/arm_scmi/driver.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c > > index 69bf85fea967..765573756987 100644 > > --- a/drivers/firmware/arm_scmi/driver.c > > +++ b/drivers/firmware/arm_scmi/driver.c > > @@ -265,6 +265,14 @@ static void scmi_tx_prepare(struct mbox_client *cl, void *m) > > struct scmi_chan_info *cinfo = client_to_scmi_chan_info(cl); > > struct scmi_shared_mem __iomem *mem = cinfo->payload; > > > > + /* > > + * Ideally channel must be free by now unless OS timeout last > > + * request and platform continued to process the same, wait > > + * until it releases the shared memory, otherwise we may endup > > + * overwriting it's response with new command payload or vice-versa > > minor typo: s/it's/its/ > maybe also s/command/message/ > Thanks for taking a look at this, both are fixed locally now. -- Regards, Sudeep _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel