qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/2] hmp queue
@ 2019-05-01 10:59 Dr. David Alan Gilbert (git)
  2019-05-01 10:59 ` Dr. David Alan Gilbert (git)
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-01 10:59 UTC (permalink / raw)
  To: qemu-devel, crobinso

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

The following changes since commit f75d15231e56cb0f2bafe19faf1229c459a60731:

  Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2019-04-30 17:06:57 +0100)

are available in the Git repository at:

  git://github.com/dagrh/qemu.git tags/pull-hmp-20190501

for you to fetch changes up to 574d96933ceff60b2d13fe97602572fc7e95f7c6:

  hmp: gva2gpa debug command (2019-05-01 10:46:59 +0100)

----------------------------------------------------------------
HMP pull

New gva2gpa command
delvm now uses hmp_handle_error so gets Error: prefix in messages

----------------------------------------------------------------
Cole Robinson (1):
      hmp: delvm: use hmp_handle_error

Dr. David Alan Gilbert (1):
      hmp: gva2gpa debug command

 hmp-commands.hx  | 15 +++++++++++++++
 hmp.c            |  7 ++++---
 monitor.c        | 22 ++++++++++++++++++++++
 tests/test-hmp.c |  1 +
 4 files changed, 42 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 0/2] hmp queue
  2019-05-01 10:59 [Qemu-devel] [PULL 0/2] hmp queue Dr. David Alan Gilbert (git)
@ 2019-05-01 10:59 ` Dr. David Alan Gilbert (git)
  2019-05-01 10:59 ` [Qemu-devel] [PULL 1/2] hmp: delvm: use hmp_handle_error Dr. David Alan Gilbert (git)
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-01 10:59 UTC (permalink / raw)
  To: qemu-devel, crobinso

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

The following changes since commit f75d15231e56cb0f2bafe19faf1229c459a60731:

  Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2019-04-30 17:06:57 +0100)

are available in the Git repository at:

  git://github.com/dagrh/qemu.git tags/pull-hmp-20190501

for you to fetch changes up to 574d96933ceff60b2d13fe97602572fc7e95f7c6:

  hmp: gva2gpa debug command (2019-05-01 10:46:59 +0100)

----------------------------------------------------------------
HMP pull

New gva2gpa command
delvm now uses hmp_handle_error so gets Error: prefix in messages

----------------------------------------------------------------
Cole Robinson (1):
      hmp: delvm: use hmp_handle_error

Dr. David Alan Gilbert (1):
      hmp: gva2gpa debug command

 hmp-commands.hx  | 15 +++++++++++++++
 hmp.c            |  7 ++++---
 monitor.c        | 22 ++++++++++++++++++++++
 tests/test-hmp.c |  1 +
 4 files changed, 42 insertions(+), 3 deletions(-)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 1/2] hmp: delvm: use hmp_handle_error
  2019-05-01 10:59 [Qemu-devel] [PULL 0/2] hmp queue Dr. David Alan Gilbert (git)
  2019-05-01 10:59 ` Dr. David Alan Gilbert (git)
@ 2019-05-01 10:59 ` Dr. David Alan Gilbert (git)
  2019-05-01 10:59   ` Dr. David Alan Gilbert (git)
  2019-05-01 10:59 ` [Qemu-devel] [PULL 2/2] hmp: gva2gpa debug command Dr. David Alan Gilbert (git)
  2019-05-02 11:04 ` [Qemu-devel] [PULL 0/2] hmp queue Peter Maydell
  3 siblings, 1 reply; 8+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-01 10:59 UTC (permalink / raw)
  To: qemu-devel, crobinso

From: Cole Robinson <crobinso@redhat.com>

This gives us the consistent 'Error:' prefix added in 66363e9a43f,
which helps users like libvirt who still need to scrape hmp error
messages to detect failure.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Message-Id: <984634226fa14316641f31f84e7dd0bb770bd94c.1556141033.git.crobinso@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 hmp.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hmp.c b/hmp.c
index 4bb3af748e..56a3ed7375 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1480,10 +1480,11 @@ void hmp_delvm(Monitor *mon, const QDict *qdict)
     const char *name = qdict_get_str(qdict, "name");
 
     if (bdrv_all_delete_snapshot(name, &bs, &err) < 0) {
-        error_reportf_err(err,
-                          "Error while deleting snapshot on device '%s': ",
-                          bdrv_get_device_name(bs));
+        error_prepend(&err,
+                      "deleting snapshot on device '%s': ",
+                      bdrv_get_device_name(bs));
     }
