Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3457764pxj; Mon, 7 Jun 2021 11:04:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpjDhdKcBBDAaEmbxN04pR2UjrnTh8jmfVOXt9I34r3NyQCUERZD4jrdouYxQFRXEnhcg1 X-Received: by 2002:a17:907:693:: with SMTP id wn19mr19542855ejb.74.1623089099656; Mon, 07 Jun 2021 11:04:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623089099; cv=none; d=google.com; s=arc-20160816; b=noI4aW95ceT1CjZQNaxpIsfIHZS5XVfsUcUF9s9PBoTF1HNg9JtoGUyiWvb8eJoSY8 l13BBGlKFBVzM+Ei5PnIKljO1HR39TAqHLU85g2b6SzRyg6+2CfIoKCBgToeRk3D7ELK Vhw6FXP+cvH4bzdicwySYsQKv2d3R6pQKjf/07lC57RLUzIL5QMNbrUprjyRGHt2LmfT fEW+I6r/KzYB5T2SKdWrWFMmaDmTxXDdIVbX4U2Dzats3pofduWuoY3+f4dUgoRruKcu b04fv9ANeIdTX/bzcKd0YjntPg8Km16FThqUtT0WZmXzVHyB6T16UUx01nWYH+MrVi+/ ZGrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=46JzXqGW/DtGEKpXpFPkGNtU7Dg6/e0+I8JKardNsFE=; b=Nk6pDFTpZj+YYFGUnZKGzi+LLEia/+tZKBQF/b8AD1KJiLJ7KWa2CedD0SOKhptSb8 7Z153tel0kNoIo5v1P1tpKa/vQnwK4xEuFMQgm8q+dkWED2w6rGYznlyH/aHHQ36HyEX GzC4pJY69lyzJrE+RMHf3p/ZKYQolkjBJf7NYYlFvwmpW1BwQyI/SyiNHR8/jkWg1rik g+wfxeUSOcZZgTCiOrN+AIwrJT+i98071R5w+X6KN50pjy0xDLXWN9IPJncRKdQ33JvE cRqxlWW61ZdGcBBLjNCGwPRzNT0TJN/ygygGOzri4vPn+xVwVa/J4xNCoueOejnlpCq+ waWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p13si590424eja.162.2021.06.07.11.04.35; Mon, 07 Jun 2021 11:04:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231478AbhFGSDk (ORCPT + 99 others); Mon, 7 Jun 2021 14:03:40 -0400 Received: from foss.arm.com ([217.140.110.172]:39426 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231239AbhFGSDi (ORCPT ); Mon, 7 Jun 2021 14:03:38 -0400 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 6AA3812FC; Mon, 7 Jun 2021 11:01:46 -0700 (PDT) Received: from e120937-lin (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AB31D3F73D; Mon, 7 Jun 2021 11:01:44 -0700 (PDT) Date: Mon, 7 Jun 2021 19:01:37 +0100 From: Cristian Marussi To: Sudeep Holla Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, f.fainelli@gmail.com, etienne.carriere@linaro.org, vincent.guittot@linaro.org, souvik.chakravarty@arm.com Subject: Re: [RFC PATCH 01/10] firmware: arm_scmi: Reset properly xfer SCMI status Message-ID: <20210607180137.GB40811@e120937-lin> References: <20210606221232.33768-1-cristian.marussi@arm.com> <20210606221232.33768-2-cristian.marussi@arm.com> <20210607173809.et6fzayvubsosvso@bogus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210607173809.et6fzayvubsosvso@bogus> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 07, 2021 at 06:38:09PM +0100, Sudeep Holla wrote: > On Sun, Jun 06, 2021 at 11:12:23PM +0100, Cristian Marussi wrote: > > When an SCMI command transfer fails due to some protocol issue an SCMI > > error code is reported inside the SCMI message payload itself and it is > > then retrieved and transcribed by the specific transport layer into the > > xfer.hdr.status field by transport specific .fetch_response(). > > > > The core SCMI transport layer never explicitly reset xfer.hdr.status, > > so when an xfer is reused, if a transport misbehaved in handling such > > status field, we risk to see an invalid ghost error code. > > > > Reset xfer.hdr.status to SCMI_SUCCESS right before each transfer is > > started. > > > > Any particular reason why it can't be part of xfer_get_init which has other > initialisations ? If none, please move it there. > Well it was there initially then I moved it here. The reason is mostly the same as the reason for the other patch in this series that adds a reinit_completion() in this same point: the core does not forbid to reuse an xfer multiple times, once obtained with xfer_get() or xfer_get_init(), and indeed some protocols do such a thing: they implements such do_xfer looping and bails out on error. In the way that it is implemented now in protocols poses no problem indeed because the do_xfer loop bails out on error and the xfer is put, but as soon as some protocol is implemented that violates this common practice and it just keeps on reuse an xfer after an error fo other do_xfers() this breaks...so it seemed more defensive to just reinit the completion and the status before each send. Thanks, Cristian > -- > Regards, > Sudeep