Received: by 10.192.165.156 with SMTP id m28csp1418169imm; Wed, 11 Apr 2018 19:25:26 -0700 (PDT) X-Google-Smtp-Source: AIpwx49AcRx8S6ZdIWs8cDvJhCRCirjyMFkN7/Rby6PNC6trkIuu/2tU+7WQhb3VX/ah7D7cYboP X-Received: by 10.99.0.4 with SMTP id 4mr278731pga.107.1523499926623; Wed, 11 Apr 2018 19:25:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523499926; cv=none; d=google.com; s=arc-20160816; b=04vEROXNOPa3ynmBGhjeVdG/EMPwvzIBg70jWmd/y71xz2GrHa3/yxy84V/DMg7efS n7TDZKOFYdTZZR4UoNZav8Casa3jLZUJGpNDVP/NUBT4oA7oR/2IC76n2j9rDcvhrU8j IeVOuhCxfE3Ep4FdzYJLUZFzCzpGFvL99OqlKdRtxWbentEyV1a2/TKKdeprXWrsW3LL T5BbX6J7tJDB/rJxpPwh5K74wjhKvKnEVEBYbYxcdf81JxD87znsReVehl8X4omMjM2P sR2GhlrrR4mhypTly3lAxdwK2AUljNJ2ySa1yBWJr2DVXZbzwFCfX+81ClArI5gTaPDF +Grg== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature:arc-authentication-results; bh=4/DM3W4XI0e1pChNjjesCGy0FjPX78dUYHlUxmOe6Es=; b=lX1JKKMG6TwRDHCc3dRRZQrIhcx5HPBFsQ/HpYefvQb/TIx4WKBuaH2oYCNZa2Lx8N sZ8OtSEOVtQSSKErmJL1gX0g/EmE9mnm6VTV0YSfg4tpQRXwKRNypx1eUwWJ2UYNcxrg DfKe1VGIgFQyIOxEgQkQMJO1aGTQ3BAeUwGpT9/3J65C5582krNe7Ip0yMmuqdPnpHMD 59vmD2g3r7cWbSaP3G14EMUTonLdl8D+i3aQvSdZQYISY+sSm+67ADewa4049iRcgHrY tx8xWMZ1NGocSilLsDABF0LEu77dTr1Y2VJT0M+4t7PMhFnpXF3p0qFkGeZ4XT3UZDAy Q8Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Mi3D3aBI; 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 j16si1530666pga.720.2018.04.11.19.24.49; Wed, 11 Apr 2018 19:25:26 -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=Mi3D3aBI; 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 S1752591AbeDLCVt (ORCPT + 99 others); Wed, 11 Apr 2018 22:21:49 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:42611 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751858AbeDLCVr (ORCPT ); Wed, 11 Apr 2018 22:21:47 -0400 Received: by mail-pf0-f193.google.com with SMTP id o16so2305384pfk.9; Wed, 11 Apr 2018 19:21:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=4/DM3W4XI0e1pChNjjesCGy0FjPX78dUYHlUxmOe6Es=; b=Mi3D3aBIIAAB/Nn3MC4JLV3DVtVU0KWkOKSCorUHEZ99B1SEtKUhbAeCq5WFhbiOp5 E0zrcfa3BJNRNV/sTGUnyHOGEmu/w1On7REbi+0n9SdIwKy1W5TwvUlQ5RrbvdpOFJWO tx8CKgzd//nnCLZo4rqyoN5gdoe+bz7jKhv/UYFot8t7Syk9uq7+lV43hui8KQKNufzh +YwZbcZ/c+i01OO5Fq7DpPoWpOLX9Em8xDsmTnr4l68CU1GgyCD3kPyR/ULbdA3Qj9qT E/Ybt+nCSoQfB5ZwS3xOoihabRU0/3btfMrqPo/pyUH7I976GTdBJmDZyD3ekC5wuHWB pt8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=4/DM3W4XI0e1pChNjjesCGy0FjPX78dUYHlUxmOe6Es=; b=E6sTahyhbXd7XxGvBYVY04h5VVNtsEI9L4ZBXJnvg2fxQBcwzxK5REwL6yfUnveT8N eBFMLWFfU2vrJ/0d6cv+0L1xroz6PAmInJSK1MJYd3VE7ksxUYVh1SgsHLu3qI0Qsu1a CcT1nswXLd7UE7C3R5o5Uo61kAT+nSuh77ePfLlBANo9Pd+ErXkYIKMubf7U6NO+cMH5 sFEe6EqXk8P40vEdcv2CWRS4bO48aHceuHa0pl5WOFBsuZKDaaABYahjUfDzMQbMb/E7 FsnVelY6oc0GQ4hHB60/gG0y5kWAKSKbYcYSodNKUUMMVW7HlksR+6ZBVjqexjMAYmE/ FR7A== X-Gm-Message-State: ALQs6tCLaR4bdIgSpcQ40e/auXaIcEe7mAJ5mn9asTSTBYof7l8kueEs PNJ46WNP1S53odyOi+s9JjKtvA== X-Received: by 10.99.119.133 with SMTP id s127mr5142103pgc.441.1523499707053; Wed, 11 Apr 2018 19:21:47 -0700 (PDT) Received: from [192.168.0.104] ([106.51.29.61]) by smtp.gmail.com with ESMTPSA id u27sm5002994pfk.100.2018.04.11.19.21.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Apr 2018 19:21:46 -0700 (PDT) Subject: Re: [PATCH v2] dec: tulip: de4x5: Replace mdelay with usleep_range in de4x5_hw_init To: Jia-Ju Bai , James Bottomley , davem@davemloft.net, stephen@networkplumber.org, johannes.berg@intel.com, dhowells@redhat.com References: <1523461182-5897-1-git-send-email-baijiaju1990@gmail.com> <1523463379.3221.18.camel@HansenPartnership.com> <8bac3385-97c6-fff1-17c6-11f5e98a039a@gmail.com> Cc: netdev@vger.kernel.org, linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org From: arvindY Message-ID: <5ACEC2B6.9080904@gmail.com> Date: Thu, 12 Apr 2018 07:51:42 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <8bac3385-97c6-fff1-17c6-11f5e98a039a@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. ~arvind > > Best wishes, > Jia-Ju Bai