All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@linux.vnet.ibm.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Huang Ying <ying.huang@intel.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Avi Kivity <avi@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	Andi Kleen <andi@firstfloor.org>,
	Dean Nelson <dnelson@redhat.com>
Subject: Re: [PATCH  -v2] Monitor command: pfa2hva, translate guest physical address to host virtual address
Date: Mon, 01 Nov 2010 13:49:15 -0500	[thread overview]
Message-ID: <4CCF0BAB.9000304@linux.vnet.ibm.com> (raw)
In-Reply-To: <20101101160952.GE1429@amt.cnet>

On 11/01/2010 11:09 AM, Marcelo Tosatti wrote:
> On Tue, Oct 26, 2010 at 10:39:48AM +0800, Huang Ying wrote:
>    
>> Author: Max Asbock<masbock@linux.vnet.ibm.com>
>>
>> Add command pfa2hva to translate guest physical address to host
>> virtual address.
>>
>> The pfa2hva command provides one step in a chain of translations from
>> guest virtual to guest physical to host virtual to host physical. Host
>> physical is then used to inject a machine check error. As a
>> consequence the HWPOISON code on the host and the MCE injection code
>> in qemu-kvm are exercised.
>>
>> v2:
>>
>> - Add QMP support
>>      
>
> Looks good to me. Anthony?
>    

The translation is not stable so this is really a bad interface.

It definitely shouldn't be a QMP command and I don't think it's 
generally useful enough that it should be a monitor command.

It's impossible to use correctly as a general interface.

I gave this feedback when it was initially submitted.

Regards,

Anthony Liguori

>> Signed-off-by: Max Asbock<masbock@linux.vnet.ibm.com>
>> Signed-off-by: Jiajia Zheng<jiajia.zheng@intel.com>
>> Signed-off-by: Huang Ying<ying.huang@intel.com>
>> ---
>>   hmp-commands.hx |   15 +++++++++++++++
>>   monitor.c       |   22 ++++++++++++++++++++++
>>   qmp-commands.hx |   27 +++++++++++++++++++++++++++
>>   3 files changed, 64 insertions(+)
>>
>> --- a/monitor.c
>> +++ b/monitor.c
>> @@ -2272,6 +2272,28 @@ static void do_inject_mce(Monitor *mon,
>>   }
>>   #endif
>>
>> +static void do_pfa2hva_print(Monitor *mon, const QObject *data)
>> +{
>> +    QInt *qint;
>> +
>> +    qint = qobject_to_qint(data);
>> +    monitor_printf(mon, "0x%lx\n", (unsigned long)qint->value);
>> +}
>> +
>> +static int do_pfa2hva(Monitor *mon, const QDict *qdict, QObject **ret_data)
>> +{
>> +    target_phys_addr_t paddr;
>> +    target_phys_addr_t size = TARGET_PAGE_SIZE;
>> +    void *vaddr;
>> +
>> +    paddr = qdict_get_int(qdict, "addr");
>> +    vaddr = cpu_physical_memory_map(paddr,&size, 0);
>> +    cpu_physical_memory_unmap(vaddr, size, 0, 0);
>> +    *ret_data = qobject_from_jsonf("%ld", (unsigned long)vaddr);
>> +
>> +    return 0;
>> +}
>> +
>>   static int do_getfd(Monitor *mon, const QDict *qdict, QObject **ret_data)
>>   {
>>       const char *fdname = qdict_get_str(qdict, "fdname");
>> --- a/hmp-commands.hx
>> +++ b/hmp-commands.hx
>> @@ -293,6 +293,21 @@ Start gdbserver session (default @var{po
>>   ETEXI
>>
>>       {
>> +        .name       = "pfa2hva",
>> +        .args_type  = "fmt:/,addr:l",
>> +        .params     = "/fmt addr",
>> +        .help       = "translate guest physical 'addr' to host virtual address",
>> +        .user_print = do_pfa2hva_print,
>> +        .mhandler.cmd_new = do_pfa2hva,
>> +    },
>> +
>> +STEXI
>> +@item pfa2hva @var{addr}
>> +@findex pfa2hva
>> +Translate guest physical @var{addr} to host virtual address.
>> +ETEXI
>> +
>> +    {
>>           .name       = "x",
>>           .args_type  = "fmt:/,addr:l",
>>           .params     = "/fmt addr",
>> --- a/qmp-commands.hx
>> +++ b/qmp-commands.hx
>> @@ -738,6 +738,33 @@ Example:
>>   EQMP
>>
>>       {
>> +        .name       = "pfa2hva",
>> +        .args_type  = "addr:l",
>> +        .params     = "addr",
>> +        .help       = "translate guest physical 'addr' to host virtual address",
>> +        .user_print = do_pfa2hva_print,
>> +        .mhandler.cmd_new = do_pfa2hva,
>> +    },
>> +
>> +SQMP
>> +pfa2hva
>> +---
>> +
>> +Translate guest physical 'addr' to host virtual address.
>> +
>> +Arguments:
>> +
>> +- "addr": the guest physical address
>> +
>> +Example:
>> +
>> +->  { "execute": "pfa2hva",
>> +		"arguments": { "addr": 196608 } }
>> +<- { "return": 139888084717568 }
>> +
>> +EQMP
>> +
>> +    {
>>           .name       = "qmp_capabilities",
>>           .args_type  = "",
>>           .params     = "",
>>
>>      


  reply	other threads:[~2010-11-01 18:49 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-26  2:39 [PATCH -v2] Monitor command: pfa2hva, translate guest physical address to host virtual address Huang Ying
2010-11-01 16:09 ` Marcelo Tosatti
2010-11-01 18:49   ` Anthony Liguori [this message]
2010-11-01 19:20     ` Huang Ying
2010-11-01 19:22       ` Anthony Liguori
2010-11-04 16:53         ` Luiz Capitulino
2010-11-06 16:24         ` Avi Kivity
2010-11-08  1:29           ` Huang Ying
2010-11-08  3:39             ` Anthony Liguori
2010-11-08 20:46               ` Huang Ying
2010-11-09  3:06               ` Huang Ying
2010-11-10  6:56               ` Avi Kivity
2010-11-10  6:59                 ` Avi Kivity
2010-11-10  7:41                   ` Huang Ying
2010-11-10  8:28                     ` Avi Kivity
2010-11-10  8:38                       ` Huang Ying
2010-11-10  8:48                         ` Avi Kivity
2010-11-10 16:42                         ` Andi Kleen
2010-11-10 17:08                           ` Avi Kivity
2010-11-10 17:44                             ` Andi Kleen
2010-11-10 17:47                               ` Avi Kivity
2010-11-10 19:16                                 ` Andi Kleen
2010-11-10 20:58                                   ` Avi Kivity
2010-11-10  8:21                 ` Huang Ying
2010-11-10  8:34                   ` Avi Kivity
2010-11-10 16:49                     ` Anthony Liguori
2010-11-11  0:56                       ` Huang Ying
2010-11-11  9:39                         ` Avi Kivity
2010-11-12  1:16                           ` Huang Ying
2010-11-14 11:08                             ` Avi Kivity
2010-11-14 11:09                               ` Avi Kivity
2010-11-15  1:46                               ` Huang Ying
2010-11-15 10:02                                 ` Andi Kleen
2010-11-08  3:37           ` Anthony Liguori

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=4CCF0BAB.9000304@linux.vnet.ibm.com \
    --to=aliguori@linux.vnet.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=andi@firstfloor.org \
    --cc=avi@redhat.com \
    --cc=dnelson@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=ying.huang@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.