+    hmp_handle_error(mon, &err);
 }
 
 void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 1/2] hmp: delvm: use hmp_handle_error
  2019-05-01 10:59 ` [Qemu-devel] [PULL 1/2] hmp: delvm: use hmp_handle_error Dr. David Alan Gilbert (git)
@ 2019-05-01 10:59   ` Dr. David Alan Gilbert (git)
  0 siblings, 0 replies; 8+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-01 10:59 UTC (permalink / raw)
  To: qemu-devel, crobinso

From: Cole Robinson <crobinso@redhat.com>

This gives us the consistent 'Error:' prefix added in 66363e9a43f,
which helps users like libvirt who still need to scrape hmp error
messages to detect failure.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Message-Id: <984634226fa14316641f31f84e7dd0bb770bd94c.1556141033.git.crobinso@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 hmp.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hmp.c b/hmp.c
index 4bb3af748e..56a3ed7375 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1480,10 +1480,11 @@ void hmp_delvm(Monitor *mon, const QDict *qdict)
     const char *name = qdict_get_str(qdict, "name");
 
     if (bdrv_all_delete_snapshot(name, &bs, &err) < 0) {
-        error_reportf_err(err,
-                          "Error while deleting snapshot on device '%s': ",
-                          bdrv_get_device_name(bs));
+        error_prepend(&err,
+                      "deleting snapshot on device '%s': ",
+                      bdrv_get_device_name(bs));
     }
+    hmp_handle_error(mon, &err);
 }
 
 void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 2/2] hmp: gva2gpa debug command
  2019-05-01 10:59 [Qemu-devel] [PULL 0/2] hmp queue Dr. David Alan Gilbert (git)
  2019-05-01 10:59 ` Dr. David Alan Gilbert (git)
  2019-05-01 10:59 ` [Qemu-devel] [PULL 1/2] hmp: delvm: use hmp_handle_error Dr. David Alan Gilbert (git)
@ 2019-05-01 10:59 ` Dr. David Alan Gilbert (git)
  2019-05-01 10:59   ` Dr. David Alan Gilbert (git)
  2019-05-02 11:04 ` [Qemu-devel] [PULL 0/2] hmp queue Peter Maydell
  3 siblings, 1 reply; 8+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-01 10:59 UTC (permalink / raw)
  To: qemu-devel, crobinso

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Add a gva2gpa command purely for debug which performs
address translation on the gva, the existing gpa2hva
command can then also be used to find it in the qemu
userspace; e.g.

(qemu) info registers
.... RSP=ffffffff81c03e98
....
(qemu) gva2gpa 0xffffffff81c03e98
gpa: 0x1c03e98
(qemu) gpa2hva 0x1c03e98
Host virtual address for 0x1c03e98 (pc.ram) is 0x7f0599a03e98
(qemu) x/10x 0xffffffff81c03e98
ffffffff81c03e98: 0x81c03eb8 0xffffffff 0x8101ea3f 0xffffffff
ffffffff81c03ea8: 0x81d27b00 0xffffffff 0x00000000 0x00000000
ffffffff81c03eb8: 0x81c03ec8 0xffffffff

gdb -p ...qemu...
(gdb) x/10x 0x7f0599a03e98
0x7f0599a03e98:	0x81c03eb8	0xffffffff	0x8101ea3f	0xffffffff
0x7f0599a03ea8:	0x81d27b00	0xffffffff	0x00000000	0x00000000
0x7f0599a03eb8:	0x81c03ec8	0xffffffff

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20190412152652.827-1-dgilbert@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 hmp-commands.hx  | 15 +++++++++++++++
 monitor.c        | 22 ++++++++++++++++++++++
 tests/test-hmp.c |  1 +
 3 files changed, 38 insertions(+)

diff --git a/hmp-commands.hx b/hmp-commands.hx
index 9b4035965c..a2c3ffc218 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -585,6 +585,21 @@ STEXI
 @findex gpa2hpa
 Print the host physical address at which the guest's physical address @var{addr}
 is mapped.
+ETEXI
+
+    {
+        .name       = "gva2gpa",
+        .args_type  = "addr:l",
+        .params     = "addr",
+        .help       = "print the guest physical address corresponding to a guest virtual address",
+        .cmd        = hmp_gva2gpa,
+    },
+
+STEXI
+@item gva2gpa @var{addr}
+@findex gva2gpa
+Print the guest physical address at which the guest's virtual address @var{addr}
+is mapped based on the mapping for the current CPU.
 ETEXI
 
     {
diff --git a/monitor.c b/monitor.c
index 9b5f10b475..bb48997913 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1673,6 +1673,28 @@ static void hmp_gpa2hva(Monitor *mon, const QDict *qdict)
     memory_region_unref(mr);
 }
 
+static void hmp_gva2gpa(Monitor *mon, const QDict *qdict)
+{
+    target_ulong addr = qdict_get_int(qdict, "addr");
+    MemTxAttrs attrs;
+    CPUState *cs = mon_get_cpu();
+    hwaddr gpa;
+
+    if (!cs) {
+        monitor_printf(mon, "No cpu\n");
+        return;
+    }
+
+    gpa  = cpu_get_phys_page_attrs_debug(mon_get_cpu(),
+                                         addr & TARGET_PAGE_MASK, &attrs);
+    if (gpa == -1) {
+        monitor_printf(mon, "Unmapped\n");
+    } else {
+        monitor_printf(mon, "gpa: %#" HWADDR_PRIx "\n",
+                       gpa + (addr & ~TARGET_PAGE_MASK));
+    }
+}
+
 #ifdef CONFIG_LINUX
 static uint64_t vtop(void *ptr, Error **errp)
 {
diff --git a/tests/test-hmp.c b/tests/test-hmp.c
index 54a01824dc..e344947f7c 100644
--- a/tests/test-hmp.c
+++ b/tests/test-hmp.c
@@ -39,6 +39,7 @@ static const char *hmp_cmds[] = {
     "dump-guest-memory /dev/null 0 4096",
     "dump-guest-memory /dev/null",
     "gdbserver",
+    "gva2gpa 0",
     "hostfwd_add tcp::43210-:43210",
     "hostfwd_remove tcp::43210-:43210",
     "i /w 0",
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PULL 2/2] hmp: gva2gpa debug command
  2019-05-01 10:59 ` [Qemu-devel] [PULL 2/2] hmp: gva2gpa debug command Dr. David Alan Gilbert (git)
