[PATCH v2 4/7] Add remote_vtop.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Don Slutz <dslutz@xxxxxxxxxxx>

For eaxmple:

crash> vtop 0xffffffff802ee778
VIRTUAL           PHYSICAL
ffffffff802ee778  4ee778

PML4 DIRECTORY: ffffffff80001000
PAGE DIRECTORY: 203067
   PUD: 203ff0 => 205063
   PMD: 205008 => bee2c163
   PTE: bee2c770 => 4ee163
  PAGE: 4ee000

 PTE    PHYSICAL  FLAGS
4ee163   4ee000   (PRESENT|RW|ACCESSED|DIRTY|GLOBAL)

      PAGE       PHYSICAL      MAPPING       INDEX CNT FLAGS
ffff8100006f7410   4ee000                0        0  1 400
crash> set debug 1
debug: 1
crash> vtop 0xffffffff802ee778
VIRTUAL           PHYSICAL
ffffffff802ee778  4ee778

PML4 DIRECTORY: ffffffff80001000
PAGE DIRECTORY: 203067
   PUD: 203ff0 => 205063
   PMD: 205008 => bee2c163
   PTE: bee2c770 => 4ee163
  PAGE: 4ee000

 PTE    PHYSICAL  FLAGS
4ee163   4ee000   (PRESENT|RW|ACCESSED|DIRTY|GLOBAL)

      PAGE       PHYSICAL      MAPPING       INDEX CNT FLAGS
ffff8100006f7410   4ee000                0        0  1 400
rvtop(ffffffff802ee778)=4ee778

Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx>
---
 defs.h   |  1 +
 memory.c |  7 +++++++
 remote.c | 40 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+)

diff --git a/defs.h b/defs.h
index 8d56da8..489e4cc 100755
--- a/defs.h
+++ b/defs.h
@@ -5528,6 +5528,7 @@ void dump_sockets_workhorse(ulong, ulong, struct reference *);
  */
 int is_remote_daemon(char *);
 physaddr_t get_remote_phys_base(physaddr_t, physaddr_t);
+physaddr_t remote_vtop(int, physaddr_t);
 void remote_fd_init(void);
 int get_remote_file(struct remote_file *);
 uint remote_page_size(void);
diff --git a/memory.c b/memory.c
index 5ec454d..707e784 100755
--- a/memory.c
+++ b/memory.c
@@ -2932,6 +2932,13 @@ cmd_vtop(void)
 
 		do_vtop(vaddr, tc, vtop_flags | loop_vtop_flags);
 
+		if (REMOTE() && CRASHDEBUG(1)) {
+			ulong pAddr = remote_vtop(tc->processor, vaddr);
+
+			if (pAddr)
+				fprintf(fp, "rvtop(%lx)=%lx\n", vaddr, pAddr);
+		}
+
 		optind++;
 	}
 }
diff --git a/remote.c b/remote.c
index a4069a7..23d17fe 100755
--- a/remote.c
+++ b/remote.c
@@ -2350,6 +2350,46 @@ get_remote_phys_base(physaddr_t text_start, physaddr_t virt_phys_base)
 }
 
 /*
+ *  Do a remote VTOP if supported.
+ */
+physaddr_t
+remote_vtop(int cpu, physaddr_t virt_addr)
+{
+	char sendbuf[BUFSIZE];
+	char recvbuf[BUFSIZE];
+	char *p1, *p2, *p3, *p4;
+	int errflag;
+	ulong value;
+
+	if (!rc->remoteType[0])
+		return 0;       /* Not a special remote. */
+
+	BZERO(sendbuf, BUFSIZE);
+	BZERO(recvbuf, BUFSIZE);
+	sprintf(sendbuf, "VTOP %d %llx", cpu, virt_addr);
+	remote_tcp_write_string(pc->sockfd, sendbuf);
+	remote_tcp_read_string(pc->sockfd, recvbuf, BUFSIZE-1, pc->flags2 & REMOTE_NIL);
+
+	if (CRASHDEBUG(2))
+		fprintf(fp, "remote_vtop(%d,%llx): [%s]\n",
+			cpu, virt_addr, recvbuf);
+
+	if (strstr(recvbuf, "<FAIL>"))
+		error(FATAL, "remote_vtop for CPU %d\n", cpu);
+	p1 = strtok(recvbuf, " ");  /* VTOP */
+	p2 = strtok(NULL, " ");     /* cpu */
+	p3 = strtok(NULL, " ");     /* vaddr */
+	p4 = strtok(NULL, " ");     /* paddr */
+
+	errflag = 0;
+	value = htol(p4, RETURN_ON_ERROR|QUIET, &errflag);
+	if (!errflag) {
+		return value;
+	}
+	return 0;
+}
+
+/*
  *
  *   Set up the file descriptors and file name strings if they haven't
  *   been set up before:
-- 
1.8.4

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux