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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EF52EB64D7 for ; Fri, 16 Jun 2023 17:53:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229521AbjFPRx5 (ORCPT ); Fri, 16 Jun 2023 13:53:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229863AbjFPRx4 (ORCPT ); Fri, 16 Jun 2023 13:53:56 -0400 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFF471FF7 for ; Fri, 16 Jun 2023 10:53:54 -0700 (PDT) X-GND-Sasl: miquel.raynal@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1686938033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XmhN5JRzY69CGdUvuK+TfZcqXireG7UwM6MpdwGB5o8=; b=JymDD+gVHVkPb0shdZZH2+zOY35/cNke6JSaWPIPzdfP1IEa7ShSf4KkBxLj4HclKXsOOD Y1BuHgDiMLyVxxRaFs+ZpNdHUvSqdH2V0s2g2RoOiq9eXjOVyfpmqjYHydKSnt7p80y6aN FoaJOq6cl2lfBOQg6RfrF1T6PWiXEbhl9Bntxhw2EIEzf6vH8O/Sfw5nHAs9Jf8DNY5riV G3y7SrIMxZP29KqrDQapXZ+dDzO237kL5h5oeBWZ2a6L9+3ZDlCQQL7vzkaX34ysOEA/ZI jl3MJZt1tbZ07Epmr1FZSnfaFJpqykXxR9q79f2ZvW86y6br/t8qFJ3/4w3AGw== X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com X-GND-Sasl: miquel.raynal@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id D7514FF807; Fri, 16 Jun 2023 17:53:52 +0000 (UTC) Date: Fri, 16 Jun 2023 19:53:51 +0200 From: Miquel Raynal To: Mark Brown Cc: Tudor Ambarus , linux-spi@vger.kernel.org, Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , linux-arm-kernel@lists.infradead.org, Thomas Petazzoni Subject: Re: [PATCH] spi: atmel: Prevent false timeouts on long transfers Message-ID: <20230616195351.4976b702@xps-13> In-Reply-To: <71245a47-5c7e-4ff4-80c3-3b2b4d3642db@sirena.org.uk> References: <20230616141225.2790073-1-miquel.raynal@bootlin.com> <89439569-4fc3-4f5e-9392-4ed92ecb62e5@sirena.org.uk> <20230616181535.032bf9de@xps-13> <4054360c-b942-4761-a03f-e4d50a328ec0@sirena.org.uk> <20230616185906.04c4a869@xps-13> <71245a47-5c7e-4ff4-80c3-3b2b4d3642db@sirena.org.uk> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Hi Mark, broonie@kernel.org wrote on Fri, 16 Jun 2023 18:43:51 +0100: > On Fri, Jun 16, 2023 at 06:59:06PM +0200, Miquel Raynal wrote: > > broonie@kernel.org wrote on Fri, 16 Jun 2023 17:43:06 +0100: =20 > > > On Fri, Jun 16, 2023 at 06:15:35PM +0200, Miquel Raynal wrote: =20 > > > > broonie@kernel.org wrote on Fri, 16 Jun 2023 15:20:27 +0100: =20 >=20 > > > Like I say we should know the transfer speed so we can do better than > > > 4ms/10k - we know how long it takes to clock out each byte, we can ju= st > > > multiply that by the size of the transfer then add some fudge factor = for > > > setup/teardown overhead. 1s feels pretty generous too. The sun6i > > > driver for example does =20 >=20 > > > max(tfr->len * 8 * 2 / (tfr->speed_hz / 1000), 100U) =20 >=20 > > > and just doubles the length based timeout with a minimum of 100ms whi= ch > > > seems reasonable. =20 >=20 > > I already had issues with ~0.1s timeouts on NAND controllers, just > > because the machine was heavily loaded. I believe we should avoid too > > small timeouts, it does not make sense and make things worse under load= . =20 >=20 > Well, we can raise that minimum if it's causing issues - 500ms say? 1s > does feel a bit extreme for short transfers (and note that we'll use > more than 100ms for long enough transfers). Sounds reasonable. I believe it's worth the try. Cheers, Miqu=C3=A8l