From patchwork Tue Nov 7 12:24:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 741872 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1587977wrr; Tue, 7 Nov 2023 04:28:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2Ahi6DBlfx3d06vXWXtnaGGNToT3kmqv2kNPLzWjtCxPTLnJ/JlZOaeYfUoY9QxN9qSX3 X-Received: by 2002:a05:620a:63c7:b0:76d:89c5:78a0 with SMTP id pw7-20020a05620a63c700b0076d89c578a0mr34458567qkn.63.1699360098089; Tue, 07 Nov 2023 04:28:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699360098; cv=none; d=google.com; s=arc-20160816; b=lgcPpx3RobB9FMtrgn2Xpu83/USHg58OIlfKI9angBshi9zDd1UmFgHnPxpPyq3p2J QpgsM0T3SEVcV6cZM3jaD0hRzD7uETrj2Esm6uR2TJUSy0Tq+/CDNKTcRQ6zGBUr0CJu MfjRo6PjdbJtHA/XGkMdCboPrn+jFyDj622uUycFokJyaQrN4mXQpUEsMpG3aaFL/72B tbDduOhGV2im1s8BPzx5yS9AwlqnMod+ueAYnwZ6n79KLQS8DTfZdcqPJbXG0p624sXi CfaBS9vAo4LJHo8Qc2XNp86xPzpnLU2vXYrjclRu3OADm6erXQSEN6VQ96AAljwaEvec 4qqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ha90/Hq7XHS9/aRysWmfk7kygcTDZa2YjrZy/ilrJOc=; fh=I50AEuyrhfZZbAacjfFSv97+FKVBkRS/oZGw9AaThus=; b=qTnULDx1EC40Kl9vl6CzsustkVArBPmilGX7k790wMqh9DJXdNzdxtZg44NCxkiaeo 4wQyFCLKFT2PRpM3Tou7zqbUazjDPjfZMtx4UrghnLbRbYT1788YID2rlkXUI1Q0jTiF iVXCxC9yKN26jnEJBeqRP/2tIQ/QFmKATdCB/vL/4JUZhSC3oHiX/KA31ZpEME0/GfXK EOdGKqBc3TiKuiT/crQxL+m04AYuZhEAvrNB63gg0CG+5surLm5exMDZNzMziFso5CPe 9FCb4M1IsWVOw2yD3U0bNVWDm4YokH8Tphk3hF+ZgJ7ixnxRSh8nlPE9tQ3Ki6JDnWE6 Qocg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uDhY9spH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w18-20020a05620a0e9200b007757464e7c7si6696858qkm.633.2023.11.07.04.28.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Nov 2023 04:28:18 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uDhY9spH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0LAO-0007fJ-NV; Tue, 07 Nov 2023 07:26:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r0L9k-0006It-2a for qemu-devel@nongnu.org; Tue, 07 Nov 2023 07:26:11 -0500 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0L9h-0005EF-4P for qemu-devel@nongnu.org; Tue, 07 Nov 2023 07:26:07 -0500 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-9dd3f4a0f5aso607178166b.1 for ; Tue, 07 Nov 2023 04:26:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699359960; x=1699964760; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ha90/Hq7XHS9/aRysWmfk7kygcTDZa2YjrZy/ilrJOc=; b=uDhY9spH/6Ai8iwOvLh4uZ2XM8p1UnqFJtJ43ozut29LJJMrAO/EB4fQ0vKt64B4+b IgJ+n5gCJoYGp6tpyh+EqonU/udVQrxnG2cbuOidbLaGkIWm3S5Kp6dHuEUiBERQaPHX lJYjbaSo5C4G4rD1BOReL6QQWwzpdF0LfOPkQevRaje/cPndYGz7k/79i5xhCzrik4Ko mGq31brLTWsqpIQ6F7oLjz8muJUNqiGAfJnBKeeZdTmdxLIfssdomQAwwtkhYO/3Qy8D T+QKtRSPtvfjXjt0bR4aRx0YBuokBYN3sG5u8qnZe01K9L+QHBCOTeiFVUWhZk2paSsz IJcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699359960; x=1699964760; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ha90/Hq7XHS9/aRysWmfk7kygcTDZa2YjrZy/ilrJOc=; b=lsOhv/ng0cb0TPH5X0at+eZMWqzMpt5mEhiXHfHqaJtz3rCGYpCKCJzqokRVGgcFkV 7pSvsbJ/+mGwyMv9ILiyk/vtvhfftTUDxtEAgQG1BaXI475CLvqZCnRW4eYiWkgSNBFb y7NRxvn9oz7olXJOgZSRv61FDuPhJIEqPBaiFddhFZCyPge+rNKA/Y6pG+Fey+6/fcnl c8RicklsKpdRsJXQNFwldEqfg8LJkk1UEqvmQE8hpLEL8hhladXOo/pvdZLAgJ8G+/9s S5x5xth1xo8XcpHzVlIXJDQkwd/TqZo8Dnqe9r/JeZnSMo1LY+42qWj523JFuBpbdnNb TtgQ== X-Gm-Message-State: AOJu0YyIP9RcqNj9ySCqwTofiNKuYGeYxMf03eowpaQPJSTWw3YXIZFY nLwvo9dyZ97a6zkjwiVeZR33YuvjPRN4I15PoGc= X-Received: by 2002:a17:907:9603:b0:9d3:f436:6807 with SMTP id gb3-20020a170907960300b009d3f4366807mr17965607ejc.42.1699359960111; Tue, 07 Nov 2023 04:26:00 -0800 (PST) Received: from m1x-phil.lan ([176.187.216.69]) by smtp.gmail.com with ESMTPSA id g7-20020a1709064e4700b0099d798a6bb5sm981057ejw.67.2023.11.07.04.25.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 07 Nov 2023 04:25:59 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-block@nongnu.org, qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Da?= =?utf-8?q?ud=C3=A9?= , Ani Sinha , Warner Losh , Kyle Evans , Richard Henderson , Paolo Bonzini , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang , Laurent Vivier , David Hildenbrand , Ilya Leoshkevich , Thomas Huth Subject: [PULL 51/75] hw/cpu: Clean up global variable shadowing Date: Tue, 7 Nov 2023 13:24:37 +0100 Message-ID: <20231107122442.58674-13-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231107122442.58674-1-philmd@linaro.org> References: <20231107122442.58674-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=philmd@linaro.org; helo=mail-ej1-x636.google.com X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Fix: hw/core/machine.c:1302:22: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] const CPUArchId *cpus = possible_cpus->cpus; ^ hw/core/numa.c:69:17: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] uint16List *cpus = NULL; ^ hw/acpi/aml-build.c:2005:20: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] CPUArchIdList *cpus = ms->possible_cpus; ^ hw/core/machine-smp.c:77:14: error: declaration shadows a variable in the global scope [-Werror,-Wshadow] unsigned cpus = config->has_cpus ? config->cpus : 0; ^ include/hw/core/cpu.h:589:17: note: previous declaration is here extern CPUTailQ cpus; ^ Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Ani Sinha Message-Id: <20231010115048.11856-2-philmd@linaro.org> --- include/hw/core/cpu.h | 8 ++++---- bsd-user/main.c | 2 +- cpu-common.c | 6 +++--- linux-user/main.c | 2 +- target/s390x/cpu_models.c | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index eb943efb8f..77893d7b81 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -586,13 +586,13 @@ static inline CPUArchState *cpu_env(CPUState *cpu) } typedef QTAILQ_HEAD(CPUTailQ, CPUState) CPUTailQ; -extern CPUTailQ cpus; +extern CPUTailQ cpus_queue; -#define first_cpu QTAILQ_FIRST_RCU(&cpus) +#define first_cpu QTAILQ_FIRST_RCU(&cpus_queue) #define CPU_NEXT(cpu) QTAILQ_NEXT_RCU(cpu, node) -#define CPU_FOREACH(cpu) QTAILQ_FOREACH_RCU(cpu, &cpus, node) +#define CPU_FOREACH(cpu) QTAILQ_FOREACH_RCU(cpu, &cpus_queue, node) #define CPU_FOREACH_SAFE(cpu, next_cpu) \ - QTAILQ_FOREACH_SAFE_RCU(cpu, &cpus, node, next_cpu) + QTAILQ_FOREACH_SAFE_RCU(cpu, &cpus_queue, node, next_cpu) extern __thread CPUState *current_cpu; diff --git a/bsd-user/main.c b/bsd-user/main.c index c402fadf46..e6014f517e 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -118,7 +118,7 @@ void fork_end(int child) */ CPU_FOREACH_SAFE(cpu, next_cpu) { if (cpu != thread_cpu) { - QTAILQ_REMOVE_RCU(&cpus, cpu, node); + QTAILQ_REMOVE_RCU(&cpus_queue, cpu, node); } } mmap_fork_end(child); diff --git a/cpu-common.c b/cpu-common.c index 45c745ecf6..c81fd72d16 100644 --- a/cpu-common.c +++ b/cpu-common.c @@ -73,7 +73,7 @@ static int cpu_get_free_index(void) return max_cpu_index; } -CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus); +CPUTailQ cpus_queue = QTAILQ_HEAD_INITIALIZER(cpus_queue); static unsigned int cpu_list_generation_id; unsigned int cpu_list_generation_id_get(void) @@ -90,7 +90,7 @@ void cpu_list_add(CPUState *cpu) } else { assert(!cpu_index_auto_assigned); } - QTAILQ_INSERT_TAIL_RCU(&cpus, cpu, node); + QTAILQ_INSERT_TAIL_RCU(&cpus_queue, cpu, node); cpu_list_generation_id++; } @@ -102,7 +102,7 @@ void cpu_list_remove(CPUState *cpu) return; } - QTAILQ_REMOVE_RCU(&cpus, cpu, node); + QTAILQ_REMOVE_RCU(&cpus_queue, cpu, node); cpu->cpu_index = UNASSIGNED_CPU_INDEX; cpu_list_generation_id++; } diff --git a/linux-user/main.c b/linux-user/main.c index 0c23584a96..0cdaf30d34 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -156,7 +156,7 @@ void fork_end(int child) Discard information about the parent threads. */ CPU_FOREACH_SAFE(cpu, next_cpu) { if (cpu != thread_cpu) { - QTAILQ_REMOVE_RCU(&cpus, cpu, node); + QTAILQ_REMOVE_RCU(&cpus_queue, cpu, node); } } qemu_init_cpu_list(); diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 4dead48650..5c455d00c0 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -757,7 +757,7 @@ void s390_set_qemu_cpu_model(uint16_t type, uint8_t gen, uint8_t ec_ga, const S390CPUDef *def = s390_find_cpu_def(type, gen, ec_ga, NULL); g_assert(def); - g_assert(QTAILQ_EMPTY_RCU(&cpus)); + g_assert(QTAILQ_EMPTY_RCU(&cpus_queue)); /* build the CPU model */ s390_qemu_cpu_model.def = def;