@ 2019-05-01 10:59   ` Dr. David Alan Gilbert (git)
  0 siblings, 0 replies; 8+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-05-01 10:59 UTC (permalink / raw)
  To: qemu-devel, crobinso

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Add a gva2gpa command purely for debug which performs
address translation on the gva, the existing gpa2hva
command can then also be used to find it in the qemu
userspace; e.g.

(qemu) info registers
.... RSP=ffffffff81c03e98
....
(qemu) gva2gpa 0xffffffff81c03e98
gpa: 0x1c03e98
(qemu) gpa2hva 0x1c03e98
Host virtual address for 0x1c03e98 (pc.ram) is 0x7f0599a03e98
(qemu) x/10x 0xffffffff81c03e98
ffffffff81c03e98: 0x81c03eb8 0xffffffff 0x8101ea3f 0xffffffff
ffffffff81c03ea8: 0x81d27b00 0xffffffff 0x00000000 0x00000000
ffffffff81c03eb8: 0x81c03ec8 0xffffffff

gdb -p ...qemu...
(gdb) x/10x 0x7f0599a03e98
0x7f0599a03e98:	0x81c03eb8	0xffffffff	0x8101ea3f	0xffffffff
0x7f0599a03ea8:	0x81d27b00	0xffffffff	0x00000000	0x00000000
0x7f0599a03eb8:	0x81c03ec8	0xffffffff

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20190412152652.827-1-dgilbert@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 hmp-commands.hx  | 15 +++++++++++++++
 monitor.c        | 22 ++++++++++++++++++++++
 tests/test-hmp.c |  1 +
 3 files changed, 38 insertions(+)

diff --git a/hmp-commands.hx b/hmp-commands.hx
index 9b4035965c..a2c3ffc218 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -585,6 +585,21 @@ STEXI
 @findex gpa2hpa
 Print the host physical address at which the guest's physical address @var{addr}
 is mapped.
+ETEXI
+
+    {
+        .name       = "gva2gpa",
+        .args_type  = "addr:l",
+        .params     = "addr",
+        .help       = "print the guest physical address corresponding to a guest virtual address",
+        .cmd        = hmp_gva2gpa,
+    },
+
+STEXI
+@item gva2gpa @var{addr}
+@findex gva2gpa
+Print the guest physical address at which the guest's virtual address @var{addr}
+is mapped based on the mapping for the current CPU.
 ETEXI
 
     {
diff --git a/monitor.c b/monitor.c
index 9b5f10b475..bb48997913 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1673,6 +1673,28 @@ static void hmp_gpa2hva(Monitor *mon, const QDict *qdict)
     memory_region_unref(mr);
 }
 
+static void hmp_gva2gpa(Monitor *mon, const QDict *qdict)
+{
+    target_ulong addr = qdict_get_int(qdict, "addr");
+    MemTxAttrs attrs;
+    CPUState *cs = mon_get_cpu();
+    hwaddr gpa;
+
+    if (!cs) {
+        monitor_printf(mon, "No cpu\n");
+        return;
+    }
+
+    gpa  = cpu_get_phys_page_attrs_debug(mon_get_cpu(),
+                                         addr & TARGET_PAGE_MASK, &attrs);
+    if (gpa == -1) {
+        monitor_printf(mon, "Unmapped\n");
+    } else {
+        monitor_printf(mon, "gpa: %#" HWADDR_PRIx "\n",
+                       gpa + (addr & ~TARGET_PAGE_MASK));
+    }
+}
+
 #ifdef CONFIG_LINUX
 static uint64_t vtop(void *ptr, Error **errp)
 {
diff --git a/tests/test-hmp.c b/tests/test-hmp.c
index 54a01824dc..e344947f7c 100644
--- a/tests/test-hmp.c
+++ b/tests/test-hmp.c
@@ -39,6 +39,7 @@ static const char *hmp_cmds[] = {
     "dump-guest-memory /dev/null 0 4096",
     "dump-guest-memory /dev/null",
     "gdbserver",
+    "gva2gpa 0",
     "hostfwd_add tcp::43210-:43210",
     "hostfwd_remove tcp::43210-:43210",
     "i /w 0",
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PULL 0/2] hmp queue
  2019-05-01 10:59 [Qemu-devel] [PULL 0/2] hmp queue Dr. David Alan Gilbert (git)
                   ` (2 preceding siblings ...)
  2019-05-01 10:59 ` [Qemu-devel] [PULL 2/2] hmp: gva2gpa debug command Dr. David Alan Gilbert (git)
@ 2019-05-02 11:04 ` Peter Maydell
  2019-05-02 11:04   ` Peter Maydell
  3 siblings, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2019-05-02 11:04 UTC (permalink / raw)
  To: Dr. David Alan Gilbert (git); +Cc: QEMU Developers, Cole Robinson

On Wed, 1 May 2019 at 12:00, Dr. David Alan Gilbert (git)
<dgilbert@redhat.com> wrote:
>
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> The following changes since commit f75d15231e56cb0f2bafe19faf1229c459a60731:
>
>   Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2019-04-30 17:06:57 +0100)
>
> are available in the Git repository at:
>
>   git://github.com/dagrh/qemu.git tags/pull-hmp-20190501
>
> for you to fetch changes up to 574d96933ceff60b2d13fe97602572fc7e95f7c6:
>
>   hmp: gva2gpa debug command (2019-05-01 10:46:59 +0100)
>
> ----------------------------------------------------------------
> HMP pull
>
> New gva2gpa command
> delvm now uses hmp_handle_error so gets Error: prefix in messages
>


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.1
for any user-visible changes.

-- PMM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PULL 0/2] hmp queue
  2019-05-02 11:04 ` [Qemu-devel] [PULL 0/2] hmp queue Peter Maydell
