From patchwork Fri Feb 24 05:45:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 13150935 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 6A03517CE for ; Fri, 24 Feb 2023 05:46:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677217562; x=1708753562; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=J4ddzLR+psc4696uSLVSdXy/gmpvIlpCfH9vfaohT5U=; b=J9lav/kEwGhgYqTz2mnUEA/QCh3sxTcBDIDWcsa+tzs/H3imAiRDGfvf L30wPJKDcjfe8rnXMyYj9WhSdP07Svn9e84KbxfX3/WG2AnUDvpIUGQ3X aNlTGdiZpUkD0VLsev7aG+cT7nVSFqlxTjykUO6BbC/FOxGTACkjQRZsI gqo7eabpqMUzfb8+Dqh5R9ndxFM3/mnVXLAG2084fmoWAa14Ih2IJ1kj3 n3LXmJN7f1mlqyDQd9yyzNJi7FpJKni29Ou399sZBd3CwKK3XiC3O4iD4 mRJrfq49JToHwUpD/FckPSOGb52WSeaPFMKyfqCrSSqtt2JYlHjkLI8wX w==; X-IronPort-AV: E=McAfee;i="6500,9779,10630"; a="398137019" X-IronPort-AV: E=Sophos;i="5.97,322,1669104000"; d="scan'208";a="398137019" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2023 21:46:00 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10630"; a="1001701697" X-IronPort-AV: E=Sophos;i="5.97,322,1669104000"; d="scan'208";a="1001701697" Received: from kwameopo-mobl1.amr.corp.intel.com (HELO vverma7-desk1.local) ([10.209.85.102]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2023 21:45:59 -0800 From: Vishal Verma Date: Thu, 23 Feb 2023 22:45:38 -0700 Subject: [PATCH ndctl 1/2] cxl/monitor: fix include paths for tracefs and traceevent Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230223-meson-build-fixes-v1-1-5fae3b606395@intel.com> References: <20230223-meson-build-fixes-v1-0-5fae3b606395@intel.com> In-Reply-To: <20230223-meson-build-fixes-v1-0-5fae3b606395@intel.com> To: linux-cxl@vger.kernel.org Cc: =?utf-8?q?Michal_Such=C3=A1nek?= , Dave Jiang , Dan Williams , Dan Williams , Vishal Verma , nvdimm@lists.linux.dev X-Mailer: b4 0.13-dev-ada30 X-Developer-Signature: v=1; a=openpgp-sha256; l=2196; i=vishal.l.verma@intel.com; h=from:subject:message-id; bh=J4ddzLR+psc4696uSLVSdXy/gmpvIlpCfH9vfaohT5U=; b=owGbwMvMwCXGf25diOft7jLG02pJDMk//MVt7mmtq5upI5NzTmrbNtcyt/T6q3sjjPuLP4jU5 X0VsI3tKGVhEONikBVTZPm75yPjMbnt+TyBCY4wc1iZQIYwcHEKwERS+xj+ClyvOVl2SeXF68n8 4WfSbxxymtkhe9j6e+XXHQdeHXUN38HIcGqDkWpqkLO6fOAO46j42duXy/CalzhXL8nmq990dGY 7NwA= X-Developer-Key: i=vishal.l.verma@intel.com; a=openpgp; fpr=F8682BE134C67A12332A2ED07AFA61BEA3B84DFF Distros vary on whether the above headers are placed in {prefix}/libtracefs/ or {prefix}/tracefs/, and likewise for traceevent. Since both of these libraries do ship with pkgconfig info to determine the exact include path, the respective #include statements can drop the {lib}trace{fs,event}/ prefix. Since the libraries are declared using meson's dependency() function, it already does the requisite pkgconfig parsing. Drop the above prefixes to allow the includes work on all distros. Link: https://github.com/pmem/ndctl/issues/234 Fixes: 8dedc6cf5e85 ("cxl: add a helper to parse trace events into a json object") Fixes: 7b237bc7a8ae ("cxl: add a helper to go through all current events and parse them") Reported-by: Michal Suchánek Cc: Dave Jiang Cc: Dan Williams Signed-off-by: Vishal Verma Reviewed-by: Ira Weiny Reviewed-by: Dave Jiang --- cxl/event_trace.c | 4 ++-- cxl/monitor.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cxl/event_trace.c b/cxl/event_trace.c index 76dd4e7..926f446 100644 --- a/cxl/event_trace.c +++ b/cxl/event_trace.c @@ -2,14 +2,14 @@ // Copyright (C) 2022, Intel Corp. All rights reserved. #include #include +#include #include #include #include #include #include #include -#include -#include +#include #include "event_trace.h" #define _GNU_SOURCE diff --git a/cxl/monitor.c b/cxl/monitor.c index 749f472..e3469b9 100644 --- a/cxl/monitor.c +++ b/cxl/monitor.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -16,8 +17,7 @@ #include #include #include -#include -#include +#include #include /* reuse the core log helpers for the monitor logger */ From patchwork Fri Feb 24 05:45:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 13150936 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 AA71117D8 for ; Fri, 24 Feb 2023 05:46:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677217562; x=1708753562; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=MUvhPFbGDL7SH+wbQDaoTiqZSJ3jpVUHgEMwcEpg3QM=; b=difvC+8WhgMu+XdCHImW/kZ6MGB6eQ5G4/X5/sBqPZiuTD6cLS6Xv/aQ RQElK9o7gbkxy5hLTLWC55G4WMQQVgPiYVk8WSCxeWupD2/SlC85nJVW9 PEK7tw7ZH05iao4kMm2gGSKFuDXsF4heIORyVx76bRlsD9EFgJit30bE+ tBj0CKl2tX3XNF9nNmZFULjh2AUF9RPfN+F/M6+xBt/9+K0IiCG5tL4qT 8CbK0/74IB6r2lzZ3i1XG9+I/VcVHTsKwtIWFXrAXia7at75jZ2CxZqh9 9HZhCd9ZVHcDnlCtYPe/r/Iauiv9BzjxdSK9r3U7vN68sCyC6lv8AVPMu w==; X-IronPort-AV: E=McAfee;i="6500,9779,10630"; a="398137025" X-IronPort-AV: E=Sophos;i="5.97,322,1669104000"; d="scan'208";a="398137025" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2023 21:46:00 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10630"; a="1001701702" X-IronPort-AV: E=Sophos;i="5.97,322,1669104000"; d="scan'208";a="1001701702" Received: from kwameopo-mobl1.amr.corp.intel.com (HELO vverma7-desk1.local) ([10.209.85.102]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2023 21:46:00 -0800 From: Vishal Verma Date: Thu, 23 Feb 2023 22:45:39 -0700 Subject: [PATCH ndctl 2/2] cxl/event-trace: use the wrapped util_json_new_u64() Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20230223-meson-build-fixes-v1-2-5fae3b606395@intel.com> References: <20230223-meson-build-fixes-v1-0-5fae3b606395@intel.com> In-Reply-To: <20230223-meson-build-fixes-v1-0-5fae3b606395@intel.com> To: linux-cxl@vger.kernel.org Cc: =?utf-8?q?Michal_Such=C3=A1nek?= , Dave Jiang , Dan Williams , Dan Williams , Vishal Verma , nvdimm@lists.linux.dev X-Mailer: b4 0.13-dev-ada30 X-Developer-Signature: v=1; a=openpgp-sha256; l=1530; i=vishal.l.verma@intel.com; h=from:subject:message-id; bh=MUvhPFbGDL7SH+wbQDaoTiqZSJ3jpVUHgEMwcEpg3QM=; b=owGbwMvMwCXGf25diOft7jLG02pJDMk//MXnn1H5let/LfG9u9Gnxm28dZuLtDUeyuSsfn4lO aLBp5yjo5SFQYyLQVZMkeXvno+Mx+S25/MEJjjCzGFlAhnCwMUpABM5WcDIsF3OtG/a2mxhL8n4 4uPT7CseaDFNq/v3e+uc/ZkxKZ23rzEynEgzNd28O3k+S7x1XXKvMsM1E2Fn9Xee3LNeJfX8ZUp kBwA= X-Developer-Key: i=vishal.l.verma@intel.com; a=openpgp; fpr=F8682BE134C67A12332A2ED07AFA61BEA3B84DFF The json-c API json_object_new_uint64() is relatively new, and some distros may not have it available. There is already a wrapped version in util/json.h which falls back to the int64 API, based on meson's determination of the availability of the uint64 version at compile time. Replace the direct uint64 calls with this wrapped version. Link: https://github.com/pmem/ndctl/issues/233 Fixes: 8dedc6cf5e85 ("cxl: add a helper to parse trace events into a json object") Reported-by: Michal Suchánek Cc: Dave Jiang Cc: Dan Williams Signed-off-by: Vishal Verma Reviewed-by: Ira Weiny Reviewed-by: Dave Jiang --- cxl/event_trace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cxl/event_trace.c b/cxl/event_trace.c index 926f446..db8cc85 100644 --- a/cxl/event_trace.c +++ b/cxl/event_trace.c @@ -25,7 +25,7 @@ static struct json_object *num_to_json(void *num, int elem_size, unsigned long f if (sign) return json_object_new_int64(*(int64_t *)num); else - return json_object_new_uint64(*(uint64_t *)num); + return util_json_new_u64(*(uint64_t *)num); } /* All others fit in a signed 64 bit */ @@ -98,7 +98,7 @@ static int cxl_event_to_json(struct tep_event *event, struct tep_record *record, } json_object_object_add(jevent, "event", jobj); - jobj = json_object_new_uint64(record->ts); + jobj = util_json_new_u64(record->ts); if (!jobj) { rc = -ENOMEM; goto err_jevent;