From patchwork Wed Nov 22 01:22:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alison Schofield X-Patchwork-Id: 13463827 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) (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 3F1B017CD for ; Wed, 22 Nov 2023 01:22:12 +0000 (UTC) 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="UwCeSnUf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700616132; x=1732152132; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qw6ErE+N/Zs5mIaQY8NIOuKAGUcYqneo1GoEkWUjLLw=; b=UwCeSnUfsAlUDjx9xG99FedqGhFvqG991vCa0QxavMDkYFHuLG+5QFVS W2nE3zeu/JVeswufsNEwNIiez9xChsR0Nkt8MQ2+Ndt0RkIJN3tmkU+Cm Qjv/gP61gxgl0YoRDOfVFKtDreSoLLCn/9sxI4Ldh8iUMuFeLNW4w+/xH 2jZrtsAXj5JAx4+9cRZD/Yh0O6UWdIqK8W1ZU9GqlBsPk4NnWGq9CY5Qb S0uu/nAQt3uigvtUtSUAQLOT7FSP7ES8nVmlBCjtpGy/7lbtFdCPRuyTP XRwnh15eKK+3RrMh+zGp/tKMWOa/Y7o2mydWPl+owMIbKC2FfCdafCTDx Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="376988164" X-IronPort-AV: E=Sophos;i="6.04,217,1695711600"; d="scan'208";a="376988164" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2023 17:22:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="760270765" X-IronPort-AV: E=Sophos;i="6.04,217,1695711600"; d="scan'208";a="760270765" Received: from aschofie-mobl2.amr.corp.intel.com (HELO localhost) ([10.209.90.75]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2023 17:22:09 -0800 From: alison.schofield@intel.com To: Vishal Verma Cc: Alison Schofield , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, Jonathan Cameron Subject: [ndctl PATCH v5 2/5] cxl: add an optional pid check to event parsing Date: Tue, 21 Nov 2023 17:22:03 -0800 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Alison Schofield When parsing CXL events, callers may only be interested in events that originate from the current process. Introduce an optional argument to the event trace context: event_pid. When event_pid is present, only include events with a matching pid in the returned JSON list. It is not a failure to see other, non matching results. Simply skip those. The initial use case for this is device poison listings where only the poison error records requested by this process are wanted. Signed-off-by: Alison Schofield Reviewed-by: Jonathan Cameron --- cxl/event_trace.c | 5 +++++ cxl/event_trace.h | 1 + 2 files changed, 6 insertions(+) diff --git a/cxl/event_trace.c b/cxl/event_trace.c index db8cc85f0b6f..269060898118 100644 --- a/cxl/event_trace.c +++ b/cxl/event_trace.c @@ -208,6 +208,11 @@ static int cxl_event_parse(struct tep_event *event, struct tep_record *record, return 0; } + if (event_ctx->event_pid) { + if (event_ctx->event_pid != tep_data_pid(event->tep, record)) + return 0; + } + if (event_ctx->parse_event) return event_ctx->parse_event(event, record, &event_ctx->jlist_head); diff --git a/cxl/event_trace.h b/cxl/event_trace.h index ec6267202c8b..7f7773b2201f 100644 --- a/cxl/event_trace.h +++ b/cxl/event_trace.h @@ -15,6 +15,7 @@ struct event_ctx { const char *system; struct list_head jlist_head; const char *event_name; /* optional */ + int event_pid; /* optional */ int (*parse_event)(struct tep_event *event, struct tep_record *record, struct list_head *jlist_head); /* optional */ };