From patchwork Tue Feb 8 14:20:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Lane X-Patchwork-Id: 1589879 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=JziemJs/; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JtQCV6j0Fz9sFs for ; Wed, 9 Feb 2022 01:20:38 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nHRM4-0000Vq-FC; Tue, 08 Feb 2022 14:20:28 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nHRLw-0000RO-TF for kernel-team@lists.ubuntu.com; Tue, 08 Feb 2022 14:20:20 +0000 Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 953AD4003D for ; Tue, 8 Feb 2022 14:20:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1644330020; bh=5Ud2sPDvDraruZaMBQRwHxe5TtCnnr8AiP5b2Q/IQiI=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JziemJs/fdubBZVkYu5MCWB/oCuSXB8D2bJ1j21g/51DrhLskUeXAHBYTM0Ix0ksj c8KFmm6swBZuK4DU+U0v+qDyvQVTqrQdzsSOhTPM64sifly//+6644oxNjqSuKhVYI SqnVybibx2P7Ok9vbQFVd6Ao8577UWHs+2AlRZJtX6vYNNO1R3I6xcfohq2hnotSXw 09xvgWNr8aNt+58B3VJfqf1zg2oBovOUULgu+sA9msBJ1wTA4vspGOifilQ4b6PDfM jqOAqaJfV6cHWt0t3NddCKV/sgquSOq64wk7wp58hsZo5uHHv7xAotuAxBow6fetM3 sI8rtXG1UNueA== Received: by mail-qv1-f69.google.com with SMTP id iv13-20020ad45ced000000b004248c87cc4cso11061721qvb.10 for ; Tue, 08 Feb 2022 06:20:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5Ud2sPDvDraruZaMBQRwHxe5TtCnnr8AiP5b2Q/IQiI=; b=yS/AjngYPQDSWZ2Sng5tfCNFhZPqj4fo+iCscbjb2XkUlaXKfCcvyAGTVlx/03VySx 6NlR9WaIpgwJFRA3V/X4a6DkwCKpMkEWZt8XwB3f4PHFri6SxMmWh5vQWEFPh3Gpq9eG joz1t6d0QyESVJdW/YLcWPKl5vKm/6mKNXPZ7WvywM+YD6HndeRRop38Jvw25aS2H7+7 PDYMKbSMaHcM0hU6eau3himV9cZSOqzvV3vNPYbFyhi1UsHXWCpQxZE2GtGmNDOhUORg 1b/UXfxt96xSqYoQku0mnlDdJLRNpVkO9shoY74SAxzARPPZJFbpXZ0J++EdvWkWWce+ faaw== X-Gm-Message-State: AOAM533aLON0iuqNkSNnqlKC21cy+6C0jbtNJK33CswN1fMhr2gLlpAY 32HIsH+LPSFH7xmaOYmtb9TvYVRs0F018HjEuTHSpN3U40Y0YQfOiR0XHoD+YWYxcGyNx57XkKD 7f0DFFBKkwUn4OxKXa2WZcHNv67pDJYU4FKW7iTZvnw== X-Received: by 2002:a05:620a:1a99:: with SMTP id bl25mr2724993qkb.137.1644330019329; Tue, 08 Feb 2022 06:20:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJymnTrYx7nvAKJwfae+0aANPFD8B4oXw/JdVuSIKcdDvAGQ3Hxl5EW6qszu1zFKCbMKoKHDXg== X-Received: by 2002:a05:620a:1a99:: with SMTP id bl25mr2724961qkb.137.1644330018890; Tue, 08 Feb 2022 06:20:18 -0800 (PST) Received: from localhost.localdomain ([71.217.161.186]) by smtp.gmail.com with ESMTPSA id b16sm6712977qtk.84.2022.02.08.06.20.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 06:20:18 -0800 (PST) From: Jeff Lane To: kernel-team@lists.ubuntu.com Subject: [J][PATCH 3/6] scsi: lpfc: Adjust CMF total bytes and rxmonitor Date: Tue, 8 Feb 2022 09:20:11 -0500 Message-Id: <20220208142014.3782820-4-jeffrey.lane@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220208142014.3782820-1-jeffrey.lane@canonical.com> References: <20220208142014.3782820-1-jeffrey.lane@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: James Smart BugLink: https://bugs.launchpad.net/bugs/1956982 Calculate any extra bytes needed to account for timer accuracy. If we are less than LPFC_CMF_INTERVAL, then calculate the adjustment needed for total to reflect a full LPFC_CMF_INTERVAL. Add additional info to rxmonitor, and adjust some log formatting. Link: https://lore.kernel.org/r/20211204002644.116455-7-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen (cherry picked from commit a6269f837045acb02904f31f05acde847ec8f8a7) Signed-off-by: Jeff Lane --- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_debugfs.c | 14 ++++++++------ drivers/scsi/lpfc/lpfc_debugfs.h | 2 +- drivers/scsi/lpfc/lpfc_init.c | 20 ++++++++++++-------- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index da5a69a2b78f..4c7bc0a5fcf7 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -1601,6 +1601,7 @@ struct lpfc_hba { #define LPFC_MAX_RXMONITOR_ENTRY 800 #define LPFC_MAX_RXMONITOR_DUMP 32 struct rxtable_entry { + uint64_t cmf_bytes; /* Total no of read bytes for CMF_SYNC_WQE */ uint64_t total_bytes; /* Total no of read bytes requested */ uint64_t rcv_bytes; /* Total no of read bytes completed */ uint64_t avg_io_size; diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 08b2e85dcd7d..a11a038e2a85 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -5561,22 +5561,24 @@ lpfc_rx_monitor_read(struct file *file, char __user *buf, size_t nbytes, start = tail; len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len, - " MaxBPI\t Total Data Cmd Total Data Cmpl " - " Latency(us) Avg IO Size\tMax IO Size IO cnt " - "Info BWutil(ms)\n"); + " MaxBPI Tot_Data_CMF Tot_Data_Cmd " + "Tot_Data_Cmpl Lat(us) Avg_IO Max_IO " + "Bsy IO_cnt Info BWutil(ms)\n"); get_table: for (i = start; i < last; i++) { entry = &phba->rxtable[i]; len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len, - "%3d:%12lld %12lld\t%12lld\t" - "%8lldus\t%8lld\t%10lld " - "%8d %2d %2d(%2d)\n", + "%3d:%12lld %12lld %12lld %12lld " + "%7lldus %8lld %7lld " + "%2d %4d %2d %2d(%2d)\n", i, entry->max_bytes_per_interval, + entry->cmf_bytes, entry->total_bytes, entry->rcv_bytes, entry->avg_io_latency, entry->avg_io_size, entry->max_read_cnt, + entry->cmf_busy, entry->io_cnt, entry->cmf_info, entry->timer_utilization, diff --git a/drivers/scsi/lpfc/lpfc_debugfs.h b/drivers/scsi/lpfc/lpfc_debugfs.h index a5bf71b34972..6dd361c1fd31 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.h +++ b/drivers/scsi/lpfc/lpfc_debugfs.h @@ -282,7 +282,7 @@ struct lpfc_idiag { void *ptr_private; }; -#define MAX_DEBUGFS_RX_TABLE_SIZE (100 * LPFC_MAX_RXMONITOR_ENTRY) +#define MAX_DEBUGFS_RX_TABLE_SIZE (128 * LPFC_MAX_RXMONITOR_ENTRY) struct lpfc_rx_monitor_debug { char *i_private; char *buffer; diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index e782e5b6aa0b..bbcf5d446cb1 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -5926,7 +5926,7 @@ lpfc_cmf_timer(struct hrtimer *timer) uint32_t io_cnt; uint32_t head, tail; uint32_t busy, max_read; - uint64_t total, rcv, lat, mbpi, extra; + uint64_t total, rcv, lat, mbpi, extra, cnt; int timer_interval = LPFC_CMF_INTERVAL; uint32_t ms; struct lpfc_cgn_stat *cgs; @@ -5997,20 +5997,23 @@ lpfc_cmf_timer(struct hrtimer *timer) /* Calculate any extra bytes needed to account for the * timer accuracy. If we are less than LPFC_CMF_INTERVAL - * add an extra 3% slop factor, equal to LPFC_CMF_INTERVAL - * add an extra 2%. The goal is to equalize total with a - * time > LPFC_CMF_INTERVAL or <= LPFC_CMF_INTERVAL + 1 + * calculate the adjustment needed for total to reflect + * a full LPFC_CMF_INTERVAL. */ - if (ms == LPFC_CMF_INTERVAL) - extra = div_u64(total, 50); - else if (ms < LPFC_CMF_INTERVAL) - extra = div_u64(total, 33); + if (ms && ms < LPFC_CMF_INTERVAL) { + cnt = div_u64(total, ms); /* bytes per ms */ + cnt *= LPFC_CMF_INTERVAL; /* what total should be */ + if (cnt > mbpi) + cnt = mbpi; + extra = cnt - total; + } lpfc_issue_cmf_sync_wqe(phba, LPFC_CMF_INTERVAL, total + extra); } else { /* For Monitor mode or link down we want mbpi * to be the full link speed */ mbpi = phba->cmf_link_byte_count; + extra = 0; } phba->cmf_timer_cnt++; @@ -6041,6 +6044,7 @@ lpfc_cmf_timer(struct hrtimer *timer) LPFC_RXMONITOR_TABLE_IN_USE); entry = &phba->rxtable[head]; entry->total_bytes = total; + entry->cmf_bytes = total + extra; entry->rcv_bytes = rcv; entry->cmf_busy = busy; entry->cmf_info = phba->cmf_active_info;