From patchwork Mon Nov 6 11:03:01 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: 741380 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1037569wrr; Mon, 6 Nov 2023 03:45:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IGVBWNEI5Lsjfjt2lquAybRg9bvTiXXPoyBcl8jTuVlAUT80i2DgQF+N94Lvz48W7rXsey6 X-Received: by 2002:a05:620a:2446:b0:778:e431:3ef1 with SMTP id h6-20020a05620a244600b00778e4313ef1mr13176287qkn.32.1699271148362; Mon, 06 Nov 2023 03:45:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699271148; cv=none; d=google.com; s=arc-20160816; b=nFnRu3jH/tWFM8iJMtV9NoYIPqC0Sx9Lu5HUD1nwTwUVkpdX6RFCEDvAgjUGMzavsc yrgyhk2WwD9i8nvvCKKN1QZzFw76rZT9BhWigu6mzCqascv7WNejg2H5OD/OA/h1o13B NVfypWbaciQBUBRjNXYQXqCQkO5tdY1MPcG3+to8w7gPnZnNXm+DBjh7L1DFeQUayEV4 ZZUsEcl//5CbonqK/AcJxcvD6VuMkVqnuZ5BvASzUUmPkhzNDGWLaRFEePMptZhwyy5P yabpw61Zre1KC11T+HlBAsRJ1mSakeINLYuBZ4twqVSpFQI9Fe0eeXdeQxBzQDmYZjxx GRPA== 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=W+HrE2ba95t1ooYtGszc36ebWNEUF8WT6p6gpPtPmuY=; fh=u2yVCK9cQSeTYJlnjxvfEJjFMQIf6oB8a58h6nNnrSY=; b=u8IR/9Tf84F0RiAgi6WfImK88aUMSCosj1MpJ+7Fd0HqCSqQeHgNwNIEEWZMR3LFWn sFFZBqgHmPUvm4D7XkMi/e63ehTsthpDY0REeDtzvOO/EtDFx5EqXBul/tEKBSz5Vjj6 QgLG264fnBo4W3+aNYRlH+Qma1jF6Fkl3zCgIraNyL3ddN6j9GflctZoCA3++bICuLKj ACWFdr7BnxoEGO828FNDBWSytYeRPypDLu44ZW4PYoU0HR8qinSTkaC9prn3cNhyjw1o g7ci8KeO6wVDqJPUrPGyL2sX6td9dENYlMuWanme6YH/hkcZRDfMPfvQcFXOsvOEOPB9 gdJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fzyOWbWY; 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 w15-20020a05620a444f00b0077a1c623987si5764311qkp.293.2023.11.06.03.45.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 03:45:48 -0800 (PST) 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=fzyOWbWY; 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 1qzxRx-0003qi-12; Mon, 06 Nov 2023 06:07:21 -0500 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 1qzxRk-00031x-7y for qemu-devel@nongnu.org; Mon, 06 Nov 2023 06:07:08 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qzxRc-0004Yx-PW for qemu-devel@nongnu.org; Mon, 06 Nov 2023 06:07:07 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4081ccf69dcso31182525e9.0 for ; Mon, 06 Nov 2023 03:07:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699268819; x=1699873619; 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=W+HrE2ba95t1ooYtGszc36ebWNEUF8WT6p6gpPtPmuY=; b=fzyOWbWY4jWCN7g0/rvVI8g/5Bdjd6C5sfGtpBo/b4HDMBPNSbN+I0q3U5SmnDKOFm RSfHuPhVQ9qSx8MSx95bl+TmJxflc6R3FBPfFrorOvuFrSvicXZZyUpqqPPzl8+wSJ47 LSS9+0YSDoBP+F01JqXyjat5RH4mttoGI7v1mL0cTamr5ZulXm8ImneBoyyC/Tsywgam EBFVVneKcbLCwgUxYSevWFrGQCMT4prfZUTTSBFoPeGAueCw866Uc0L4M/PstYnNWhl6 ft3Jai5zmbtvGtiOFIbWAuS1MLpe0NapWdeMyjaBmVbwUdQ+2wETErOhwqtmF49RFCTW pLow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699268819; x=1699873619; 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=W+HrE2ba95t1ooYtGszc36ebWNEUF8WT6p6gpPtPmuY=; b=gqyvcGL8J8kV1dTQQPI1IQgNBEHamba18zjvC2CzqOYzWe60v6WlDMZBpOInD9Huhf jt3tS1hu0QX+ItcfTVsrenwPb+OhQHgbxa/PIT+LOP7m6uOJyKcbAlL7th/LlLRfc/S3 dmR2xTH8ReQOAW40aq2qSE/nrMhQmehf6bvfwemnBBUXkEth2r9eU57pSKAQpHAME8t7 Ak4IPqp1bD8HPJUNjPmMLKoLJleTuGHUmnz6qUcfEbP3oPhSRQSFcsbS3BEKGqPhFMLs KgGgjOqMh/xGJaUoUbSK2JzH1zP+e00QAaYftdeeMNlGQzN30I2Ut8ez1WfBTHzuFiTW F3Tw== X-Gm-Message-State: AOJu0YwYj+QS7dHopS5/eEZoUPWVOWrP9W/OET5mh13uyPNy08FzDKAK +CjVBkUna0innGusPE0k7n12ZqUmxkLvw5A8Lus= X-Received: by 2002:a05:6000:12ca:b0:32f:76a0:a99b with SMTP id l10-20020a05600012ca00b0032f76a0a99bmr8610843wrx.19.1699268819099; Mon, 06 Nov 2023 03:06:59 -0800 (PST) Received: from m1x-phil.lan (176-131-220-199.abo.bbox.fr. [176.131.220.199]) by smtp.gmail.com with ESMTPSA id f4-20020a5d6644000000b0032da49e18fasm9178802wrw.23.2023.11.06.03.06.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 06 Nov 2023 03:06:58 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, qemu-s390x@nongnu.org, qemu-block@nongnu.org, qemu-riscv@nongnu.org, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Dongli Zhang , Joe Jin , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , David Woodhouse , Juan Quintela , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 29/60] target/i386/monitor: synchronize cpu state for lapic info Date: Mon, 6 Nov 2023 12:03:01 +0100 Message-ID: <20231106110336.358-30-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231106110336.358-1-philmd@linaro.org> References: <20231106110336.358-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 From: Dongli Zhang While the default "info lapic" always synchronizes cpu state ... mon_get_cpu() -> mon_get_cpu_sync(mon, true) -> cpu_synchronize_state(cpu) -> ioctl KVM_GET_LAPIC (taking KVM as example) ... the cpu state is not synchronized when the apic-id is available as argument. The cpu state should be synchronized when apic-id is available. Otherwise the "info lapic " always returns stale data. Reference: https://lore.kernel.org/all/20211028155457.967291-19-berrange@redhat.com/ Cc: Joe Jin Signed-off-by: Dongli Zhang Reviewed-by: Daniel P. Berrangé Reviewed-by: David Woodhouse Message-ID: <20231030085336.2681386-1-armbru@redhat.com> Reviewed-by: Juan Quintela Message-ID: <20231026211938.162815-1-dongli.zhang@oracle.com> Signed-off-by: Philippe Mathieu-Daudé --- target/i386/monitor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 6512846327..950ff9ccbc 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -28,6 +28,7 @@ #include "monitor/hmp-target.h" #include "monitor/hmp.h" #include "qapi/qmp/qdict.h" +#include "sysemu/hw_accel.h" #include "sysemu/kvm.h" #include "qapi/error.h" #include "qapi/qapi-commands-misc-target.h" @@ -654,7 +655,11 @@ 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); + if (cs) { + cpu_synchronize_state(cs); + } } else { cs = mon_get_cpu(mon); }