Received: by 10.192.165.156 with SMTP id m28csp1422242imm; Wed, 11 Apr 2018 19:30:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx49her8yVNTT64m//ANgzDF8oQS2hsm1klpvU7ZZoDTXHhMq2TrqAWJhpIxKaN+YX6E80Xzj X-Received: by 2002:a17:902:714e:: with SMTP id u14-v6mr7602431plm.356.1523500251827; Wed, 11 Apr 2018 19:30:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523500251; cv=none; d=google.com; s=arc-20160816; b=DxYeGSED9W7iaIRQRVGV+uN8bbmQNrqhOqYGghp782a26pDrwQSxA7R4OfJNvxOA0b 0FHcJOZIBn9hZX7oPzyXUTfiV+yc27CIvZQf7uu02FS2FvBn7a8T1TXOJN5YIa4W+Swx bVBQCl9tgFaeaPQOXW0N8yaQG/Wl2fsLaqRqYftqh66AOM0tj0rblUlAWohCH0N9uYFy K5wEQGVd4NzSr+k/beRPvokL7Ed8CAgPEq7UfkF+cXC6TQySeN2zAgq0Y2pB2oaHrRow kcQVPCEkPC6a7q5ZZD48up1hTP+Fukb7kdDO/KKsMCclWdBM+ygdrREov/32ML8UqtSv 0itg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=SVM6x19jRFkKUMl8FaOSL+9MAAX5fyKrBaRiQ+haYKI=; b=uPBO0FCLdJ+zSCTpAQv0N6I5vxpm3eDNKtN5zJtn7eDN4cI7vHanJOWmAH63n2zXbq N8u9YqgdwBQEqxDly6UTN9+BDD1YsUTRTZY/GOMIjNBw2tdRAflxpUPJxunKjxGt83WQ iYKdSfysKFEM7xn0tyvWyQHU6WRpUouxsEnMIfWh43FZlH0dR06aVIzrdWHXOsrax7Ma Q86nn0oujpB/vC6+ln7VhjxVa7Izfp01LkLo3M2VtQZQcG2Tl28Wtspa5MAz7k3EY598 mJ0FYUzDnKgN64++VpahI3Hd3nCj9VfZxm/k9hF8H4j4Y4ExnCfjCzHMvRrJlr0iVVRy 0SpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=X7yShziC; 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 n5si1732589pff.370.2018.04.11.19.30.14; Wed, 11 Apr 2018 19:30:51 -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=X7yShziC; 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 S1752734AbeDLC1L (ORCPT + 99 others); Wed, 11 Apr 2018 22:27:11 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:38016 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752320AbeDLC1J (ORCPT ); Wed, 11 Apr 2018 22:27:09 -0400 Received: by mail-pl0-f67.google.com with SMTP id c7-v6so2805252plr.5; Wed, 11 Apr 2018 19:27:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=SVM6x19jRFkKUMl8FaOSL+9MAAX5fyKrBaRiQ+haYKI=; b=X7yShziCzNlPJPeu5CdYfcE7hup3ZIy9+wq/fQLa24qjV1LQbZCTdYmHGIwZ27RetC 7AYjqSVMsRw8dfpeEXIiexq+hhC3qvg0txYv8aUgQcOOVyhtCZF38Hkzp0ARi+mGo09j 5ZMBJ6a0uHMJCimIcCuegyiJbWsWMMoQsBNyQmFqxn1y2+u+fraWXGslt/EsolW1KYNg P/fU4LYj9osSybu5VuuYca9CkdBpLwAEMDWZpdFfTx/ulfyGDU8VrtOqjVyqTKW5ViNv acFzcZuhv4bjM9LS9k0emHqKWTpoVxSesApu0gBOhR31J1tmtvtBTMPbTnGppubhPkS+ Hi4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=SVM6x19jRFkKUMl8FaOSL+9MAAX5fyKrBaRiQ+haYKI=; b=ASF7f0WLl0W2Ds75++Zg4jlbB/vMcPSKK6SSe551DBoaZs0KlXLwIRUnt57omM1DzC MiUFMVTT21yCurhcHoiLvVNIWCzfOoCze79QIk9ooiVTOc71YMCN1/Nen4fsci0zP41y pRLv9MZ3MMZwFO57mwuLgk/WWrPwvuIQtxgzNi2aYE1xdOP+p5TNuCO5vUMQO5pIivxM n/OPvCN1mmt55Udel9hScdg+/rsWwgiooXXbzrMuULsV2bViUt9w29hB8fbNCTqGbZ1G 1LnTe/gsT/AzJJrTNRSL2SSLrIfXPlK2nW3PzPwwPL5jQGlQLXPNmITszS680/W219Q9 yvNg== X-Gm-Message-State: ALQs6tBnoeth39vp1RDo6INo+q44zb+GKyDv5y3HvJ8QN9/AF1Cbw6TR T3LGmr+IdSivksWXhkatgUkeGWJONUI= X-Received: by 2002:a17:902:9a0c:: with SMTP id v12-v6mr4747697plp.162.1523500028648; Wed, 11 Apr 2018 19:27:08 -0700 (PDT) Received: from ?IPv6:2402:f000:1:1501:200:5efe:166.111.70.53? ([2402:f000:1:1501:200:5efe:a66f:4635]) by smtp.gmail.com with ESMTPSA id b4sm4651307pfa.64.2018.04.11.19.27.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Apr 2018 19:27:08 -0700 (PDT) Subject: Re: [PATCH v2] dec: tulip: de4x5: Replace mdelay with usleep_range in de4x5_hw_init To: arvindY , James Bottomley , davem@davemloft.net, stephen@networkplumber.org, johannes.berg@intel.com, dhowells@redhat.com Cc: netdev@vger.kernel.org, linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org References: <1523461182-5897-1-git-send-email-baijiaju1990@gmail.com> <1523463379.3221.18.camel@HansenPartnership.com> <8bac3385-97c6-fff1-17c6-11f5e98a039a@gmail.com> <5ACEC2B6.9080904@gmail.com> From: Jia-Ju Bai Message-ID: Date: Thu, 12 Apr 2018 10:26:47 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <5ACEC2B6.9080904@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/4/12 10:21, arvindY wrote: > > > On Thursday 12 April 2018 07:00 AM, Jia-Ju Bai wrote: >> >> >> On 2018/4/12 0:16, James Bottomley wrote: >>> On Wed, 2018-04-11 at 23:39 +0800, Jia-Ju Bai wrote: >>>> de4x5_hw_init() is never called in atomic context. >>>> >>>> de4x5_hw_init() is only called by de4x5_pci_probe(), which is only >>>> set as ".probe" in struct pci_driver. >>>> >>>> Despite never getting called from atomic context, de4x5_hw_init() >>>> calls mdelay() to busily wait. This is not necessary and can be >>>> replaced with usleep_range() to avoid busy waiting. >>>> >>>> This is found by a static analysis tool named DCNS written by myself. >>>> And I also manually check it. >>> Did you actually test this? The usual reason for wanting m/udelay is >>> that the timing must be exact. The driver is filled with mdelay()s for >>> this reason. The one you've picked on is in the init path so it won't >>> affect the runtime in any way. I also don't think we have the hrtimer >>> machinery for usleep_range() to work properly on parisc, so I don't >>> think the replacement works. >>> >>> James >>> >> >> Hello, James. >> Thanks for your reply :) >> >> I agree that usleep_range() here will not much affect the real >> execution of this driver. >> >> But I think usleep_range() can more opportunity for other threads to >> use the CPU core to schedule during waiting. >> That is why I detect mdelay() that can be replaced with msleep() or >> usleep_range(). >> > > James is right, You have added all usleep_range() during system > boot-up time. > During boot-up system will run as single threaded. Where this change will > not make much sense. System first priority is match the exact timing on > each and every boot-up. > Hello, Arvind. Thanks for your reply :) I admit I am not familiar with this driver. I did not know this driver is only loaded during system boot-up time, I thought this driver can be loaded as a kernel module (like many drivers) after system booting. After knowing this, I admit my patch is not proper, sorry... Best wishes, Jia-Ju Bai