Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp509572yba; Wed, 15 May 2019 05:22:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyuZFwhiw1YuVGpiNuQnsUY4Q1hG/i/3a3lyKpdo2nsDTKAh918ZXUU8kJ0xylRGl6JtgLf X-Received: by 2002:a63:6941:: with SMTP id e62mr40176801pgc.99.1557922971645; Wed, 15 May 2019 05:22:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557922971; cv=none; d=google.com; s=arc-20160816; b=dLc08puOibUY+ZmTRSAwPB7JcqlrnBqfGkCcAnFkOcQxrm9RJQXuNZxjA7/ANpSkYR o2Ua+dRfEPVYfIqHH/t38XMt6mAf3cTk344pRS8X92m7Bp1nkMfWi7K9JSC+Lekx9vge e/89/iik/AaSQQJF5eW6gSzOw5o4ngGh2s1rILXG7+f+UJP17PxDhwtaGpCJd4jb/27i YRCqpkOSPqLF+zVQQAtRkgOFBLhs/ztYEpGd0LNiIBk4bjuo8nqMRciWjibo1nKKwvMq XlSPHhPVTejVbtvQzYYJpdv0V9yDfKECVUk+roYDpEMvwYRF7Yj65u3dkVwBMnjJ67qx tABw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6w7UPBJw8WJh5EyFcqdWS/rADh+9wPK/zsQuoz+mQyw=; b=xNPgMhJ9/ET7/Q/g8Y2k/KdC1SCQyQZ80DqC+9hA2opVRWNo81cfnRBVAdAtiuTGwq x+8i2yWe4zfwHYJrUyCoW0K/GkKiWETHfgzAMjr5zwv2a1t+JRSayoQa0R2Jpgr42G39 gdW7HT0gol6Jr7UzWDwRQa2Wcw+SMyl+XlqkjiCSLosCGSUNGVeYbQTUV/WPwkk8ihI7 Hxtja63O4I0tGhjLluRMsID7I79ysvBK1zQmWv5NlV6YAi4uo4gsr4LF49oWocLNq7kC ABsKKfqleOAa7206DOOKyixpmkAGALYI8pqgcxRnao+7xKD2zHO9yDIWH83sP4SJHk0U 78dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="IGTyw6x/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p15si1547059plo.310.2019.05.15.05.22.36; Wed, 15 May 2019 05:22:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="IGTyw6x/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727374AbfEOMV3 (ORCPT + 99 others); Wed, 15 May 2019 08:21:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:54978 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726909AbfEOK6j (ORCPT ); Wed, 15 May 2019 06:58:39 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0EC8721744; Wed, 15 May 2019 10:58:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557917918; bh=zKswGvSRSrlJ9yPK1emjp0wB8r+fjmFbtrUTF8Q5H6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IGTyw6x/Y60lMEKT3xXU72JdE8IG7AcgiYWv+2um5yr6JEwXzuzQlJ3Za1G6D5N2/ mNFOOjL6XtJCee+g8vwvKYK72+Qg9fIK+p5vQZ+LuQF9GGSjaPgFIlKe1PfLPg96w2 iVWtjKiN8Wu54/KxS373RJ0k5SeAn8zsSrQLDioI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steffen Maier , Benjamin Block , Jens Remus , "Martin K. Petersen" , "Sasha Levin (Microsoft)" Subject: [PATCH 3.18 25/86] scsi: zfcp: reduce flood of fcrscn1 trace records on multi-element RSCN Date: Wed, 15 May 2019 12:55:02 +0200 Message-Id: <20190515090647.871060271@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090642.339346723@linuxfoundation.org> References: <20190515090642.339346723@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ 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 Reviewed-by: Benjamin Block Reviewed-by: Jens Remus Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin (Microsoft) --- 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 ca28e1c66115..f9d59262da88 100644 --- a/drivers/s390/scsi/zfcp_fc.c +++ b/drivers/s390/scsi/zfcp_fc.c @@ -195,10 +195,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); } @@ -206,6 +202,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; @@ -218,6 +215,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