@ 2019-05-02 11:04   ` Peter Maydell
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2019-05-02 11:04 UTC (permalink / raw)
  To: Dr. David Alan Gilbert (git); +Cc: QEMU Developers, Cole Robinson

On Wed, 1 May 2019 at 12:00, Dr. David Alan Gilbert (git)
<dgilbert@redhat.com> wrote:
>
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> The following changes since commit f75d15231e56cb0f2bafe19faf1229c459a60731:
>
>   Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2019-04-30 17:06:57 +0100)
>
> are available in the Git repository at:
>
>   git://github.com/dagrh/qemu.git tags/pull-hmp-20190501
>
> for you to fetch changes up to 574d96933ceff60b2d13fe97602572fc7e95f7c6:
>
>   hmp: gva2gpa debug command (2019-05-01 10:46:59 +0100)
>
> ----------------------------------------------------------------
> HMP pull
>
> New gva2gpa command
> delvm now uses hmp_handle_error so gets Error: prefix in messages
>


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.1
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-05-02 11:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-01 10:59 [Qemu-devel] [PULL 0/2] hmp queue Dr. David Alan Gilbert (git)
2019-05-01 10:59 ` Dr. David Alan Gilbert (git)
2019-05-01 10:59 ` [Qemu-devel] [PULL 1/2] hmp: delvm: use hmp_handle_error Dr. David Alan Gilbert (git)
2019-05-01 10:59   ` Dr. David Alan Gilbert (git)
2019-05-01 10:59 ` [Qemu-devel] [PULL 2/2] hmp: gva2gpa debug command Dr. David Alan Gilbert (git)
2019-05-01 10:59   ` Dr. David Alan Gilbert (git)
2019-05-02 11:04 ` [Qemu-devel] [PULL 0/2] hmp queue Peter Maydell
2019-05-02 11:04   ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).