From patchwork Thu Jan 18 00:28:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alison Schofield X-Patchwork-Id: 13522274 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D6E565C for ; Thu, 18 Jan 2024 00:28:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705537698; cv=none; b=S4rgva1cEA69/6Su8kN2IURZub6971YEodoEhS8+iF+t4RnwL0C+y9EFRuEwG9Z6ghvOd8MaNrwuSZYlMms5v2NVdFTnZNCuq+/yG01TzC7K7ey4nXg6Nv1mFXHsKPeMqrf107rDO8P5MBBFN9U+yZe8MOifdoWJ7d1NbrQXAX8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705537698; c=relaxed/simple; bh=0XLw4CP08uGngf2UQEdkpoCE656YckzdRPZcyX89Cio=; h=DKIM-Signature:X-IronPort-AV:X-IronPort-AV:Received:X-ExtLoop1: X-IronPort-AV:X-IronPort-AV:Received:From:To:Cc:Subject:Date: Message-Id:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; b=PkOMXakFlpW61BLK5VEYCx+8yVPow0Ito88siS3FU0hTkR1SPSe5XpeVDIxy02skYsbU5fJ4vGNM2ggDgG+7xPQ0A9+Hrji0lW6cCSoRDrEjkyXA77RoE5aS/u8BSqPiyJiP+9QBHvoUGli+JljFwJPwZKTnyNxegEHi6iaNu2Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mKHH/wXQ; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mKHH/wXQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705537696; x=1737073696; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0XLw4CP08uGngf2UQEdkpoCE656YckzdRPZcyX89Cio=; b=mKHH/wXQkIKOFL/ZFZamGzUxhT3cyaeV3HSoE+CmVdi9wEBGUo5axDdK J2dv47puDD2A2iuX0GsyiLjvnnI7dZE5BZAwBYVCfRQv4RXS4d/vt608x j2BFdGwU76dqtllrviipqrddsAKJR3aj8Lyj6wh8YHyL11BOlcK9SZOMi HomKAVzdxFJpogXHfc0mx8phyUMXVk4P2e6N3qs/exE13fFyzNYlYlO7I +xstxEl+LODgFkZDX619+/NjEqlDfnPa055pSvZrxSNIxIUUJXJt3iL0E GPqjXhdS9CYtX1ZH0Tn4SajVugJsW2+M/TZRaWNeC7tQ9O2Je2OIQnGgZ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10956"; a="18904544" X-IronPort-AV: E=Sophos;i="6.05,201,1701158400"; d="scan'208";a="18904544" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jan 2024 16:28:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10956"; a="777577217" X-IronPort-AV: E=Sophos;i="6.05,201,1701158400"; d="scan'208";a="777577217" Received: from aschofie-mobl2.amr.corp.intel.com (HELO localhost) ([10.209.110.93]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jan 2024 16:28:14 -0800 From: alison.schofield@intel.com To: Vishal Verma Cc: Alison Schofield , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Subject: [PATCH v6 3/7] cxl/event_trace: add a private context for private parsers Date: Wed, 17 Jan 2024 16:28:02 -0800 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Alison Schofield CXL event tracing provides helpers to iterate through a trace buffer and extract events of interest. It offers two parsing options: a default parser that adds every field of an event to a json object, and a private parsing option where the caller can parse each event as it wishes. Although the private parser can do some conditional parsing based on field values, it has no method to receive additional information needed to make parsing decisions in the callback. Add a private_ctx field to the existing 'struct event_context'. Replace the jlist_head parameter, used in the default parser, with the private_ctx. This is in preparation for adding a private parser requiring additional context for cxl_poison events. Signed-off-by: Alison Schofield Reviewed-by: Dave Jiang --- cxl/event_trace.c | 2 +- cxl/event_trace.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cxl/event_trace.c b/cxl/event_trace.c index 269060898118..fbf7a77235ff 100644 --- a/cxl/event_trace.c +++ b/cxl/event_trace.c @@ -215,7 +215,7 @@ static int cxl_event_parse(struct tep_event *event, struct tep_record *record, if (event_ctx->parse_event) return event_ctx->parse_event(event, record, - &event_ctx->jlist_head); + event_ctx->private_ctx); return cxl_event_to_json(event, record, &event_ctx->jlist_head); } diff --git a/cxl/event_trace.h b/cxl/event_trace.h index 7f7773b2201f..ec61962abbc6 100644 --- a/cxl/event_trace.h +++ b/cxl/event_trace.h @@ -16,8 +16,9 @@ struct event_ctx { struct list_head jlist_head; const char *event_name; /* optional */ int event_pid; /* optional */ + void *private_ctx; /* required with parse_event() */ int (*parse_event)(struct tep_event *event, struct tep_record *record, - struct list_head *jlist_head); /* optional */ + void *private_ctx);/* optional */ }; int cxl_parse_events(struct tracefs_instance *inst, struct event_ctx *ectx);