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: 13437686 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB5FEC25B67 for ; Thu, 26 Oct 2023 15:40:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345469AbjJZPkF (ORCPT ); Thu, 26 Oct 2023 11:40:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235079AbjJZPkE (ORCPT ); Thu, 26 Oct 2023 11:40:04 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A90B1AA for ; Thu, 26 Oct 2023 08:40:01 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.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); }