From patchwork Tue Jan 15 01:09:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satish Kharat X-Patchwork-Id: 10763701 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7C5CE91E for ; Tue, 15 Jan 2019 01:25:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6DDB52BAC8 for ; Tue, 15 Jan 2019 01:25:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 624052BAD1; Tue, 15 Jan 2019 01:25:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 001332BAC8 for ; Tue, 15 Jan 2019 01:25:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727786AbfAOBZd (ORCPT ); Mon, 14 Jan 2019 20:25:33 -0500 Received: from alln-iport-4.cisco.com ([173.37.142.91]:4005 "EHLO alln-iport-4.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727355AbfAOBZd (ORCPT ); Mon, 14 Jan 2019 20:25:33 -0500 X-Greylist: delayed 566 seconds by postgrey-1.27 at vger.kernel.org; Mon, 14 Jan 2019 20:25:32 EST DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3404; q=dns/txt; s=iport; t=1547515532; x=1548725132; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=MQcvJO8eTSu7EEKhCYE3+VZsMmvEywacvtllnsYPxrc=; b=k0DJlTYgEpXrjgQP67D1UrA1edhIzxAH9HBrOg/SQh6Ox/rDJHQm0D60 cOZ433ulby5sPtALd/jgDaym49d/QCnJXF9IHf54WVSEwNcG1F6B6UZRy 8gzN79bSssPDVxvwpXzHOrnzwDl7PeouCqXGrUuC4ZDf0YBnPVt49kDkI Q=; X-IronPort-AV: E=Sophos;i="5.56,479,1539648000"; d="scan'208";a="226064301" Received: from alln-core-11.cisco.com ([173.36.13.133]) by alln-iport-4.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jan 2019 01:16:05 +0000 Received: from satish-ini-cisco-com.cisco.com (satish-ini.cisco.com [10.193.101.67]) by alln-core-11.cisco.com (8.15.2/8.15.2) with ESMTP id x0F1G2Bq016303; Tue, 15 Jan 2019 01:16:05 GMT From: Satish Kharat To: satishkh@cisco.com, martin.petersen@oracle.com, jejb@linux.vnet.ibm.com Cc: linux-scsi@vger.kernel.org Subject: [PATCH v2 06/10] scsi: fnic: fnic stats for max CQs processed and ISR time Date: Mon, 14 Jan 2019 17:09:25 -0800 Message-Id: <20190115010929.15347-7-satishkh@cisco.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190115010929.15347-1-satishkh@cisco.com> References: <20190115010929.15347-1-satishkh@cisco.com> X-Outbound-SMTP-Client: 10.193.101.67, satish-ini.cisco.com X-Outbound-Node: alln-core-11.cisco.com Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This change is to add fnic stats for the max number of CQs (corresponding to copy WQ) processed in a given interrupt, max time taken by the ISR. Signed-off-by: Satish Kharat --- drivers/scsi/fnic/fnic_scsi.c | 19 +++++++++++++++++++ drivers/scsi/fnic/fnic_stats.h | 3 +++ drivers/scsi/fnic/fnic_trace.c | 6 ++++++ 3 files changed, 28 insertions(+) diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c index 94186c4da091..61606fd675d0 100644 --- a/drivers/scsi/fnic/fnic_scsi.c +++ b/drivers/scsi/fnic/fnic_scsi.c @@ -1325,13 +1325,32 @@ int fnic_wq_copy_cmpl_handler(struct fnic *fnic, int copy_work_to_do) unsigned int wq_work_done = 0; unsigned int i, cq_index; unsigned int cur_work_done; + struct misc_stats *misc_stats = &fnic->fnic_stats.misc_stats; + u64 start_jiffies = 0; + u64 end_jiffies = 0; + u64 delta_jiffies = 0; + u64 delta_ms = 0; for (i = 0; i < fnic->wq_copy_count; i++) { cq_index = i + fnic->raw_wq_count + fnic->rq_count; + + start_jiffies = jiffies; cur_work_done = vnic_cq_copy_service(&fnic->cq[cq_index], fnic_fcpio_cmpl_handler, copy_work_to_do); + end_jiffies = jiffies; + wq_work_done += cur_work_done; + delta_jiffies = end_jiffies - start_jiffies; + if (delta_jiffies > + (u64) atomic64_read(&misc_stats->max_isr_jiffies)) { + atomic64_set(&misc_stats->max_isr_jiffies, + delta_jiffies); + delta_ms = jiffies_to_msecs(delta_jiffies); + atomic64_set(&misc_stats->max_isr_time_ms, delta_ms); + atomic64_set(&misc_stats->corr_work_done, + cur_work_done); + } } return wq_work_done; } diff --git a/drivers/scsi/fnic/fnic_stats.h b/drivers/scsi/fnic/fnic_stats.h index 299e925921b1..1b1006a882e9 100644 --- a/drivers/scsi/fnic/fnic_stats.h +++ b/drivers/scsi/fnic/fnic_stats.h @@ -97,6 +97,9 @@ struct vlan_stats { struct misc_stats { u64 last_isr_time; u64 last_ack_time; + atomic64_t max_isr_jiffies; + atomic64_t max_isr_time_ms; + atomic64_t corr_work_done; atomic64_t isr_count; atomic64_t max_cq_entries; atomic64_t ack_index_out_of_range; diff --git a/drivers/scsi/fnic/fnic_trace.c b/drivers/scsi/fnic/fnic_trace.c index 8c0d4ee824db..ce32380a182e 100644 --- a/drivers/scsi/fnic/fnic_trace.c +++ b/drivers/scsi/fnic/fnic_trace.c @@ -409,6 +409,9 @@ int fnic_get_stats_data(struct stats_debug_info *debug, len += snprintf(debug->debug_buffer + len, buf_size - len, "Last ISR time: %llu (%8llu.%09lu)\n" "Last ACK time: %llu (%8llu.%09lu)\n" + "Max ISR jiffies: %llu\n" + "Max ISR time (ms) (0 denotes < 1 ms): %llu\n" + "Corr. work done: %llu\n" "Number of ISRs: %lld\n" "Maximum CQ Entries: %lld\n" "Number of ACK index out of range: %lld\n" @@ -428,6 +431,9 @@ int fnic_get_stats_data(struct stats_debug_info *debug, (s64)val1.tv_sec, val1.tv_nsec, (u64)stats->misc_stats.last_ack_time, (s64)val2.tv_sec, val2.tv_nsec, + (u64)atomic64_read(&stats->misc_stats.max_isr_jiffies), + (u64)atomic64_read(&stats->misc_stats.max_isr_time_ms), + (u64)atomic64_read(&stats->misc_stats.corr_work_done), (u64)atomic64_read(&stats->misc_stats.isr_count), (u64)atomic64_read(&stats->misc_stats.max_cq_entries), (u64)atomic64_read(&stats->misc_stats.ack_index_out_of_range),