Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1719031lqg; Mon, 4 Mar 2024 01:19:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVnuk8VcrpLhJBAz/3Gwad083zDyshcsiGKlpNokogT0dxBUmW6q4IXSfWc1pVcuBlL0fsm8xLlma4hKNUYfg8xfDwB52xgiH76R0MJ0g== X-Google-Smtp-Source: AGHT+IEHETALvZ0SMgNhRQHJZAfA8wkC9vxX2uQdvZzLBT7lybR8Cp594OmGrwzUp+KbMy0AM4EW X-Received: by 2002:a17:903:1104:b0:1dc:de7f:517e with SMTP id n4-20020a170903110400b001dcde7f517emr10674895plh.22.1709543979309; Mon, 04 Mar 2024 01:19:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709543979; cv=pass; d=google.com; s=arc-20160816; b=Lb/GOUoqMD/LnJ+JkqTrcJLpiBvsXcztdRUQRIL1Yj3gWhikp0iwDtk1MRn06Vie5x yJF5DRHn8mYyEIWF+zrbR7ds/R3gbWt9NtC/vyj40jyINTeZfWEndrR/KCuhlMmAnamU mau5l48vyXYoQSig+MAmCNFr0wo4QRLwXHX4ZdOzHs8sFBGxYyN8l4aeEeSTuHzikAJ/ G9Lxa/5ybwMngU6RyB4yVC3v7lSC07bktc/hVvLslSIiKB/TTxMpaxRzDcaHIBZ9aA8U CZLPNUMeywj5Vm3S4YCcvMOmnPmPEl6YKsraHdRSyfB1XQr5ndTRF1hoG0ven/OneS7S +2zQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=7EF5sz935xVojk7NRVPz3xJo1Gj+9ykYuns0TSOkX7c=; fh=WFBbuB0+4EoISoNLKdVxh9iPtkL4XbOGRzOjhABSLNU=; b=G95OiUC8Z7Im76OoW8K3zV54qy+eebbhHQp1GAyw2lSoYid49aEef2xI89g/ckTUhQ 9nGUEbEHofj4uF63dTHivPovrjJ13Q6XIBW+0OGmBFU7VLQJwQgARdgyq1BBEzO8g9Xf WkWlTDpVDqdNnh52zQ0wdFfEjeK1yZhwJjHl9QnBq6VMdxFNU09He0n2sjeUuAQBzHGL 42PnJbqj2W01w+dF53FMaEeaDCXHCKQftUUcWv3UEGZD/Olq/t3+4dm5Pf+GXz2GezNd TA5n5VGfzydb562mfeeTlSiQHIpg0cqzJYEUNMVgq+YufcAuXG7DRtq6XG2m6MgmrVlx Hc9g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cMVaAVwB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-90295-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90295-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q12-20020a170902dacc00b001dc8df92f1dsi7136002plx.234.2024.03.04.01.19.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 01:19:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90295-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cMVaAVwB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-90295-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90295-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 54195283C1A for ; Mon, 4 Mar 2024 09:19:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6AE3722615; Mon, 4 Mar 2024 09:18:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cMVaAVwB" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80A721BDC8; Mon, 4 Mar 2024 09:18:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709543886; cv=none; b=D0obt3atJRDb5L8R26UeTe97ppoeUdpyPx18axpcIuY+Z3Yacr3UcENU0bq4FVDdEJQwvArUKB6DM/epJNA073GyK3EF5m5N/qWTZ0MaBJXFk2R32cFjtlR3qkv53U1oRl8cBOxW9NSvmDmianILgGcw0tqvPxocVlJ1VSIAK/w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709543886; c=relaxed/simple; bh=Hz5X8SjPZaPMVvkREhxPkwcMhjiRAzuRBm8lmosOsm8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aWYhGJ2mGYK66YqdSDdVwnD2UCz2Cog9mGGi7A8Kstsa+Qt6QyY9lSB6wSd8uUkRXhaNhS7dvdYJed3fo8dev3w8BbklcUbCeiLYIzcObaHH7DV11gtG+/R5oPAmS5OxbSLOSxTJyd9w1FFyJdi36mU4Hc9hWmuf1fBFGY1W4EA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cMVaAVwB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5EEFC433C7; Mon, 4 Mar 2024 09:18:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709543886; bh=Hz5X8SjPZaPMVvkREhxPkwcMhjiRAzuRBm8lmosOsm8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cMVaAVwBcvnPGrdq6e7btLLYM9gCJQP57sSCSb/GFXetumUhwhDWy4EWBcEfNHuOs nen/R8UCTax7+UIhGtc3FxuSQO9ozn82C6VBuIGCvx1vMD+24pTAKpz3Nje3Xf/I0N 6mmZQl49BemD1XRaRAAs+ffgwzHIBcQ8iZwuHGxPdyuq4w7dcT3HDTPLg9kp9G2yB+ BBtQVG7yQQ/iXqdMzkJqu+k8SjonewKeRUrQ0gv5yJ4Rg6YzEif7laeHz16KIkb0zT F5M6d4wEhuYNkksw5E8rb1nkn9Np/Q6fA/sSMFcnFRx22q2uNNONhVwWeg6zSRqx+B nIvgFipJpSi/A== Date: Mon, 4 Mar 2024 10:18:02 +0100 From: Wolfram Sang To: =?utf-8?B?VGjDqW8=?= Lebrun Cc: Linus Walleij , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Bogendoerfer , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Gregory Clement , Vladimir Kondratiev , Thomas Petazzoni , Tawfik Bayouk Subject: Re: [PATCH v2 06/11] i2c: nomadik: support short xfer timeouts using waitqueue & hrtimer Message-ID: Mail-Followup-To: Wolfram Sang , =?utf-8?B?VGjDqW8=?= Lebrun , Linus Walleij , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Bogendoerfer , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Gregory Clement , Vladimir Kondratiev , Thomas Petazzoni , Tawfik Bayouk References: <20240229-mbly-i2c-v2-0-b32ed18c098c@bootlin.com> <20240229-mbly-i2c-v2-6-b32ed18c098c@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ADopU0GSN45E8OWO" Content-Disposition: inline In-Reply-To: <20240229-mbly-i2c-v2-6-b32ed18c098c@bootlin.com> --ADopU0GSN45E8OWO Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 29, 2024 at 07:10:54PM +0100, Th=C3=A9o Lebrun wrote: > Replace the completion by a waitqueue for synchronization from IRQ > handler to task. For short timeouts, use hrtimers, else use timers. > Usecase: avoid blocking the I2C bus for too long when an issue occurs. >=20 > The threshold picked is one jiffy: if timeout is below that, use > hrtimers. This threshold is NOT configurable. >=20 > Implement behavior but do NOT change fetching of timeout. This means the > timeout is unchanged (200ms) and the hrtimer case will never trigger. >=20 > A waitqueue is used because it supports both desired timeout approaches. > See wait_event_timeout() and wait_event_hrtimeout(). An atomic boolean > serves as synchronization condition. >=20 > Reviewed-by: Linus Walleij > Signed-off-by: Th=C3=A9o Lebrun Largely: Reviewed-by: Wolfram Sang Nit: > - int timeout; > + int timeout_usecs; I think 'unsigned' makes a lot of sense here. Maybe u32 even? --ADopU0GSN45E8OWO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAmXlkcoACgkQFA3kzBSg Kba7iw/8Cjwrc5SjA/NL3KJonpOz3S37vaadRXid+bhB8XUNVUI0PMJkyw//gEc4 njYS1/v197pg+4JsPPorLhOxjDGoD14nvA+kQkZ4XDktCxU+U12NUBKDc5XgFMmN cx7+QIr8AtfJpo5Il8nNYO4xn15+F510a1qjPgTlCE4QV2sX9aeSgOazretpVNmp 03IKZDUPmP3HCFfNkGgt5PzpZpnY4RlPflThQcMYJm2wXz+E/h6VM1xqmENlhJQa 2oqZ9FNBttktiahGx8vBpGeLcSXnQF3okUiCJC1f7MCP9ApaLI7a9700eneemBLn +Q9M1Gexied95SJcIJYKzgTzN10+GOHg8P1pFsuf3NKNCmZApobOIc3Nv/zDfGum Rp08Hrq0OgTSXGyPsLPs6OSeEtEg7KvCO/WZyuLAdt+wHVEKTMYsWra3FUCu6YMB m1RIQcluy4QVlv4E61RmOI22YsKibwl2mw2WMENEbLodFPc6lvtSSiEmjWSOBL4r Pv1oTlkNjBGOpgFF1T9TByvhhmIWLCQcbAHxR2R+EGcO3NNQ7wLMFCLkm7cm1sI3 u4Y+cxDfdXz0zag7rJkp6GwzxwmNorvo90wbNA3FODizmmqFuUt6tIExR2hfxkA8 4GURp7XQJAp5kXMt5vBAaEoDDCvaa5ivgOmaq0OFdQRcYnHtHRw= =vre8 -----END PGP SIGNATURE----- --ADopU0GSN45E8OWO--