qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Re: [Qemu-devel] [PATCH v2] hmp: allow cpu index for "info lapic"
@ 2017-07-19  4:47 wang.yi59
  2017-07-19  6:16 ` Eduardo Habkost
  2017-07-19  8:10 ` Dr. David Alan Gilbert
  0 siblings, 2 replies; 21+ messages in thread
From: wang.yi59 @ 2017-07-19  4:47 UTC (permalink / raw)
  To: ehabkost, qemu-devel
  Cc: pbonzini, rth, dgilbert, Liu.Jianjun3, liu.yunh, wang.yi59

Hi Eduardo,

Thank you for your reply!

>On Mon, Jul 17, 2017 at 09:49:37PM -0400, Yi Wang wrote:

>> Add [vcpu] index support for hmp command "info lapic", which is

>> useful when debugging ipi and so on. Current behavior is not

>> changed when the parameter isn't specified.

>> 

>> Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>

>> Signed-off-by: Yun Liu <liu.yunh@zte.com.cn>

>

>We have 8 monitor commands (see below) that use the CPU set by

>the "cpu" command (mon_get_cpu()) as input.  Why is "info lapic"

>special?

When we debugging a problem of ipi, we wanted to verify lapic info

on each vCPU, but we found that we could only get vCPU 0's lapic

through "info lapic", so we supposed this patch could help those

who have the same problem as us.




>

>* info cpustats

>* info lapic

>* info mem

>* info registers

>* info tlb

>* x

>* memsave

>* inject-nmi (QMP)

Monitor command "info registers" already have "-a" parameter to

show all vCPU's info. -)

May I send some new patches for the other monitor commands, which may

be helpful for analyzing multiple cpu problems?





---

Best wishes

Yi Wang

^ permalink raw reply	[flat|nested] 21+ messages in thread
* Re: [Qemu-devel] [PATCH v2] hmp: allow cpu index for "info lapic"
@ 2017-07-20  4:41 wang.yi59
  0 siblings, 0 replies; 21+ messages in thread
From: wang.yi59 @ 2017-07-20  4:41 UTC (permalink / raw)
  To: ehabkost
  Cc: dgilbert, eblake, berrange, liu.yunh, qemu-devel, libvir-list,
	pbonzini, Liu.Jianjun3, rth

>On Wed, Jul 19, 2017 at 08:17:49PM +0100, Dr. David Alan Gilbert wrote:

>> * Eduardo Habkost (address@hidden) wrote:

>> > On Wed, Jul 19, 2017 at 10:17:36AM -0500, Eric Blake wrote:

>> > > On 07/19/2017 10:07 AM, Daniel P. Berrange wrote:

>> > > >> It doesn't.  Perhaps we should add that as a future libvirt-qemu.so API

>> > > >> addition, although it's probably easier to just use QMP than HMP when

>> > > >> using 'virsh qemu-monitor-command' if HMP doesn't do what you want.

>> > > > 

>> > > > Or special case the "cpu 1" command - ie notice that it is being

>> > > > requested and don't execute 'human-montor-command'. Instead just

>> > > > record the CPU index, and use that for future "human-monitor-command"

>> > > > invokations, so we get full compat with the (dubious) stateful HMP

>> > > > semantics that traditionally existed.

>> > > 

>> > > Is 'cpu' (and the followup commands affected by it) the only stateful

>> > > HMP command pairing?  Is there a way to specify multiple HMP commands in

>> > > a single human-monitor-command QMP call?

>> > > 

>> > > Indeed, tweaking qemu's human-monitor-command call to track the state

>> > > might be cleaner than having libvirt have to tweak API to work around

>> > > this wart of HMP.

>> > 

>> > The CPU index was the only state kept by the human monitor, and I

>> > think it's by design that it stopped being considered "monitor

>> > state" to be tracked, and became just an argument to

>> > human-monitor-command.

>> > 

>> > It's true that it broke compatibility of

>> >   "virsh qemu-monitor-command <domain> --hmp 'cpu <n>'",

