Received: by 10.213.65.68 with SMTP id h4csp475729imn; Fri, 16 Mar 2018 08:54:51 -0700 (PDT) X-Google-Smtp-Source: AG47ELuhbgkctnXGoJ6g8ynJgCM0G9DWbY+ua9xchpKePYlDQgZ0RjDhimbG2SzdDmEnSxHo6Bz6 X-Received: by 10.99.67.1 with SMTP id q1mr1831062pga.365.1521215691653; Fri, 16 Mar 2018 08:54:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521215691; cv=none; d=google.com; s=arc-20160816; b=hCEW8BncP1cVRB5I125daE01VjyZQke8GlSSt27CuJXV0pAwQYVvjjR1YduJVS48eU UY2mG1cBSLkemyQxsc6PP9LO4I8ziVeTupixg35X7x19lKD04/5leC324ifZmULW6pKP VYdmk4OEap3z4AkuYk1dHgbDzMQsJ2hSARt4ZUU+XMWumwms0yVLLSna9KPhQK3Z2HdO HKmcefGDRkSdEPoUjybqAGOfrH5iSBcQBXtKPFJMKLkZMPgdV9//ys+dYJucYF/97qUi p3A4ClyIgiLGuDyJhqebds1uazHeqza9foB3ozZS8ownUCpmdOnTiowqzfqXYqu101T2 HwAg== 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=qR7SHuFOQwDHDK3j8+6gpFsHmcJ1MDWIovMNQZEbLlk=; b=FpJweqwvlPz7Tp9OY1dgPLtxZZB+/do1OiHBaDwvlHpEaHvur4L1zNJMpocYkJfZWa u4kfLMsDZsruPRPNOe9xLS+NBZcBbavNHu0j3efxiE9PGR/UaRv4HWu3/UpitWwgC84y sKLuVL1R/JwxjrTbMy+Y4g/h/tTj6UhXWY1OFYXOFt530jF6SB4GwInxfqGlz/pAXQlu R66qWDT5fxFAc+Q3TQ6thjz2px2Kj5nC6/Duku/iZ1Q7/D73YcQi59xsVxm5s13hhi1B 3/leG1EF+VFfP3F5ZEqNfjVRAcQZ0zBpnKQsGTmZyBln+bTo5rKq3+HEkhy0Zjc3UCKC DUtA== 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 70-v6si6492724ple.372.2018.03.16.08.54.37; Fri, 16 Mar 2018 08:54: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; 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 S1754628AbeCPPvz (ORCPT + 99 others); Fri, 16 Mar 2018 11:51:55 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45992 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753521AbeCPPob (ORCPT ); Fri, 16 Mar 2018 11:44:31 -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 B935DE40; Fri, 16 Mar 2018 15:44:30 +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.15 082/128] scsi: ses: dont ask for diagnostic pages repeatedly during probe Date: Fri, 16 Mar 2018 16:23:43 +0100 Message-Id: <20180316152340.721657702@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152336.199007505@linuxfoundation.org> References: <20180316152336.199007505@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.15-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;