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:   Sun, 31 Jan 2021 08:35:24 +0100
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Avri Altman <Avri.Altman@....com>
Cc:     "James E . J . Bottomley" <jejb@...ux.vnet.ibm.com>,
        "Martin K . Petersen" <martin.petersen@...cle.com>,
        "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Bart Van Assche <bvanassche@....org>,
        yongmyung lee <ymhungry.lee@...sung.com>,
        Daejun Park <daejun7.park@...sung.com>,
        "alim.akhtar@...sung.com" <alim.akhtar@...sung.com>,
        "asutoshd@...eaurora.org" <asutoshd@...eaurora.org>,
        Zang Leigang <zangleigang@...ilicon.com>,
        Avi Shchislowski <Avi.Shchislowski@....com>,
        Bean Huo <beanhuo@...ron.com>,
        "cang@...eaurora.org" <cang@...eaurora.org>,
        "stanley.chu@...iatek.com" <stanley.chu@...iatek.com>
Subject: Re: [PATCH 3/8] scsi: ufshpb: Add region's reads counter

On Sun, Jan 31, 2021 at 07:25:37AM +0000, Avri Altman wrote:
> > >
> > > +     if (ufshpb_mode == HPB_HOST_CONTROL)
> > > +             reads = atomic64_inc_return(&rgn->reads);
> > > +
> > >       if (!ufshpb_is_support_chunk(transfer_len))
> > >               return;
> > >
> > > +     if (ufshpb_mode == HPB_HOST_CONTROL) {
> > > +             /*
> > > +              * in host control mode, reads are the main source for
> > > +              * activation trials.
> > > +              */
> > > +             if (reads == ACTIVATION_THRSHLD) {
> Oops - this is a bug...
> 
> > > +
> > > +     /* region reads - for host mode */
> > > +     atomic64_t reads;
> > 
> > Why do you need an atomic variable for this?  What are you trying to
> > "protect" here by flushing the cpus all the time?  What protects this
> > variable from changing right after you have read from it (hint, you do
> > that above...)
> > 
> > atomics are not race-free, use a real lock if you need that.
> We are on the data path here - this is called from queuecommand.
> The "reads" counter is being symmetrically read and written,
> so adding a spin lock here might become a source for contention.

And an atomic varible is not?  You do know what spinlocks are made of,
right?  :)

> Also I am not worried about the exact value of this counter, except of one place - 
> See above.  Will fix it.

So it's not really needed?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