Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1743344lqg; Mon, 4 Mar 2024 02:18:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX2tHrvC8Ju3Q63flfv0a1gZtF19oATo18vQKSH50yznCLoa4Qq7SESrELudcV7aDTmaHUqowPksYn+DJcd6LICNyQilx9D4bKOc/X2SA== X-Google-Smtp-Source: AGHT+IFGagLRXQ2T8qizGzD11/i6ZNaO6QsRPyimFYMdv/9voi+iVYrV3UvAP6IenedybZjj73n1 X-Received: by 2002:a05:6a20:9e49:b0:1a0:eb42:a708 with SMTP id mt9-20020a056a209e4900b001a0eb42a708mr15050000pzb.18.1709547494579; Mon, 04 Mar 2024 02:18:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709547494; cv=pass; d=google.com; s=arc-20160816; b=Hunc99R0dX7nThWfxpwXKpTIU4xr54AW8zkBR7AkzywAcLL1MPK2KIVcg/CiRanmQg Fl1OtYrdKbsNfgZnhXoINvRnRN98Cka9FY6JnlrEtYSgjKw2W/9Xsekd1ctQAM6pjpff qAQphXwpK2kuz2m2zm4AzGstYLC9M0heU6nnS/6+NKaWii7nN5WsPZ0u+U8CpicTguts 7JfHHkg6bvZVjE33GAS52D+5+RrIKggKhZH30m8sbsa6V3RguGCJObX5NO5XbQfydk9z 8ez53D67RmK79ulFeI7aD+JeG3lppr7xdu8pGJbmu+zmsk/OKsbi0BTW9cYhZKgaEyZm CMqw== 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=rwK2LvulJHcbE7EmhorBdfblFEGwYo80VFJJkLx6bEM=; fh=ybvdazfPRpN+rA9a+1hPI3iim/t7CtV9KNNGAMOJZww=; b=aJ1z3lnL0YwLPyVZOb22ZazXDNtA8flk0ZQ8d+eiM+yxBVtifHxFUejE2yHqn1qsB1 7cmAW6iIzSgxxBijzRrqYljUJjE8bDsGQZid5XfAFdwD4tgTdyYXWeM2psfnwsE+hCQ3 OpY7y0Vcd0qZFI+bMDg0rTsKEfleZVuGjasO8RlzhK7ximA5XEw37A5D8cNAHRvj5tz2 ApBGcnvweLZ4w1IOU/PRosHTwb2Q1hR28kVKL7v+z/lHefYWHa8ARdiDOTP/GFdswvTW R90m5PjQLvoJxtand5lXFQrMZYNokpBzqOx82XdGBTfoD9E6+1JvDxmvp7nrBx/JO67w 5U3w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Ym8KY+n2; 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-90406-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90406-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 i11-20020a63d44b000000b005dc359329fasi8197394pgj.23.2024.03.04.02.18.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 02:18:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90406-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=Ym8KY+n2; 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-90406-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90406-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 42586283072 for ; Mon, 4 Mar 2024 10:18:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90BAD24B52; Mon, 4 Mar 2024 10:15:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Ym8KY+n2" 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 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-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, 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