From mboxrd@z Thu Jan 1 00:00:00 1970 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 89A6E249FE; Mon, 4 Mar 2024 10:14:56 +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=1709547299; cv=none; b=clOntgSpgtQOPnrjM+T2zI6NEl3TEwqqe1I4FnaWjHjkla24IdewY2n5T6SULXckVQ4g5Iykx6xpMNSJJEaKgzQwJQGDLn4JprqDvsi8uT4pWutmVUPhNt9RiVFI6Db+pwTyvpMpL2qWqA4qwlwmZKivruOS+CfdK2x40mVd22Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709547299; c=relaxed/simple; bh=l1WERtT5arsgrWURcH/8kAmZA8tXvv8Qm9AF3iNFUnE=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:To:From: References:In-Reply-To; b=WZtDF0PsVwtc0XDWeMPb/G4OA2PTWNqCXQq7YQAKz9Lh8d68pH5UjbUBXikBR/Vm8NPDyEBri/F5pd6PISemdYPV3l+ovsWKzMUQhZe2D6g0t5YdcWkESpGGBt3mZ6o4BnO90WUH/O5lgrzvqQWp8daN5JCLqX2eg9fKn5ylBbs= 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=Ym8KY+n2; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Ym8KY+n2" Received: by mail.gandi.net (Postfix) with ESMTPSA id 1275A1C0004; Mon, 4 Mar 2024 10:14:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709547294; 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=rwK2LvulJHcbE7EmhorBdfblFEGwYo80VFJJkLx6bEM=; b=Ym8KY+n2YskzH42HV2pYni6ovFBEES1RrCl8btmcC5bGzboVaC+z71RtEB0GOGiEYVX7HM SV4gJnS44PUjERVjsW1NEqHGR2hbGYkOYE8ifxHS0iJEsncm1w6qMaBKRxMRdxJCgBfAvu rao6ZStM6bI9yioHYxMRNbR+P7LgggIZO9jg4NSbdPRDuZrlh3kFDs7e0+lIJngJZgZ/rQ ljGLKo/FdYEfyX6HqxXPCKHH9xnI0guJKrtuXPYrvoWsr7qsXL1jx0RD09mJF6EqonEf9b 0nnWI8iPOODQBB0isjQrT+Oypb/zfx1khrhL+pbIdcZV4x9fTUbmL/BqUqaV+Q== Precedence: bulk X-Mailing-List: linux-mips@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, 04 Mar 2024 11:14:53 +0100 Message-Id: Subject: Re: [PATCH v2 06/11] i2c: nomadik: support short xfer timeouts using waitqueue & hrtimer Cc: "Linus Walleij" , "Andi Shyti" , "Rob Herring" , "Krzysztof Kozlowski" , "Conor Dooley" , "Thomas Bogendoerfer" , , , , , , "Gregory Clement" , "Vladimir Kondratiev" , "Thomas Petazzoni" , "Tawfik Bayouk" To: "Wolfram Sang" From: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: aerc 0.15.2 References: <20240229-mbly-i2c-v2-0-b32ed18c098c@bootlin.com> <20240229-mbly-i2c-v2-6-b32ed18c098c@bootlin.com> In-Reply-To: X-GND-Sasl: theo.lebrun@bootlin.com Hello, On Mon Mar 4, 2024 at 10:18 AM CET, Wolfram Sang wrote: > 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 th= e > > 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 Thanks for the reviews Wolfram. > Nit: > > > - int timeout; > > + int timeout_usecs; > > I think 'unsigned' makes a lot of sense here. Maybe u32 even? Yes unsigned would make sense. unsigned int or u32, I wouldn't know which to pick. Regards, -- Th=C3=A9o Lebrun, Bootlin Embedded Linux and Kernel engineering https://bootlin.com