From patchwork Wed Jun 14 15:33:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 105534 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp338615qgd; Wed, 14 Jun 2017 08:05:27 -0700 (PDT) X-Received: by 10.84.228.201 with SMTP id y9mr598863pli.300.1497452727093; Wed, 14 Jun 2017 08:05:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497452727; cv=none; d=google.com; s=arc-20160816; b=C7KwwkVcDM8cV3l/Tbe9igO9BtyPnX7TNhEnGVS1v7m1zphDhhY486v1Y4yytz2O1n MfQ1EiLQVWb6g85VHSS5qMtlJTXMhuK2AyBEo7vOG1V5Q9YOWKRaQ0vnPmHmBu/hF5u2 9aOcNvqlKXn+U0oJkrfcY+1a2oUCN8IT2BxkQ4Gg8cMWGTSIYnEe+xvKc0/1vAly/N5m 8R/lo3nG2NI2CYXQMcdFPe7cPan1J+1PSUSkqQwTNWcZ9rF+LWmvcCX/0RzZ4XUH2Yh3 KxvmPpSBUAbiTJCYXeCd0S7wfJU9L4X3Y+4RCWYRChCqKdFgZ8PTyPkDoIcSPz0erru9 mpLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=W3ZENiT6rbuOaL1qWYIvO/P+NXsy2fHe91r2sPp9dZ8=; b=koyUKAGaA+BSFfVY41HVR2V0e36XyJWDDgwjjCq7frNdi7IB/G/S9fltouoSqm3mF7 KNMg8pEzP2NEtVmcgNNhGqExNuCIxd/TrbKV4KyyT50mZwd2pkfubzdwDjMZ0lbgevfT BHJHXuBPBE2o3f3ckEeQVjNCD2EsnSb0CfYOEzYz5liEhoom6pbvWbLcLIGUG/f03TZH 5lHJBd6e8NPkDi1VoHzX8m2uwrDTxiuueVcIP3bQayqwbHIAmW83Gv4k3ItyN76L4yJc D+pu1ssNx1XjTXKkljeHw8qcxo3a5qqzDRoK36cNSeWc+UztvGAFvNnVmMxmgWeHTIkA 1FBw== 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 h26si166442pfk.157.2017.06.14.08.05.26; Wed, 14 Jun 2017 08:05:27 -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 S1752702AbdFNPFF (ORCPT + 25 others); Wed, 14 Jun 2017 11:05:05 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:7849 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752611AbdFNPEU (ORCPT ); Wed, 14 Jun 2017 11:04:20 -0400 Received: from 172.30.72.57 (EHLO dggeml406-hub.china.huawei.com) ([172.30.72.57]) by dggrg02-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id API60188; Wed, 14 Jun 2017 23:03:27 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by dggeml406-hub.china.huawei.com (10.3.17.50) with Microsoft SMTP Server id 14.3.301.0; Wed, 14 Jun 2017 23:03:12 +0800 From: John Garry To: , CC: , , , , , "John Garry" Subject: [PATCH v6 02/22] scsi: hisi_sas: define hisi_sas_device.device_id as int Date: Wed, 14 Jun 2017 23:33:12 +0800 Message-ID: <1497454412-91194-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1497454412-91194-1-git-send-email-john.garry@huawei.com> References: <1497454412-91194-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.5941503F.013D, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 7cc3aac2cd29781ac2cb0fff08d9c811 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently hisi_sas_device.device_id is a u64. This can create a problem in selecting the queue for a device, in that this code does a 64b division on device id. For some 32b systems, 64b division is slow and the lib reference must be explicitly included. The device id does not need to be 64b in size, so, as a solution, just make as an int. Also, struct hisi_sas_device elements are re-ordered to improve packing efficiency. Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 8 ++++---- drivers/scsi/hisi_sas/hisi_sas_main.c | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index 4e28f32..b4e96fa9 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -107,15 +107,15 @@ struct hisi_sas_dq { }; struct hisi_sas_device { - enum sas_device_type dev_type; struct hisi_hba *hisi_hba; struct domain_device *sas_device; + struct list_head list; u64 attached_phy; - u64 device_id; atomic64_t running_req; - struct list_head list; - u8 dev_status; + enum sas_device_type dev_type; + int device_id; int sata_idx; + u8 dev_status; }; struct hisi_sas_slot { diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 3605d28..54e0cf2 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -209,7 +209,7 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_hba *hisi_hba, if (DEV_IS_GONE(sas_dev)) { if (sas_dev) - dev_info(dev, "task prep: device %llu not ready\n", + dev_info(dev, "task prep: device %d not ready\n", sas_dev->device_id); else dev_info(dev, "task prep: device %016llx not ready\n", @@ -627,9 +627,9 @@ static void hisi_sas_dev_gone(struct domain_device *device) struct hisi_sas_device *sas_dev = device->lldd_dev; struct hisi_hba *hisi_hba = dev_to_hisi_hba(device); struct device *dev = &hisi_hba->pdev->dev; - u64 dev_id = sas_dev->device_id; + int dev_id = sas_dev->device_id; - dev_info(dev, "found dev[%lld:%x] is gone\n", + dev_info(dev, "found dev[%d:%x] is gone\n", sas_dev->device_id, sas_dev->dev_type); hisi_sas_internal_task_abort(hisi_hba, device, @@ -1082,7 +1082,7 @@ static int hisi_sas_lu_reset(struct domain_device *device, u8 *lun) } out: if (rc != TMF_RESP_FUNC_COMPLETE) - dev_err(dev, "lu_reset: for device[%llx]:rc= %d\n", + dev_err(dev, "lu_reset: for device[%d]:rc= %d\n", sas_dev->device_id, rc); return rc; } @@ -1129,7 +1129,7 @@ static int hisi_sas_query_task(struct sas_task *task) } static int -hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, u64 device_id, +hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id, struct sas_task *task, int abort_flag, int task_tag) {