From patchwork Tue Oct 10 11:50:43 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: 731450 Delivered-To: patch@linaro.org Received: by 2002:a5d:574c:0:b0:31d:da82:a3b4 with SMTP id q12csp1701271wrw; Tue, 10 Oct 2023 04:51:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH32vfTQ54woO5Xop8ufZNieIP9fodJpAqlwkRGpgyuK6hFIG5+Tlq97+a2ZtFsRaxLEhGQ X-Received: by 2002:a05:6102:3c7:b0:44d:4b34:af92 with SMTP id n7-20020a05610203c700b0044d4b34af92mr15581693vsq.7.1696938677023; Tue, 10 Oct 2023 04:51:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696938677; cv=none; d=google.com; s=arc-20160816; b=iJ+YxQqz8xrV1qyCc/OsLUMvr1WfysbK0BiHanogkV0pQAYWySVepUXFgFIvPWAbIj xJzmIwDBBlJQXtIdPmXrRdYokwSgBlOnTi3WB9suCRt7qDpZRs8bRwyiiX4lWx7vlBND 2LtNJHxfIoiF27zk7BIYXdhdTEV8PixWvn8wVzw+y3O16f35TGiBqPJUieg3LcVBtWfz JWi4Bg2l8cC2k4jxgATP9vNn1lbi7Rfpi84DcNFbIkdJoUWVdBNCKBrhaUMgzMt2e11e Q03hB2sxZMcvBmQG3ANs7f5Aqwd4Rw83OXFpujrgPXYoTrrI+Rq5qWKEKb64S2jENgOj WlPQ== 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=06c1SfXCDJsZD94qIZFbVOXNxhn2+zM3SMxozUzqBSg=; b=styTjydq19JSUqP92unLWU+G7qwRdjnl+/ZQ+gj8jPnJeB5UhYMjUewWyRwinYv6WH 7HHAf0Em75DeHYOw6AFrwyUf+isvwZG9Cyd+Y4IOSXGorcWKyuxNq5lmZ0ZHj6EL5qOl ByOK7kZDCPP+aB6cRU6lNbR6YbW1KS/EpmbM/dYJOsaw5qwV2HU2igv0zmeJIzK/EcKg lV0ZK5DTzpLM0kGl8J0Cp/qoSZemeNo3BCHK87iFcSOLKaEF7k7GzQIpt6JRZM5emKEb eIeLZaB59ZU/XQ5gciUdwTBhjdM1zaONMCdI1mAQV76KUSZ11RcmjldI5tz1F20HDbKX jZzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PTN8CrEg; 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 qk16-20020a05620a889000b00775cf5ea68fsi7253297qkn.65.2023.10.10.04.51.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Oct 2023 04:51:17 -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=PTN8CrEg; 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 1qqBGS-0007d6-N4; Tue, 10 Oct 2023 07:51:04 -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 1qqBGQ-0007cJ-SJ for qemu-devel@nongnu.org; Tue, 10 Oct 2023 07:51:02 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qqBGP-0006zb-6Z for qemu-devel@nongnu.org; Tue, 10 Oct 2023 07:51:02 -0400 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-9b29186e20aso946382466b.2 for ; Tue, 10 Oct 2023 04:51:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696938658; x=1697543458; 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=PTN8CrEgNmZbn0FxKhcLr8Og2Rz6umyv/CdW2JLE6ksbqTH8qU3L2Is4lJACUq2e64 HXo2sX18nnzZg7a7qV07ZLaRZL0BJc4a8eNUzJS3Y9Bzs28G7UC0VK5Q96QSwRwdoDjZ Hio6x8t09M8AgBuyTBuNqdKLT76vs2VdD+1K4r5qGLJi4vZQ6E2Y6Msfx7pNBA3G5v9H ZzqbmXXgM1HLu0So9duhiSo2jtpm6ISYNJ3tWbW6naFCPBUDhkEn24okQFoi1QlasPQG T92s82c1dEL5cKK6hEq0xLJTMqq3IMlYk2INHOUK/s29v/7dNRWkXORL6ksYuxu//n4l wvAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696938658; x=1697543458; 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=oG3P//0Srb9AEnw+y/mYPAOS/IeZuHu50hBZKF3AVK6jm/lJ6PTUNPSD/9KmhCc5Xy VJK+W25aHgkOqycZ9d48VQOjNxS6o4P9IjgfFyUjhbg1qWFzn24Rtvv6Z9tbb1F139IU VeEX+EgeMiNwul2ob/GROpGh7ufqro48RFFCiPkgGgmgJUyNOt0tHQ6LgiQmYZrym0Vt o9lDJXATLzkQbm4qzZyCaop531NzVqEyox/jYfHujBpCcYxpKkPadGMMQsiLT1GoWVdT xxXFFlW6TM4QCf856SZbHaXU72zAH9X/6OL72dtI2yO6qp+tqY2I1GxVJEYn9Hxk8F3e it2w== X-Gm-Message-State: AOJu0YyOtVUITu73c+1+TTbhNJZTMfSY+AbYi/nCwTCrX5EclXec6XIK auX8kBtSO/S97lfsm+DbWBRQGIaLF5GmlUY9lEJLLA== X-Received: by 2002:a17:906:738f:b0:9ba:14a3:7221 with SMTP id f15-20020a170906738f00b009ba14a37221mr5684027ejl.73.1696938658458; Tue, 10 Oct 2023 04:50:58 -0700 (PDT) Received: from m1x-phil.lan (aif79-h01-176-172-113-148.dsl.sta.abo.bbox.fr. [176.172.113.148]) by smtp.gmail.com with ESMTPSA id i13-20020a056402054d00b005231e3d89efsm7543598edx.31.2023.10.10.04.50.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 10 Oct 2023 04:50:58 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Markus Armbruster , Igor Mammedov , Richard Henderson , Ilya Leoshkevich , Gerd Hoffmann , Halil Pasic , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , "Michael S. Tsirkin" , Yanan Wang , Eduardo Habkost , Eric Farman , qemu-s390x@nongnu.org, Christian Borntraeger , Thomas Huth , Ani Sinha , David Hildenbrand Subject: [PATCH v2 1/6] hw/core/cpu: Clean up global variable shadowing Date: Tue, 10 Oct 2023 13:50:43 +0200 Message-ID: <20231010115048.11856-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231010115048.11856-1-philmd@linaro.org> References: <20231010115048.11856-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=philmd@linaro.org; helo=mail-ej1-x635.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é Reviewed-by: Ani Sinha --- 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;