netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: arvindY <arvind.yadav.cs@gmail.com>,
	James Bottomley <James.Bottomley@HansenPartnership.com>,
	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
Subject: Re: [PATCH v2] dec: tulip: de4x5: Replace mdelay with usleep_range in de4x5_hw_init
Date: Thu, 12 Apr 2018 10:26:47 +0800	[thread overview]
Message-ID: <df283c24-5a6e-8d17-ca61-10c66ddf4fca@gmail.com> (raw)
In-Reply-To: <5ACEC2B6.9080904@gmail.com>



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

      reply	other threads:[~2018-04-12  2:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-11 15:39 [PATCH v2] dec: tulip: de4x5: Replace mdelay with usleep_range in de4x5_hw_init Jia-Ju Bai
2018-04-11 16:16 ` James Bottomley
2018-04-12  1:30   ` Jia-Ju Bai
2018-04-12  2:21     ` arvindY
2018-04-12  2:26       ` Jia-Ju Bai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=df283c24-5a6e-8d17-ca61-10c66ddf4fca@gmail.com \
    --to=baijiaju1990@gmail.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=arvind.yadav.cs@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=johannes.berg@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).