Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2468835ybd; Mon, 24 Jun 2019 07:00:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqxKJ3qqbF0sM6KIMhTRJwQuXpZ3cZzsz/BP5IEryTZuPRH5uasd1Vb5Bc7n8uGa8xJAil7+ X-Received: by 2002:a17:90a:9a8d:: with SMTP id e13mr25376059pjp.77.1561384845498; Mon, 24 Jun 2019 07:00:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561384845; cv=none; d=google.com; s=arc-20160816; b=Dh3rRpAbqgUqvJewV6UGSje2JNq72fMVqmIq/jYuNjQLuSl2L7+pbAJlMq3Enf8jQr izYTD237ABx1pfIND7l6OOT1X4fLgvHQLWjVmskSs02ot//Lrs7hMuspiAQHpd3v1TZq EXIwLj9lHZzaTNWXybeCA27UFfxgDgDKjIs+gfyiV+rDdIQmD24r5ESrPtnfQZGtWLMS +FyfSdIoWwcxBGpln3g/EeVWIiAkqHovIMaLI2ZrDzyUq1tvp3uSy9d+MYfQ2A+BGwTE OHh5zIqFAQNI3aff2e/AIKhJCYJEGLoofoweWvsaLT0uvAzoZ7Nfp0yrOarKH1a4d9bK D+qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=wVmwcNN2x0z7spY7zYPZ8zADoKRMx9NGM2HlFTAoRDU=; b=OioE/5/AkM1APvb9c3Kd8w1Bl3iyDh6Q8cp/np0FoIIH1ohZ1IYn5a970tJ490iV34 eRaTxNMmvzu5Ss0b0Wrbk05AQidpnGBT18d4JWhrVisnmp2PYgagzWp5L+gZ346iq0kt NRUdoIO6Ea8WavTmhBv8Vz7P9M2YzKmfNpKpTiUBJPZZAFp8fVfDq7OYn0wmAxRAxhw/ VzSPrj47vzJSQzShIfqnhLoxgLxm5hUCITUozmv+/07jt382U3iuiSI3WYz2d9wI6ont 1PAz/YU+WO1lVz5LZbndl6UE4fLy/jVluNZbS+wQ9C2hBhPXa/ulhi6gG/ZEhLfmgp/q N96A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t4si10745069pfh.261.2019.06.24.07.00.29; Mon, 24 Jun 2019 07:00:45 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729773AbfFXLz7 (ORCPT + 99 others); Mon, 24 Jun 2019 07:55:59 -0400 Received: from ns.iliad.fr ([212.27.33.1]:54742 "EHLO ns.iliad.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727579AbfFXLz7 (ORCPT ); Mon, 24 Jun 2019 07:55:59 -0400 Received: from ns.iliad.fr (localhost [127.0.0.1]) by ns.iliad.fr (Postfix) with ESMTP id 02C7520598; Mon, 24 Jun 2019 13:55:58 +0200 (CEST) Received: from [192.168.108.49] (freebox.vlq16.iliad.fr [213.36.7.13]) by ns.iliad.fr (Postfix) with ESMTP id BF36F202C7; Mon, 24 Jun 2019 13:55:57 +0200 (CEST) Subject: Re: [PATCH v1] phy: qcom-qmp: Raise qcom_qmp_phy_enable() polling delay To: Kishon Vijay Abraham I , Vivek Gautam , Bjorn Andersson , Douglas Anderson Cc: MSM , LKML References: <92d97c68-d226-6290-37d6-f46f42ea604b@free.fr> <134f4648-682e-5fed-60e7-bc25985dd7e9@free.fr> From: Marc Gonzalez Message-ID: <967571b1-358f-09c3-dee6-0e664ab3c3d3@free.fr> Date: Mon, 24 Jun 2019 13:55:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP ; ns.iliad.fr ; Mon Jun 24 13:55:58 2019 +0200 (CEST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/06/2019 08:25, Kishon Vijay Abraham I wrote: > On 14/06/19 6:08 PM, Marc Gonzalez wrote: > >> The issue is usleep_range() being misused ^_^ >> >> Although usleep_range() takes unsigned longs as parameters, it is >> not appropriate over the entire 0-2^64 range. >> >> a) It should not be used with tiny values, because the cost of programming >> the timer interrupt, and processing the resulting IRQ would dominate. >> >> b) It should not be used with large values (above 2000000/HZ) because >> msleep() is more efficient, and is acceptable for these ranges. > > Documentation/timers/timers-howto.txt has all the information on the various > kernel delay/sleep mechanisms. For < ~10us, it recommends to use udelay > (readx_poll_timeout_atomic). Depending on the actual timeout to be used, the > delay mechanism in timers-howto.txt should be used. Hello Kishon, I believe the proposed patch does the right thing: a) polling for the ready bit is not done in atomic context, therefore we don't need to busy-loop b) since we're ultimately calling usleep_range(), we should pass an appropriate parameter, such as max_us = 10 (instead of max_us = 1, which is outside usleep_range spec) Maybe it would help if someone reviewed this patch. Regards.