From nobody Sun May 19 20:47:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1628853977; cv=none; d=zohomail.com; s=zohoarc; b=bzGe3id1YKUPsdpfx9HiMgEJak4hjzzBLzqeHMAO4hMTR6L466ESjgCsmfrNHFb0Latk4hqytfH6kE6D/HK3x5s9I64wb/YL9/O9ni8t2sVmCF/eFAwJjnbm+6UUmbNhOeMAhaFR0E4CNDK3E3ypPLyLGoDjBqwLI3IT2VF4SVw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628853977; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=y9ZNqtKL1cC+fTmEJTF4kIlxQkEz59g4jviAlnj0Q4c=; b=U7HmE0QnBRKkkGap1yaXsaYJDUxuvMizMKVMmqsBaA2Y8BeC6SSUOgGfBr4mX6tq8R98cgSrFr+mrMsXu3qD1z+nLU4fO6lD7ZLjZVyecPNKhME1UW/rb/xJnBgrJ/7DQKQtedThxgWl10yuqkcIMewKcSaqtHin40KfPqxGOb0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1628853977813649.7678972487649; Fri, 13 Aug 2021 04:26:17 -0700 (PDT) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-230-Oy0poua4NSmRChAV9QFssA-1; Fri, 13 Aug 2021 07:26:15 -0400 Received: by mail-wm1-f72.google.com with SMTP id b3-20020a1c80030000b02902e6a7296cb3so2596613wmd.5 for ; Fri, 13 Aug 2021 04:26:15 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (163.red-83-52-55.dynamicip.rima-tde.net. [83.52.55.163]) by smtp.gmail.com with ESMTPSA id f2sm1286209wrq.69.2021.08.13.04.26.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Aug 2021 04:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628853976; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y9ZNqtKL1cC+fTmEJTF4kIlxQkEz59g4jviAlnj0Q4c=; b=cbHhPfoj/uA+7qZhfZ2fNQFYvOZMcpA6jCk/7n/EVRzNMNXOT8K8yxGllWfmXoZaWNhtwz +q1GLBmjwFlEj+ZttBBfzic3MTiT0PIGvYcIziLFaYFfuGeznI/Sue/zJgaiC7l/8bp8la LhKQWqdi0lYf2LCSn9cYUX3GbY3R4ac= X-MC-Unique: Oy0poua4NSmRChAV9QFssA-1 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=y9ZNqtKL1cC+fTmEJTF4kIlxQkEz59g4jviAlnj0Q4c=; b=q4v1saEnJGoHsEOWBcbGXWbfhLSKYtlyq71od20ITHq+8u09VY0RhF749CqABSbBtN EqgIwmwEzprQDsYDDG95/VqhbWtWDeV/xoeGg7f0gCvaQwm8WotfW2uZOxeCDYqLqAGa icnMcecyEc8ilb3Apu0o0P7Eg7u6TA87tR8y+/ScZA7c2YkHxMpyCnZpFyleuGfCPhEe JJP1wTQHpjm+fU69dgKbXPHCM5otWuYtOdkEXR5lNxeSxD8kFe+Fvn+m/NmRXh76vjfh PhVU28aUmlZuUS4mtJYose8rRxZBcqxP5nyaDe5/NcmqxC8IkSee2MHef9gD4wSg//Yp rXmg== X-Gm-Message-State: AOAM533I34FMbbwA8Vrku/9+w7j5ajnTM4l20d435OQcvAt1ROcVPudQ 5JDY3m6EDLJ5I6nQuJt76PFnUAQKSfVNDWdfbJzwDVoLYOz+4qqJ3jGs2HH+aZKzqgoZcwUtVE3 NnHkasXnFr15sXg== X-Received: by 2002:adf:f046:: with SMTP id t6mr2617399wro.266.1628853974458; Fri, 13 Aug 2021 04:26:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBJKBUqSZxapvwL8yYh83lXE3AhuZKZ0UcL3YCGZIfD/BcHVkoJqjsGtjhpcfLYd9T2qsZYw== X-Received: by 2002:adf:f046:: with SMTP id t6mr2617378wro.266.1628853974323; Fri, 13 Aug 2021 04:26:14 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Marcel Apfelbaum , Eduardo Habkost , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-6.1? v2 1/3] hw/core: Add missing return on error Date: Fri, 13 Aug 2021 13:26:06 +0200 Message-Id: <20210813112608.1452541-2-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210813112608.1452541-1-philmd@redhat.com> References: <20210813112608.1452541-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628853978741100001 If dies is not supported by this machine's CPU topology, don't keep processing options and return directly. Fixes: 0aebebb561c ("machine: reject -smp dies!=3D1 for non-PC machines") Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/machine.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/core/machine.c b/hw/core/machine.c index 943974d411c..abaeda589b7 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -752,6 +752,7 @@ static void smp_parse(MachineState *ms, SMPConfiguratio= n *config, Error **errp) =20 if (config->has_dies && config->dies !=3D 0 && config->dies !=3D 1) { error_setg(errp, "dies not supported by this machine's CPU topolog= y"); + return; } =20 /* compute missing values, prefer sockets over cores over threads */ --=20 2.31.1 From nobody Sun May 19 20:47:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1628853987; cv=none; d=zohomail.com; s=zohoarc; b=BR1G2MDgYoFNDoNYtiqixobQN2ih10Gq2WpVw8htqVn1SIjfUsSdD+1X8Br2uX44X4bcT2kTNG6xoqg3n8zjMwMTTDEOIZq/xlU7+tWKFdziIcET4ZGBFEZZzi2/ZgJ231HDbleEKONUIGrz3qRBETYouJO/2/8Z7UnvhqlcbW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628853987; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=8+x5cDRqGYYB882mrXq6yDCo4MYAmB6tqQmNrQFCSL8=; b=Xx92sUjdRRAdrxH3sVR/c47tyhaGq9MEVwJEzqIVRm4leXXvjaPbvupRKpwFkVHNdkDCAx1y6xHYwmAUyyQKmm2KhIi3rTYpuNm4q7BWjH0SB6z9X7nBEXBO+Rcg2bYcnNhAZZzuGYR4kfH4+xAMieki6BnUIgVgfZlcj0ll/wo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1628853987729154.79168342866; Fri, 13 Aug 2021 04:26:27 -0700 (PDT) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-205-cKoqDyosMM2m-JFjj2gOag-1; Fri, 13 Aug 2021 07:26:20 -0400 Received: by mail-wm1-f71.google.com with SMTP id k5-20020a7bc3050000b02901e081f69d80so2595595wmj.8 for ; Fri, 13 Aug 2021 04:26:20 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (163.red-83-52-55.dynamicip.rima-tde.net. [83.52.55.163]) by smtp.gmail.com with ESMTPSA id d8sm209710wrx.12.2021.08.13.04.26.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Aug 2021 04:26:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628853986; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8+x5cDRqGYYB882mrXq6yDCo4MYAmB6tqQmNrQFCSL8=; b=YvddfaxR0SBDKPAXmzY3KG8zAXTV3G0GtAptRjRZBjnrEcWou62lT51iU1WUC2bdR6b0Ur oY3qjN+NDJL2eHsSgPpRK6iroL1ztRqAeAPrDYnL0cnvpsj9nXlSSo9MBby7YScJqTlEb4 cxg6iTeWcKAFKaF79zsT3mXYEYFwjPc= X-MC-Unique: cKoqDyosMM2m-JFjj2gOag-1 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=8+x5cDRqGYYB882mrXq6yDCo4MYAmB6tqQmNrQFCSL8=; b=hXjbPEk6Idu2Y31/0R7dNnh3WFcqQ1eA8qrhJRln/wgjm8gZ+zCnsTseRe2yVnuDUw gJG6hAZej7Op8zIAcFt4yqmiCM1lwmRXrx9A9K1nFc5CpWq0ABOTpD7qSHATezrE84Lr 6dBkOw2PXe+kDhO4I2p10NdPCffvtmJ/1Qun0aJG7eV2ZyN3BiVP7io15kYa8hoVmmcq x6fnCRjrk4dTxmiPOHLXRp8ST5LUVMAe5wFGnc07/tnbvumgqmInvPuEF4CQJLhCR2F5 W63erjhM3CrzUcmi1/nG+EmmS2SN3HYryBakKJn6AB4pwlj8V6egjWBK7groyL2mZLI2 anqw== X-Gm-Message-State: AOAM530KzQLpBpXFWvW1GtKKwd4JwEVi7y93Xn+2I631YS81mQroqDSu 5FmhqzK8Z8jxASdkOG7BNB1vmtmx5U5+S0XXuAPxsH3AoaQv2bdXgbCoZzPuISxmfS+XdAdembC zOMvSTzTDXFIQOw== X-Received: by 2002:a1c:9dcc:: with SMTP id g195mr1526602wme.125.1628853979588; Fri, 13 Aug 2021 04:26:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDieBdnjSLfVD6+rvO2WxiF+dQr521Rd88x9WgAXxzR0U5ksNcWHB0I7Qc1unECLaCzK3+hg== X-Received: by 2002:a1c:9dcc:: with SMTP id g195mr1526579wme.125.1628853979358; Fri, 13 Aug 2021 04:26:19 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Marcel Apfelbaum , Eduardo Habkost , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-6.1? v2 2/3] hw/core: Have MachineClass::smp_parse() return boolean on error Date: Fri, 13 Aug 2021 13:26:07 +0200 Message-Id: <20210813112608.1452541-3-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210813112608.1452541-1-philmd@redhat.com> References: <20210813112608.1452541-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628853989326100002 Just for consistency, following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), return a boolean value indicating an error is set or not. Directly pass errp as the local_err is not requested in our case. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/boards.h | 2 +- hw/core/machine.c | 12 +++++++----- hw/i386/pc.c | 10 ++++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index accd6eff35a..d5b7058c2e2 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -209,7 +209,7 @@ struct MachineClass { void (*reset)(MachineState *state); void (*wakeup)(MachineState *state); int (*kvm_type)(MachineState *machine, const char *arg); - void (*smp_parse)(MachineState *ms, SMPConfiguration *config, Error **= errp); + bool (*smp_parse)(MachineState *ms, SMPConfiguration *config, Error **= errp); =20 BlockInterfaceType block_default_type; int units_per_default_bus; diff --git a/hw/core/machine.c b/hw/core/machine.c index abaeda589b7..159c6b098e2 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -743,7 +743,7 @@ void machine_set_cpu_numa_node(MachineState *machine, } } =20 -static void smp_parse(MachineState *ms, SMPConfiguration *config, Error **= errp) +static bool smp_parse(MachineState *ms, SMPConfiguration *config, Error **= errp) { unsigned cpus =3D config->has_cpus ? config->cpus : 0; unsigned sockets =3D config->has_sockets ? config->sockets : 0; @@ -752,7 +752,7 @@ static void smp_parse(MachineState *ms, SMPConfiguratio= n *config, Error **errp) =20 if (config->has_dies && config->dies !=3D 0 && config->dies !=3D 1) { error_setg(errp, "dies not supported by this machine's CPU topolog= y"); - return; + return true; } =20 /* compute missing values, prefer sockets over cores over threads */ @@ -778,14 +778,14 @@ static void smp_parse(MachineState *ms, SMPConfigurat= ion *config, Error **errp) "sockets (%u) * cores (%u) * threads (%u) < " "smp_cpus (%u)", sockets, cores, threads, cpus); - return; + return true; } =20 ms->smp.max_cpus =3D config->has_maxcpus ? config->maxcpus : cpus; =20 if (ms->smp.max_cpus < cpus) { error_setg(errp, "maxcpus must be equal to or greater than smp"); - return; + return true; } =20 if (sockets * cores * threads !=3D ms->smp.max_cpus) { @@ -794,13 +794,15 @@ static void smp_parse(MachineState *ms, SMPConfigurat= ion *config, Error **errp) "!=3D maxcpus (%u)", sockets, cores, threads, ms->smp.max_cpus); - return; + return true; } =20 ms->smp.cpus =3D cpus; ms->smp.cores =3D cores; ms->smp.threads =3D threads; ms->smp.sockets =3D sockets; + + return false; } =20 static void machine_get_smp(Object *obj, Visitor *v, const char *name, diff --git a/hw/i386/pc.c b/hw/i386/pc.c index c2b9d62a358..84138a8bfd2 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -712,7 +712,7 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int l= evel) * This function is very similar to smp_parse() * in hw/core/machine.c but includes CPU die support. */ -static void pc_smp_parse(MachineState *ms, SMPConfiguration *config, Error= **errp) +static bool pc_smp_parse(MachineState *ms, SMPConfiguration *config, Error= **errp) { unsigned cpus =3D config->has_cpus ? config->cpus : 0; unsigned sockets =3D config->has_sockets ? config->sockets : 0; @@ -743,14 +743,14 @@ static void pc_smp_parse(MachineState *ms, SMPConfigu= ration *config, Error **err "sockets (%u) * dies (%u) * cores (%u) * threads (%u) <= " "smp_cpus (%u)", sockets, dies, cores, threads, cpus); - return; + return true; } =20 ms->smp.max_cpus =3D config->has_maxcpus ? config->maxcpus : cpus; =20 if (ms->smp.max_cpus < cpus) { error_setg(errp, "maxcpus must be equal to or greater than smp"); - return; + return true; } =20 if (sockets * dies * cores * threads !=3D ms->smp.max_cpus) { @@ -759,7 +759,7 @@ static void pc_smp_parse(MachineState *ms, SMPConfigura= tion *config, Error **err "!=3D maxcpus (%u)", sockets, dies, cores, threads, ms->smp.max_cpus); - return; + return true; } =20 ms->smp.cpus =3D cpus; @@ -767,6 +767,8 @@ static void pc_smp_parse(MachineState *ms, SMPConfigura= tion *config, Error **err ms->smp.threads =3D threads; ms->smp.sockets =3D sockets; ms->smp.dies =3D dies; + + return false; } =20 static --=20 2.31.1 From nobody Sun May 19 20:47:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1628853988; cv=none; d=zohomail.com; s=zohoarc; b=i1Cbj+W6qwjE2XsYDs1E9aYXp7Mw+Vm1ViFoTPfrZJ2BuKt2Rnknf1sCOoGgfZgRBuBGwR3/t3XvjYatWWbBHG6Se1CicXsmfLesyCZ/Q8wdSoH278CTRwmKQ8UJQmB5D6N+be7MFT9IEvwhpwm45Vqlw1cV00Y1Ttnuu6/yldg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628853988; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=wfQAzrKxjRuJBWe/tqbh1NmyCNL6bF3yTkYktgk4knk=; b=K6bynJ9GiBHUriiINKUpsSKqOxSthyrKmwq8b6b+8dccOFbcUFFhibQxA8djVjBUgvOI6IZ6EUTIgl/4lQR890hB8Q863Jz1KZDL+5Oj/b5udf0Yfr1uFIaT+dQgP5hUW7Me2bt/AbqkCi+G7ZkU2jHo58/ZjWDjuodTu0KaLew= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1628853987951918.3759492031623; Fri, 13 Aug 2021 04:26:27 -0700 (PDT) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-184-HdMdXQ5mPTuu3QiBlsGGiA-1; Fri, 13 Aug 2021 07:26:25 -0400 Received: by mail-wm1-f71.google.com with SMTP id w25-20020a1cf6190000b0290252505ddd56so2598376wmc.3 for ; Fri, 13 Aug 2021 04:26:25 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (163.red-83-52-55.dynamicip.rima-tde.net. [83.52.55.163]) by smtp.gmail.com with ESMTPSA id q75sm1254983wme.40.2021.08.13.04.26.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Aug 2021 04:26:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628853986; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wfQAzrKxjRuJBWe/tqbh1NmyCNL6bF3yTkYktgk4knk=; b=cbgm7L69zPIQVq+fP/+WVQFCi/u1d9zR4gWMgY8PIv7BuhX8HZVXecOo89y7Og+elBYpuD gRXh/xtiMspahwqTPNv1fokQGn77FCbx6PepK3jdoFHMdA65BRo6I1gPLJSBuLr09HKNt6 M4MuT3jNDsPuO7piTondsLgjG05JXWY= X-MC-Unique: HdMdXQ5mPTuu3QiBlsGGiA-1 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=wfQAzrKxjRuJBWe/tqbh1NmyCNL6bF3yTkYktgk4knk=; b=V+hUZBuXwlVJ8bH3goyXEFr+/3lrUJ6FpTwYSgGgWzYprUYolkPb8Tid8JROxrIZAG HaVYyBhNSLXJpFxhIlEEB53hDMzkc8sibbNbFHoyFpMNzjDy/130SLdTt4wrRYU5fbPB C0hQYvoUqmDsGnONOvHZe5FumsJuix8mk/dIJPTxauMDzsBgX4FHi84azMFpb7AmvBK5 KA+oyurVaeHA+hXVIsJ+hbWS5avjm3EN55cMjz9rLHw9ht7L/GERB6MUyPoFtcY0oj1I m5yjmQ2LU3GfovgxYYcN85vtjMXUBJYwCUwvRrQaVGU0ul7picn9Q32Hf3XDPsiR8eoh fFmA== X-Gm-Message-State: AOAM532FQElypI7pGGJtUJQfSJGl1fnf3FyUce02FgvYC//XVCPjDLyf Hoppkpkg1Qwrt3jGHJOuOplgtUAXIfheOABOHiITES/G5fH1lhG1ojQNeFA+TnW8uzMQjyvDleE GS21DJU8AIKX4uA== X-Received: by 2002:adf:cd04:: with SMTP id w4mr1976922wrm.119.1628853984406; Fri, 13 Aug 2021 04:26:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAFnQOwbTdw+3Y1TWppFVvARxX7xWxjwZWDH3bVaNn30JkwTxQIhgOdnlCFeCruw/Q/2Df6Q== X-Received: by 2002:adf:cd04:: with SMTP id w4mr1976908wrm.119.1628853984270; Fri, 13 Aug 2021 04:26:24 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Marcel Apfelbaum , Eduardo Habkost , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-6.1? v2 3/3] hw/core: fix error checkig in smp_parse Date: Fri, 13 Aug 2021 13:26:08 +0200 Message-Id: <20210813112608.1452541-4-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210813112608.1452541-1-philmd@redhat.com> References: <20210813112608.1452541-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628853989311100001 From: Daniel P. Berrang=C3=A9 The machine_set_smp() mistakenly checks 'errp' not '*errp', and so thinks there is an error every single time it runs. This causes it to jump to the end of the method, skipping the max CPUs checks. The caller meanwhile sees no error and so carries on execution. The result of all this is: $ qemu-system-x86_64 -smp -1 qemu-system-x86_64: GLib: ../glib/gmem.c:142: failed to allocate 481036337= 048 bytes instead of $ qemu-system-x86_64 -smp -1 qemu-system-x86_64: Invalid SMP CPUs -1. The max CPUs supported by machine= 'pc-i440fx-6.1' is 255 This is a regression from commit fe68090e8fbd6e831aaf3fc3bb0459c5cccf14cf Author: Paolo Bonzini Date: Thu May 13 09:03:48 2021 -0400 machine: add smp compound property Closes: https://gitlab.com/qemu-project/qemu/-/issues/524 Signed-off-by: Daniel P. Berrang=C3=A9 Message-Id: <20210812175353.4128471-1-berrange@redhat.com> [PMD: Check MachineClass::smp_parse() returned value] Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/machine.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 159c6b098e2..29edf655140 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -834,8 +834,7 @@ static void machine_set_smp(Object *obj, Visitor *v, co= nst char *name, return; } =20 - mc->smp_parse(ms, config, errp); - if (errp) { + if (mc->smp_parse(ms, config, errp)) { goto out_free; } =20 --=20 2.31.1