Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4723625ybb; Tue, 24 Mar 2020 04:13:13 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv/qhT0v61yOyLtOaVUD059nmpoHjSdX3bJbrF6sVna8a3zM+FOdjd3vN2PcyCPHjI/Ybb5 X-Received: by 2002:a9d:6857:: with SMTP id c23mr8513097oto.224.1585048392911; Tue, 24 Mar 2020 04:13:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585048392; cv=none; d=google.com; s=arc-20160816; b=Ln3ByzMLRex8OsBXM6MMtcRJ+hQD4IG/HkGFcsJ+lgv8z7NrzRFB/dcCdJzmtTpSfP P0JgBM/S5V00MJBcwiUQ0FH8tjsTwpsCkez84bsq1FuI8ed/xz2zfgcLVHL2HEDoG/kr Px7Tfm7evPR2qKjGMthcvNLrtvGXROaxQtz1XBfYJjgz2etADdus2YbSvjp2G6rbjxVS BOzsMEZLlQiY5Xhus3vFNfUtNvjTCZKEG0QMvokZ1n2ORky9EufU4W9jj465jgJPmJzF bXsKxqDPxBWOiQGF27ZmvMyKH+ngAFsEzTWMWk8RHvFc4STwWWw+h5SGopX1xprg1FgU imeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=dELJVRYxlGhu9i4AEGE2L20IBZeNNSP6rwQj75nRA8o=; b=BykUs+9grW4zHE9CMr+h9EbR68n31Fs0E+okqon5lQhiCFw4F5aqJ1BVAd2K9hLv5B RB/4/hnGfyfvfBpWw77s8W18X6ueQ/DcPYbh/PbTv0PM5Mf1UKjFbZ7VibwD0pmNWW4P utIUrsyNDuGcW68jsb+JDI3PXpsbuVmvR4Ni0EsB69Z62U2v57KB3xAJHOPG9qcRClnD LnqpGkNdd5+Yulv1my2DwU/m4ihrwtMBq7XIjyc2AXRkocuO7mJCyYj4beg4ee3cuOEg iiLLMnLYZJPYgBg3r8/V62j3bkdFvGxsWksBDEqqf1elowomIP4/6O9xX0WE7I/+1RYG 8WBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p2si6942312otk.247.2020.03.24.04.12.58; Tue, 24 Mar 2020 04:13:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727179AbgCXLMU (ORCPT + 99 others); Tue, 24 Mar 2020 07:12:20 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:35664 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726524AbgCXLMU (ORCPT ); Tue, 24 Mar 2020 07:12:20 -0400 Received: from mail-pj1-f70.google.com ([209.85.216.70]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jGhTl-00042Q-OP for linux-kernel@vger.kernel.org; Tue, 24 Mar 2020 11:12:17 +0000 Received: by mail-pj1-f70.google.com with SMTP id go23so2296682pjb.2 for ; Tue, 24 Mar 2020 04:12:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=dELJVRYxlGhu9i4AEGE2L20IBZeNNSP6rwQj75nRA8o=; b=V1/1r03YT8UMVqbSAGRXCJZvBvhadzRZNbQIeOIoclYiqBfPTpmzj5dM6zCZppak8I CZSOnvkLmMDdzh3j/J93iS85HtvMQ6h7VplpDpaZz8Fv8TQbnonJ8jstDc9TBZm5jRLs 5TMI+Sr9UO9NpZsagwd+Z8mxfJJ5BapI13MopdEMWKhEVq4OK2aV56A9mDLzS/QmyMLo eUtiJN4I1QwR2NNGnZ8LlB/DwwkELY98HUl+dimy3gekTDVdBfNjYCC36b3oAf8KH1ZN 9bboFSTya5IJWd3lTS9OxVmWrJvs7VzzDrTgJ+m5SfX2ryJWxtPkNIWRI0t99L3vLvlk HEdw== X-Gm-Message-State: ANhLgQ3wxzBn98fB71NlsSQsuyt0XkiSnyJPP7QzWxp/CMCok63ycbMM UixbiKwS3EY6KZllaGD/3rOVrS+HlULboGOGN95WaKc3wLSB3zEIkZiEZqZPJ8UExt037GfCae0 oDk7CRU//y8drhqI+zouhEufoYegfAscZVGt5AJJfmQ== X-Received: by 2002:a17:902:7c93:: with SMTP id y19mr25768297pll.205.1585048336453; Tue, 24 Mar 2020 04:12:16 -0700 (PDT) X-Received: by 2002:a17:902:7c93:: with SMTP id y19mr25768263pll.205.1585048336044; Tue, 24 Mar 2020 04:12:16 -0700 (PDT) Received: from [192.168.1.208] (220-133-187-190.HINET-IP.hinet.net. [220.133.187.190]) by smtp.gmail.com with ESMTPSA id z12sm17044363pfj.144.2020.03.24.04.12.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Mar 2020 04:12:15 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) Subject: Re: [PATCH] i2c: nvidia-gpu: Handle timeout correctly in gpu_i2c_check_status() From: Kai-Heng Feng In-Reply-To: <20200324110930.GH1134@ninjato> Date: Tue, 24 Mar 2020 19:12:13 +0800 Cc: ajayg@nvidia.com, Andy Shevchenko , "open list:I2C CONTROLLER DRIVER FOR NVIDIA GPU" , open list Content-Transfer-Encoding: 7bit Message-Id: <9771BC92-1785-4E9A-81C7-E72C2C65CE22@canonical.com> References: <20200311165806.12365-1-kai.heng.feng@canonical.com> <20200324110930.GH1134@ninjato> To: Wolfram Sang X-Mailer: Apple Mail (2.3608.60.0.2.5) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Wolfram, > On Mar 24, 2020, at 19:09, Wolfram Sang wrote: > > >> } while (time_is_after_jiffies(target)); >> >> - if (time_is_before_jiffies(target)) { >> + if (time_is_before_eq_jiffies(target)) { > > While unlikely, there is a tiny race between the time_is_* calls, > jiffies could update inbetween them. > > So, for the sake of good programming practice, I'd recommend to set a > flag in the do_while-loop and the have the logic above solely based on > the flag. > Ok, I'll send a v2 based on your suggestion. Kai-Heng