lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 12 Dec 2019 14:12:46 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Scott Schafer <schaferjscott@...il.com>
Cc:     Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
        devel@...verdev.osuosl.org, GR-Linux-NIC-Dev@...vell.com,
        Manish Chopra <manishc@...vell.com>,
        gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
        netdev@...r.kernel.org
Subject: Re: [PATCH v2 20/23] staging: qlge: Fix CHECK: usleep_range is
 preferred over udelay

On Thu, Dec 12, 2019 at 05:00:57AM -0600, Scott Schafer wrote:
> On Thu, Dec 12, 2019 at 01:45:57PM +0300, Sergei Shtylyov wrote:
> > Hello!
> > 
> > On 11.12.2019 21:12, Scott Schafer wrote:
> > 
> > > chage udelay() to usleep_range()
> > 
> >    Change?
> > 
> > > Signed-off-by: Scott Schafer <schaferjscott@...il.com>
> > > ---
> > >   drivers/staging/qlge/qlge_main.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c
> > > index e18aa335c899..9427386e4a1e 100644
> > > --- a/drivers/staging/qlge/qlge_main.c
> > > +++ b/drivers/staging/qlge/qlge_main.c
> > > @@ -147,7 +147,7 @@ int ql_sem_spinlock(struct ql_adapter *qdev, u32 sem_mask)
> > >   	do {
> > >   		if (!ql_sem_trylock(qdev, sem_mask))
> > >   			return 0;
> > > -		udelay(100);
> > > +		usleep_range(100, 200);
> > 
> >    I hope you're not in atomic context...
> > 
> > >   	} while (--wait_count);
> > >   	return -ETIMEDOUT;
> > >   }
> > 
> > MBR, Sergei
> 
> Im not quite what you mean by "I hope you're not in atomic context",
> could you please explain why you said this? 

You can't sleep from certain IRQs or when you are holding certain locks
(spin_locks and rwlocks).  The we have preempt_disable() then you can't
sleep.

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