From patchwork Tue Oct 10 23:28:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Dongyang X-Patchwork-Id: 9998153 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 711FA603B5 for ; Tue, 10 Oct 2017 23:34:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 614912870B for ; Tue, 10 Oct 2017 23:34:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54B36287A2; Tue, 10 Oct 2017 23:34:40 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 EBD542870B for ; Tue, 10 Oct 2017 23:34:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755147AbdJJXeh (ORCPT ); Tue, 10 Oct 2017 19:34:37 -0400 Received: from maildrop2.anu.edu.au ([130.56.64.108]:32780 "EHLO maildrop2.anu.edu.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754477AbdJJXeg (ORCPT ); Tue, 10 Oct 2017 19:34:36 -0400 X-Greylist: delayed 379 seconds by postgrey-1.27 at vger.kernel.org; Tue, 10 Oct 2017 19:34:36 EDT Received: from mailpmx4.anu.edu.au (snatpool01-2.anu.edu.au [130.56.66.106]) by maildrop2.anu.edu.au (8.13.8/8.13.8) with ESMTP id v9ANSGTn002872 for ; Wed, 11 Oct 2017 10:28:16 +1100 Received: from mailpmx4.anu.edu.au (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 540AC818E9 for ; Wed, 11 Oct 2017 10:28:16 +1100 (AEDT) Received: from smtphost1.anu.edu.au (snatpool01-1.anu.edu.au [130.56.66.105]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mailpmx4.anu.edu.au (Postfix) with ESMTPS id 36E64818AC for ; Wed, 11 Oct 2017 10:28:16 +1100 (AEDT) Received: from XPS13.anu.edu.au (bebique.anu.edu.au [150.203.248.39]) (authenticated bits=0) by smtphost1.anu.edu.au (8.13.8/8.13.8) with ESMTP id v9ANS1TY008683 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 11 Oct 2017 10:28:16 +1100 From: Li Dongyang To: linux-scsi@vger.kernel.org Subject: [PATCH] scsi: ses: don't ask for diagnostic pages repeatedly during probe Date: Wed, 11 Oct 2017 10:28:01 +1100 Message-Id: <20171010232801.17642-1-dongyang.li@anu.edu.au> X-Mailer: git-send-email 2.14.2 X-PMX-Version: 6.3.3.2656215, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2017.10.10.232116, AntiVirus-Engine: 5.43.0, AntiVirus-Data: 2017.10.10.5430001 internal X-OriginatorOrg: anu.edu.au X-PerlMx-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, FROM_EDU_TLD 0, NO_URI_HTTPS 0, __ANY_URI 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __NO_HTML_TAG_RAW 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' 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 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 --- drivers/scsi/ses.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index 11826c5c2dd4..62f04c0511cf 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -615,13 +615,16 @@ static void ses_enclosure_data_process(struct enclosure_device *edev, } 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); @@ -652,7 +655,7 @@ static int ses_intf_add(struct device *cdev, 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; @@ -768,7 +771,7 @@ static int ses_intf_add(struct device *cdev, 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;