Received: by 10.213.65.68 with SMTP id h4csp37616imn; Mon, 19 Mar 2018 18:46:13 -0700 (PDT) X-Google-Smtp-Source: AG47ELtGHcu0K0i4g+hZ6w/7LRyMKPRseXZnJ9gydkU5aa9DUyhfMK1qEp1s5CMkY7LyYQKbQaNt X-Received: by 10.99.125.75 with SMTP id m11mr10672481pgn.391.1521510373351; Mon, 19 Mar 2018 18:46:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521510373; cv=none; d=google.com; s=arc-20160816; b=LF0rrrg0dxKwMo/M8Gpa/o/O6WFEY4/4+p1wgxkyfPYQsn4nqZ93twSh0p7Nwg1Jl+ C//OH+WxDBmq8Z9gVpj5Y/na1sEEcZVfOqSb30v/81sCoXydQf1HF/2XgMJJHEtJysyK uVuaA38bxRCYDde1lPJU+f+/ITb7s4UeGqShpdMIwqyVbm2eZQnd7HEhr4RItahNFy41 jzz+UROVrYEIbglRh60aYRE5gtdCMQ2dDRrDZ7GXYXTFavKdjMrH/8GRyC0zErjya3Sp 5dcI5Ullm9V+l4aK4WoKgVJsEPE9OrR7moXxTn3ojK17k7uy6/fs8Wf3sdoqaNGkGZJb XChg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=wP3NJRl0hUl7yjgr+hMQKVwKG3zqHu++L7uVg8IqVWc=; b=c7BQ+lwJNtdldkRGnmeQu1c7X4aU742phKN/s/MzT1y8A5NACvu+BVaAzcDmy2ma9J 0kXHPT1uLoWP3RkxLyw2ZkdTyGnq4uzeyFvAB6ojHIx4N/XbUdwybXw4n0Dsv4U82sDE rDSUxy1ZxXkrcY2gM0fUjnmrthTlpOSkezHNZFokCq4FIQIUDW89pzmtDphSuEltkBvj Elz81ckAZbmQvxRi35bfag++lW34vTWUUUNhFEkSkmBnqqEXA2uf2OoodckjbG+nG0Tx NGmThhd4DMxgJfcfp1WR0bhOYiNnUI3ZURp+xglmFLr5JlKDhTnChucgF106ra/phsGy RhOQ== ARC-Authentication-Results: i=1; mx.google.com; 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 z21-v6si539180plo.225.2018.03.19.18.45.59; Mon, 19 Mar 2018 18:46:13 -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; 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 S935837AbeCSTR3 (ORCPT + 99 others); Mon, 19 Mar 2018 15:17:29 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50718 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031329AbeCSS0O (ORCPT ); Mon, 19 Mar 2018 14:26:14 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7806C103C; Mon, 19 Mar 2018 18:26:13 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Dongyang , Jason Ozolins , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.9 186/241] scsi: ses: dont ask for diagnostic pages repeatedly during probe Date: Mon, 19 Mar 2018 19:07:31 +0100 Message-Id: <20180319180758.850617113@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Li Dongyang [ Upstream commit 9c0a50022b8ac7e863e6ec8342fa476fe5d1d75c ] We are testing if there is a match with the ses device in a loop by calling ses_match_to_enclosure(), which will issue scsi receive diagnostics commands to the ses device for every device on the same host. On one of our boxes with 840 disks, it takes a long time to load the driver: [root@g1b-oss06 ~]# time modprobe ses real 40m48.247s user 0m0.001s sys 0m0.196s With the patch: [root@g1b-oss06 ~]# time modprobe ses real 0m17.915s user 0m0.008s sys 0m0.053s Note that we still need to refresh page 10 when we see a new disk to create the link. Signed-off-by: Li Dongyang Tested-by: Jason Ozolins Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/ses.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -578,13 +578,16 @@ static void ses_enclosure_data_process(s } static void ses_match_to_enclosure(struct enclosure_device *edev, - struct scsi_device *sdev) + struct scsi_device *sdev, + int refresh) { + struct scsi_device *edev_sdev = to_scsi_device(edev->edev.parent); struct efd efd = { .addr = 0, }; - ses_enclosure_data_process(edev, to_scsi_device(edev->edev.parent), 0); + if (refresh) + ses_enclosure_data_process(edev, edev_sdev, 0); if (scsi_is_sas_rphy(sdev->sdev_target->dev.parent)) efd.addr = sas_get_address(sdev); @@ -615,7 +618,7 @@ static int ses_intf_add(struct device *c struct enclosure_device *prev = NULL; while ((edev = enclosure_find(&sdev->host->shost_gendev, prev)) != NULL) { - ses_match_to_enclosure(edev, sdev); + ses_match_to_enclosure(edev, sdev, 1); prev = edev; } return -ENODEV; @@ -727,7 +730,7 @@ static int ses_intf_add(struct device *c shost_for_each_device(tmp_sdev, sdev->host) { if (tmp_sdev->lun != 0 || scsi_device_enclosure(tmp_sdev)) continue; - ses_match_to_enclosure(edev, tmp_sdev); + ses_match_to_enclosure(edev, tmp_sdev, 0); } return 0;