Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tao Liu <ltao@redhat.com>
To: yamazaki-msmt@nec.com, k-hagio-ab@nec.com, kexec@lists.infradead.org
Cc: aravinda@linux.vnet.ibm.com, devel@lists.crash-utility.osci.io,
	Tao Liu <ltao@redhat.com>
Subject: [PATCH RFC][makedumpfile 08/10] Enable page filtering for dwarf eppic
Date: Tue, 10 Jun 2025 21:57:41 +1200	[thread overview]
Message-ID: <20250610095743.18073-9-ltao@redhat.com> (raw)
In-Reply-To: <20250610095743.18073-1-ltao@redhat.com>

Since dwarf and btf have different apiops, so making it as parameter to
eppic_init, and initialized respectively.

Signed-off-by: Tao Liu <ltao@redhat.com>
---
 erase_info.c      |  8 +++++---
 extension_eppic.c | 34 +++++++++++++++++++++++++++++++---
 extension_eppic.h |  6 ++++--
 3 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/erase_info.c b/erase_info.c
index 9ec1813..eeb2c3b 100644
--- a/erase_info.c
+++ b/erase_info.c
@@ -2202,7 +2202,7 @@ get_die_member_all(unsigned long long die_off, int index, long *offset,
 
 /* Process the eppic macro using eppic library */
 static int
-process_eppic_file(char *name_config)
+process_eppic_file(char *name_config, bool is_btf)
 {
 	void *handle;
 	void (*eppic_load)(char *), (*eppic_unload)(char *);
@@ -2221,7 +2221,9 @@ process_eppic_file(char *name_config)
 	 * Support specifying eppic macros in makedumpfile.conf file
 	 */
 
-	eppic_init = dlsym(handle, "eppic_init");
+	if (!is_btf) {
+		eppic_init = dlsym(handle, "eppic_dwarf_init");
+	}
 	if (!eppic_init) {
 		ERRMSG("Could not find eppic_init function\n");
 		return FALSE;
@@ -2368,7 +2370,7 @@ gather_filter_info(void)
 		ret = process_config_file(info->name_filterconfig);
 
 	if (info->name_eppic_config)
-		ret &= process_eppic_file(info->name_eppic_config);
+		ret &= process_eppic_file(info->name_eppic_config, false);
 
 	/*
 	 * Remove modules symbol information, we dont need now.
diff --git a/extension_eppic.c b/extension_eppic.c
index c4a13b9..59178e5 100644
--- a/extension_eppic.c
+++ b/extension_eppic.c
@@ -23,8 +23,10 @@
 
 #include "makedumpfile.h"
 #include "extension_eppic.h"
+#include "eppic_maple.h"
 
 static int apigetctype(int, char *, type_t *);
+struct call_back *cb;
 
 /*
  * Most of the functions included in this file performs similar
@@ -416,7 +418,7 @@ apifindsym(char *p)
 	return NULL;
 }
 
-apiops icops = {
+apiops dwarf_icops = {
 	apigetmem,
 	apiputmem,
 	apimember,
@@ -449,17 +451,27 @@ eppic_memset(VALUE_S *vaddr, VALUE_S *vch, VALUE_S *vlen)
 	return eppic_makebtype(1);
 }
 
+VALUE_S *
+eppic_filter_pages(VALUE_S *p, VALUE_S *n)
+{
+	unsigned long pfn = eppic_getval(p);
+	unsigned long num = eppic_getval(n);
+
+	UPDATE_FILTER_PAGE_INFO(pfn, num);
+	return eppic_makebtype(1);
+}
+
 
 /* Initialize eppic */
 int
-eppic_init(void *fun_ptr)
+eppic_init(void *fun_ptr, apiops *ops, bool is_btf)
 {
 	cb = (struct call_back *)fun_ptr;
 
 	if (eppic_open() >= 0) {
 
 		/* Register call back functions */
-		eppic_apiset(&icops, 3, sizeof(long), 0);
+		eppic_apiset(ops, 3, sizeof(long), 0);
 
 		/* set the new function callback */
 		eppic_setcallback(reg_callback);
@@ -468,8 +480,24 @@ eppic_init(void *fun_ptr)
 		eppic_builtin("int memset(char *, int, int)",
 				(bf_t *)eppic_memset);
 
+		if (maple_init(is_btf) == FALSE)
+			return 1;
+
+		eppic_builtin("int maple_count(char *)",
+				(bf_t *)maple_count);
+
+		eppic_builtin("unsigned long maple_elem(char *, int)",
+				(bf_t *)maple_elem);
+
+		eppic_builtin("unsigned long filter_pages(unsigned long, unsigned long)",
+				(bf_t *)eppic_filter_pages);
+
 		return 0;
 	}
 	return 1;
 }
 
+int eppic_dwarf_init(void *fun_ptr)
+{
+	return eppic_init(fun_ptr, &dwarf_icops, false);
+}
diff --git a/extension_eppic.h b/extension_eppic.h
index 08f1db0..ff92f01 100644
--- a/extension_eppic.h
+++ b/extension_eppic.h
@@ -79,8 +79,7 @@ do { \
 		fprintf(stderr, x); \
 } while (0)
 
-
-struct call_back *cb;
+extern struct call_back *cb;
 
 #define GET_DOMAIN_ALL cb->get_domain_all
 #define READMEM cb->readmem
@@ -92,5 +91,8 @@ struct call_back *cb;
 #define GET_DIE_NFIELDS_ALL cb->get_die_nfields_all
 #define GET_SYMBOL_ADDR_ALL cb->get_symbol_addr_all
 #define UPDATE_FILTER_INFO_RAW cb->update_filter_info_raw
+#define UPDATE_FILTER_PAGE_INFO cb->update_filter_pages_info
+
+int eppic_init(void *, apiops *, bool);
 
 #endif /* _EXTENSION_EPPIC_H */
-- 
2.47.0



  parent reply	other threads:[~2025-06-10 10:56 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10  9:57 [PATCH RFC][makedumpfile 00/10] btf/kallsyms based eppic extension for mm page filtering Tao Liu
2025-06-10  9:57 ` [PATCH RFC][makedumpfile 01/10] dwarf_info: Support kernel address randomization Tao Liu
2025-09-08 11:11   ` YAMAZAKI MASAMITSU(山崎 真光)
2025-09-09  5:24     ` Tao Liu
2025-09-29  6:30   ` HAGIO KAZUHITO(萩尾 一仁)
2025-09-30  0:34     ` Tao Liu
2025-09-30  1:28       ` HAGIO KAZUHITO(萩尾 一仁)
2025-09-30  1:44         ` Tao Liu
2025-06-10  9:57 ` [PATCH RFC][makedumpfile 02/10] dwarf_info: Fix a infinite recursion bug for search_domain Tao Liu
2025-10-03  7:22   ` YAMAZAKI MASAMITSU(山崎 真光)
2025-10-05 23:25     ` Tao Liu
2025-10-17  4:21   ` HAGIO KAZUHITO(萩尾 一仁)
2025-10-20  3:52     ` Tao Liu
2025-06-10  9:57 ` [PATCH RFC][makedumpfile 03/10] Add page filtering function Tao Liu
2025-06-10  9:57 ` [PATCH RFC][makedumpfile 04/10] Add btf/kallsyms support for symbol type/address resolving Tao Liu
2025-06-10  9:57 ` [PATCH RFC][makedumpfile 05/10] Export necessary btf/kallsyms functions to eppic extension Tao Liu
2025-06-10  9:57 ` [PATCH RFC][makedumpfile 06/10] Port the maple tree data structures and functions Tao Liu
2025-06-10  9:57 ` [PATCH RFC][makedumpfile 07/10] Supporting main() as the entry of eppic script Tao Liu
2025-06-10  9:57 ` Tao Liu [this message]
2025-06-10  9:57 ` [PATCH RFC][makedumpfile 09/10] Enable page filtering for btf/kallsyms eppic Tao Liu
2025-06-10  9:57 ` [PATCH RFC][makedumpfile 10/10] Introducing 2 eppic scripts to test the dwarf/btf eppic extension Tao Liu
2025-08-05  3:16 ` [PATCH RFC][makedumpfile 00/10] btf/kallsyms based eppic extension for mm page filtering Tao Liu
2025-08-07 11:42   ` YAMAZAKI MASAMITSU(山崎 真光)
2025-08-11  0:04     ` Tao Liu
2025-09-05 12:41       ` YAMAZAKI MASAMITSU(山崎 真光)
2025-09-09  1:56         ` Tao Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250610095743.18073-9-ltao@redhat.com \
    --to=ltao@redhat.com \
    --cc=aravinda@linux.vnet.ibm.com \
    --cc=devel@lists.crash-utility.osci.io \
    --cc=k-hagio-ab@nec.com \
    --cc=kexec@lists.infradead.org \
    --cc=yamazaki-msmt@nec.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox