Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1168871rdb; Mon, 19 Feb 2024 06:32:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUiWBVzPwtxM2IzOFFiAJHpBgHh6S0GQV2Tvfkr/JrAZYcUjRwrXSw2zJv9MnBW7jRKaYVhD8cgYNt3Gzv04HLDffSsMuEXjvhzkca5/g== X-Google-Smtp-Source: AGHT+IGDJxcc8X53ll/U2QmLvszQv2JG9hrmvJ7EPX3qliCzYPAkmwsPclF2O81eY4uqT1En8XvU X-Received: by 2002:a05:6a21:2d07:b0:19e:99c0:c1eb with SMTP id tw7-20020a056a212d0700b0019e99c0c1ebmr17611219pzb.51.1708353124943; Mon, 19 Feb 2024 06:32:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708353124; cv=pass; d=google.com; s=arc-20160816; b=HQAdFQZI006PNnZ7OruOhZQH8WbTtCwRWfe/+bGCLq2Y2ULlbaL4ODqsLxxxUM2NQ0 zwnfmx0mBop3SAOVmLSCwRXHVat8NlnlwvweFuSKezEbCLCyBgCYv/VAMIKaGXKyI+aF uqkuK+eZSoqIibGFhgQOOwQCwuw8S203vHl3eZH/5GvPEIxsrHnlE92TMbUWgM7eHAeA n5071RHzHOMeGc8KATKG3mIL3zQw2TKZ7jiOz4UShNpRl9p0j+dQPNQ/6w8lhvFcAVbJ mzzfJC4hghn1/Quyon7VLrAUI+X6oTsy2sHUxk+gQerKqHqW6A/KVCX5dcXKZgGh4RDf lYog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:from:to:cc:subject:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=hKfqt+6AH9WiehjZH1IaTO+O21L0m+AX+DTUgObkBAY=; fh=VxiA6NlNkYG7yRJR7zgUocvd5D+8Kt6BSDV3aFo6BHE=; b=j5iQ5B9w5SRX75mvJtMiWB7FPty6wBAngCEsrbMZFoM896WNmvzQSbL0LCY2WVpl5K wXjsmI5wC5o6wrv4Pw+IzMGlK6kPbnvLhihLy2dWW3F6cfznFZgN+Ntfuumhbkz002my /f2rndcYqpS20p2QwEcxngCWLlCTT2U0gnPZAmNSwljCsnYC7lM1GjqBgQBEeNZYb5ZS 8OfAoVjMgEBOuEMXsgDUTIPQ0ksDzOj15Cb8IyXbIz2gkPgyzBIwEOjYjD1GT4sR8jbI uMLBMVXKv0mZMJzjvRa0pe9tZC0+RGhtXXAq50IiQ0ug/QTfKfJEl1UUOj11a4cyyTEV m8PQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=kC7uVdmQ; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-71481-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71481-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g7-20020a056a000b8700b006e03c7ff47asi4645165pfj.124.2024.02.19.06.32.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 06:32:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71481-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=@bootlin.com header.s=gm1 header.b=kC7uVdmQ; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-71481-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71481-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com 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 86110282CCB for ; Mon, 19 Feb 2024 14:32:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77D871DDFC; Mon, 19 Feb 2024 14:31:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="kC7uVdmQ" Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (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 58F151DDD5; Mon, 19 Feb 2024 14:31:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708353110; cv=none; b=V3EGEvzHoOdySDZeqousIvQ55ZF8yz0JAsE4B7EPl2wrFxIug6TYDVsTXItGeX59ty8I4VHnxSkq8AGsH6c6jfa4GrntW9WvOWiqMHpwrtNHzV+zmDTlQG7CeU7G/5Ye92nG+6Vlqkr99Zs7ZXdryyLQyMmxkw5SDCNoPsHwmoo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708353110; c=relaxed/simple; bh=hKfqt+6AH9WiehjZH1IaTO+O21L0m+AX+DTUgObkBAY=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:To:From: References:In-Reply-To; b=TXtWzg/yICbzsBN49fh6U8KD0zvgyQhbOw9OSVOtPuwyQ42indSK83PcpB0dD2VzKcDkBlxTlCQdf8e7f4vQU7Jvi1M8667WB+EBfXeI6ovrr5yF0N9DAW/+PdMyZUy1kGLH72TTBA/qy1x+e3VEKvm0i7nbboZklhW/jyAnCWc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=kC7uVdmQ; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 9F9441C0012; Mon, 19 Feb 2024 14:31:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708353106; 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=hKfqt+6AH9WiehjZH1IaTO+O21L0m+AX+DTUgObkBAY=; b=kC7uVdmQuKOY2GZO7/+U8nGkDmIS2gUMSAn6I3uoBiu8m1t7O7ruLaNdalx34aTxFThyby 4xEjQzka7TB8XMIdmRxWxQw3OWpVgOT5vk695IlP4IdxkXuFPU4ApdZhDB5Kl+CVQpr+RC ZVvauYyA3BM0jtZ8FruNvEisL5LZS9HTI5K9Sa6dgtv2w/u3zzhXJBYg9iPSh+l2eXSZJn 3GvZd2GHfFANPZX8zWkS4LXroL2RmFjaem7TJvuJaX7ZRN/WCZfspHigpm5MWOb8kbXvhz jo71SgSyaCFgtWRj/NFHARZzLGnwwSOQ8EVbfHSHGPu9KBuRop9FCd/wV0uXpA== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 19 Feb 2024 15:31:45 +0100 Message-Id: Subject: Re: [PATCH 07/13] i2c: nomadik: support short xfer timeouts using waitqueue & hrtimer Cc: "Andi Shyti" , "Rob Herring" , "Krzysztof Kozlowski" , "Conor Dooley" , "Thomas Bogendoerfer" , , , , , , "Gregory Clement" , "Vladimir Kondratiev" , "Thomas Petazzoni" , "Tawfik Bayouk" To: "Linus Walleij" From: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: aerc 0.15.2 References: <20240215-mbly-i2c-v1-0-19a336e91dca@bootlin.com> <20240215-mbly-i2c-v1-7-19a336e91dca@bootlin.com> In-Reply-To: X-GND-Sasl: theo.lebrun@bootlin.com Hello, On Mon Feb 19, 2024 at 3:19 PM CET, Linus Walleij wrote: > On Thu, Feb 15, 2024 at 5:52=E2=80=AFPM 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. > > > > The threshold picked is one jiffy: if timeout is below that, use > > hrtimers. This threshold is NOT configurable. > > > > Implement behavior but do NOT change fetching of timeout. This means th= e > > timeout is unchanged (200ms) and the hrtimer case will never trigger. > > > > 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. > > > > Signed-off-by: Th=C3=A9o Lebrun > > Part of me want to go and fix completions to handle hrtimer timeouts > for submicrosecond timeouts, BUT I realized that this is a bit thick > request for a simple driver, so just a suggestion for something we could > do one day. This is fine with me. > Reviewed-by: Linus Walleij Indeed having to switch to another abstraction because we desire another timeout method is nonsensical. Completion supporting hrtimeouts would make sense. As you said though, this is too much for a simple driver. Thanks, -- Th=C3=A9o Lebrun, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ------------------------------------------------------------------------