linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Steffen Maier <maier@linux.ibm.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-s390@vger.kernel.org
Subject: [PATCH AUTOSEL 4.4 19/21] scsi: zfcp: reduce flood of fcrscn1 trace records on multi-element RSCN
Date: Mon, 22 Apr 2019 15:49:39 -0400	[thread overview]
Message-ID: <20190422194941.13433-19-sashal@kernel.org> (raw)
In-Reply-To: <20190422194941.13433-1-sashal@kernel.org>

From: Steffen Maier <maier@linux.ibm.com>

[ Upstream commit c8206579175c34a2546de8a74262456278a7795a ]

If an incoming ELS of type RSCN contains more than one element, zfcp
suboptimally causes repeated erp trigger NOP trace records for each
previously failed port. These could be ports that went away.  It loops over
each RSCN element, and for each of those in an inner loop over all
zfcp_ports.

The trigger to recover failed ports should be just the reception of some
RSCN, no matter how many elements it has. So we can loop over failed ports
separately, and only then loop over each RSCN element to handle the
non-failed ports.

The call chain was:

  zfcp_fc_incoming_rscn
    for (i = 1; i < no_entries; i++)
      _zfcp_fc_incoming_rscn
        list_for_each_entry(port, &adapter->port_list, list)
          if (masked port->d_id match) zfcp_fc_test_link
          if (!port->d_id) zfcp_erp_port_reopen "fcrscn1"   <===

In order the reduce the "flooding" of the REC trace area in such cases, we
factor out handling the failed ports to be outside of the entries loop:

  zfcp_fc_incoming_rscn
    if (no_entries > 1)                                     <===
      list_for_each_entry(port, &adapter->port_list, list)  <===
        if (!port->d_id) zfcp_erp_port_reopen "fcrscn1"     <===
    for (i = 1; i < no_entries; i++)
      _zfcp_fc_incoming_rscn
        list_for_each_entry(port, &adapter->port_list, list)
          if (masked port->d_id match) zfcp_fc_test_link

Abbreviated example trace records before this code change:

Tag            : fcrscn1
WWPN           : 0x500507630310d327
ERP want       : 0x02
ERP need       : 0x02

Tag            : fcrscn1
WWPN           : 0x500507630310d327
ERP want       : 0x02
ERP need       : 0x00                 NOP => superfluous trace record

The last trace entry repeats if there are more than 2 RSCN elements.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
---
 drivers/s390/scsi/zfcp_fc.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index 237688af179b..f7630cf581cd 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -238,10 +238,6 @@ static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range,
 	list_for_each_entry(port, &adapter->port_list, list) {
 		if ((port->d_id & range) == (ntoh24(page->rscn_fid) & range))
 			zfcp_fc_test_link(port);
-		if (!port->d_id)
-			zfcp_erp_port_reopen(port,
-					     ZFCP_STATUS_COMMON_ERP_FAILED,
-					     "fcrscn1");
 	}
 	read_unlock_irqrestore(&adapter->port_list_lock, flags);
 }
@@ -249,6 +245,7 @@ static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range,
 static void zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req)
 {
 	struct fsf_status_read_buffer *status_buffer = (void *)fsf_req->data;
+	struct zfcp_adapter *adapter = fsf_req->adapter;
 	struct fc_els_rscn *head;
 	struct fc_els_rscn_page *page;
 	u16 i;
@@ -261,6 +258,22 @@ static void zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req)
 	/* see FC-FS */
 	no_entries = head->rscn_plen / sizeof(struct fc_els_rscn_page);
 
+	if (no_entries > 1) {
+		/* handle failed ports */
+		unsigned long flags;
+		struct zfcp_port *port;
+
+		read_lock_irqsave(&adapter->port_list_lock, flags);
+		list_for_each_entry(port, &adapter->port_list, list) {
+			if (port->d_id)
+				continue;
+			zfcp_erp_port_reopen(port,
+					     ZFCP_STATUS_COMMON_ERP_FAILED,
+					     "fcrscn1");
+		}
+		read_unlock_irqrestore(&adapter->port_list_lock, flags);
+	}
+
 	for (i = 1; i < no_entries; i++) {
 		/* skip head and start with 1st element */
 		page++;
-- 
2.19.1


  parent reply	other threads:[~2019-04-22 19:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-22 19:49 [PATCH AUTOSEL 4.4 01/21] qlcnic: Avoid potential NULL pointer dereference Sasha Levin
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 02/21] netfilter: bridge: set skb transport_header before entering NF_INET_PRE_ROUTING Sasha Levin
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 03/21] sc16is7xx: missing unregister/delete driver on error in sc16is7xx_init() Sasha Levin
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 04/21] usb: gadget: net2280: Fix overrun of OUT messages Sasha Levin
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 05/21] usb: gadget: net2280: Fix net2280_dequeue() Sasha Levin
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 06/21] usb: gadget: net2272: Fix net2272_dequeue() Sasha Levin
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 07/21] ARM: dts: pfla02: increase phy reset duration Sasha Levin
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 08/21] net: ks8851: Dequeue RX packets explicitly Sasha Levin
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 09/21] net: ks8851: Reassert reset pin if chip ID check fails Sasha Levin
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 10/21] net: ks8851: Delay requesting IRQ until opened Sasha Levin
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 11/21] net: ks8851: Set initial carrier state to down Sasha Levin
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 12/21] net: xilinx: fix possible object reference leak Sasha Levin
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 13/21] net: ibm: " Sasha Levin
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 14/21] net: ethernet: ti: " Sasha Levin
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 15/21] scsi: qla4xxx: fix a potential NULL pointer dereference Sasha Levin
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 16/21] usb: u132-hcd: fix resource leak Sasha Levin
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 17/21] tty: fix NULL pointer issue when tty_port ops is not set Sasha Levin
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 18/21] ceph: fix use-after-free on symlink traversal Sasha Levin
2019-04-22 19:49 ` Sasha Levin [this message]
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 20/21] libata: fix using DMA buffers on stack Sasha Levin
2019-04-22 19:49 ` [PATCH AUTOSEL 4.4 21/21] kconfig/[mn]conf: handle backspace (^H) key Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190422194941.13433-19-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=maier@linux.ibm.com \
    --cc=martin.petersen@oracle.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).