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]
Message-ID: <1891546521.01617683881598.JavaMail.epsvc@epcpadp4>
Date:   Tue, 06 Apr 2021 13:11:40 +0900
From:   Daejun Park <daejun7.park@...sung.com>
To:     "asutoshd@...eaurora.org" <asutoshd@...eaurora.org>,
        "nguyenb@...eaurora.org" <nguyenb@...eaurora.org>,
        "hongwus@...eaurora.org" <hongwus@...eaurora.org>,
        "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "kernel-team@...roid.com" <kernel-team@...roid.com>,
        "cang@...eaurora.org" <cang@...eaurora.org>
CC:     ALIM AKHTAR <alim.akhtar@...sung.com>,
        Avri Altman <avri.altman@....com>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        Stanley Chu <stanley.chu@...iatek.com>,
        Bean Huo <beanhuo@...ron.com>,
        Jaegeuk Kim <jaegeuk@...nel.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Kiwoong Kim <kwmad.kim@...sung.com>,
        Satya Tangirala <satyat@...gle.com>,
        open list <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 1/2] scsi: ufs: Introduce hba performance monitor sysfs
 nodes

Hi Can Guo,

> +static ssize_t monitor_enable_store(struct device *dev,
> +                                    struct device_attribute *attr,
> +                                    const char *buf, size_t count)
> +{
> +        struct ufs_hba *hba = dev_get_drvdata(dev);
> +        unsigned long value, flags;
> +
> +        if (kstrtoul(buf, 0, &value))
> +                return -EINVAL;
> +
> +        value = !!value;
> +        spin_lock_irqsave(hba->host->host_lock, flags);
> +        if (value == hba->monitor.enabled)
> +                goto out_unlock;
> +
> +        if (!value) {
> +                memset(&hba->monitor, 0, sizeof(hba->monitor));
> +        } else {
> +                hba->monitor.enabled = true;
> +                hba->monitor.enabled_ts = ktime_get();

How about setting lat_max to and lat_min to KTIME_MAX and 0?
I think lat_sum should be 0 at this point.

> +        }
> +
> +out_unlock:
> +        spin_unlock_irqrestore(hba->host->host_lock, flags);
> +        return count;
> +}


> +static void ufshcd_update_monitor(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
> +{
> +        int dir = ufshcd_monitor_opcode2dir(*lrbp->cmd->cmnd);
> +
> +        if (dir >= 0 && hba->monitor.nr_queued[dir] > 0) {
> +                struct request *req = lrbp->cmd->request;
> +                struct ufs_hba_monitor *m = &hba->monitor;
> +                ktime_t now, inc, lat;
> +
> +                now = ktime_get();

How about using lrbp->compl_time_stamp instead of getting new value?

> +                inc = ktime_sub(now, m->busy_start_ts[dir]);
> +                m->total_busy[dir] = ktime_add(m->total_busy[dir], inc);
> +                m->nr_sec_rw[dir] += blk_rq_sectors(req);
> +
> +                /* Update latencies */
> +                m->nr_req[dir]++;
> +                lat = ktime_sub(now, lrbp->issue_time_stamp);
> +                m->lat_sum[dir] += lat;
> +                if (m->lat_max[dir] < lat || !m->lat_max[dir])
> +                        m->lat_max[dir] = lat;
> +                if (m->lat_min[dir] > lat || !m->lat_min[dir])
> +                        m->lat_min[dir] = lat;

This if statement can be shorted, by setting lat_max / lat_min as default value.

> +
> +                m->nr_queued[dir]--;
> +                /* Push forward the busy start of monitor */
> +                m->busy_start_ts[dir] = now;
> +        }
> +}

Thanks,
Daejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