From patchwork Wed May 31 14:32:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 100784 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp343954qge; Wed, 31 May 2017 07:13:58 -0700 (PDT) X-Received: by 10.101.72.135 with SMTP id n7mr2388160pgs.198.1496240038806; Wed, 31 May 2017 07:13:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496240038; cv=none; d=google.com; s=arc-20160816; b=WXi7xsGuY2F5ksjTtyBvhmUyIK7dgFcNW02I5xmMxbhAc1Jkn/V2WtiWFYX1GrRgQ4 hcQy24zFuT7i9V3pPDpd6kol9EPEYplpAQCxxOoqaIIxP4yrjYOoxlCjhrVQvIyIZNjH qpB3xBiRWODAGDawFHfCGVUsx66MyHAb5HoKYPSUPjRf9to+cSxiW8dH4IpcRDMXPJxB kWqWvH2Z9sZ7V70sQT+ZxUwzzN836HQtAnFEluerNtnUq2KFAZkEsbqCz9nib+pGgWTC NdwTe1/SIEzLGkc1Z+7JaFIKBUel8qmMV8QiARTmP2GLzZY33e66cyXgB+lyjEHXn6RZ yfWQ== 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=QZeob4s2ZQhA9q2n3yc6wIEIhcqG6bU+BP24s/OnXN9JDiIqD8GWjdswbjTZJ87Z2U rvqoZ0cZc5l3TuwEvvLQMSEK1U5WGRUrioAL4S7pqDvCKwTpaEjo6PiRfoSALKVtZl06 TRKWo8qrYI09b39dx0dUvh/DWpK7o9OgjcvbKvGcq2I4JF76sv0w9+pIOb3KLUpxX9we pzFux1b0EEU3d6492OCzcOT94HX332klHmcngG7MVFMf+3YU9lBZW24HmrHkguoVls5i o7a4rYF4ivBe4C8cj1zWXvQi6a1C9QrvJGjI7RTBtqg2r5UuSna28sWEmQdcjl5UefEo wNMw== 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 u131si3657126pgb.26.2017.05.31.07.13.58; Wed, 31 May 2017 07:13:58 -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 S1751637AbdEaONk (ORCPT + 25 others); Wed, 31 May 2017 10:13:40 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:7288 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751265AbdEaOFK (ORCPT ); Wed, 31 May 2017 10:05:10 -0400 Received: from 172.30.72.55 (EHLO dggeml405-hub.china.huawei.com) ([172.30.72.55]) by dggrg01-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id APN16047; Wed, 31 May 2017 22:05:06 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by dggeml405-hub.china.huawei.com (10.3.17.49) with Microsoft SMTP Server id 14.3.301.0; Wed, 31 May 2017 22:04:57 +0800 From: John Garry To: , CC: , , , , , John Garry Subject: [PATCH v3 02/23] scsi: hisi_sas: define hisi_sas_device.device_id as int Date: Wed, 31 May 2017 22:32:54 +0800 Message-ID: <1496241195-217678-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1496241195-217678-1-git-send-email-john.garry@huawei.com> References: <1496241195-217678-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.0A020203.592ECD93.0011, 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: 83d8ab7c84b87bd4db99792a2fd8fed4 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) {