Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3143232pxb; Tue, 19 Jan 2021 15:11:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJzBYpCEcKpL6dnzD6519Nw0d6qa8KAHDjh8mdBVdp6Kg7E+9ZSiPvb/9L6adL646vJsSzP4 X-Received: by 2002:a17:906:154d:: with SMTP id c13mr4497482ejd.471.1611097909488; Tue, 19 Jan 2021 15:11:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611097909; cv=none; d=google.com; s=arc-20160816; b=RBJ7zQOfOwIsTeS7yFjIqTe8pEZOLzyYEW03QTScwiqQOncUFZC7g9dHQio79gZS6W 5GM1RL1dUfMozKgs0Q56+AY5I64ABEpxvB7n87UbkZdWbHeUbi+9bD7MSZMXAl1jMeHx 62IkUut4Kgyw0zp//obwfiEyJQse5XkalUwV2emiBjELfF6G0f8v9lefpQuRQVnX6X4N b3ccaLmK7Q9ThqWKgXjVafAZW7JqbvyqVtymPiGqT+2lm+cExbxGMtckoq+pRvNYzH2P 7DqH/s/lX8xBfZIVpT+USV+LARNb6/IcMnV0gW8oIbL1lqej/NIzptfl3G0354fD0YrL HlWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:references:in-reply-to:message-id :date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=uBLoOxbrdPcY7LOw0s15sD/u2XwF7me85GoyFzXRQAA=; b=HD+W/yR7x87l4Q77uILHamSm18nB1CtfyIlvNtUX5v6kp/5gmbHx6/UG4ouYeSlwln gRlHeoGokFCMbEmYh6vM/K85I57dJmi7KXbnuPMa0lkrDW+uYMcgi6TC7CAYFQC7dXZ0 67M5ssZVZ5egrjx7A89R52S7jZpqljjTjCNDJ5BBL58KHfAxoSNJCpL/PBR9JXfWiI4U I8wdWQENFHwF6vsrxTmCJxrK/0NOPwhjZhyBq5HpM/J6loch6W8+rjYquR1lflQ0xvc5 KfBiN9t88FYXQm8aNuNo3NQwoRDoeze6/FuyMhfA05M873VExZxRdI/ft1i2UNvu6d6n BVNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qx12si77584ejb.375.2021.01.19.15.11.04; Tue, 19 Jan 2021 15:11:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728441AbhASXHl (ORCPT + 99 others); Tue, 19 Jan 2021 18:07:41 -0500 Received: from mga17.intel.com ([192.55.52.151]:24142 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2395361AbhASORN (ORCPT ); Tue, 19 Jan 2021 09:17:13 -0500 IronPort-SDR: hNWqhV0mmu7tbd49MkXtb++U01q55sCsqiXgBBVbRryKKzf3V5zzqLU/EAVpzLAhgQ1n5PH990 BadOLZkrqYRw== X-IronPort-AV: E=McAfee;i="6000,8403,9868"; a="158704813" X-IronPort-AV: E=Sophos;i="5.79,359,1602572400"; d="scan'208";a="158704813" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2021 06:15:43 -0800 IronPort-SDR: M2KeUX9KMFL3STSPaDSMletKeaY7XWUWHpQJvyLApA4DJqMUMW/zPV+X9hMqAW72GLAKNhAU8/ wjjYgstEbIIw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,359,1602572400"; d="scan'208";a="347189929" Received: from ahunter-desktop.fi.intel.com ([10.237.72.149]) by fmsmga007.fm.intel.com with ESMTP; 19 Jan 2021 06:15:40 -0800 From: Adrian Hunter To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Alim Akhtar , Avri Altman , Bean Huo , Can Guo , Stanley Chu Subject: [PATCH 1/4] scsi: ufs: Add exception event tracepoint Date: Tue, 19 Jan 2021 16:15:39 +0200 Message-Id: <20210119141542.3808-2-adrian.hunter@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210119141542.3808-1-adrian.hunter@intel.com> References: <20210119141542.3808-1-adrian.hunter@intel.com> Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, exception event status can be read from wExceptionEventStatus attribute (sysfs file attributes/exception_event_status under the UFS host controller device directory). Polling that attribute to track UFS exception events is impractical, so add a tracepoint to track exception events for testing and debugging purposes. Note, by the time the exception event status is read, the exception event may have cleared, so the value can be zero - see example below. Note also, only enabled exception events can be reported. A subsequent patch adds the ability for users to enable selected exception events via debugfs. Example with driver instrumented to enable all exception events: # echo 1 > /sys/kernel/debug/tracing/events/ufs/ufshcd_exception_event/enable ... do some I/O ... # cat /sys/kernel/debug/tracing/trace # tracer: nop # # entries-in-buffer/entries-written: 3/3 #P:5 # # _-----=> irqs-off # / _----=> need-resched # | / _---=> hardirq/softirq # || / _--=> preempt-depth # ||| / delay # TASK-PID CPU# |||| TIMESTAMP FUNCTION # | | | |||| | | kworker/2:2-173 [002] .... 731.486419: ufshcd_exception_event: 0000:00:12.5: exception event status 0x0 kworker/2:2-173 [002] .... 732.608918: ufshcd_exception_event: 0000:00:12.5: exception event status 0x4 kworker/2:2-173 [002] .... 732.609312: ufshcd_exception_event: 0000:00:12.5: exception event status 0x4 Signed-off-by: Adrian Hunter --- drivers/scsi/ufs/ufshcd.c | 2 ++ include/trace/events/ufs.h | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 46a499b7e8a8..7d46b2c278dd 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -5624,6 +5624,8 @@ static void ufshcd_exception_event_handler(struct work_struct *work) goto out; } + trace_ufshcd_exception_event(dev_name(hba->dev), status); + status &= hba->ee_ctrl_mask; if (status & MASK_EE_URGENT_BKOPS) diff --git a/include/trace/events/ufs.h b/include/trace/events/ufs.h index e151477d645c..5a2586217eb6 100644 --- a/include/trace/events/ufs.h +++ b/include/trace/events/ufs.h @@ -349,6 +349,27 @@ TRACE_EVENT(ufshcd_upiu, ) ); +TRACE_EVENT(ufshcd_exception_event, + + TP_PROTO(const char *dev_name, u16 status), + + TP_ARGS(dev_name, status), + + TP_STRUCT__entry( + __string(dev_name, dev_name) + __field(u16, status) + ), + + TP_fast_assign( + __assign_str(dev_name, dev_name); + __entry->status = status; + ), + + TP_printk("%s: exception event status 0x%x", + __get_str(dev_name), __entry->status + ) +); + #endif /* if !defined(_TRACE_UFS_H) || defined(TRACE_HEADER_MULTI_READ) */ /* This part must be outside protection */ -- 2.17.1