From patchwork Fri Jun 20 17:13:11 2025 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: 898342 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f54:0:b0:3a4:ee3f:8f15 with SMTP id cm20csp1453763wrb; Fri, 20 Jun 2025 10:19:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWhPzh73Tkyw1uysng+GLHGg5Ns7wJC0alChN1YuYqakCkDn9Nsi2XvQCQSsu5RLeohwPkYoA==@linaro.org X-Google-Smtp-Source: AGHT+IH7oPgV6+RAAQLXdw5SEK2w6M678ssjFjH1xdUqlOkAFUMSZpysMrhReNpVRdVNTOk9B5gh X-Received: by 2002:a05:622a:6182:b0:4a7:6839:d095 with SMTP id d75a77b69052e-4a77a1ee157mr56986121cf.3.1750439967548; Fri, 20 Jun 2025 10:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1750439967; cv=none; d=google.com; s=arc-20240605; b=VUe0TaJfW7LlwPbk3sImq41IqUIObqmrL/+yJx5z+l2T4KQKZpPpu3o1e+qssVWO9D d5cbeC15A+egkSH4j49n8AD4QGw8xXFDMvDoluW/uqmHgtc7k6Ax0JJ75BIRqShi9xqv eDMJZJXuSxHFNZ9+vUQJlZj9dGtkxb4b97XWIsKV9feiQpR3MJJHtuN570s7WZzOgM9d r9pC06eCj4Pc29mmVf7qcdUCnNGjWgIkdxtr1F3XznGAg+Cct85qGjLKVn+BUkzkKyjK s/WC7A7X7M85vT4x/R2crvpEGDgt0mehCKaL+p4iZWHVQKBeV1QT1UCtKoia/sDm8Xwz r2dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=8g3SAyDwaT1EwDV5s2zbr9B0oT21Z4aa77jAxEnb4OU=; fh=8f2AL0Su0K9UlZksY2EEcc9O+An+AQ/T/SEdbs2pdSA=; b=AvbjZui5LAO24xJmFG4TRMhf7X+sTxgDfXS7o6+A+7T1oBlpwyPYGy2NOhFP90FFDO Kh9kANN8CT2FmjAa8La4QfJKyzb+TC9Bo6MyGCXatIiyCvjTbvrPEhCVmCT3BhOr73Lb yLTu3gtES6DVuXiXb+Lsi+eOL/Ds/GDgfNWp8FqhgzDNMrarJmBZniE5erAn23vUB5lH lFMbtNw0C3Fx/89DEOA29eKHJEoS/y43DQ7Bsrrs9ihOsWzJEzvpnGVMq9wwYRIX2hzr qWRNFSplwfXCPTCGYYXi7Xj8KD0aDAtUjoPcrhlBQArvEkHQtruWkabeXDq0zzSbCP9e V5eA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="f5bNpV/+"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-4a77a0d812bsi19238081cf.541.2025.06.20.10.19.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Jun 2025 10:19:27 -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="f5bNpV/+"; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uSfLU-0002Sq-S4; Fri, 20 Jun 2025 13:16:10 -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 1uSfKd-0001Vk-MZ for qemu-devel@nongnu.org; Fri, 20 Jun 2025 13:15:20 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uSfKb-0004TX-VJ for qemu-devel@nongnu.org; Fri, 20 Jun 2025 13:15:15 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-3a548a73ff2so1954148f8f.0 for ; Fri, 20 Jun 2025 10:15:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1750439712; x=1751044512; 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=8g3SAyDwaT1EwDV5s2zbr9B0oT21Z4aa77jAxEnb4OU=; b=f5bNpV/+60wPY1b0nDdn5udsBo86fq63SQVi6yhSp7bCCSeLbAmGRKAcAv4re76yDU C/BeuRPxHyuZQmW7s4gDHyghRp991HbgNyKuFu7SRsGWZtPhcSgqNkO/Z90dFKrlYHei PuYxNF5+UJ+Qm7fUAmJbf8M+JPttA1xkPVYO/6GNdVVyX7pCCmYxPc9X58VMs9Yk5Wr9 4ND+H0cn8pwAaGAVGXuM0Rnd4zgZEew+5mqAoWgqrVqpTxAH1zINMTzj1b6cersA2dYb +eQnAZelzAV2s3OoBMn3ZCK1KBITGAWx+yudRBfUzyncrTrOyWpJnhyEA9FCjH+y4hBR 3/1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750439712; x=1751044512; 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=8g3SAyDwaT1EwDV5s2zbr9B0oT21Z4aa77jAxEnb4OU=; b=Re6Rg9D4EyGbWI8kIUq2btW6Ed+4Bu2LmShac4Z+0NFm0wq2IznKQEr7S1BKCtl+R3 248fGpH+6RKN8jEW1N2rMuU3sY3WmhscIATbsltKCsAuiv+Leso8s8c1Gqogmgzmq5/l MrxCyaXEj4camGPcyVJXnXQSB+1tgZQKtpLLgvviAqqonR3vD5Q7OJiW6b53zayo4T4W u3KOnieAeSxum+nnbiRCnULcCmedXBkvD8mhvu6a/fLKEmKeLqqyBcIeearn5Eln5rpi PpMqkLjXGncKqYNw9O6M6buIV6w1iGvuPAYrxqXQKW1v2XviDi7CXmxadw2xXmMMhsZx jYSg== X-Gm-Message-State: AOJu0YwbIs01zHx4t9Jyv3mf/qTrEO4iyZ4mry8YrNfn4OgwkX0sIrMH ijW95nyxG7p1zsc786qYPnIC+DzJZebCQFo4Lr0CI5/z//SDMs3L5mCnlGVIuvRadWIs9f6Qeet t1am7o5U= X-Gm-Gg: ASbGncvDwQacy68yNOYq7pQALQtU8ppR6nE3nofekYqKL6WsEXcXDT3Rve9pu1cjluV ZaeEzT2dfgoJnm8sydwP2wI9Wb+NuO/MfMVN2OFwHqkNI4+60oTAzbcWGwc9Zfriq6DK3AwLu03 qK6YwoDVYi9w1Qv2i+xqLJ4j9/B/y8v4TaRa9oRzkVKk8XyL0PEu0CL1HOYtAvcbegmF/HLvcRH HFixV8TWBtdhs263cwPDh6xgY2GzEk6X/aRsSDx5iHaHcwVRgbuSGb9wXBlxuRy++4K+/+AFPjF Kek4smxR7FojqaiFUZjnNkR524mShyr41Gc77Ghg34joZpey9U7NfWMtruT6zzQ/LhhJL/k8/I7 JgMfTOEVzsqjI+mvOj5OcZpOsXl8C2B22yNRN X-Received: by 2002:a05:6000:1447:b0:3a4:f430:2547 with SMTP id ffacd0b85a97d-3a6d12bb41cmr3142916f8f.6.1750439711867; Fri, 20 Jun 2025 10:15:11 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a6d118a1f2sm2507970f8f.83.2025.06.20.10.15.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Jun 2025 10:15:11 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Alexander Graf , Richard Henderson , Pierrick Bouvier , Peter Maydell , Thomas Huth , Cameron Esfahani , Julian Armistead , Paolo Bonzini , "Edgar E. Iglesias" , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= Subject: [RFC PATCH v2 18/48] accel/hvf: Implement get_vcpu_stats() Date: Fri, 20 Jun 2025 19:13:11 +0200 Message-ID: <20250620171342.92678-19-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250620171342.92678-1-philmd@linaro.org> References: <20250620171342.92678-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.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 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/hvf/hvf-accel-ops.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c index 45dd4baa321..bfdfef7c397 100644 --- a/accel/hvf/hvf-accel-ops.c +++ b/accel/hvf/hvf-accel-ops.c @@ -358,6 +358,12 @@ static inline int hvf_gdbstub_sstep_flags(AccelState *as) return SSTEP_ENABLE | SSTEP_NOIRQ; } +static void do_hvf_get_vcpu_exec_time(CPUState *cpu, run_on_cpu_data arg) +{ + int r = hv_vcpu_get_exec_time(cpu->accel->fd, arg.host_ptr); + assert_hvf_ok(r); +} + static void hvf_accel_class_init(ObjectClass *oc, const void *data) { AccelClass *ac = ACCEL_CLASS(oc); @@ -583,6 +589,16 @@ static void hvf_remove_all_breakpoints(CPUState *cpu) } } +static void hvf_get_vcpu_stats(CPUState *cpu, GString *buf) +{ + uint64_t time_us; /* units of mach_absolute_time() */ + + run_on_cpu(cpu, do_hvf_get_vcpu_exec_time, RUN_ON_CPU_HOST_PTR(&time_us)); + + g_string_append_printf(buf, "HVF cumulative execution time: %llu.%.3llus\n", + time_us / 1000000, (time_us % 1000000) / 1000); +} + static void hvf_accel_ops_class_init(ObjectClass *oc, const void *data) { AccelOpsClass *ops = ACCEL_OPS_CLASS(oc); @@ -601,7 +617,10 @@ static void hvf_accel_ops_class_init(ObjectClass *oc, const void *data) ops->remove_breakpoint = hvf_remove_breakpoint; ops->remove_all_breakpoints = hvf_remove_all_breakpoints; ops->update_guest_debug = hvf_update_guest_debug; + + ops->get_vcpu_stats = hvf_get_vcpu_stats; }; + static const TypeInfo hvf_accel_ops_type = { .name = ACCEL_OPS_NAME("hvf"),