From nobody Sat Feb 7 08:07:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626205509468319.5846744667557; Tue, 13 Jul 2021 12:45:09 -0700 (PDT) Received: from localhost ([::1]:59216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m3OL5-0001CJ-G7 for importer@patchew.org; Tue, 13 Jul 2021 15:45:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54830) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3OHG-0000zt-7P; Tue, 13 Jul 2021 15:41:10 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:46744) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m3OHE-0006Ux-Gd; Tue, 13 Jul 2021 15:41:09 -0400 Received: by mail-pf1-x431.google.com with SMTP id x16so20526549pfa.13; Tue, 13 Jul 2021 12:41:07 -0700 (PDT) Received: from rekt.ibmuc.com ([191.193.148.134]) by smtp.gmail.com with ESMTPSA id o72sm20077506pfg.44.2021.07.13.12.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jul 2021 12:41:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JQbLYJekVFXHz1j8A8zyhgeWXPfW3Rmufm8WbLN+aw4=; b=CTNZZkHg59AMBFZ7jpPlupOVjD3KtQ5YFnLvG/SKH6+ohAXndoaZMdUE9NZvM2Xlis v5mPm2rbAzP+EUWXnknG7QhzfkAue/48WcEpkKGB1g6/7qw3UUV2F6IPvZFQ05TL2EP6 8O51Ec9f4HiQ1anDn0PpSSCC6jDeSWxUpTdPrPszri/MezJDgU62A8UHXdYio3rtlIlt 7bqrhRW122LOKRu+oIBcr/OB7rK6GkNpElqUKnrf336Ny++daumkXa5Sar+mVaGyfg/p kYEUOwHGg5pITeFmHA8vDGoZTc+aAqf027nSZChnCh8yHtALZqMY1Q1dezmGjZs0aXwR Xhmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JQbLYJekVFXHz1j8A8zyhgeWXPfW3Rmufm8WbLN+aw4=; b=doh3GQusKy+C0DiUbrb5Z05ePbM+Ij9h6/vU6i3wRtKY4b9MbmkERKaZS9nR+Z7MZ3 4jOwUKlIZaPJwDnbZ8mMxtd9twN+8k8iWrI0OG7xphtd8LHuKKsQjSkmRbQjIhDVyfhz LmQ/7AMwctml852tM7isH27NxsvOs/+5k/NJSMZXF3FGR08QT3rgCq5Ia1lhGKWqvo5x EXRNDhm7gyunlucHfyFKdC2aq9NEXzPkpcbiiUoNSAvvOXRcA4U/WtHi4dpFAs8rshNa 0Lc7kajj/vsATmYVozhP2Dmt7ksfjNIGVEuCizFJwjrVPm2iQmd2LPVZuwqM6ZHjAq7H WRnw== X-Gm-Message-State: AOAM532GX/fYvnr/s8xGDlxFgzBjeXzjMnhNx3YmoS3SC+Hy1eCh3OXy fMyvaA33QtsYXxB0Ccz4PotsxSKyod+nHJxIazo= X-Google-Smtp-Source: ABdhPJye85PcMPJOl2ccsjbKMWida0mnORZgjeXpsXca4ai+z8oBpkR6ffAlvbODN9Xz5MfdhRHIdA== X-Received: by 2002:a63:110c:: with SMTP id g12mr5667058pgl.139.1626205266140; Tue, 13 Jul 2021 12:41:06 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [RFC PATCH v3 5/5] spapr: move memory/cpu less check to spapr_numa_FORM1_affinity_init() Date: Tue, 13 Jul 2021 16:40:45 -0300 Message-Id: <20210713194045.916263-6-danielhb413@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210713194045.916263-1-danielhb413@gmail.com> References: <20210713194045.916263-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=danielhb413@gmail.com; helo=mail-pf1-x431.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aneesh.kumar@linux.ibm.com, Daniel Henrique Barboza , qemu-ppc@nongnu.org, groug@kaod.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1626205511391100001 Content-Type: text/plain; charset="utf-8" FORM2 NUMA affinity is prepared to deal with memory/cpu less NUMA nodes. This is used by the DAX KMEM driver to locate a PAPR SCM device that has a different latency than the original NUMA node from the regular memory. Move this verification to FORM1 affinity code. Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr.c | 33 --------------------------------- hw/ppc/spapr_numa.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 76f1637959..538c5bcd94 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2794,39 +2794,6 @@ static void spapr_machine_init(MachineState *machine) /* init CPUs */ spapr_init_cpus(spapr); =20 - /* - * check we don't have a memory-less/cpu-less NUMA node - * Firmware relies on the existing memory/cpu topology to provide the - * NUMA topology to the kernel. - * And the linux kernel needs to know the NUMA topology at start - * to be able to hotplug CPUs later. - */ - if (machine->numa_state->num_nodes) { - for (i =3D 0; i < machine->numa_state->num_nodes; ++i) { - /* check for memory-less node */ - if (machine->numa_state->nodes[i].node_mem =3D=3D 0) { - CPUState *cs; - int found =3D 0; - /* check for cpu-less node */ - CPU_FOREACH(cs) { - PowerPCCPU *cpu =3D POWERPC_CPU(cs); - if (cpu->node_id =3D=3D i) { - found =3D 1; - break; - } - } - /* memory-less and cpu-less node */ - if (!found) { - error_report( - "Memory-less/cpu-less nodes are not supported (node= %d)", - i); - exit(1); - } - } - } - - } - spapr->gpu_numa_id =3D spapr_numa_initial_nvgpu_numa_id(machine); =20 if ((!kvm_enabled() || kvmppc_has_cap_mmu_radix()) && diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c index bba5a984e4..98740c732d 100644 --- a/hw/ppc/spapr_numa.c +++ b/hw/ppc/spapr_numa.c @@ -162,6 +162,39 @@ static void spapr_numa_FORM1_affinity_init(SpaprMachin= eState *spapr, MachineState *machine) { bool using_legacy_numa =3D spapr_machine_using_legacy_numa(spapr); + int i; + + /* + * check we don't have a memory-less/cpu-less NUMA node + * Firmware relies on the existing memory/cpu topology to provide the + * NUMA topology to the kernel. + * And the linux kernel needs to know the NUMA topology at start + * to be able to hotplug CPUs later. + */ + if (machine->numa_state->num_nodes) { + for (i =3D 0; i < machine->numa_state->num_nodes; ++i) { + /* check for memory-less node */ + if (machine->numa_state->nodes[i].node_mem =3D=3D 0) { + CPUState *cs; + int found =3D 0; + /* check for cpu-less node */ + CPU_FOREACH(cs) { + PowerPCCPU *cpu =3D POWERPC_CPU(cs); + if (cpu->node_id =3D=3D i) { + found =3D 1; + break; + } + } + /* memory-less and cpu-less node */ + if (!found) { + error_report( + "Memory-less/cpu-less nodes are not supported (node= %d)", + i); + exit(1); + } + } + } + } =20 /* * Legacy NUMA guests (pseries-5.1 and older, or guests with only --=20 2.31.1