From nobody Sun Sep 28 16:59:06 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1756273191; cv=none; d=zohomail.com; s=zohoarc; b=Ga06KNo06dVoN663GcoQz7QZ1npghsT0V9qevJnSgPDc6U3WK4AR8w5HGNWNN6kCRjGkkqe6Pz9F3wBAlYCndg3uLEdUd4BF21d0XM9GYVsERVOU2eoNDGLwZ9dGXkQWeJjsFuxVi6CM0mYKJhXWeVw/JMsYo6cso0wTk0vXB1A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756273191; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YdMhIp1+hv+APs6iwmimqvUCk8niLvWTzzjevOU/ip4=; b=F5tkiqeKHxf2hIdndmmrpsmO+XtlR44VWVjBwCzCipO6tbaKUcAoojoLxyTZTvcKa/SVq6Y1LpuCCF/pN6nYGop/K0334HiphTP7KZtUfLyC9MK+H13bdvq9oIBfknnBG4w/xleo2sfxco0hcC55huN7RyCORpYHBDd84JWa1mM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756273191213144.14483740732578; Tue, 26 Aug 2025 22:39:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ur8s0-0005MY-HE; Wed, 27 Aug 2025 01:38:52 -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 1ur8rx-0005Lq-9C for qemu-devel@nongnu.org; Wed, 27 Aug 2025 01:38:49 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ur8rs-0006kw-JU for qemu-devel@nongnu.org; Wed, 27 Aug 2025 01:38:48 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-771ff6f117aso1147080b3a.2 for ; Tue, 26 Aug 2025 22:38:43 -0700 (PDT) Received: from stoup.. ([144.6.121.55]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-770401af6b2sm12071868b3a.56.2025.08.26.22.38.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Aug 2025 22:38:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1756273120; x=1756877920; 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=YdMhIp1+hv+APs6iwmimqvUCk8niLvWTzzjevOU/ip4=; b=WavaqESygPtZ+T1M4bOuVFkSxzKC5OVC4B4c9W+ZDfMLPeJbXZNBTfXQLKTSCAzjmA 8UJpgEoxk09DZx6fWuItFwgXculqmI0Aj7NOI8vR8s4Kxfw0Vg6eGqx6VzfDzusC5Gjo o6UrlL80jC0isYMdmrR19y4aDJpoJKyZICxSZ9emQOXVD7GHgMT4QM7AoggE63qznPPF bqddggJhmUJv1BPbY1lUyPulUl3/eh+C1U8ksmmNnZPiZEEM2qftCsHQMTdAPtttJW67 OiewMPSDQ1D7f5AdUBze2ZSEw8C9VeCjVczDmXBtUjhBD2m6WS1mHRHvpG/CAYPaJcxk 7FfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756273120; x=1756877920; 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=YdMhIp1+hv+APs6iwmimqvUCk8niLvWTzzjevOU/ip4=; b=oyUJYiIMjlFlO9LOPY4sWQ0LHwXSyD91+vJZqfbPczrH7UFgK/iBh/FQWWOWbaRl2w MyXopFHs9tL+VnFdS4hiN9qRVdwICZJywE1c6kSFATH92xtVTQibdEnwGNLSSW63mWvs g8FFg43LojGzIuq9qUhG2fMDxuzkdsFnWWIorxIaLvAz2J5vH4gmqjsltWxPIneKY5fk qvYOXbQS9Z2qdtOIHc2R2vy2722r/qRopbWU1cjuIgdNX+7BXs/p7El4N3HrrFtSgf6p HaEv0B5XApEZvew/jAH4/Ey5YBEzWi4sfPAGIPCeMTPs+kFzX4UfWsTl2HKqRpZk68ab G19g== X-Gm-Message-State: AOJu0YwX7p7aN1rzvfk2/443jPM8A7xyAP/nMeK0cYwXwCYjTyu26e0S jOuXJlJ8G1T2arTcYNwDS5oExomNG9IYAKIQUvJu1aJhRHbHBqwGp+OVHvY5r8p97jeu8xkpSga 6yHpbgC8= X-Gm-Gg: ASbGncu7Ce97f1hMfzcSg0t8RhWMDk6FqY87LbdfWE8gSgeFnLZDexlCGXAlLaoBUdC uIuIGAQcmIlHyD5I6tgGZ/jnIWeZhRGfSdzVZUzJ/Ts3xYFqdknYJojYgwOhQ11pzUYFZbdEed8 D6G7/7VNMzscSnbb7qEHYO1Bg2cWylvMiFh1q12W5+EVKvDnzM4jD9fmt4HCfz52Pg6SJlba02Z +o/iRYOJChTvkDOm1ad0gC0F2+mlqR/BExgaJq4KDIUCj7HpptZ+DlEBMx6UbawIZ9PwXwnzSLz YVlUjraUTF0OAArjW/y0F28Iqzsdd04usLKuSyu8KYHL+yvzTBDW5ho4aDa6nG4P5vUZqKWyxDY QXKSOf/B4US16DbcDxUx22PK2lQ== X-Google-Smtp-Source: AGHT+IH7MUhEFcCtXhNNqHuq7YiIUPCOE4bVyQOXMM3kexrPkIf9QycSXIm4LYOUzKnbbZkHm4ggbA== X-Received: by 2002:a05:6a00:80f:b0:771:fd05:d376 with SMTP id d2e1a72fcca58-771fd05dad5mr4796989b3a.0.1756273120390; Tue, 26 Aug 2025 22:38:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Henk van der Laak Subject: [PATCH 1/2] hw/core: Dump cpu_reset in the reset.exit phase Date: Wed, 27 Aug 2025 15:38:21 +1000 Message-ID: <20250827053822.4094239-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250827053822.4094239-1-richard.henderson@linaro.org> References: <20250827053822.4094239-1-richard.henderson@linaro.org> 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::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1756273192440116600 Content-Type: text/plain; charset="utf-8" During reset.hold, the cpu is in an inconsistent state, where the leaf class has not had a chance to initialize state at all. This is visible as a SIGSEGV in "qemu-system-sparc64 -d cpu_reset". Move the dump to the exit phase, where all initialization is certain to be complete. Reported-by: Henk van der Laak Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/cpu-common.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 39e674aca2..26321be785 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -119,11 +119,6 @@ static void cpu_common_reset_hold(Object *obj, ResetTy= pe type) { CPUState *cpu =3D CPU(obj); =20 - if (qemu_loglevel_mask(CPU_LOG_RESET)) { - qemu_log("CPU Reset (CPU %d)\n", cpu->cpu_index); - log_cpu_state(cpu, cpu->cc->reset_dump_flags); - } - cpu->interrupt_request =3D 0; cpu->halted =3D cpu->start_powered_off; cpu->mem_io_pc =3D 0; @@ -137,6 +132,16 @@ static void cpu_common_reset_hold(Object *obj, ResetTy= pe type) cpu_exec_reset_hold(cpu); } =20 +static void cpu_common_reset_exit(Object *obj, ResetType type) +{ + if (qemu_loglevel_mask(CPU_LOG_RESET)) { + CPUState *cpu =3D CPU(obj); + + qemu_log("CPU Reset (CPU %d)\n", cpu->cpu_index); + log_cpu_state(cpu, cpu->cc->reset_dump_flags); + } +} + ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model) { ObjectClass *oc; @@ -380,6 +385,7 @@ static void cpu_common_class_init(ObjectClass *klass, c= onst void *data) dc->realize =3D cpu_common_realizefn; dc->unrealize =3D cpu_common_unrealizefn; rc->phases.hold =3D cpu_common_reset_hold; + rc->phases.exit =3D cpu_common_reset_exit; cpu_class_init_props(dc); /* * Reason: CPUs still need special care by board code: wiring up --=20 2.43.0