From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 8209C3EEAEB for ; Fri, 10 Jul 2026 09:28:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783675686; cv=none; b=Erqncui6DQBJIZdoVcw0C3l/RLOdoQiWsQTUvJXZjsF5alq/JJ9WqfdHx+4sKXJ0e6ej3irjK6v/vS/FYHqqUa7dJds7BRtm6agnyohLHRCEienb5WvHetYb4OYo6q2Keygs5bTHYID3pGg21xp+mQy/ANatxUhIZwIQLC9yu9Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783675686; c=relaxed/simple; bh=3W9St2a+jKGkGj0S5oGaRQjvJtDzomLECmfwJ3GV3XU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=XY5x/Zm0cUQSs2SGXdPvkWbxeLiMOnXKIaOgQgT9gf+R9V0VRi7k8V792SD8tRkvbbeplL93d9ttrG2giL1+SKfqI3m3SvMw0oVtiNHxJRkQgsQpcZ5jJiEN3gDowyX9hqcCFwYqlrfzK2at4TfHzCDJtTDF+TPA4bnNx0LVems= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=bEQZwyc8; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=F6IO4rya; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="bEQZwyc8"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="F6IO4rya" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66A7dqk6188249 for ; Fri, 10 Jul 2026 09:28:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Ea0QguoYL7HAG5QOZUHhNnUFaa6FuT9iaUs3b0VOK4E=; b=bEQZwyc8XDMXAW5T oEMWxvv0TPUNE+xjii/lGQs/yn9jua4T4pq8gYMXFaVqqv3cUCllqk9RRr0FtlZs FW6ncGBWWy53MmpI7kIlvuWR6NXQUazvB06l2jzszG69JXWFEvdVuY3fgJ6eTA4G kdh9ZpYO0R2TKghzi+ltSI7N1ljdtrWw+J8S9jvXkmApG9tpzHh/L7TMc7hPjw1X TIAWCIOdl2RbUMUEMI4jHB5vGnw7hkUeKicM/4bxTvqg0FZHIg59pjpn+27e0m0v sg+BieWuHrm/sC0Y8Rz+0LwssX/yp8NpboriYdS06O3QH1fTG5W26EU1MIvGL5Zz Pz25Zg== Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4faeesus7c-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 10 Jul 2026 09:28:00 +0000 (GMT) Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-51c9e97b626so2356791cf.1 for ; Fri, 10 Jul 2026 02:28:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1783675680; x=1784280480; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Ea0QguoYL7HAG5QOZUHhNnUFaa6FuT9iaUs3b0VOK4E=; b=F6IO4ryaLWtGoxWuuRSr1Khcgk3XEP+a0s/k4WOPCBGahPDcTnjM3XX9dc2FqI8188 dwZbsp6sP087f8Q3EnEhhl8zrtW/QDMk0i63h4HTRvYi9wbEFy93ujqL2Ld+dsB4lc95 RPOtFJdu3LwXQWW9gUjAJrE/DgLPXarfkDrWWX83PZjZRkW4R1/5lEhGyTgYff9xpl/+ V+631fh9W4762qRZtY4y5qRlXBKO9lM/ecwTWhqvqgkfUlJ6SyVUsdEsVh3TZY3nGHHQ n15xg2Y1gBVPkd/De2E903IpnQD1fDCammJwTRcO+rfA0Iaeg3RNLGAWHdu9sLpHbkXe oIng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783675680; x=1784280480; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Ea0QguoYL7HAG5QOZUHhNnUFaa6FuT9iaUs3b0VOK4E=; b=mI8jSctBgC9dGX6fQRGi0TblEefyu1WzjbcEeHUq8QWTe1EvmNfq89jDR9sGEDORQa 0TB3GeVzkJHsNL7V4KNwsviwwFBCPjtRtisyQq9gz2l46vVLzSTJ39yK2P80WPEkYdHg xUcs9ELMGhKPlgfeyLyurrl4pLtnMZb33jXgyxFppFdRnXKC/catBVPni026Q6KEFSqt vmuE7In7YX7+qXIAjNBOjhZpPn/Xr+H0+B8G7GKSOeC8Bs4DKBiQdokP4riKKjSoAbec 1LMqGx12kxu56Xm71K+x/tmygfHODPaPW0m1V7TQlw9KpF2MUJmdy78YgTRYM4Bov4BV XwSw== X-Forwarded-Encrypted: i=1; AHgh+Rr+7ZKRWHvHEntVmDEDeRPKydjudi+O2JnLLmUx3z4sjRLSBThb4SF9J7erSgLUI5IQs9uohYfFLL+IxBI=@vger.kernel.org X-Gm-Message-State: AOJu0YzjxA66dj7TZ1HXNMD6VcpQnVtvnG/coG3IET0nA9/fKhz39yxI vvLyDRc+DaguVta0kp1NjWq6Ut7Hs8dp6+LD83KNXJhB8oHmPb5eSkCUOcw9AvE0C8ycqjVpbOt d6I90tcv0QB4HxegzMPZV83dBYpt1HgihcIbqIcdzhx3eSkE7+nxfhxmftF/qxBY+3WkOQCrOsR 0= X-Gm-Gg: AfdE7clgT2D+OkP3d5rfp9xloO7yP4iA73U7amXmovg3F+61SMGIxdMqsOrhdTgMCNZ 5B8r52bLqTh1kw5tH/fhfxFlLh/bnfJ3e6I2CW6BIUH5HbHjkk6dMeuD77SIFFv8lQrp/CXskHk nb0tXExSE5ySMBTvDpcjqGvxgJc25rx89Zfxgb4YaIbcoq0s/Rms9RKMfKJPQJ+VZ3x9ZvWsl6j +11KhLmyQP5KmhG1POGJzpDek+Ldede0hTM0aqmX1B7vMVnyYXgSg14jkZAdvilaY0qVU70FQzs DxXkCYtgOzlo/HuwxqclTMthSqIEOVOwNsWW1t9RLXPCOEwzGO3Bg7ZusWQGL/NYpMX6qSfeoXw WFgo7PRASY9cYW0/MHybjVfw+5z+zjUIrrTk= X-Received: by 2002:ac8:5acd:0:b0:51a:8c9c:7de1 with SMTP id d75a77b69052e-51c9684058emr68768601cf.11.1783675679842; Fri, 10 Jul 2026 02:27:59 -0700 (PDT) X-Received: by 2002:ac8:5acd:0:b0:51a:8c9c:7de1 with SMTP id d75a77b69052e-51c9684058emr68768501cf.11.1783675679321; Fri, 10 Jul 2026 02:27:59 -0700 (PDT) Received: from [192.168.120.193] ([178.235.128.140]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c15cfac0f76sm402966166b.33.2026.07.10.02.27.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Jul 2026 02:27:58 -0700 (PDT) Message-ID: <82326bd4-59f0-45b6-8f06-38896cf9f9bb@oss.qualcomm.com> Date: Fri, 10 Jul 2026 11:27:56 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] i2c: qcom-geni: Add dynamic transfer timeout based on transfer length and frequency To: Aniket RANDIVE , mukesh.savaliya@oss.qualcomm.com, viken.dadhaniya@oss.qualcomm.com, andi.shyti@kernel.org, sumit.semwal@linaro.org, christian.koenig@amd.com Cc: linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, naresh.maramaina@oss.qualcomm.com References: <20260705135739.4038826-1-aniket.randive@oss.qualcomm.com> <4f865aaf-a400-4dc6-acaa-80dc22a36af7@oss.qualcomm.com> <6b53fa97-0fae-4ba2-a774-ae8df2c2ad4e@oss.qualcomm.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: <6b53fa97-0fae-4ba2-a774-ae8df2c2ad4e@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-GUID: 5yvg7qijSnWWw8c-K2HIzldZlK3WqW_T X-Authority-Analysis: v=2.4 cv=bbpbluPB c=1 sm=1 tr=0 ts=6a50bb20 cx=c_pps a=JbAStetqSzwMeJznSMzCyw==:117 a=PRfkaYvzSr8QmIIGAkY2Sg==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=7-yhJlWS37sO_0-qT9EA:9 a=QEXdDO2ut3YA:10 a=uxP6HrT_eTzRwkO_Te1X:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEwMDA5MSBTYWx0ZWRfX5vx2DoHEp/An W8nijlrdSwHrVCFwklc2KhR/sr8RAX3ZLo0f95Zt25CgEwkHtqd4w10veafR4ROaae1iUu7i9Nq 3jihYZo5aaH7KOWq/YGUNKodSMBfB6E= X-Proofpoint-ORIG-GUID: 5yvg7qijSnWWw8c-K2HIzldZlK3WqW_T X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEwMDA5MSBTYWx0ZWRfX9rmyVoz+6PMQ cCgZalAcNgqqxVbG5hfLuYO173euoydu3pY7ckgL4lbqvmRg9Oh182ItuS0wnTnCV9FVwyizVQu bmHfDBOGBURbXp8Q5vPXZn4tH13O+pttyWTzMLG0JlkuZhr40KoSZ9nhAoz48Dq30sRk/cORD5q w8SUnipCDpFcmZbIJcG6jgr9GLNfJMECMiG32exh3nz2xLe4bv0WUWcENatqPmECJde7RJdvIA2 4iOS8P62iHjeJsyP6u5a8DvKA8AuaR/DeXR7slOaRg4atlVBbq111z5Pbt/dSTutvB9hgRB0ufs PHXG0dOlCzEu/VcFNHw9Vto980as56wKkhs4HD5ulBv8mTnWKu8IrkI4qrAWq4DlejKV6peIbo0 PyJ4vgz3KB5kOqt506Aglc5759cV4Xez6fxwkHcYXy9xh55UGxaHvuZGK4BuvtBPZ/Zlj48yKpo JuT2TpPaUBz0R7XCbxg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-10_02,2026-07-09_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 malwarescore=0 bulkscore=0 suspectscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607100091 On 7/9/26 8:28 AM, Aniket RANDIVE wrote: > Thanks Konrad for the review. > > Sorry, I missed your comments on the v2 patch and ended up posting v3. I'm happy to post a v4 incorporating your feedback once the discussion concludes. > > On 7/6/2026 5:11 PM, Konrad Dybcio wrote: >> On 7/5/26 3:57 PM, Aniket Randive wrote: >>> The driver uses a static XFER_TIMEOUT of HZ (1 second) for all transfers >>> regardless of message length or bus frequency, causing unnecessary >>> delays on error paths. >>> >>> Compute the timeout dynamically from message length and bus frequency >>> with a 10x safety margin over the theoretical wire time and a 300ms >>> floor. For GPI multi-descriptor transfers, use the maximum message >>> length across all queued messages as the per-completion timeout. >> >> What's the reason for a 0.3 s floor? > > The floor accounts for I2C clock stretching. The spec allows slaves to hold SCL low indefinitely during internal processing. A dynamically computed xfer time alone gives no time for that. > 300ms value covers worst-case stretching while still detecting real hangs 3x faster than the old 1s static timeout. Please put that in the commit message and possibly in the code as a comment > > Thanks, > Aniket > >> >> Why a 10x safety margin specifically? >> >> [...] > > The multiplier covers the gap between theoretical xfer time and actual completion time (DMA descriptor setup, interrupt latency, and scheduling jitter on a loaded system) > Without it, short transfers would have almost no extra time before a spurious timeout. Likewise (Should there be a constant safety margin added to account for all that? Keep in mind this driver will run on a turbofast Glymur and on a notsofast Agatti so any numbers that depend on the processor's speed must be reasonable for both) Konrad