From patchwork Tue Feb 12 21:48:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1040880 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43zc4541Xdz9s4Z for ; Wed, 13 Feb 2019 08:58:45 +1100 (AEDT) Received: from localhost ([127.0.0.1]:46719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtg4h-0002RX-Hq for incoming@patchwork.ozlabs.org; Tue, 12 Feb 2019 16:58:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43595) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtg41-0002P8-OP for qemu-devel@nongnu.org; Tue, 12 Feb 2019 16:58:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtg3z-0007L5-Ac for qemu-devel@nongnu.org; Tue, 12 Feb 2019 16:58:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42290) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gtg3y-00076V-Ss; Tue, 12 Feb 2019 16:57:59 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 678446699C; Tue, 12 Feb 2019 21:48:40 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-204-62.brq.redhat.com [10.40.204.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id D99B710018F9; Tue, 12 Feb 2019 21:48:37 +0000 (UTC) From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 12 Feb 2019 22:48:26 +0100 Message-Id: <20190212214827.30543-4-lvivier@redhat.com> In-Reply-To: <20190212214827.30543-1-lvivier@redhat.com> References: <20190212214827.30543-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 12 Feb 2019 21:48:40 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 3/4] numa: move cpu_slot_to_string() upper in the function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Thomas Huth , Eduardo Habkost , qemu-ppc@nongnu.org, Igor Mammedov , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will allow to use it in more functions in the future. As we change the prototype to take directly CpuInstanceProperties instead of CPUArchId, rename the function to cpu_props_to_string(). Signed-off-by: Laurent Vivier --- hw/core/machine.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 7c74b318f635..a2c29692b55e 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -550,6 +550,27 @@ HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine) return head; } +static char *cpu_props_to_string(const CpuInstanceProperties *props) +{ + GString *s = g_string_new(NULL); + if (props->has_socket_id) { + g_string_append_printf(s, "socket-id: %"PRId64, props->socket_id); + } + if (props->has_core_id) { + if (s->len) { + g_string_append_printf(s, ", "); + } + g_string_append_printf(s, "core-id: %"PRId64, props->core_id); + } + if (props->has_thread_id) { + if (s->len) { + g_string_append_printf(s, ", "); + } + g_string_append_printf(s, "thread-id: %"PRId64, props->thread_id); + } + return g_string_free(s, false); +} + /** * machine_set_cpu_numa_node: * @machine: machine object to modify @@ -849,27 +870,6 @@ bool machine_mem_merge(MachineState *machine) return machine->mem_merge; } -static char *cpu_slot_to_string(const CPUArchId *cpu) -{ - GString *s = g_string_new(NULL); - if (cpu->props.has_socket_id) { - g_string_append_printf(s, "socket-id: %"PRId64, cpu->props.socket_id); - } - if (cpu->props.has_core_id) { - if (s->len) { - g_string_append_printf(s, ", "); - } - g_string_append_printf(s, "core-id: %"PRId64, cpu->props.core_id); - } - if (cpu->props.has_thread_id) { - if (s->len) { - g_string_append_printf(s, ", "); - } - g_string_append_printf(s, "thread-id: %"PRId64, cpu->props.thread_id); - } - return g_string_free(s, false); -} - static void machine_numa_finish_cpu_init(MachineState *machine) { int i; @@ -887,7 +887,7 @@ static void machine_numa_finish_cpu_init(MachineState *machine) default_mapping = false; } else { /* record slots with not set mapping, */ - char *cpu_str = cpu_slot_to_string(cpu_slot); + char *cpu_str = cpu_props_to_string(&cpu_slot->props); g_string_append_printf(s, "%sCPU %d [%s]", s->len ? ", " : "", i, cpu_str); g_free(cpu_str);