From patchwork Thu Oct 24 14:08:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 177514 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2249237ill; Thu, 24 Oct 2019 07:13:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBYrdjxUzkcthYPvBM8qAj6J8eJei5ZmxoRlDGaMmDcRUcdinrTZA2oNajeqaUcY5wqbm4 X-Received: by 2002:a17:906:7f06:: with SMTP id d6mr18443765ejr.323.1571926384107; Thu, 24 Oct 2019 07:13:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571926384; cv=none; d=google.com; s=arc-20160816; b=L3RkyLKgPD/XA3R5jli6klc3lITaD5cBVpCDY7HkIMANEN+4RsxSeEpRLQ21Vea53x AjL8eVWgCcsqDGZKqz+6uk3D2XqKRbc/26uB3W2xOo2HSGe9QLvNYbXr07L+Gn4aw5Pw d8wHJDDdvDy5UNvWwRB9vn3dFuTlHTRr015THeUYDPRbb++MLXL+I+3sLdI0gxzQUnbF JbLlY9Y9YlTmkIXRzL6VZjpWfEgw9eP/1XvGCQFaIufVVGSz5sgBFvEwQQkfgo9OfQ36 Xi/bEtQdN1Ods3AjalBDZi4D4Qzf4HWsBD/Nypvzqld+Glq9MnsifAN45fm8/p9ygb8G cY4g== 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; bh=jSOF8azF+ucdE0rYPRHqXlFS9fakeLFeDTQqvIy7E9s=; b=R0/Wi84YiOoUuDfBZJqKb7tfUvmpV1YUXWzjjmKSZJlJG1vyrV8xdosBawr1SRll3Q 4KU7SlXziTRX7+ArRr3zFb5HDLQUQ8Q7L1GlEM+S6+yYg1qoq+qDkkqjqm7B0ZKmR0g+ H5eW5JUtCw9BAfXwviTl1gmfTJ3pwW9LSg+pgk4nFK/LV0SV8JiQPd1COkQoD+G1jb45 GliAEAUBHAMYnrvLVzxdhBbbYGtUl4l8TPcPX4VJ2JCpa01XWNuGVN7j1jvo+SNOEHhB PNxhpOZv51iB+exObcDU+jonlZ4TXCyob5/Mfw58ImzLuy2TG7esuDnW0npLuiXnymE5 nIJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-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 c13si702273edk.4.2019.10.24.07.13.03 for ; Thu, 24 Oct 2019 07:13:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-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-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404908AbfJXONC (ORCPT ); Thu, 24 Oct 2019 10:13:02 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5170 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2502394AbfJXOLo (ORCPT ); Thu, 24 Oct 2019 10:11:44 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 9AD9753DBAE59EFE9EAC; Thu, 24 Oct 2019 22:11:35 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.439.0; Thu, 24 Oct 2019 22:11:24 +0800 From: John Garry To: , CC: , , , Luo Jiaxing , "John Garry" Subject: [PATCH v2 05/18] scsi: hisi_sas: Add timestamp for a debugfs dump Date: Thu, 24 Oct 2019 22:08:12 +0800 Message-ID: <1571926105-74636-6-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1571926105-74636-1-git-send-email-john.garry@huawei.com> References: <1571926105-74636-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Luo Jiaxing It's useful to know when the dump occurred, so add a timestamp file for this. Signed-off-by: Luo Jiaxing Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 2 ++ drivers/scsi/hisi_sas/hisi_sas_main.c | 8 ++++++++ 2 files changed, 10 insertions(+) -- 2.17.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index 83232e8472fb..7069dae4cec9 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -410,6 +411,7 @@ struct hisi_hba { struct hisi_sas_iost *debugfs_iost; struct hisi_sas_itct *debugfs_itct; u64 *debugfs_iost_cache; + u64 debugfs_timestamp; u64 *debugfs_itct_cache; struct dentry *debugfs_dir; diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index a7bac5dc389a..a0d04e4e13e2 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -3194,6 +3194,7 @@ static const struct file_operations hisi_sas_debugfs_itct_cache_fops = { static void hisi_sas_debugfs_create_files(struct hisi_hba *hisi_hba) { + u64 *debugfs_timestamp; struct dentry *dump_dentry; struct dentry *dentry; char name[256]; @@ -3201,10 +3202,14 @@ static void hisi_sas_debugfs_create_files(struct hisi_hba *hisi_hba) int c; int d; + debugfs_timestamp = &hisi_hba->debugfs_timestamp; /* Create dump dir inside device dir */ dump_dentry = debugfs_create_dir("dump", hisi_hba->debugfs_dir); hisi_hba->debugfs_dump_dentry = dump_dentry; + debugfs_create_u64("timestamp", 0400, dump_dentry, + debugfs_timestamp); + debugfs_create_file("global", 0400, dump_dentry, hisi_hba, &hisi_sas_debugfs_global_fops); @@ -3684,7 +3689,10 @@ void hisi_sas_debugfs_work_handler(struct work_struct *work) { struct hisi_hba *hisi_hba = container_of(work, struct hisi_hba, debugfs_work); + u64 timestamp = local_clock(); + do_div(timestamp, NSEC_PER_MSEC); + hisi_hba->debugfs_timestamp = timestamp; if (hisi_hba->debugfs_snapshot) return; hisi_hba->debugfs_snapshot = true;