Received: by 10.213.65.68 with SMTP id h4csp497736imn; Fri, 16 Mar 2018 09:32:39 -0700 (PDT) X-Google-Smtp-Source: AG47ELtCHwEn6+FrYOHg0c01/H4Cb8ljDpEHtEqW8mwFTIRvyduKqwp4/+MSqjHHWuiy/3bAur92 X-Received: by 2002:a17:902:a705:: with SMTP id w5-v6mr2839435plq.299.1521217959289; Fri, 16 Mar 2018 09:32:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521217959; cv=none; d=google.com; s=arc-20160816; b=fOzdAKK3KDAx2joy2/rwX4lrNWhPrKR03ZyL36KJUdI64kqHJ+q3BWLeKmUfvAZM5Q LEe5Rnq46MacI7KNqL/sCwylqXOknUTg1kklVVAaG0DpOMlmPXq3rkJwArw5AX84EzM9 IayxPb2Fc3lv26CGHunaLjx+1CQTrzdziw1v2DRCREtcj1MPPBcZ6yX64UtoDXA3YDuO KsoSgxjC5cpWRfSIsgCA5Vm/Tf08/ZFLks02buqXG2B8Q1f/iK//23O9xAf4HHpfaeNQ xKQZ1gkeu3+iqgjH59adr5Go03xfgMVDQqLymT9vyUv2pfFZS2zAz7eDlHBkwkrxAEmw Wy8Q== 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=2QJ4Y2zKdeISjVlA6BrYmdt6HJA/R+HNSiXjYyCFPYo=; b=MlvezzENvctRXfm6jEuJUdmhvBb22hLHMFVOUk5FJ29Z1k0KyubB2KGckkTeSDz4xe kspANi0upl3wzNLnYb2p9DMlxaDGaS+LTSEjLHZ6f9NxCdvh8V4EeMpLvgQSns7aHWa2 i8bhGOZek3UvGNS4fEmpzN6S06h/jH9EjJnMRJs89Y12wfxhc0rLO8pb2SCfo6jIqIq6 dDJn00kOdS1Csl65yl+1iWr0H2H9c7cgHBXyCMbo7R171FyldKXx+/mMU7RO+zUR+FCn OIpizHPZW+o5pXA1LEQZDC8dtVo1yoHV8kDHrDDGGXMraSSqbdkl2nomyXHWZZplJ7aI lxdA== 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 j184si5214626pgc.142.2018.03.16.09.32.25; Fri, 16 Mar 2018 09:32:39 -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 S933718AbeCPPih (ORCPT + 99 others); Fri, 16 Mar 2018 11:38:37 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42960 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933255AbeCPPif (ORCPT ); Fri, 16 Mar 2018 11:38:35 -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 7C3C849F; Fri, 16 Mar 2018 15:38:34 +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.14 067/109] scsi: ses: dont ask for diagnostic pages repeatedly during probe Date: Fri, 16 Mar 2018 16:23:36 +0100 Message-Id: <20180316152333.641237416@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152329.844663293@linuxfoundation.org> References: <20180316152329.844663293@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.14-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 @@ -615,13 +615,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); @@ -652,7 +655,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; @@ -768,7 +771,7 @@ page2_not_supported: 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;