From patchwork Wed Feb 15 04:12:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 13141271 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 766B4C636CC for ; Wed, 15 Feb 2023 04:13:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229632AbjBOENF (ORCPT ); Tue, 14 Feb 2023 23:13:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbjBOEND (ORCPT ); Tue, 14 Feb 2023 23:13:03 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D58CF23D84; Tue, 14 Feb 2023 20:13:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676434381; x=1707970381; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=AGbVQNjFFhD48sGA4OZ7YohsbgowM2f2d1WZiqzgwps=; b=jkj4MQpfAy32ZTQyeMLZdCKMNEZWpTUUp05hzeOEbb6OlhGzs1vIZn1k NtsQgT/XlwN2Q3wK1k/pl58aoyQMDu+qL5E0VvBeBrxt3Og1BJXtEl5Xb owYUTR7xJB0L6c0G5BjuHimizogY5MF3wDWsax+GKdYHwQefgCz37eC71 VoQFIHvsotVLp27RsRiTUvhk3efeOKTNqeuekkwRu+W9mOcm5RZdaWtef pan9/7LdwrobLt6Qs9k+IDZ+TQonW8b/Gy7vlOBGnraqhU4nUPysy3G2R vNkMU7SWaL+LvRytTybLqwgvgposgGaldIr+D/rflvBGN9hyqRBCXsNsp Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10621"; a="311706801" X-IronPort-AV: E=Sophos;i="5.97,298,1669104000"; d="scan'208";a="311706801" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2023 20:13:00 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10621"; a="647016996" X-IronPort-AV: E=Sophos;i="5.97,298,1669104000"; d="scan'208";a="647016996" Received: from iweiny-desk3.amr.corp.intel.com (HELO localhost) ([10.212.74.178]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2023 20:12:59 -0800 From: Ira Weiny Date: Tue, 14 Feb 2023 20:12:43 -0800 Subject: [PATCH v2 1/3] cxl/trace: Standardize device information output MIME-Version: 1.0 Message-Id: <20230208-cxl-event-names-v2-1-fca130c2c68b@intel.com> References: <20230208-cxl-event-names-v2-0-fca130c2c68b@intel.com> In-Reply-To: <20230208-cxl-event-names-v2-0-fca130c2c68b@intel.com> To: Alison Schofield , Vishal Verma , Ben Widawsky , Dan Williams Cc: linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, Ira Weiny , Steven Rostedt , Dave Jiang X-Mailer: b4 0.13-dev-ada30 X-Developer-Signature: v=1; a=ed25519-sha256; t=1676434378; l=11681; i=ira.weiny@intel.com; s=20221222; h=from:subject:message-id; bh=AGbVQNjFFhD48sGA4OZ7YohsbgowM2f2d1WZiqzgwps=; b=C4xFfEhcG5fT4dcLw1nET3J8nnyv0ayCjqE5x4pzWI8dvGPfVP3c4/JGfVgr6UzV46WhNKNEMNUC LjDBFW8tBZGgpurDv11W3BXHDh4OqPIK4MnMaX4Pa0gD1woH7z/z X-Developer-Key: i=ira.weiny@intel.com; a=ed25519; pk=brwqReAJklzu/xZ9FpSsMPSQ/qkSalbg6scP3w809Ec= Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org The trace points were written to take a struct device input for the trace. In CXL multiple device objects are associated with each CXL hardware device. Using different device objects in the trace point can lead to confusion for users. The PCIe device is nice to have, but the user space tooling relies on the memory device naming. It is better to have those device names reported. Change all trace points to take struct cxl_memdev as a standard and report that name. Furthermore, standardize on the name 'memdev' in both /sys/kernel/tracing/trace and cxl-cli monitor output. Cc: Steven Rostedt Cc: Dave Jiang Signed-off-by: Ira Weiny --- Changes for v2 Update commit message Wrap cxlmd in parens within the CXL_EVT_TP_fast_assign macro Fix a formatting issue --- drivers/cxl/core/mbox.c | 14 +++++----- drivers/cxl/core/pci.c | 8 ++---- drivers/cxl/core/trace.h | 70 ++++++++++++++++++++++++------------------------ 3 files changed, 44 insertions(+), 48 deletions(-) diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c index fc7631bb1c24..f2addb457172 100644 --- a/drivers/cxl/core/mbox.c +++ b/drivers/cxl/core/mbox.c @@ -768,7 +768,7 @@ static const uuid_t mem_mod_event_uuid = UUID_INIT(0xfe927475, 0xdd59, 0x4339, 0xa5, 0x86, 0x79, 0xba, 0xb1, 0x13, 0xb7, 0x74); -static void cxl_event_trace_record(const struct device *dev, +static void cxl_event_trace_record(const struct cxl_memdev *cxlmd, enum cxl_event_log_type type, struct cxl_event_record_raw *record) { @@ -778,19 +778,19 @@ static void cxl_event_trace_record(const struct device *dev, struct cxl_event_gen_media *rec = (struct cxl_event_gen_media *)record; - trace_cxl_general_media(dev, type, rec); + trace_cxl_general_media(cxlmd, type, rec); } else if (uuid_equal(id, &dram_event_uuid)) { struct cxl_event_dram *rec = (struct cxl_event_dram *)record; - trace_cxl_dram(dev, type, rec); + trace_cxl_dram(cxlmd, type, rec); } else if (uuid_equal(id, &mem_mod_event_uuid)) { struct cxl_event_mem_module *rec = (struct cxl_event_mem_module *)record; - trace_cxl_memory_module(dev, type, rec); + trace_cxl_memory_module(cxlmd, type, rec); } else { /* For unknown record types print just the header */ - trace_cxl_generic_event(dev, type, record); + trace_cxl_generic_event(cxlmd, type, record); } } @@ -897,11 +897,11 @@ static void cxl_mem_get_records_log(struct cxl_dev_state *cxlds, break; for (i = 0; i < nr_rec; i++) - cxl_event_trace_record(cxlds->dev, type, + cxl_event_trace_record(cxlds->cxlmd, type, &payload->records[i]); if (payload->flags & CXL_GET_EVENT_FLAG_OVERFLOW) - trace_cxl_overflow(cxlds->dev, type, payload); + trace_cxl_overflow(cxlds->cxlmd, type, payload); rc = cxl_clear_event_record(cxlds, type, payload); if (rc) { diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 2b463f107cb5..8afd127fa9f5 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -622,8 +622,6 @@ EXPORT_SYMBOL_NS_GPL(read_cdat_data, CXL); void cxl_cor_error_detected(struct pci_dev *pdev) { struct cxl_dev_state *cxlds = pci_get_drvdata(pdev); - struct cxl_memdev *cxlmd = cxlds->cxlmd; - struct device *dev = &cxlmd->dev; void __iomem *addr; u32 status; @@ -634,7 +632,7 @@ void cxl_cor_error_detected(struct pci_dev *pdev) status = readl(addr); if (status & CXL_RAS_CORRECTABLE_STATUS_MASK) { writel(status & CXL_RAS_CORRECTABLE_STATUS_MASK, addr); - trace_cxl_aer_correctable_error(dev, status); + trace_cxl_aer_correctable_error(cxlds->cxlmd, status); } } EXPORT_SYMBOL_NS_GPL(cxl_cor_error_detected, CXL); @@ -662,8 +660,6 @@ static void header_log_copy(struct cxl_dev_state *cxlds, u32 *log) */ static bool cxl_report_and_clear(struct cxl_dev_state *cxlds) { - struct cxl_memdev *cxlmd = cxlds->cxlmd; - struct device *dev = &cxlmd->dev; u32 hl[CXL_HEADERLOG_SIZE_U32]; void __iomem *addr; u32 status; @@ -689,7 +685,7 @@ static bool cxl_report_and_clear(struct cxl_dev_state *cxlds) } header_log_copy(cxlds, hl); - trace_cxl_aer_uncorrectable_error(dev, status, fe, hl); + trace_cxl_aer_uncorrectable_error(cxlds->cxlmd, status, fe, hl); writel(status & CXL_RAS_UNCORRECTABLE_STATUS_MASK, addr); return true; diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h index c72ef9321cfe..93ac651a2f21 100644 --- a/drivers/cxl/core/trace.h +++ b/drivers/cxl/core/trace.h @@ -47,16 +47,16 @@ ) TRACE_EVENT(cxl_aer_uncorrectable_error, - TP_PROTO(const struct device *dev, u32 status, u32 fe, u32 *hl), - TP_ARGS(dev, status, fe, hl), + TP_PROTO(const struct cxl_memdev *cxlmd, u32 status, u32 fe, u32 *hl), + TP_ARGS(cxlmd, status, fe, hl), TP_STRUCT__entry( - __string(dev_name, dev_name(dev)) + __string(memdev, dev_name(&cxlmd->dev)) __field(u32, status) __field(u32, first_error) __array(u32, header_log, CXL_HEADERLOG_SIZE_U32) ), TP_fast_assign( - __assign_str(dev_name, dev_name(dev)); + __assign_str(memdev, dev_name(&cxlmd->dev)); __entry->status = status; __entry->first_error = fe; /* @@ -65,8 +65,8 @@ TRACE_EVENT(cxl_aer_uncorrectable_error, */ memcpy(__entry->header_log, hl, CXL_HEADERLOG_SIZE); ), - TP_printk("%s: status: '%s' first_error: '%s'", - __get_str(dev_name), + TP_printk("memdev=%s: status: '%s' first_error: '%s'", + __get_str(memdev), show_uc_errs(__entry->status), show_uc_errs(__entry->first_error) ) @@ -91,18 +91,18 @@ TRACE_EVENT(cxl_aer_uncorrectable_error, ) TRACE_EVENT(cxl_aer_correctable_error, - TP_PROTO(const struct device *dev, u32 status), - TP_ARGS(dev, status), + TP_PROTO(const struct cxl_memdev *cxlmd, u32 status), + TP_ARGS(cxlmd, status), TP_STRUCT__entry( - __string(dev_name, dev_name(dev)) + __string(memdev, dev_name(&cxlmd->dev)) __field(u32, status) ), TP_fast_assign( - __assign_str(dev_name, dev_name(dev)); + __assign_str(memdev, dev_name(&cxlmd->dev)); __entry->status = status; ), - TP_printk("%s: status: '%s'", - __get_str(dev_name), show_ce_errs(__entry->status) + TP_printk("memdev=%s: status: '%s'", + __get_str(memdev), show_ce_errs(__entry->status) ) ); @@ -115,13 +115,13 @@ TRACE_EVENT(cxl_aer_correctable_error, TRACE_EVENT(cxl_overflow, - TP_PROTO(const struct device *dev, enum cxl_event_log_type log, + TP_PROTO(const struct cxl_memdev *cxlmd, enum cxl_event_log_type log, struct cxl_get_event_payload *payload), - TP_ARGS(dev, log, payload), + TP_ARGS(cxlmd, log, payload), TP_STRUCT__entry( - __string(dev_name, dev_name(dev)) + __string(memdev, dev_name(&cxlmd->dev)) __field(int, log) __field(u64, first_ts) __field(u64, last_ts) @@ -129,15 +129,15 @@ TRACE_EVENT(cxl_overflow, ), TP_fast_assign( - __assign_str(dev_name, dev_name(dev)); + __assign_str(memdev, dev_name(&cxlmd->dev)); __entry->log = log; __entry->count = le16_to_cpu(payload->overflow_err_count); __entry->first_ts = le64_to_cpu(payload->first_overflow_timestamp); __entry->last_ts = le64_to_cpu(payload->last_overflow_timestamp); ), - TP_printk("%s: log=%s : %u records from %llu to %llu", - __get_str(dev_name), cxl_event_log_type_str(__entry->log), + TP_printk("memdev=%s: log=%s : %u records from %llu to %llu", + __get_str(memdev), cxl_event_log_type_str(__entry->log), __entry->count, __entry->first_ts, __entry->last_ts) ); @@ -170,7 +170,7 @@ TRACE_EVENT(cxl_overflow, * See the generic_event tracepoint as an example. */ #define CXL_EVT_TP_entry \ - __string(dev_name, dev_name(dev)) \ + __string(memdev, dev_name(&cxlmd->dev)) \ __field(int, log) \ __field_struct(uuid_t, hdr_uuid) \ __field(u32, hdr_flags) \ @@ -180,8 +180,8 @@ TRACE_EVENT(cxl_overflow, __field(u8, hdr_length) \ __field(u8, hdr_maint_op_class) -#define CXL_EVT_TP_fast_assign(dev, l, hdr) \ - __assign_str(dev_name, dev_name(dev)); \ +#define CXL_EVT_TP_fast_assign(cxlmd, l, hdr) \ + __assign_str(memdev, dev_name(&(cxlmd)->dev)); \ __entry->log = (l); \ memcpy(&__entry->hdr_uuid, &(hdr).id, sizeof(uuid_t)); \ __entry->hdr_length = (hdr).length; \ @@ -192,10 +192,10 @@ TRACE_EVENT(cxl_overflow, __entry->hdr_maint_op_class = (hdr).maint_op_class #define CXL_EVT_TP_printk(fmt, ...) \ - TP_printk("%s log=%s : time=%llu uuid=%pUb len=%d flags='%s' " \ + TP_printk("memdev=%s log=%s : time=%llu uuid=%pUb len=%d flags='%s' " \ "handle=%x related_handle=%x maint_op_class=%u" \ " : " fmt, \ - __get_str(dev_name), cxl_event_log_type_str(__entry->log), \ + __get_str(memdev), cxl_event_log_type_str(__entry->log), \ __entry->hdr_timestamp, &__entry->hdr_uuid, __entry->hdr_length,\ show_hdr_flags(__entry->hdr_flags), __entry->hdr_handle, \ __entry->hdr_related_handle, __entry->hdr_maint_op_class, \ @@ -203,10 +203,10 @@ TRACE_EVENT(cxl_overflow, TRACE_EVENT(cxl_generic_event, - TP_PROTO(const struct device *dev, enum cxl_event_log_type log, + TP_PROTO(const struct cxl_memdev *cxlmd, enum cxl_event_log_type log, struct cxl_event_record_raw *rec), - TP_ARGS(dev, log, rec), + TP_ARGS(cxlmd, log, rec), TP_STRUCT__entry( CXL_EVT_TP_entry @@ -214,7 +214,7 @@ TRACE_EVENT(cxl_generic_event, ), TP_fast_assign( - CXL_EVT_TP_fast_assign(dev, log, rec->hdr); + CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr); memcpy(__entry->data, &rec->data, CXL_EVENT_RECORD_DATA_LENGTH); ), @@ -293,10 +293,10 @@ TRACE_EVENT(cxl_generic_event, TRACE_EVENT(cxl_general_media, - TP_PROTO(const struct device *dev, enum cxl_event_log_type log, + TP_PROTO(const struct cxl_memdev *cxlmd, enum cxl_event_log_type log, struct cxl_event_gen_media *rec), - TP_ARGS(dev, log, rec), + TP_ARGS(cxlmd, log, rec), TP_STRUCT__entry( CXL_EVT_TP_entry @@ -315,7 +315,7 @@ TRACE_EVENT(cxl_general_media, ), TP_fast_assign( - CXL_EVT_TP_fast_assign(dev, log, rec->hdr); + CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr); /* General Media */ __entry->dpa = le64_to_cpu(rec->phys_addr); @@ -376,10 +376,10 @@ TRACE_EVENT(cxl_general_media, TRACE_EVENT(cxl_dram, - TP_PROTO(const struct device *dev, enum cxl_event_log_type log, + TP_PROTO(const struct cxl_memdev *cxlmd, enum cxl_event_log_type log, struct cxl_event_dram *rec), - TP_ARGS(dev, log, rec), + TP_ARGS(cxlmd, log, rec), TP_STRUCT__entry( CXL_EVT_TP_entry @@ -401,7 +401,7 @@ TRACE_EVENT(cxl_dram, ), TP_fast_assign( - CXL_EVT_TP_fast_assign(dev, log, rec->hdr); + CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr); /* DRAM */ __entry->dpa = le64_to_cpu(rec->phys_addr); @@ -525,10 +525,10 @@ TRACE_EVENT(cxl_dram, TRACE_EVENT(cxl_memory_module, - TP_PROTO(const struct device *dev, enum cxl_event_log_type log, + TP_PROTO(const struct cxl_memdev *cxlmd, enum cxl_event_log_type log, struct cxl_event_mem_module *rec), - TP_ARGS(dev, log, rec), + TP_ARGS(cxlmd, log, rec), TP_STRUCT__entry( CXL_EVT_TP_entry @@ -548,7 +548,7 @@ TRACE_EVENT(cxl_memory_module, ), TP_fast_assign( - CXL_EVT_TP_fast_assign(dev, log, rec->hdr); + CXL_EVT_TP_fast_assign(cxlmd, log, rec->hdr); /* Memory Module Event */ __entry->event_type = rec->event_type; From patchwork Wed Feb 15 04:12:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 13141273 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BB05C636D4 for ; Wed, 15 Feb 2023 04:13:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229988AbjBOENG (ORCPT ); Tue, 14 Feb 2023 23:13:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbjBOENE (ORCPT ); Tue, 14 Feb 2023 23:13:04 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4628241C5; Tue, 14 Feb 2023 20:13:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676434383; x=1707970383; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=IGyWMYciUslHEYV1SyNUcPNSTP6hK0gf7hhbx21h8G8=; b=AY15KkvDpI6VWfeCENI7fvyBgIB+h1s7pS5JY/WbtjA805iJ2UdoGibg Y2UEiTCyD+ej5pXbK+km3yOc3Bqo/ZWqlFJrGML3FTiaWRvVMZ3NzQCJU MwupPP3OAcy71V+yF/66DVqeot71nYRpVOa3s0dMCDunHbuK+pZH58kbK F67Jqd/RaI++EXzYf2dvFDlgpXIwroOnYA43idMyAHVbSEFYJzc7CluH1 vfCwoHMwenzPg7sKcMorIlxMYeVaYeRaTMJnRDY940nTfL2dAcPwmfl3y JpW3b26zKHuejy+zhjRkZ93UjbTz4j0+Ae3wHZWenxGV3TQ5BuVO19rcI Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10621"; a="311706807" X-IronPort-AV: E=Sophos;i="5.97,298,1669104000"; d="scan'208";a="311706807" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2023 20:13:01 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10621"; a="647016999" X-IronPort-AV: E=Sophos;i="5.97,298,1669104000"; d="scan'208";a="647016999" Received: from iweiny-desk3.amr.corp.intel.com (HELO localhost) ([10.212.74.178]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2023 20:13:00 -0800 From: Ira Weiny Date: Tue, 14 Feb 2023 20:12:44 -0800 Subject: [PATCH v2 2/3] cxl/trace: Add host output to trace points MIME-Version: 1.0 Message-Id: <20230208-cxl-event-names-v2-2-fca130c2c68b@intel.com> References: <20230208-cxl-event-names-v2-0-fca130c2c68b@intel.com> In-Reply-To: <20230208-cxl-event-names-v2-0-fca130c2c68b@intel.com> To: Alison Schofield , Vishal Verma , Ben Widawsky , Dan Williams Cc: linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, Ira Weiny , Steven Rostedt , Dave Jiang X-Mailer: b4 0.13-dev-ada30 X-Developer-Signature: v=1; a=ed25519-sha256; t=1676434378; l=4670; i=ira.weiny@intel.com; s=20221222; h=from:subject:message-id; bh=IGyWMYciUslHEYV1SyNUcPNSTP6hK0gf7hhbx21h8G8=; b=l/uO+zxczN1O6TEigg2pxzvc0xM9VDRHf5i13B3Oa3JqhDPH8qUs7JsAJdWDm5M4mCyK1o1XfSCn HIgd8rfQAUGrsMdIcEh4FFRnBOHQ+Zt5hvoPbhJz3J3mhixwsem8 X-Developer-Key: i=ira.weiny@intel.com; a=ed25519; pk=brwqReAJklzu/xZ9FpSsMPSQ/qkSalbg6scP3w809Ec= Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org The host parameter of where the memdev is connected is useful information. Report host consistently in all trace points. Cc: Steven Rostedt Cc: Dave Jiang Signed-off-by: Ira Weiny --- Changes for v2 Correctly use parens in the CXL_EVT_TP_fast_assign macro --- drivers/cxl/core/trace.h | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h index 93ac651a2f21..ed69e558187b 100644 --- a/drivers/cxl/core/trace.h +++ b/drivers/cxl/core/trace.h @@ -51,12 +51,14 @@ TRACE_EVENT(cxl_aer_uncorrectable_error, TP_ARGS(cxlmd, status, fe, hl), TP_STRUCT__entry( __string(memdev, dev_name(&cxlmd->dev)) + __string(host, dev_name(cxlmd->dev.parent)) __field(u32, status) __field(u32, first_error) __array(u32, header_log, CXL_HEADERLOG_SIZE_U32) ), TP_fast_assign( __assign_str(memdev, dev_name(&cxlmd->dev)); + __assign_str(host, dev_name(cxlmd->dev.parent)); __entry->status = status; __entry->first_error = fe; /* @@ -65,8 +67,8 @@ TRACE_EVENT(cxl_aer_uncorrectable_error, */ memcpy(__entry->header_log, hl, CXL_HEADERLOG_SIZE); ), - TP_printk("memdev=%s: status: '%s' first_error: '%s'", - __get_str(memdev), + TP_printk("memdev=%s host=%s: status: '%s' first_error: '%s'", + __get_str(memdev), __get_str(host), show_uc_errs(__entry->status), show_uc_errs(__entry->first_error) ) @@ -95,14 +97,17 @@ TRACE_EVENT(cxl_aer_correctable_error, TP_ARGS(cxlmd, status), TP_STRUCT__entry( __string(memdev, dev_name(&cxlmd->dev)) + __string(host, dev_name(cxlmd->dev.parent)) __field(u32, status) ), TP_fast_assign( __assign_str(memdev, dev_name(&cxlmd->dev)); + __assign_str(host, dev_name(cxlmd->dev.parent)); __entry->status = status; ), - TP_printk("memdev=%s: status: '%s'", - __get_str(memdev), show_ce_errs(__entry->status) + TP_printk("memdev=%s host=%s: status: '%s'", + __get_str(memdev), __get_str(host), + show_ce_errs(__entry->status) ) ); @@ -122,6 +127,7 @@ TRACE_EVENT(cxl_overflow, TP_STRUCT__entry( __string(memdev, dev_name(&cxlmd->dev)) + __string(host, dev_name(cxlmd->dev.parent)) __field(int, log) __field(u64, first_ts) __field(u64, last_ts) @@ -130,15 +136,17 @@ TRACE_EVENT(cxl_overflow, TP_fast_assign( __assign_str(memdev, dev_name(&cxlmd->dev)); + __assign_str(host, dev_name(cxlmd->dev.parent)); __entry->log = log; __entry->count = le16_to_cpu(payload->overflow_err_count); __entry->first_ts = le64_to_cpu(payload->first_overflow_timestamp); __entry->last_ts = le64_to_cpu(payload->last_overflow_timestamp); ), - TP_printk("memdev=%s: log=%s : %u records from %llu to %llu", - __get_str(memdev), cxl_event_log_type_str(__entry->log), - __entry->count, __entry->first_ts, __entry->last_ts) + TP_printk("memdev=%s host=%s: log=%s : %u records from %llu to %llu", + __get_str(memdev), __get_str(host), + cxl_event_log_type_str(__entry->log), __entry->count, + __entry->first_ts, __entry->last_ts) ); @@ -171,6 +179,7 @@ TRACE_EVENT(cxl_overflow, */ #define CXL_EVT_TP_entry \ __string(memdev, dev_name(&cxlmd->dev)) \ + __string(host, dev_name(cxlmd->dev.parent)) \ __field(int, log) \ __field_struct(uuid_t, hdr_uuid) \ __field(u32, hdr_flags) \ @@ -182,6 +191,7 @@ TRACE_EVENT(cxl_overflow, #define CXL_EVT_TP_fast_assign(cxlmd, l, hdr) \ __assign_str(memdev, dev_name(&(cxlmd)->dev)); \ + __assign_str(host, dev_name((cxlmd)->dev.parent)); \ __entry->log = (l); \ memcpy(&__entry->hdr_uuid, &(hdr).id, sizeof(uuid_t)); \ __entry->hdr_length = (hdr).length; \ @@ -192,10 +202,11 @@ TRACE_EVENT(cxl_overflow, __entry->hdr_maint_op_class = (hdr).maint_op_class #define CXL_EVT_TP_printk(fmt, ...) \ - TP_printk("memdev=%s log=%s : time=%llu uuid=%pUb len=%d flags='%s' " \ - "handle=%x related_handle=%x maint_op_class=%u" \ + TP_printk("memdev=%s host=%s log=%s : time=%llu uuid=%pUb len=%d " \ + "flags='%s' handle=%x related_handle=%x maint_op_class=%u" \ " : " fmt, \ - __get_str(memdev), cxl_event_log_type_str(__entry->log), \ + __get_str(memdev), __get_str(host), \ + cxl_event_log_type_str(__entry->log), \ __entry->hdr_timestamp, &__entry->hdr_uuid, __entry->hdr_length,\ show_hdr_flags(__entry->hdr_flags), __entry->hdr_handle, \ __entry->hdr_related_handle, __entry->hdr_maint_op_class, \ From patchwork Wed Feb 15 04:12:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 13141272 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B856C64EC7 for ; Wed, 15 Feb 2023 04:13:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229526AbjBOENG (ORCPT ); Tue, 14 Feb 2023 23:13:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229581AbjBOENE (ORCPT ); Tue, 14 Feb 2023 23:13:04 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C46C0241E7; Tue, 14 Feb 2023 20:13:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676434383; x=1707970383; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=Hw1DDHRIHIwPlwNgbgIfy7AWI3+eWUYTCa7drEZt1eI=; b=cud5PTODHg77ga+zq8z8rUKhGo/8QRZiHAKgyG+xIZPvm4vEVr0r7TZU 636oMRtIkEzfXfCWIggcg5qpemRvhKsyg1wzkOK8Mhel0lIKXlxi6KWW1 R7YAIkjLoD7nW2TqzUxWfIWunQQjzdCKCqGQcfrSj2Zjpz806beZsmG32 O0iS6PUlfxsBOAD3zPnq3h3V4PU4y+MIDweqGyxfaVF2rEykdl9af8zs0 BPHrl+BHvjZ/V3bUakEdR1E18xSPvkGQuzh/zoLS6WQtE1egnlC9Or98B a/us11dKcE1gHwzCtAvovUUo4GZXCuxTv2LJZek0eHLvdq3h5GVz9Fhy+ A==; X-IronPort-AV: E=McAfee;i="6500,9779,10621"; a="311706810" X-IronPort-AV: E=Sophos;i="5.97,298,1669104000"; d="scan'208";a="311706810" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2023 20:13:02 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10621"; a="647017003" X-IronPort-AV: E=Sophos;i="5.97,298,1669104000"; d="scan'208";a="647017003" Received: from iweiny-desk3.amr.corp.intel.com (HELO localhost) ([10.212.74.178]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2023 20:13:01 -0800 From: Ira Weiny Date: Tue, 14 Feb 2023 20:12:45 -0800 Subject: [PATCH v2 3/3] cxl/trace: Add serial number to trace points MIME-Version: 1.0 Message-Id: <20230208-cxl-event-names-v2-3-fca130c2c68b@intel.com> References: <20230208-cxl-event-names-v2-0-fca130c2c68b@intel.com> In-Reply-To: <20230208-cxl-event-names-v2-0-fca130c2c68b@intel.com> To: Alison Schofield , Vishal Verma , Ben Widawsky , Dan Williams Cc: linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, Ira Weiny , Steven Rostedt , Dave Jiang X-Mailer: b4 0.13-dev-ada30 X-Developer-Signature: v=1; a=ed25519-sha256; t=1676434378; l=5068; i=ira.weiny@intel.com; s=20221222; h=from:subject:message-id; bh=Hw1DDHRIHIwPlwNgbgIfy7AWI3+eWUYTCa7drEZt1eI=; b=OGsI2VdXSKeA4uMGc+TIfF1n64xZK9eC0RhbRGhesXGaL7aI28/E17lFL1gFxEfd5h0j8+8qMSER uKoIKjmqBsSpirWJ2xvR8IgzP7yH7c4ScYej9kNqxtiYpuLvJyTa X-Developer-Key: i=ira.weiny@intel.com; a=ed25519; pk=brwqReAJklzu/xZ9FpSsMPSQ/qkSalbg6scP3w809Ec= Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org Device serial numbers are useful information for the user. Add device serial numbers to all the trace points. Cc: Steven Rostedt Cc: Dave Jiang Signed-off-by: Ira Weiny --- NOTE: Device serial numbers default to 0 but can be added in QEMU with the following syntax for testing: "-device cxl-type3,sn=,..." Changes for v2 From Dan New patch -- don't forget the serial number --- drivers/cxl/core/trace.h | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h index ed69e558187b..9b8d3d997834 100644 --- a/drivers/cxl/core/trace.h +++ b/drivers/cxl/core/trace.h @@ -52,6 +52,7 @@ TRACE_EVENT(cxl_aer_uncorrectable_error, TP_STRUCT__entry( __string(memdev, dev_name(&cxlmd->dev)) __string(host, dev_name(cxlmd->dev.parent)) + __field(u64, serial) __field(u32, status) __field(u32, first_error) __array(u32, header_log, CXL_HEADERLOG_SIZE_U32) @@ -59,6 +60,7 @@ TRACE_EVENT(cxl_aer_uncorrectable_error, TP_fast_assign( __assign_str(memdev, dev_name(&cxlmd->dev)); __assign_str(host, dev_name(cxlmd->dev.parent)); + __entry->serial = cxlmd->cxlds->serial; __entry->status = status; __entry->first_error = fe; /* @@ -67,8 +69,8 @@ TRACE_EVENT(cxl_aer_uncorrectable_error, */ memcpy(__entry->header_log, hl, CXL_HEADERLOG_SIZE); ), - TP_printk("memdev=%s host=%s: status: '%s' first_error: '%s'", - __get_str(memdev), __get_str(host), + TP_printk("memdev=%s host=%s serial=%lld: status: '%s' first_error: '%s'", + __get_str(memdev), __get_str(host), __entry->serial, show_uc_errs(__entry->status), show_uc_errs(__entry->first_error) ) @@ -98,15 +100,17 @@ TRACE_EVENT(cxl_aer_correctable_error, TP_STRUCT__entry( __string(memdev, dev_name(&cxlmd->dev)) __string(host, dev_name(cxlmd->dev.parent)) + __field(u64, serial) __field(u32, status) ), TP_fast_assign( __assign_str(memdev, dev_name(&cxlmd->dev)); __assign_str(host, dev_name(cxlmd->dev.parent)); + __entry->serial = cxlmd->cxlds->serial; __entry->status = status; ), - TP_printk("memdev=%s host=%s: status: '%s'", - __get_str(memdev), __get_str(host), + TP_printk("memdev=%s host=%s serial=%lld: status: '%s'", + __get_str(memdev), __get_str(host), __entry->serial, show_ce_errs(__entry->status) ) ); @@ -129,6 +133,7 @@ TRACE_EVENT(cxl_overflow, __string(memdev, dev_name(&cxlmd->dev)) __string(host, dev_name(cxlmd->dev.parent)) __field(int, log) + __field(u64, serial) __field(u64, first_ts) __field(u64, last_ts) __field(u16, count) @@ -137,14 +142,15 @@ TRACE_EVENT(cxl_overflow, TP_fast_assign( __assign_str(memdev, dev_name(&cxlmd->dev)); __assign_str(host, dev_name(cxlmd->dev.parent)); + __entry->serial = cxlmd->cxlds->serial; __entry->log = log; __entry->count = le16_to_cpu(payload->overflow_err_count); __entry->first_ts = le64_to_cpu(payload->first_overflow_timestamp); __entry->last_ts = le64_to_cpu(payload->last_overflow_timestamp); ), - TP_printk("memdev=%s host=%s: log=%s : %u records from %llu to %llu", - __get_str(memdev), __get_str(host), + TP_printk("memdev=%s host=%s serial=%lld: log=%s : %u records from %llu to %llu", + __get_str(memdev), __get_str(host), __entry->serial, cxl_event_log_type_str(__entry->log), __entry->count, __entry->first_ts, __entry->last_ts) @@ -182,6 +188,7 @@ TRACE_EVENT(cxl_overflow, __string(host, dev_name(cxlmd->dev.parent)) \ __field(int, log) \ __field_struct(uuid_t, hdr_uuid) \ + __field(u64, serial) \ __field(u32, hdr_flags) \ __field(u16, hdr_handle) \ __field(u16, hdr_related_handle) \ @@ -193,6 +200,7 @@ TRACE_EVENT(cxl_overflow, __assign_str(memdev, dev_name(&(cxlmd)->dev)); \ __assign_str(host, dev_name((cxlmd)->dev.parent)); \ __entry->log = (l); \ + __entry->serial = (cxlmd)->cxlds->serial; \ memcpy(&__entry->hdr_uuid, &(hdr).id, sizeof(uuid_t)); \ __entry->hdr_length = (hdr).length; \ __entry->hdr_flags = get_unaligned_le24((hdr).flags); \ @@ -202,10 +210,10 @@ TRACE_EVENT(cxl_overflow, __entry->hdr_maint_op_class = (hdr).maint_op_class #define CXL_EVT_TP_printk(fmt, ...) \ - TP_printk("memdev=%s host=%s log=%s : time=%llu uuid=%pUb len=%d " \ - "flags='%s' handle=%x related_handle=%x maint_op_class=%u" \ - " : " fmt, \ - __get_str(memdev), __get_str(host), \ + TP_printk("memdev=%s host=%s serial=%lld log=%s : time=%llu uuid=%pUb " \ + "len=%d flags='%s' handle=%x related_handle=%x " \ + "maint_op_class=%u : " fmt, \ + __get_str(memdev), __get_str(host), __entry->serial, \ cxl_event_log_type_str(__entry->log), \ __entry->hdr_timestamp, &__entry->hdr_uuid, __entry->hdr_length,\ show_hdr_flags(__entry->hdr_flags), __entry->hdr_handle, \