From patchwork Thu Oct 26 15:39:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Woodhouse X-Patchwork-Id: 1855864 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=fLbX5BNZ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SGVPL6gMQz202k for ; Fri, 27 Oct 2023 02:40:38 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qw2Sm-0001GB-2u; Thu, 26 Oct 2023 11:40:00 -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 1qw2Sk-0001Ft-Jc for qemu-devel@nongnu.org; Thu, 26 Oct 2023 11:39:58 -0400 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qw2Sg-0005HB-So for qemu-devel@nongnu.org; Thu, 26 Oct 2023 11:39:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=MIME-Version:Content-Type:Date:Cc:To: From:Subject:Message-ID:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:In-Reply-To:References; bh=UW56wepZGMtMASY31t+t9QjEPPwtgOzJf/u/En0rghk=; b=fLbX5BNZKq692M3i3B4aiDV6D4 4VtEaAmjhCWrWFSh1Nt5cLqrzwfVO0cEBW5OoUOjihyq/ZM54zkTo+/O3YAAxub/SKEEjWhVGhfDp bOXbTadHTx0Z5Wp0YWYE3n21iwE+NW5kJHGXJlVvUyyiJIvF0ivi90ECeAuXfCxl3ySo0iYz2LNdN 2T+tAxSa+gIFMaPAe05Eza4EZImNhvRdR3QqgG/EPRpV1A6i28m86dPixoRZTx18hvprh11CiFmLI nEC5LQQa/5NTgW+U+ZjKJw0JkMC3X7T5x/csP+0flNF9efiMumJuZjvAPMdteftMTH38JYhWjcZxP B41A94Ig==; Received: from [2001:8b0:10b:5:a059:f7a9:933a:2236] (helo=u3832b3a9db3152.ant.amazon.com) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qw2Sd-00Foa6-Ki; Thu, 26 Oct 2023 15:39:51 +0000 Message-ID: <870c998c450ba7e2bc2a72c12066f1af75e507d0.camel@infradead.org> Subject: [PATCH] target/i386/monitor: synchronize cpu before printing lapic state From: David Woodhouse To: qemu-devel Cc: Paolo Bonzini , Marcelo Tosatti , kvm , Richard Henderson , Philippe =?iso-8859-1?q?M?= =?iso-8859-1?q?athieu-Daud=E9?= , Thomas Huth Date: Thu, 26 Oct 2023 16:39:51 +0100 User-Agent: Evolution 3.44.4-0ubuntu2 MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Received-SPF: none client-ip=2001:8b0:10b:1236::1; envelope-from=BATV+1fb9ca25523a2d41ea1b+7368+infradead.org+dwmw2@casper.srs.infradead.org; helo=casper.infradead.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: David Woodhouse Where the local APIC is emulated by KVM, we need kvm_get_apic() to pull the current state into userspace before it's printed. Otherwise we get stale values. Signed-off-by: David Woodhouse --- target/i386/monitor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 6512846327..0754d699ba 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -29,6 +29,7 @@ #include "monitor/hmp.h" #include "qapi/qmp/qdict.h" #include "sysemu/kvm.h" +#include "sysemu/hw_accel.h" #include "qapi/error.h" #include "qapi/qapi-commands-misc-target.h" #include "qapi/qapi-commands-misc.h" @@ -655,6 +656,7 @@ void hmp_info_local_apic(Monitor *mon, const QDict *qdict) if (qdict_haskey(qdict, "apic-id")) { int id = qdict_get_try_int(qdict, "apic-id", 0); cs = cpu_by_arch_id(id); + cpu_synchronize_state(cs); } else { cs = mon_get_cpu(mon); }