Received: from eggs.gnu.org ([2001:4830:134:3::10]:38431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UvBbI-0001L5-HI for qemu-devel@nongnu.org; Fri, 05 Jul 2013 15:23:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UvBQb-0001xC-00 for qemu-devel@nongnu.org; Fri, 05 Jul 2013 15:12:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43668) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UvB4T-0002mS-Fu for qemu-devel@nongnu.org; Fri, 05 Jul 2013 14:49:29 -0400 Date: Fri, 5 Jul 2013 15:49:18 -0300 From: Eduardo Habkost Message-ID: <20130705184918.GQ13956@otherpad.lan.raisama.net> References: <1372931597-28115-1-git-send-email-gaowanlong@cn.fujitsu.com> <1372931597-28115-11-git-send-email-gaowanlong@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1372931597-28115-11-git-send-email-gaowanlong@cn.fujitsu.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH V4 10/10] NUMA: show host memory policy info in info numa command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wanlong Gao Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, bsd@redhat.com, pbonzini@redhat.com, y-goto@jp.fujitsu.com, afaerber@suse.de On Thu, Jul 04, 2013 at 05:53:17PM +0800, Wanlong Gao wrote: > Show host memory policy of nodes in the info numa monitor command. > After this patch, the monitor command "info numa" will show the > information like following if the host numa support is enabled: >=20 > (qemu) info numa > 2 nodes > node 0 cpus: 0 > node 0 size: 1024 MB > node 0 mempolicy: membind=3D0,1 > node 1 cpus: 1 > node 1 size: 1024 MB > node 1 mempolicy: interleave=3D1 >=20 > Signed-off-by: Wanlong Gao > --- > monitor.c | 42 ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 42 insertions(+) >=20 > diff --git a/monitor.c b/monitor.c > index 93ac045..a40415d 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -74,6 +74,11 @@ > #endif > #include "hw/lm32/lm32_pic.h" > =20 > +#ifdef CONFIG_NUMA > +#include > +#include > +#endif > + > //#define DEBUG > //#define DEBUG_COMPLETION > =20 > @@ -1808,6 +1813,7 @@ static void do_info_numa(Monitor *mon, const QDic= t *qdict) > int i; > CPUArchState *env; > CPUState *cpu; > + unsigned long first, next; This breaks compilation with --enable-werror and CONFIG_NUMA disabled: /home/ehabkost/rh/proj/virt/qemu/monitor.c: In function =E2=80=98do_info_= numa=E2=80=99: /home/ehabkost/rh/proj/virt/qemu/monitor.c:1816:26: error: unused variabl= e =E2=80=98next=E2=80=99 [-Werror=3Dunused-variable] /home/ehabkost/rh/proj/virt/qemu/monitor.c:1816:19: error: unused variabl= e =E2=80=98first=E2=80=99 [-Werror=3Dunused-variable] cc1: all warnings being treated as errors make[1]: *** [monitor.o] Error 1 > =20 > monitor_printf(mon, "%d nodes\n", nb_numa_nodes); > for (i =3D 0; i < nb_numa_nodes; i++) { > @@ -1821,6 +1827,42 @@ static void do_info_numa(Monitor *mon, const QDi= ct *qdict) > monitor_printf(mon, "\n"); > monitor_printf(mon, "node %d size: %" PRId64 " MB\n", i, > numa_info[i].node_mem >> 20); > + > +#ifdef CONFIG_NUMA > + monitor_printf(mon, "node %d mempolicy: ", i); > + switch (numa_info[i].flags & NODE_HOST_POLICY_MASK) { > + case NODE_HOST_BIND: > + monitor_printf(mon, "membind=3D"); > + break; > + case NODE_HOST_INTERLEAVE: > + monitor_printf(mon, "interleave=3D"); > + break; > + case NODE_HOST_PREFERRED: > + monitor_printf(mon, "preferred=3D"); > + break; > + default: > + monitor_printf(mon, "default\n"); > + continue; > + } > + > + if (numa_info[i].flags & NODE_HOST_RELATIVE) > + monitor_printf(mon, "+"); > + > + next =3D first =3D find_first_bit(numa_info[i].host_mem, MAX_C= PUMASK_BITS); > + monitor_printf(mon, "%lu", first); > + do { > + if (next =3D=3D numa_max_node()) > + break; > + next =3D find_next_bit(numa_info[i].host_mem, MAX_CPUMASK_= BITS, > + next + 1); > + if (next > numa_max_node() || next =3D=3D MAX_CPUMASK_BITS= ) > + break; > + > + monitor_printf(mon, ",%lu", next); > + } while (true); > + > + monitor_printf(mon, "\n"); > +#endif > } > } > =20 > --=20 > 1.8.3.2.634.g7a3187e >=20 >=20 --=20 Eduardo