>> > when we moved to QMP, but this happened years ago, and it looks

>> > like nobody was relying on it.  I don't see the point of trying

>> > to emulate the previous stateful interface.

>> 

>> IMHO Yi's fix (once reworked) is the right fix - it removes the

>> use of that piece of state, when the optional parameter is used.

>> (OK, so it needs rework not to change that state and to

>> come to some agreement as to what to use instead of cpu index number

>> etc).

>

>Agreed, as it helps us to keep the "virsh qemu-monitor-command"

>interface simpler.  But we have 8 commands that use

>mon_get_cpu(), we shouldn't fix only "info lapic".




Thank you all!

I will rework this patch in this way:

  - extend 'info registers' with apic id value instead of current, like this:

      CPU#1 (socket-id: a, core-id: b, thread-id: c, apic-id: d)

  - add parameter 'apic id' for 'info lapic'




As to other commands, I want to send some other patches 'cause in my opinion not

all commands need 'apic-id' as index.




---

Best wishes

Yi Wang

^ permalink raw reply	[flat|nested] 21+ messages in thread
* Re: [Qemu-devel] [PATCH v2] hmp: allow cpu index for "info lapic"
@ 2017-07-19  8:48 wang.yi59
  2017-07-19  9:16 ` Igor Mammedov
  0 siblings, 1 reply; 21+ messages in thread
From: wang.yi59 @ 2017-07-19  8:48 UTC (permalink / raw)
  To: dgilbert, qemu-devel; +Cc: ehabkost, pbonzini, rth, Liu.Jianjun3, liu.yunh

>* wang.yi59@zte.com.cn (wang.yi59@zte.com.cn) wrote:


>> Hi Eduardo,

>> 

>> Thank you for your reply!

>> 

>> >On Mon, Jul 17, 2017 at 09:49:37PM -0400, Yi Wang wrote:

>> 

>> >> Add [vcpu] index support for hmp command "info lapic", which is

>> 

>> >> useful when debugging ipi and so on. Current behavior is not

>> 

>> >> changed when the parameter isn't specified.

>> 

>> >> 

>> 

>> >> Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>

>> 

>> >> Signed-off-by: Yun Liu <liu.yunh@zte.com.cn>

>> 

>> >

>> 

>> >We have 8 monitor commands (see below) that use the CPU set by

>> >the "cpu" command (mon_get_cpu()) as input.  Why is "info lapic"

>> >special?

>> 

>> When we debugging a problem of ipi, we wanted to verify lapic info

>> on each vCPU, but we found that we could only get vCPU 0's lapic

>> through "info lapic", so we supposed this patch could help those

>> who have the same problem as us.

>

>I think Eduardo's point is that you can already do:

>    cpu 0

>    info lapic

>    cpu 1

>    info lapic

Yes, I get it, thank you.

The reason of the problem we met is that we use "virsh qemu-monitor-command",

so the 'cpu' command didn't work.








---

Best wishes

Yi Wang

^ permalink raw reply	[flat|nested] 21+ messages in thread
* Re: [Qemu-devel] [PATCH v2] hmp: allow cpu index for "info lapic"
@ 2017-07-19  4:25 wang.yi59
  2017-07-19  7:36 ` Igor Mammedov
  0 siblings, 1 reply; 21+ messages in thread
From: wang.yi59 @ 2017-07-19  4:25 UTC (permalink / raw)
  To: imammedo, qemu-devel
  Cc: pbonzini, rth, ehabkost, dgilbert, liu.yunh, Liu.Jianjun3

>On Mon, 17 Jul 2017 21:49:37 -0400

>Yi Wang <address@hidden> wrote:

>

>> Add [vcpu] index support for hmp command "info lapic", which is

>> useful when debugging ipi and so on. Current behavior is not

>> changed when the parameter isn't specified.

>we shouldn't expose cpu_index to users anymore,

>

>I would suggest using to use real APIC ID here but we don't

