From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UosYw-0006bs-VV for qemu-devel@nongnu.org; Tue, 18 Jun 2013 05:50:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UosYv-0007hu-1b for qemu-devel@nongnu.org; Tue, 18 Jun 2013 05:50:54 -0400 Received: from [222.73.24.84] (port=34671 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UosYu-0007hX-BZ for qemu-devel@nongnu.org; Tue, 18 Jun 2013 05:50:52 -0400 Message-ID: <51C02D0D.5020307@cn.fujitsu.com> Date: Tue, 18 Jun 2013 17:49:01 +0800 From: Wanlong Gao MIME-Version: 1.0 References: <1371542991-15911-1-git-send-email-gaowanlong@cn.fujitsu.com> <1371542991-15911-7-git-send-email-gaowanlong@cn.fujitsu.com> <51C0271A.8030900@redhat.com> In-Reply-To: <51C0271A.8030900@redhat.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-15 Subject: Re: [Qemu-devel] [PATCH 6/7] NUMA: add hmp command set-mpol Reply-To: gaowanlong@cn.fujitsu.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: andre.przywara@amd.com, aliguori@us.ibm.com, ehabkost@redhat.com, qemu-devel@nongnu.org, y-goto@jp.fujitsu.com, afaerber@suse.de, Wanlong Gao On 06/18/2013 05:23 PM, Paolo Bonzini wrote: > Il 18/06/2013 10:09, Wanlong Gao ha scritto: >> Add hmp command set-mpol to set host memory policy for a guest >> NUMA node. Then we can also set node's memory policy using >> the monitor command like: >> (qemu) set-mpol 0 membind 0-1 > > I suggest something similar to what chardev-add does: Just make it > "set-mpol ", for example > > (qemu) set-mpol 0 mem-policy=membind,mem-hostnode=0-1 > > Similar to the command-line syntax. That's better, I'll try to change like this, thank you very much. ;) Regards, Wanlong Gao > > Paolo > >> Signed-off-by: Wanlong Gao >> --- >> hmp-commands.hx | 16 ++++++++++++++++ >> hmp.c | 22 ++++++++++++++++++++++ >> hmp.h | 1 + >> 3 files changed, 39 insertions(+) >> >> diff --git a/hmp-commands.hx b/hmp-commands.hx >> index 915b0d1..fd3505e 100644 >> --- a/hmp-commands.hx >> +++ b/hmp-commands.hx >> @@ -1567,6 +1567,22 @@ Executes a qemu-io command on the given block device. >> ETEXI >> >> { >> + .name = "set-mpol", >> + .args_type = "nodeid:i,mpol:s?,nodemask:s?", >> + .params = "nodeid [mpol] [nodemask]", >> + .help = "set host memory policy for a guest NUMA node", >> + .mhandler.cmd = hmp_set_mpol, >> + }, >> + >> +STEXI >> +@item set-mpol @var{nodeid} @var{mpol} @var{nodemask} >> +@findex set-mpol >> + >> +Set host memory policy for a guest NUMA node >> + >> +ETEXI >> + >> + { >> .name = "info", >> .args_type = "item:s?", >> .params = "[subcommand]", >> diff --git a/hmp.c b/hmp.c >> index 494a9aa..2e5315e 100644 >> --- a/hmp.c >> +++ b/hmp.c >> @@ -1464,3 +1464,25 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict) >> >> hmp_handle_error(mon, &err); >> } >> + >> +void hmp_set_mpol(Monitor *mon, const QDict *qdict) >> +{ >> + Error *local_err = NULL; >> + bool has_mpol = true; >> + bool has_nodemask = true; >> + >> + uint64_t nodeid = qdict_get_int(qdict, "nodeid"); >> + const char *mpol = qdict_get_try_str(qdict, "mpol"); >> + const char *nodemask = qdict_get_try_str(qdict, "nodemask"); >> + >> + if (mpol == NULL) { >> + has_mpol = false; >> + } >> + >> + if (nodemask == NULL) { >> + has_nodemask = false; >> + } >> + >> + qmp_set_mpol(nodeid, has_mpol, mpol, has_nodemask, nodemask, &local_err); >> + hmp_handle_error(mon, &local_err); >> +} >> diff --git a/hmp.h b/hmp.h >> index 56d2e92..81f631b 100644 >> --- a/hmp.h >> +++ b/hmp.h >> @@ -86,5 +86,6 @@ void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict); >> void hmp_chardev_add(Monitor *mon, const QDict *qdict); >> void hmp_chardev_remove(Monitor *mon, const QDict *qdict); >> void hmp_qemu_io(Monitor *mon, const QDict *qdict); >> +void hmp_set_mpol(Monitor *mon, const QDict *qdict); >> >> #endif >> > >