From patchwork Mon Oct 9 09:47:41 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: 730972 Delivered-To: patch@linaro.org Received: by 2002:a5d:574c:0:b0:31d:da82:a3b4 with SMTP id q12csp1116211wrw; Mon, 9 Oct 2023 02:51:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvC1apzr3DtYNuiQpoSurY7GeFB5IcJda3mLINez4IBWKeVc6/eFERohD+QC3tpEGKMc9B X-Received: by 2002:a0c:f34a:0:b0:66a:f6ee:26ac with SMTP id e10-20020a0cf34a000000b0066af6ee26acmr7347931qvm.2.1696845064184; Mon, 09 Oct 2023 02:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696845064; cv=none; d=google.com; s=arc-20160816; b=CV5U9UWXlQ1VfpBqMHmrxmFo4YCl6t//hvwjB6aV5Cjk4d5d19pkdZQ9iTbzJ+lLor J6TnWRX0vtnd9/Wdm3kb6cNtfB4bKjlWQCLxRluJ0jw2VthmzSxdplOs5KIptmz5Rzeg tDogWCn+Fj4W4WvVb0KS2QZyJW+3q4Zwe6laW4doL9RqnZx72gEf7j37NY82uQtAl82C o3RqvfHAmmmz9ylyVB07eXH2XIzs40fM1lDckkhyhmadhwYjEiYQRYWK2VtSXYb5ZNwN hKcDD+w676d/KKMsFDLGtMvnpeTsDcyqdBiY0TbZnPQHtPnuU7yhzfix3UUFbDdSCKqI NdjA== 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=vq0Txo18oKNgqgLa0NbVIIUbcU1WzhTxJcpN9pagyhs=; fh=n4SzPhYKXn8xRxTgdSQ5YZq0XW28GvXJqV224ul7a6o=; b=qxwDcKByByRU9Wgah5fhXUQHks263iq0OcLIEBqrR9IpetZIgkDDVUi/8xgs8jhI1d DgNbz9C3ZZbYe8V2VSBdnrY0U+G0leIsyJID/ZeTLk2lU2kJDzOZYKbVhF9c/PT4xHGi 9unVYyZ3QdPcJAWCqRqYcQQZQzctKZjNDssTyM/SspFdFzItK+tRinXE+Lfzy6EVvnH9 R0A1SzzSdEPJzTY03bYnwOgYedkfRaPk0hd/jccd/l5jaVVSARZdDSinJPcz4CbaCJGi MPJGtRtMmLeuLr7mkwfCnUAT85bK1GY+y39mp/ynwVFdWxjKSjK49PXtbYdEWcYMhBk1 IxOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xIhzdOZ7; 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 qc2-20020a05620a654200b0076db2a74a65si5696458qkn.174.2023.10.09.02.51.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Oct 2023 02:51:04 -0700 (PDT) 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=xIhzdOZ7; 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 1qpmsF-0001ui-CV; Mon, 09 Oct 2023 05:48:34 -0400 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 1qpmro-0001T6-Gn for qemu-devel@nongnu.org; Mon, 09 Oct 2023 05:48:03 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qpmrm-0005wb-Kx for qemu-devel@nongnu.org; Mon, 09 Oct 2023 05:48:00 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-9ba081173a3so360539666b.1 for ; Mon, 09 Oct 2023 02:47:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696844877; x=1697449677; 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=vq0Txo18oKNgqgLa0NbVIIUbcU1WzhTxJcpN9pagyhs=; b=xIhzdOZ7cG7ZkZ1Po3OLADTikCBdSXQOS3cwnmJLv0eYQ8c4uXO0nWcAWrv0KuPUvV tg9WoSHZ2fTcHhXrpuhKg/41BUVm/gZHvpux9Uk7sklk+9sNFpHSvDlp5wzy/WcH1M40 8fRPhP2G827i8tZfgvmPkWlXoDN48QHl1OGlAVl1ujFCyKB2eDHBJYcKy3HHciKX+ucE ijNs37drjC4mS0SPLntqT8rcrzES8AQluSNwGkG3bGyGYTMpuhlwNareouvl0GCrRtqb qqhpGist/NwqbuOC5uHvYU7NJD4Yx4AtaeyyG6tmvk6QbvWcEdUy8n2+lHUsomAYr7Qy l6dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696844877; x=1697449677; 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=vq0Txo18oKNgqgLa0NbVIIUbcU1WzhTxJcpN9pagyhs=; b=HLY3BDwIMtB3t32Irp2e6H1T60DHU7h07euD7oSIxpPC87nmQrzytGbGFDgDSf5wik o0So4afsgO2RS6wTZMMKCdomNLK0kem/BgzCdFG/LWA8r03FHMPhicCUlpwXj1Awx93V yJ7TQx4SsnTyvBv5RwhuohDMIjnqdjpmFqJnEFVdlmMjeFc6CAMpxE9fv07hn6JZfiQv kt5xcsqRgiGIjCbLsCGDasjWiqIT7vvGNjgsJswK9tXCEptN8O10W5Vi422stmaZbfMa KEIs+fylEOKGQldxVFLgpzxmprExVxPfX8Tq4lswelf+Cgo4kcfLaD/VUmhq8lrcqIPA iSKQ== X-Gm-Message-State: AOJu0YwzfnxHayece5lPW+46N0ZIG3mx1nu4BtygXpbl1pYeERLtrgAl OihzRdXT0gI6FQ4+m3L1Kste2ViAGVwd27lMWKM= X-Received: by 2002:a17:906:1ba1:b0:9ba:2fe3:c97e with SMTP id r1-20020a1709061ba100b009ba2fe3c97emr377767ejg.11.1696844876878; Mon, 09 Oct 2023 02:47:56 -0700 (PDT) Received: from m1x-phil.lan (thr44-h01-176-170-217-185.dsl.sta.abo.bbox.fr. [176.170.217.185]) by smtp.gmail.com with ESMTPSA id l7-20020a170906414700b009ae69c303aasm6506561ejk.137.2023.10.09.02.47.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Oct 2023 02:47:56 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Christian Borntraeger , qemu-s390x@nongnu.org, Paolo Bonzini , Ani Sinha , "Michael S. Tsirkin" , Igor Mammedov , Yanan Wang , David Hildenbrand , Eric Farman , Richard Henderson , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Marcel Apfelbaum , Thomas Huth , Halil Pasic , Gerd Hoffmann , Ilya Leoshkevich Subject: [PATCH 1/6] hw/core/cpu: Clean up global variable shadowing Date: Mon, 9 Oct 2023 11:47:41 +0200 Message-ID: <20231009094747.54240-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231009094747.54240-1-philmd@linaro.org> References: <20231009094747.54240-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=philmd@linaro.org; helo=mail-ej1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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.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é --- include/hw/core/cpu.h | 8 ++++---- cpu-common.c | 6 +++--- target/s390x/cpu_models.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index e02bc5980f..d0dc0a1698 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/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/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 98f14c09c2..b1e77b3a2b 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -756,7 +756,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;