From nobody Sat Nov 15 12:44:15 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=1752590829; cv=none; d=zohomail.com; s=zohoarc; b=UByM1LqKX96uzY3Vg3fY7rMA2hy+CKBIT83Y8DDyMgfRJ9lx6tdkEI2iHKsrprnTah7axhj8gp0+jWJWqfr4FNa/t5JigOBq+e+F5dyXW4AAi2H5wkjuHoyn5b+CCCAhG9wNeaWrSAsh6qreCoNcJR49DSoeKzq5Csbvh0IwBJ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752590829; h=Content-Type: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=WBxxvAKWvDXoU3BMlwQqtGjDUKV/shCGTJ2G1DYo+uQ=; b=nZJ3dsbfbdw7mnCuhcWJKLSjNLakxBMmTO4MLxA+MXG14DtckSx+H8bI2VPuF3v10gIQwAXr6AC00Pqq4XIfchXjNEX+ISCu1rloNITTL+m5Muc/jvEO3SCHUoe31nCT2IzKvAZfDAcaTOycAfOr5e3I/f5rIMhDNfF35VY/Yqg= 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 1752590829285350.34239785953343; Tue, 15 Jul 2025 07:47:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ubgvq-000856-2q; Tue, 15 Jul 2025 10:46:58 -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 1ubgE2-0000MZ-Rc for qemu-devel@nongnu.org; Tue, 15 Jul 2025 10:01:55 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ubgDv-0004VE-Sh for qemu-devel@nongnu.org; Tue, 15 Jul 2025 10:01:42 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4561a4a8bf2so22380765e9.1 for ; Tue, 15 Jul 2025 07:01:33 -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-3b5e8dc23cfsm15492280f8f.37.2025.07.15.07.01.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 15 Jul 2025 07:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752588092; x=1753192892; 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=WBxxvAKWvDXoU3BMlwQqtGjDUKV/shCGTJ2G1DYo+uQ=; b=AEmxUS6hMyzjb1pVd9bd7/byKj+lZaG1xHy/vECOZ4jRJcdd726OaW1xfl4SI5HLTV 5jG/jrEHARgAYq+vJ3Nrc5KXxqpcbXl/3wSllwazZByjEMYiaZHRXtWnlB81qSfKF2xF QERbvIaFikGJmZSohseqiDV4iA/3SmGBrlQGJjGnKcNqaG+bO3CkgOQZfMnAE3WjuIzj WllG3RofS0LsBLKqXOQaRO7rwv7zdWwwYi4f7x3fRJpphDzpXgguVeBBvTyKJYBEwmK5 rN5xGIrrwBi+tZBT0P2PBZNhvnGz2mxEaKSKceN12YKA6MGJZeavGRvEKUhz3sIXiRJQ URyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752588092; x=1753192892; 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=WBxxvAKWvDXoU3BMlwQqtGjDUKV/shCGTJ2G1DYo+uQ=; b=cSF40rhWWF1fJbHqvIB5JZ0Pndwhbcsk8MdQRJcQvyuLoUdbsjGumiOw6vscb4BeBY YiSnqVfxTfXUCWiFZNtj/c6aiKiUL+7pxSS8ISDoDZ8Fs07Zz6iJbNxazUfBtYdwZ0GN bEPmrds8IbETDpePvQuidUbY2SLonRNIt/U6shzYa41wLBBSGnUE32yBldINdvOGuiNT zAp7KX0rXGWlCS0SAOqVA4ETgBpSsAMmewWnpkeUFEE3LeSvQ1OvBCK38WUv8cQ1qzUg wPaF6SEUZgbB5RncpmzJcYDxXZ/V6Qvgf4SF+nVghy8JOgrFaFrM4VeeBUZwMQDr1u/q gmQQ== X-Gm-Message-State: AOJu0YwaUHdp5Co9COkfBgAwKZR3oZNxDPAjDtt4HzXemSezlLhUV2/S 9LYebsbwavE9q5ztWD+nnxZAzCXcyn4ihXE3ncH4vzT9mVIXs6Iq/luvulsApQ1kdRCfYZ8/ByO b7Ra8 X-Gm-Gg: ASbGncu5E6ozfD5Pr297qrgs05sMS0IBj8P1knw+4m6+R60d3b8/y2a3S3hDSdhwps5 8GYbi47SXUiLq89YL33HRmjZK0sbPAj0SH9j5KVsMzlyQr/j/VVXUS6ctpA2Ayqs3QJ3VCP91p3 CX0QK3FhbPpaPFWXWF1OSlW9PkGbdHEpG+kJTu2SBsoId/Mh7CEXfVC0BOzT3lve2N4D+9sNvp3 7qqqmIdA2buz2bSTFAHOKEKob3uuIji5/dPpC5tFfBoBKhIrSPemwecZf8obmCuvwJ3pJcsJ+Q8 nVPH9Hnwq2F55DN2QbSI2Jj/AXCd8n2LSY0gvN6Lo8T3JzmwwxnhmICQPtT+1HTcBcRgZZhMrxA MUxcjeL67Lt0y6kifUt7/rXUTk0DFax71UDScmhrKMHRNx4x03FzntFk2pLV9wZt8sBPRj+Tdc8 Iu5A== X-Google-Smtp-Source: AGHT+IEeEI7cZI8PqFXh8cQfjoJcctNrMOuz2OXXR2e2Na0uQ1B4xgEJcvDRn/zouslbEURQUEMCXA== X-Received: by 2002:a05:600c:354b:b0:456:1a87:a6ba with SMTP id 5b1f17b1804b1-4561a87af02mr60631425e9.33.1752588091640; Tue, 15 Jul 2025 07:01:31 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Phil Dennis-Jordan , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Cameron Esfahani , Laurent Vivier , Manos Pitsidianakis , "Dr. David Alan Gilbert" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Roman Bolshakov , Eric Blake , Paolo Bonzini , Pierrick Bouvier , Richard Henderson , Mads Ynddal Subject: [PATCH-for-10.1 v6 7/8] accel/hvf: Implement AccelClass::get_vcpu_stats() Date: Tue, 15 Jul 2025 16:00:47 +0200 Message-ID: <20250715140048.84942-8-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250715140048.84942-1-philmd@linaro.org> References: <20250715140048.84942-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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: 1752590831541116600 Co-developed-by: Mads Ynddal Signed-off-by: Mads Ynddal Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- accel/hvf/hvf-accel-ops.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c index 214454bd0b4..94a5bffb44e 100644 --- a/accel/hvf/hvf-accel-ops.c +++ b/accel/hvf/hvf-accel-ops.c @@ -58,6 +58,7 @@ #include "system/cpus.h" #include "system/hvf.h" #include "system/hvf_int.h" +#include =20 HVFState *hvf_state; =20 @@ -118,6 +119,12 @@ static void dummy_signal(int sig) { } =20 +static void do_hvf_get_vcpu_exec_time(CPUState *cpu, run_on_cpu_data arg) +{ + int r =3D hv_vcpu_get_exec_time(cpu->accel->fd, arg.host_ptr); + assert_hvf_ok(r); +} + static void hvf_vcpu_destroy(CPUState *cpu) { hv_return_t ret =3D hv_vcpu_destroy(cpu->accel->fd); @@ -347,6 +354,20 @@ static void hvf_remove_all_breakpoints(CPUState *cpu) } } =20 +static void hvf_get_vcpu_stats(CPUState *cpu, GString *buf) +{ + uint64_t time_mach; /* units of mach_absolute_time() */ + + run_on_cpu(cpu, do_hvf_get_vcpu_exec_time, RUN_ON_CPU_HOST_PTR(&time_m= ach)); + + mach_timebase_info_data_t timebase; + mach_timebase_info(&timebase); + uint64_t time_ns =3D time_mach * timebase.numer / timebase.denom; + + g_string_append_printf(buf, "HVF cumulative execution time: %llu.%.3ll= us\n", + time_ns / 1000000000, (time_ns % 100000000= 0) / 1000000); +} + static void hvf_accel_ops_class_init(ObjectClass *oc, const void *data) { AccelOpsClass *ops =3D ACCEL_OPS_CLASS(oc); @@ -365,7 +386,10 @@ static void hvf_accel_ops_class_init(ObjectClass *oc, = const void *data) ops->remove_all_breakpoints =3D hvf_remove_all_breakpoints; ops->update_guest_debug =3D hvf_update_guest_debug; ops->supports_guest_debug =3D hvf_arch_supports_guest_debug; + + ops->get_vcpu_stats =3D hvf_get_vcpu_stats; }; + static const TypeInfo hvf_accel_ops_type =3D { .name =3D ACCEL_OPS_NAME("hvf"), =20 --=20 2.49.0