From patchwork Fri Feb 23 02:15:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alison Schofield X-Patchwork-Id: 13568488 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 3CAFCBE48 for ; Fri, 23 Feb 2024 02:15:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708654552; cv=none; b=bfqXHhnrKbXxhXQXJYrqiN2joIIFKThONdw282J8DI3Do/gikOY7KL9t3wPdv/Qmi07i15thOHkgMd0oz9keDgl5dERXjKOw+fB57z6ZEDJNKLg5k2sUZNTuHRLFn1wdTdEz4YSbzCG9llcjlyzA+IaC+j6w7IsRTE6MSMbXE74= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708654552; c=relaxed/simple; bh=sg75Nzd0Nfpa+tECk4dpxR+hOqypAdcjo1sTuoZWf9Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gcU9YFEJ703CQET+m4JHkPO/MF6wnRCQKljtxWa4+Zn+XovXTJljSPLckixjG7d9OK28qe1VslDi83W6Y6pNOyFt6hfPjupFtfLCcrdT+Ew4LQrYR+rFTMHNckScU1v09Jwos/DEm6ZLs+yEKeax7Z7BqGhC/V4Zn8IWPMjU13g= 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=JYlaJLLN; arc=none smtp.client-ip=192.198.163.10 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="JYlaJLLN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708654549; x=1740190549; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sg75Nzd0Nfpa+tECk4dpxR+hOqypAdcjo1sTuoZWf9Q=; b=JYlaJLLN4yAQcUuGqaffbBluqqhPlumAucQ1ggl4zrDWcWuRYjCaBBX4 c9VSGPcL3KFHOU7cpLdIBXs2o27Ppq4K68/mTVuCeOvi9vsbFW6L3nZeO iKwoCZ9lEDKSM/ZASGa94tfb9IeFyrpSyK1psyT2oC4WVSpt+DCIbU/3X IduvwxcXqj0dpRjH9B1yVhKFgLeih+87Ty5qZTWGShvEx1kjDRMZOFkAE rjTZwDj/6pIj9j/eh6tFI7f6AIgNZeZgpG2hU3bBHNkB5b4q4xIh31weF j61rpMDnxWJMxHoYBYQOCHlpE2/YO8Cn3rqGvr5MSMIKHrrXUxk/Wkiou w==; X-IronPort-AV: E=McAfee;i="6600,9927,10992"; a="14364242" X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="14364242" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2024 18:15:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="10410100" Received: from aschofie-mobl2.amr.corp.intel.com (HELO localhost) ([10.209.29.102]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2024 18:15:48 -0800 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 v8 2/7] cxl: add an optional pid check to event parsing Date: Thu, 22 Feb 2024 18:15:39 -0800 Message-Id: <14a5fd819da5f4607463135f0340675b9e836e78.1708653303.git.alison.schofield@intel.com> 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 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, 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 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 --- 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 */ };