>have monitor command that returns APIC IDs for present cpus.




Would you like to explain the reason we shouldn't use cpu_index any

more, which is more straightforward than socket-id/core-id/thread-id?

As Eduardo wrote in the next reply, "CPU #<n>" is already a perfectly

good identifier for a human interface :-)

Many thanks.





---

Best wishes

Yi Wang

^ permalink raw reply	[flat|nested] 21+ messages in thread
* [Qemu-devel]  [PATCH v2] hmp: allow cpu index for "info lapic"
@ 2017-07-18  1:49 Yi Wang
  2017-07-18 14:54 ` Igor Mammedov
  2017-07-18 23:25 ` Eduardo Habkost
  0 siblings, 2 replies; 21+ messages in thread
From: Yi Wang @ 2017-07-18  1:49 UTC (permalink / raw)
  To: pbonzini, rth, ehabkost, dgilbert, qemu-devel
  Cc: wang.yi59, Liu.Jianjun3, liu.yunh

Add [vcpu] index support for hmp command "info lapic", which is
useful when debugging ipi and so on. Current behavior is not
changed when the parameter isn't specified.

Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Signed-off-by: Yun Liu <liu.yunh@zte.com.cn>
---
 hmp-commands-info.hx  | 6 +++---
 target/i386/monitor.c | 8 +++++++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index d9df238..c534b03 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -115,9 +115,9 @@ ETEXI
 #if defined(TARGET_I386)
     {
         .name       = "lapic",
-        .args_type  = "",
-        .params     = "",
-        .help       = "show local apic state",
+        .args_type  = "vcpu:i?",
+        .params     = "[vcpu]",
+        .help       = "show local apic state (vcpu: vCPU to read, default is 0)",
         .cmd        = hmp_info_local_apic,
     },
 #endif
diff --git a/target/i386/monitor.c b/target/i386/monitor.c
index 77ead60..813005e 100644
--- a/target/i386/monitor.c
+++ b/target/i386/monitor.c
@@ -632,8 +632,14 @@ const MonitorDef *target_monitor_defs(void)
 
 void hmp_info_local_apic(Monitor *mon, const QDict *qdict)
 {
-    CPUState *cs = mon_get_cpu();
+    CPUState *cs;
 
+    if (qdict_haskey(qdict, "vcpu")) {
+        int index = qdict_get_try_int(qdict, "vcpu", 0);
+        cs = qemu_get_cpu(index);
+    } else {
+        cs = mon_get_cpu();
+    }
     if (!cs) {
         monitor_printf(mon, "No CPU available\n");
         return;
-- 
1.8.3.1

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

end of thread, other threads:[~2017-07-20  4:42 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-19  4:47 [Qemu-devel] [PATCH v2] hmp: allow cpu index for "info lapic" wang.yi59
2017-07-19  6:16 ` Eduardo Habkost
2017-07-19 12:16   ` Dr. David Alan Gilbert
2017-07-19 12:41     ` Eduardo Habkost
2017-07-19 15:02       ` Eric Blake
2017-07-19 15:07         ` Daniel P. Berrange
2017-07-19 15:17           ` Eric Blake
2017-07-19 18:32             ` Eduardo Habkost
2017-07-19 19:17               ` Dr. David Alan Gilbert
2017-07-19 19:46                 ` Eduardo Habkost
2017-07-19  8:10 ` Dr. David Alan Gilbert
  -- strict thread matches above, loose matches on Subject: below --
2017-07-20  4:41 wang.yi59
2017-07-19  8:48 wang.yi59
2017-07-19  9:16 ` Igor Mammedov
2017-07-19  4:25 wang.yi59
2017-07-19  7:36 ` Igor Mammedov
2017-07-18  1:49 Yi Wang
2017-07-18 14:54 ` Igor Mammedov
2017-07-18 23:26   ` Eduardo Habkost
2017-07-19  7:39     ` Igor Mammedov
2017-07-18 23:25 ` Eduardo Habkost

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).