Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4420302ooa; Tue, 14 Aug 2018 05:51:48 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwGhxUyrIs1xas9dF3ewFZf7ZrjGfP+AjOvHtgv+JeIo6rglRJJBlYkreKqKXnpvxSmaT8g X-Received: by 2002:a17:902:5ac7:: with SMTP id g7-v6mr20017378plm.90.1534251108662; Tue, 14 Aug 2018 05:51:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534251108; cv=none; d=google.com; s=arc-20160816; b=IqngHFn8c0pOoqBbMDQIByNRiv1iiL9bafb4IrMxL+ZjfLMvmY0jZKELOiiBbRImM/ acZEJ4JLY0BiOGjPI2JZKG0bj5CUQp0U18jbOE6otMzyQ5okMEKM6/9tJcfY3bBW3GyU Gx8HFzz2GlOxtFMeDJnq1maXgISIMrh/FlXOm5GxBWMgSIXZVmYvp8yDrYFeoreHAnfx l4tU+8UAOAHbXxEyPf0IJE676TLLzGhCJZ21owSmI6cfgfN1YIc+5wOY4rTcrj/JDKdz IZ6jgV+lxHNI1VSPrh44Audfp3tRC5LX0Kt/DlKTdZQgl+tVsxsD5O1N+nGvLCuV5h2M SbkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=LSdJB22vzugeYdCQwG643iZT3g/2nPdkb6ENk3QX3t4=; b=cz0Ee6oPyNUbRXgAKWNxJghaRDxXSrW9ANWdNFHbjcHPuzo9YUXxxX9GLWmObIWS+1 7gp3BOx4hV7GP1gZl8/SbCcn/L0G+CCDk+RTvxSO1+sxdsTP78+5INl4JgPrBnWF0oJM nHtl/jRKR23joUgztqoKhe+q4Au32VDkfRTFWlAsWaJWHt7PuLzfEFcJePtwf0Wq4b6b P13dLTa8aRL9MxE4EioZ+/xZEyK3jLJWTgr6q3ZoJYJPs1ZK+w3F+UfyFfRrJBhOXOLC czUzQmn5QDyeK04eUhuHa8PiMX1CTI3qm1+mvRy4SJQ6TycFVqudtxTbqPkRhveMsMlp 3D0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ky0KVpVV; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b184-v6si22055585pfg.94.2018.08.14.05.51.29; Tue, 14 Aug 2018 05:51:48 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ky0KVpVV; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732480AbeHNPho (ORCPT + 99 others); Tue, 14 Aug 2018 11:37:44 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:35885 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729536AbeHNPhn (ORCPT ); Tue, 14 Aug 2018 11:37:43 -0400 Received: by mail-qt0-f195.google.com with SMTP id t5-v6so20933170qtn.3; Tue, 14 Aug 2018 05:50:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=LSdJB22vzugeYdCQwG643iZT3g/2nPdkb6ENk3QX3t4=; b=Ky0KVpVVb3PSQVYelvIeVJssN2Lx53CyKnBxodFUyrCu91uEciDsJ9UpYU59JJVu9C rxd2Tu/zl13My3n2glFhB5RIRSVjVR0Vj1G4ydWjSm9f0iVCqjr6BAcmuguC4VkDwbuf 2i6fw9dEHsQA6IBaFPsy5EGPKIMnkpEA2Q9fLzk6BadNmAYjYOgAa8z8+UdRhCNnS0rg 3ejh5onaIeKZfBOKtdCzf4krXK1eAGiBFRpOC9ocoKp8e2qmlScov/uwQqjAwhJf4rFa isC72xWSvTqPdOqOC4ckxjMHbCLW0ee8Buhr1/woGE0H55whM6pxr+QvJMny3XbJQGzh eEkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=LSdJB22vzugeYdCQwG643iZT3g/2nPdkb6ENk3QX3t4=; b=YtL5xIY1DFLWC7vf8Sc9TfCWqlHxH/m2hFOuMXUvTEs8LZMN4YkBEe4LUUZ08UjYmB TvXRvlk9TYz4jcXdiUSAdNPkt9b946Ro92M3ztbLggT5TNXBAL7K3dn4FzE2OPuqrIO/ E1sg/10/QC6zpv8Kn9pRQimhvchtn7RpIEpFKz7xfGfgiauCLPEAZGshYIpzCrLON0KB UO7/JTFP2vXZH42ijmtiRERTuEyK6XcoroBgWSrKgiLR7INSm5YQiT3z1ZnTOFGxIfEW 6Ld3NE9y2k6aRogYKovFMXCE+QEIdxhu29UcCDJGcjKREmzMl59eHet0e0mNgDnK+yMe GvMQ== X-Gm-Message-State: AOUpUlHc8uOrbiefT4Xr70hI2Eb5pqmwpU43aWJfGSyK/heJFyPALMly rdFOb3MPre06QA3G2Ot/Hx7R0gc7z4tCzGsANyo= X-Received: by 2002:aed:3c34:: with SMTP id t49-v6mr19856150qte.404.1534251040697; Tue, 14 Aug 2018 05:50:40 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a0c:9c4a:0:0:0:0:0 with HTTP; Tue, 14 Aug 2018 05:50:40 -0700 (PDT) In-Reply-To: References: From: Andy Shevchenko Date: Tue, 14 Aug 2018 15:50:40 +0300 Message-ID: Subject: Re: [PATCH] eeprom: at24: Fix unexpected timeout under high load To: "Jonas Mark (BT-FIR/ENG1)" Cc: Bartosz Golaszewski , Arnd Bergmann , Greg Kroah-Hartman , linux-i2c , Linux Kernel Mailing List , "WANG Xin (BT-FIR/ENG1-Zhu)" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 6, 2018 at 2:39 PM, Jonas Mark (BT-FIR/ENG1) wrote: > tout = jiffies + msecs_to_jiffies(at24_write_timeout); > do { > read_time = jiffies; > > ret = regmap_bulk_read(regmap, offset, buf, count); > dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", > count, offset, ret, jiffies); > if (!ret) > return count; > > usleep_range(1000, 1500); > } while (!time_before(tout, read_time)) > > The advantage of this code is that the usleep_range() is unconditional. > The disadvantage of the new proposal is that in case of a timeout one > more unnecessary sleep is made. Is that acceptable? Yes. > An alternative would be to duplicate the regmap_bulk_read() and the > debugging code outside the loop. > Is this preferable? No. -- With Best Regards, Andy Shevchenko