From patchwork Wed Mar 27 19:52:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alison Schofield X-Patchwork-Id: 13607374 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (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 B26F012FB28 for ; Wed, 27 Mar 2024 19:52:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.17 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711569159; cv=none; b=jW2E+skvdPjv8G97uKufjXgAqKxqemGv0ZLH52+CxagjuFw4j19BqSLtBCnYAmiWH3GRU87X5h7hKVksmWQBOib7DiBnV6tszbyzKUaj8JFR1kN8CK0+ZDO+gaVQvzZSfBCVua6Es2mdJYazbmDY2qF3X4Es9HFlfyINHkTeHlM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711569159; c=relaxed/simple; bh=roIYcf7YeNI5tK4KPiAUUtFVUrvSOClHX7/lSK37xJk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=f76pjCCvFkOitrgyz/4HJqXBBk94ykoZTZFIzno5S15xyKHg2qsRjKZmNRJFjq/C3WmV5UzYys8EURV38k27Ql9yCsXJOI9KeFdeDCuRSQA1vmXRVkYn6OWMVSLS8RadHcfW1Gug1z+stxx84kdQowx3hhhMrWEItOrcvw1/9eM= 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=iykTP7ua; arc=none smtp.client-ip=192.198.163.17 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="iykTP7ua" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711569158; x=1743105158; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=roIYcf7YeNI5tK4KPiAUUtFVUrvSOClHX7/lSK37xJk=; b=iykTP7uaje/lstzteJf9izjVBt/y1LeeVLyTq4PCbwsUGvpVW0loqATs fqfTxMB4WsAlxT9szHdFGTVP3iiWV2GubN8PDRVxHrGxVxdeNhuT9SoZX e/SUGOBbvBjx9kLOliiN/DlI4+hHcFm48o2dlOA1JXcBsaYkgHfdRg0rv Xz+5pKzPS7LUu/iO5hojqzXbAKd0GLAi/MgXPzj6sEPwXBlVY47hK+PPu 2Swf5l73MYVLKPHJlQnwvTDU/pFs9uroVOihzKE1PcqJqHCiOgN5UXU07 7zFWlFQoOVI2hs/o/VNoUastxfMYpbtp4VRnTt2j3CHQd7n7eqnmaEM12 g==; X-CSE-ConnectionGUID: EzY1s235TjivRYMIJpgj5w== X-CSE-MsgGUID: izHMy/iNTgyQh0Aw43bOvg== X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="6560201" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="6560201" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 12:52:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="47616299" Received: from aschofie-mobl2.amr.corp.intel.com (HELO localhost) ([10.209.82.250]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 12:52:35 -0700 From: alison.schofield@intel.com To: Vishal Verma Cc: Alison Schofield , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, Jonathan Cameron , Dave Jiang Subject: [ndctl PATCH v12 2/8] util/trace: add an optional pid check to event parsing Date: Wed, 27 Mar 2024 12:52:23 -0700 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 When parsing 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, simply skip the parsing of events without a matching pid. It is not a failure to see other, non matching events. The initial use case for this is CXL device poison listings where only the media-error records requested by this process are wanted. Signed-off-by: Alison Schofield Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang --- util/event_trace.c | 5 +++++ util/event_trace.h | 1 + 2 files changed, 6 insertions(+) diff --git a/util/event_trace.c b/util/event_trace.c index 16013412bc06..57318e2adace 100644 --- a/util/event_trace.c +++ b/util/event_trace.c @@ -214,6 +214,11 @@ static int 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/util/event_trace.h b/util/event_trace.h index 37c39aded871..6586e1dc254d 100644 --- a/util/event_trace.h +++ b/util/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 */ };