From patchwork Thu Feb 4 16:45:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 8225651 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 67BD4BEEED for ; Thu, 4 Feb 2016 17:28:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7081F20397 for ; Thu, 4 Feb 2016 17:28:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 691012039C for ; Thu, 4 Feb 2016 17:28:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934611AbcBDR17 (ORCPT ); Thu, 4 Feb 2016 12:27:59 -0500 Received: from mx0a-0016ce01.pphosted.com ([67.231.148.157]:10275 "EHLO mx0a-0016ce01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934559AbcBDR15 (ORCPT ); Thu, 4 Feb 2016 12:27:57 -0500 Received: from pps.filterd (m0045602.ppops.net [127.0.0.1]) by mx0a-0016ce01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u14HRqJU018314; Thu, 4 Feb 2016 09:27:55 -0800 Received: from avcashub1.qlogic.com ([198.186.0.115]) by mx0a-0016ce01.pphosted.com with ESMTP id 20tkef419j-5 (version=TLSv1 cipher=AES128-SHA bits=128 verify=NOT); Thu, 04 Feb 2016 09:27:55 -0800 Received: from dut6217.mv.qlogic.com (172.29.56.217) by qlc.com (10.1.4.190) with Microsoft SMTP Server id 14.3.235.1; Thu, 4 Feb 2016 09:27:53 -0800 Received: by dut6217.mv.qlogic.com (Postfix, from userid 0) id 9F8BF5220BB; Thu, 4 Feb 2016 11:45:19 -0500 (EST) From: Himanshu Madhani To: , CC: , , Subject: [PATCH 4/4] qla2xxx: Add DebugFS node to show irq vector's cpuid Date: Thu, 4 Feb 2016 11:45:19 -0500 Message-ID: <1454604319-27947-5-git-send-email-himanshu.madhani@qlogic.com> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1454604319-27947-1-git-send-email-himanshu.madhani@qlogic.com> References: <1454604319-27947-1-git-send-email-himanshu.madhani@qlogic.com> MIME-Version: 1.0 disclaimer: bypass X-Proofpoint-Virus-Version: vendor=nai engine=5800 definitions=8065 signatures=670687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1601100000 definitions=main-1602040295 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Quinn Tran > cat /sys/kernel/debug/qla2xxx/*/irq_cpuid qla2xxx_81 IRQ Name Vector CPUID qla2xxx (default) 150 9 qla2xxx (rsp_q) 151 9 qla2xxx (atio_q) 152 9 Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 2 + drivers/scsi/qla2xxx/qla_dfs.c | 49 ++++++++++++++++++++++++++++++++++++++++ drivers/scsi/qla2xxx/qla_isr.c | 16 +++++++++++++ 3 files changed, 67 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index e6c5bcf..c6cc519 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2722,6 +2722,7 @@ struct qla_msix_entry { int have_irq; uint32_t vector; uint16_t entry; + const char *name; struct rsp_que *rsp; struct irq_affinity_notify irq_notify; int cpuid; @@ -3377,6 +3378,7 @@ struct qla_hw_data { struct dentry *dfs_fce; struct dentry *dfs_tgt_counters; struct dentry *dfs_fw_resource_cnt; + struct dentry *dfs_irq_cpuid; dma_addr_t fce_dma; void *fce; diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c index 34272fd..4ff17f6 100644 --- a/drivers/scsi/qla2xxx/qla_dfs.c +++ b/drivers/scsi/qla2xxx/qla_dfs.c @@ -13,6 +13,41 @@ static struct dentry *qla2x00_dfs_root; static atomic_t qla2x00_dfs_root_count; static int +qla2x00_dfs_irq_cpuid_show(struct seq_file *s, void *unused) +{ + scsi_qla_host_t *vha = s->private; + struct qla_hw_data *ha = vha->hw; + struct qla_msix_entry *qentry; + int i; + + seq_printf(s, "%s\n",vha->host_str); + seq_printf(s, "%20s Vector CPUID\n","IRQ Name"); + + for (i = 0; i < ha->msix_count; i++) { + qentry = &ha->msix_entries[i]; + if (qentry->have_irq) + seq_printf(s, "%20s %3d %d\n", qentry->name, + qentry->vector, qentry->cpuid); + } + + return 0; +} + +static int +qla2x00_dfs_irq_cpuid_open(struct inode *inode, struct file *file) +{ + scsi_qla_host_t *vha = inode->i_private; + return single_open(file, qla2x00_dfs_irq_cpuid_show, vha); +} + +static const struct file_operations dfs_irq_cpuid_ops = { + .open = qla2x00_dfs_irq_cpuid_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int qla2x00_dfs_tgt_sess_show(struct seq_file *s, void *unused) { scsi_qla_host_t *vha = s->private; @@ -298,6 +333,15 @@ create_nodes: goto out; } + ha->dfs_irq_cpuid = debugfs_create_file("irq_cpuid", + S_IRUSR, ha->dfs_dir, vha, &dfs_irq_cpuid_ops); + if (!ha->dfs_irq_cpuid) { + ql_log(ql_log_warn, vha, 0xffff, + "Unable to create debugFS irq_cpuid node.\n"); + goto out; + } + + out: return 0; } @@ -307,6 +351,11 @@ qla2x00_dfs_remove(scsi_qla_host_t *vha) { struct qla_hw_data *ha = vha->hw; + if (ha->dfs_irq_cpuid) { + debugfs_remove(ha->dfs_irq_cpuid); + ha->dfs_irq_cpuid = NULL; + } + if (ha->tgt.dfs_tgt_sess) { debugfs_remove(ha->tgt.dfs_tgt_sess); ha->tgt.dfs_tgt_sess = NULL; diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 4af9547..d527189 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -3102,6 +3102,7 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) goto msix_register_fail; qentry->have_irq = 1; qentry->rsp = rsp; + qentry->name = msix_entries[i].name; rsp->msix = qentry; /* Register for CPU affinity notification. */ @@ -3128,7 +3129,22 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) 0, qla83xx_msix_entries[ATIO_VECTOR].name, rsp); qentry->have_irq = 1; qentry->rsp = rsp; + qentry->name = qla83xx_msix_entries[ATIO_VECTOR].name; + qentry->irq_notify.notify = qla_irq_affinity_notify; + qentry->irq_notify.release = qla_irq_affinity_release; rsp->msix = qentry; + + /* Register for CPU affinity notification. */ + irq_set_affinity_notifier(qentry->vector, &qentry->irq_notify); + + /* Schedule work (ie. trigger a notification) to read cpu + * mask for this specific irq. + * kref_get is required because + * irq_affinity_notify() will do + * kref_put(). + */ + kref_get(&qentry->irq_notify.kref); + schedule_work(&qentry->irq_notify.work); } msix_register_fail: