From patchwork Wed May 31 19:48:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 687290 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1441581wru; Wed, 31 May 2023 12:48:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7SEaMGu5Ejlo9J3dPbtSqx7TKEoF9/OoQ0RxCh+gzi9U91y74pKKCMvkjuVtIdREX36HAO X-Received: by 2002:a05:620a:27d1:b0:75b:23a1:3653 with SMTP id i17-20020a05620a27d100b0075b23a13653mr7010308qkp.20.1685562529587; Wed, 31 May 2023 12:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685562529; cv=none; d=google.com; s=arc-20160816; b=POJZlDx9kTLaOJXf7L4TBh3W0gdQUYsQuf8mhTmJFDoxtj1vHM+52L+hcL7DGM+HJr SeNqFIeddCTU3g/ncCkN/v7boFOXvIPKGnKgseK/ahtYKvPPISwVwXftFWqy1Menlu6k ZNnhKquiTw1S9JG9+W+hb8YOUP7L+KEVfDz7pvl9IXTV5MhGtWlRg54AIvCYRFqFFuD+ Zy+D+daDAcQqpI7BN5qKRasj2zq9F6XHiGUuo5K2D0SNuzm4WGDD4itEUSJGGAIBZ5+2 Zw3PczojveCGeVJZUviAAIQycPneri9gRmSRzggNFmZjrVPUdciv9iydwSitXjPsWKvD ZyyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:sender:errors-to:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to:delivered-to:dkim-signature; bh=fOQ3qUI6u0ZiSdZl/ogv+WP+K/JrIOYVS2c+U3Wz4Bc=; b=ssneGgcRA8pWGtzSph06pz/RiIPa8Uq0oX5Gkn3/b2fF2ojre6i/6fdH3fj+6pgmxw Rlfw1xc9Xa6ozncOMqXhClEpOORTo7qgfACGF0a4DStFJcRSbDQdMR7bRIESVV4disL5 Jli0fD4h74cf+yvCzuD3UlDl35zZ4SdxS0n4dFfNbxbM3Zz3mgkbvHT9ztidMlqqvg7k VyBCvmvmXuLiuD5FFmPi4fKaImrPKVSVOewNyS0rAZXg7uIhB48bPp8fTx8FWmNSxrur b/arBaTwDuYyx60hkiLcKmivvUqd8rCQKM3EWv5OMYGP3mz3NlWgOznKzQsdJSJNr+6T 9KZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UqWbwaMd; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com. [170.10.133.124]) by mx.google.com with ESMTPS id m23-20020ae9e717000000b007591805caf5si8428534qka.83.2023.05.31.12.48.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 12:48:49 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UqWbwaMd; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685562529; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=fOQ3qUI6u0ZiSdZl/ogv+WP+K/JrIOYVS2c+U3Wz4Bc=; b=UqWbwaMds7K2wPtANxeO72Kii5nVzkqcZUwNMsZ5zwxEFHWFfjInbdkl0Gc7SWCN34W/Ry O3fmZsaoajej7+QULbAlZfQpNIoBs3c2Kp4QhoncU+sUjZoRnaXPFdDASLZ1TVSw7GXABk WJ3E4rUSVfcMwAGCwH7EFiE6+aXCWXg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-650--OE6eDlgPiuY9lzM7JqsDw-1; Wed, 31 May 2023 15:48:47 -0400 X-MC-Unique: -OE6eDlgPiuY9lzM7JqsDw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A6D17185A78B; Wed, 31 May 2023 19:48:44 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 938A2202696C; Wed, 31 May 2023 19:48:44 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 728D419465B6; Wed, 31 May 2023 19:48:44 +0000 (UTC) X-Original-To: libvir-list@listman.corp.redhat.com Delivered-To: libvir-list@listman.corp.redhat.com Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0811319465B1 for ; Wed, 31 May 2023 19:48:21 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id EB2CB40CFD49; Wed, 31 May 2023 19:48:20 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from localhost (unknown [10.39.192.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A81A40CFD45; Wed, 31 May 2023 19:48:20 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 01/11] *-user: remove the guest_user_syscall tracepoints Date: Wed, 31 May 2023 15:48:05 -0400 Message-Id: <20230531194815.1508961-2-stefanha@redhat.com> In-Reply-To: <20230531194815.1508961-1-stefanha@redhat.com> References: <20230531194815.1508961-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , libvir-list@redhat.com, Kyle Evans , Riku Voipio , Richard Henderson , Greg Kurz , Markus Armbruster , Yanan Wang , Stefan Hajnoczi , Michael Roth , Paolo Bonzini , Christian Schoenebeck , Eric Blake , Warner Losh , Richard Henderson Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Alex Bennée This is pure duplication now. Both bsd-user and linux-user have builtin strace support and we can also track syscalls via the plugins system. Reviewed-by: Warner Losh Reviewed-by: Stefan Hajnoczi Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Message-id: 20230526165401.574474-2-alex.bennee@linaro.org Message-Id: <20230524133952.3971948-2-alex.bennee@linaro.org> Signed-off-by: Stefan Hajnoczi --- include/user/syscall-trace.h | 4 ---- bsd-user/freebsd/os-syscall.c | 2 -- trace-events | 19 ------------------- 3 files changed, 25 deletions(-) diff --git a/include/user/syscall-trace.h b/include/user/syscall-trace.h index 90bda7631c..557f881a79 100644 --- a/include/user/syscall-trace.h +++ b/include/user/syscall-trace.h @@ -26,9 +26,6 @@ static inline void record_syscall_start(void *cpu, int num, abi_long arg5, abi_long arg6, abi_long arg7, abi_long arg8) { - trace_guest_user_syscall(cpu, num, - arg1, arg2, arg3, arg4, - arg5, arg6, arg7, arg8); qemu_plugin_vcpu_syscall(cpu, num, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); @@ -36,7 +33,6 @@ static inline void record_syscall_start(void *cpu, int num, static inline void record_syscall_return(void *cpu, int num, abi_long ret) { - trace_guest_user_syscall_ret(cpu, num, ret); qemu_plugin_vcpu_syscall_ret(cpu, num, ret); } diff --git a/bsd-user/freebsd/os-syscall.c b/bsd-user/freebsd/os-syscall.c index c8f998ecec..b0ae43766f 100644 --- a/bsd-user/freebsd/os-syscall.c +++ b/bsd-user/freebsd/os-syscall.c @@ -531,7 +531,6 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1, CPUState *cpu = env_cpu(cpu_env); abi_long ret; - trace_guest_user_syscall(cpu, num, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); if (do_strace) { print_freebsd_syscall(num, arg1, arg2, arg3, arg4, arg5, arg6); } @@ -541,7 +540,6 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1, if (do_strace) { print_freebsd_syscall_ret(num, ret); } - trace_guest_user_syscall_ret(cpu, num, ret); return ret; } diff --git a/trace-events b/trace-events index b6b84b175e..691c3533e4 100644 --- a/trace-events +++ b/trace-events @@ -85,22 +85,3 @@ vcpu guest_cpu_exit(void) # Targets: all vcpu guest_cpu_reset(void) -# include/user/syscall-trace.h - -# @num: System call number. -# @arg*: System call argument value. -# -# Start executing a guest system call in syscall emulation mode. -# -# Mode: user -# Targets: TCG(all) -vcpu guest_user_syscall(uint64_t num, uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5, uint64_t arg6, uint64_t arg7, uint64_t arg8) "num=0x%016"PRIx64" arg1=0x%016"PRIx64" arg2=0x%016"PRIx64" arg3=0x%016"PRIx64" arg4=0x%016"PRIx64" arg5=0x%016"PRIx64" arg6=0x%016"PRIx64" arg7=0x%016"PRIx64" arg8=0x%016"PRIx64 - -# @num: System call number. -# @ret: System call result value. -# -# Finish executing a guest system call in syscall emulation mode. -# -# Mode: user -# Targets: TCG(all) -vcpu guest_user_syscall_ret(uint64_t num, uint64_t ret) "num=0x%016"PRIx64" ret=0x%016"PRIx64 From patchwork Wed May 31 19:48:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 687288 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1441506wru; Wed, 31 May 2023 12:48:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7jt9lhSod5+mA5ldzUFci+FpaVWP/NTeIhYLMcOQ2NGU9ZcLS1VYlQG/PdJ0ncIn1pXthJ X-Received: by 2002:ac8:5dd3:0:b0:3f6:b285:a37c with SMTP id e19-20020ac85dd3000000b003f6b285a37cmr7783921qtx.49.1685562516881; Wed, 31 May 2023 12:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685562516; cv=none; d=google.com; s=arc-20160816; b=EUFShWGCunC9h4aSJ+pzpormO/Vd+puXzxwJPoWulOkQxyDHqi+z/lUCjYKCaLlwQu Cab0BYsuwCgSEMPOwteIn5osaJj0H8/k0jwLXWGGj6UX9iHKeIoE3JY7CAtx4NQnQ/NH BHuZKl+zToI3FEMip+7S502gmsp5gdmXMYCeuyPVKIOkpXabEZbEiHK3MaOQmzDQrOzv tUur//CVSB5z7tZ36ZowfVkxROnpK/hehT1D2RnevnKxM2bYOQDX2erMvqIHEpkGM6Iu /7XIjEI7UPfSPsWx/njyTNFAcMEEgZRcdKyWjoLotyTVg5IQ2LdWTYLRirnwLRGq3Pnn N6ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:sender:errors-to:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to:delivered-to:dkim-signature; bh=rxCD5rDF+n6gslp/qcSJG+BYddChTkonQBMOIDMr/v0=; b=txRbQvnBxl/v2G0bbP/Z7eqeN/9+3Da/tq3EAVYdWO/AAHaSFyT/80opReELjEIILP E6jaOST10Wd/TpBGJ7VV6CI6SIKZMWAWVLZW7ta5bHKYvvo+lJp5usjiPRv1iMflR4vp BhiO5Rsd/CjzlPg70/7/O7pKTyFIwx2GSWufJe0lCZNgW4an3QBwpq1EXIYsAWsrPUg/ 8qJJ77j/CP6Z5lFnsaPS51FvEvwPcIT9UwH8O/WZAV5hd8y6c86+TJT2Zb2oexF2fzMj rYmPxWRgJCjyXaxqLK7ta35S16svi1eUHW67ZGXRKW2qWIm35acnE9P7Y5VdnwZ75zk6 JxUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=b6ss2OB5; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com. [170.10.133.124]) by mx.google.com with ESMTPS id t14-20020a05622a180e00b003f56af9d547si8880321qtc.616.2023.05.31.12.48.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 12:48:36 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=b6ss2OB5; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685562516; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=rxCD5rDF+n6gslp/qcSJG+BYddChTkonQBMOIDMr/v0=; b=b6ss2OB5J6wrfrIQon0O1Tkcd/FUkjfvRIzUCe7B7rYUtamlCItqrSPTqs30YKwGKu2UYY 8lUAg7x6hW+DAtJ+faygr5E0OqvkBrJsIl/jwxWH1FkV5x+q8SosWC5ukMUtIiUVXe5Zaa tk+dyr4oTC+eWAgiav6cJwC9Fu3aMMw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-660-ZixqGhsvPm-f-8VafQ4F6A-1; Wed, 31 May 2023 15:48:33 -0400 X-MC-Unique: ZixqGhsvPm-f-8VafQ4F6A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 32616101A531; Wed, 31 May 2023 19:48:30 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F894140E962; Wed, 31 May 2023 19:48:30 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id DD7C419465B3; Wed, 31 May 2023 19:48:24 +0000 (UTC) X-Original-To: libvir-list@listman.corp.redhat.com Delivered-To: libvir-list@listman.corp.redhat.com Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6279919465B1 for ; Wed, 31 May 2023 19:48:23 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 51A4B1121331; Wed, 31 May 2023 19:48:23 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from localhost (unknown [10.39.192.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id A8237112132C; Wed, 31 May 2023 19:48:22 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 02/11] trace-events: remove the remaining vcpu trace events Date: Wed, 31 May 2023 15:48:06 -0400 Message-Id: <20230531194815.1508961-3-stefanha@redhat.com> In-Reply-To: <20230531194815.1508961-1-stefanha@redhat.com> References: <20230531194815.1508961-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , libvir-list@redhat.com, Kyle Evans , Riku Voipio , Richard Henderson , Greg Kurz , Markus Armbruster , Yanan Wang , Stefan Hajnoczi , Michael Roth , Paolo Bonzini , Christian Schoenebeck , Eric Blake , Warner Losh , Richard Henderson Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Alex Bennée While these are all in helper functions being designated vcpu events complicates the removal of the dynamic vcpu state code. TCG plugins allow you to instrument vcpu_[init|exit|idle]. We rename cpu_reset and make it a normal trace point. Reviewed-by: Stefan Hajnoczi Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Message-id: 20230526165401.574474-3-alex.bennee@linaro.org Message-Id: <20230524133952.3971948-3-alex.bennee@linaro.org> Signed-off-by: Stefan Hajnoczi --- hw/core/cpu-common.c | 4 ++-- trace/control-target.c | 1 - trace/control.c | 2 -- hw/core/trace-events | 3 +++ trace-events | 31 ------------------------------- 5 files changed, 5 insertions(+), 36 deletions(-) diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 5ccc3837b6..951477a7fd 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -32,7 +32,7 @@ #include "sysemu/tcg.h" #include "hw/boards.h" #include "hw/qdev-properties.h" -#include "trace/trace-root.h" +#include "trace.h" #include "qemu/plugin.h" CPUState *cpu_by_arch_id(int64_t id) @@ -113,7 +113,7 @@ void cpu_reset(CPUState *cpu) { device_cold_reset(DEVICE(cpu)); - trace_guest_cpu_reset(cpu); + trace_cpu_reset(cpu->cpu_index); } static void cpu_common_reset_hold(Object *obj) diff --git a/trace/control-target.c b/trace/control-target.c index c0c1e2310a..a10752924b 100644 --- a/trace/control-target.c +++ b/trace/control-target.c @@ -144,5 +144,4 @@ void trace_init_vcpu(CPUState *vcpu) } } } - trace_guest_cpu_enter(vcpu); } diff --git a/trace/control.c b/trace/control.c index 6c77cc6318..d24af91004 100644 --- a/trace/control.c +++ b/trace/control.c @@ -277,8 +277,6 @@ void trace_fini_vcpu(CPUState *vcpu) TraceEventIter iter; TraceEvent *ev; - trace_guest_cpu_exit(vcpu); - trace_event_iter_init_all(&iter); while ((ev = trace_event_iter_next(&iter)) != NULL) { if (trace_event_is_vcpu(ev) && diff --git a/hw/core/trace-events b/hw/core/trace-events index 56da55bd71..2cf085ac66 100644 --- a/hw/core/trace-events +++ b/hw/core/trace-events @@ -29,3 +29,6 @@ clock_set(const char *clk, uint64_t old, uint64_t new) "'%s', %"PRIu64"Hz->%"PRI clock_propagate(const char *clk) "'%s'" clock_update(const char *clk, const char *src, uint64_t hz, int cb) "'%s', src='%s', val=%"PRIu64"Hz cb=%d" clock_set_mul_div(const char *clk, uint32_t oldmul, uint32_t mul, uint32_t olddiv, uint32_t div) "'%s', mul: %u -> %u, div: %u -> %u" + +# cpu-common.c +cpu_reset(int cpu_index) "%d" diff --git a/trace-events b/trace-events index 691c3533e4..dd318ed1af 100644 --- a/trace-events +++ b/trace-events @@ -54,34 +54,3 @@ qmp_job_resume(void *job) "job %p" qmp_job_complete(void *job) "job %p" qmp_job_finalize(void *job) "job %p" qmp_job_dismiss(void *job) "job %p" - - -### Guest events, keep at bottom - - -## vCPU - -# trace/control-target.c - -# Hot-plug a new virtual (guest) CPU -# -# Mode: user, softmmu -# Targets: all -vcpu guest_cpu_enter(void) - -# trace/control.c - -# Hot-unplug a virtual (guest) CPU -# -# Mode: user, softmmu -# Targets: all -vcpu guest_cpu_exit(void) - -# hw/core/cpu.c - -# Reset the state of a virtual (guest) CPU -# -# Mode: user, softmmu -# Targets: all -vcpu guest_cpu_reset(void) - From patchwork Wed May 31 19:48:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 687287 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1441497wru; Wed, 31 May 2023 12:48:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6CFgJckHDtjtIzoEh40ubI6oiE1yOWXYkIeRw+BCUr4K8nm5E1Bgv60aftxiBRGhIYK3VH X-Received: by 2002:a05:6214:e61:b0:625:aa49:c34b with SMTP id jz1-20020a0562140e6100b00625aa49c34bmr7065096qvb.63.1685562515570; Wed, 31 May 2023 12:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685562515; cv=none; d=google.com; s=arc-20160816; b=YMsT1Ig/TbNDcJ03xDc5yyZDjObR/gMnmvRmq92jf/JCaiSZmbPIyz4SHThbDj/uSY VY5mLaSkSdQWKGZAZ/NX7NOoM3EPtFRNNlTkl0cGUqhLiHk3c7pr1sy65lMo6WK7wqQt 0RAGvqYyH+mwXLxiSLYT7eaQ/1Z8lI8E+EmKMn2NLlx3sP/FsCIh2mlcZ248WOkEUtS4 cbWzxerbW92NhOfKmGJvB5AeMGQ1zBuv+cYiPLRpqxDyonU/8JOx7HpftZ3t4dd/nbHM sTT8trw0dsWCs97YPAVcjet6ckfweVDwlb7r7kjOycI6KNf2HAA/nHb9CrmEWOQhkIQo 6WWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:sender:errors-to:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to:delivered-to:dkim-signature; bh=oi+seq7KnOXSMael//8077PMVV9G55+tWTDGQkzuYPg=; b=BH8y+Ed7PTI+rWFy4AUhNIMRA8X0eZWntUnhHH8Zny37ykEAWbhuki3GthL/4duPiH REx4tEY7khiWr5kSsKe4Zy+D1JBShgTC9nzI+gR9sCjruOfHpGSWIj/LCda7LhI3/9Qj jrWTv2tnU1CB7ICgfBcLWqNWAi0BM73v0s6ugBbgZ5h6gY+DAthboFFkd9xB7GHjKzW0 UlOnIPMPdpPEeld1jrtR1gWVvUceaGfkbs5F85Hg4OYz+24M2F8r3lCkzUsfRAjblzJC 7JO1gP813bd6I63EO4L4/Wvi3Jvs7LYxyufi8uZaFab0YKwbnsj9h8B5ko3kJcni08kk dpuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VyRASL2e; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com. [170.10.133.124]) by mx.google.com with ESMTPS id fn6-20020ad45d66000000b006272be53839si1748407qvb.295.2023.05.31.12.48.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 12:48:35 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VyRASL2e; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685562515; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=oi+seq7KnOXSMael//8077PMVV9G55+tWTDGQkzuYPg=; b=VyRASL2eJ+GzDt1RF3ZZkMMjhAJO8mPDG5AkUcEUU0Ol1AGcmF6MYlZFxTkogXe88fzCNI irVLtHN/IemXTi6dr0VeHoN+qFZ1du6eg3H0Y94yNo3lK7jq18qKrvhzXy8qTFyBfNaguf nPPSH0IiqL5bG4fXDwik1PSEYo7MIzA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-588-aKQdpyQYOfSOFJIjJ2hEDg-1; Wed, 31 May 2023 15:48:31 -0400 X-MC-Unique: aKQdpyQYOfSOFJIjJ2hEDg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6996A28EA6F2; Wed, 31 May 2023 19:48:28 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 56D4F40CFD47; Wed, 31 May 2023 19:48:28 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2822919465B9; Wed, 31 May 2023 19:48:28 +0000 (UTC) X-Original-To: libvir-list@listman.corp.redhat.com Delivered-To: libvir-list@listman.corp.redhat.com Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 524AF19465B7 for ; Wed, 31 May 2023 19:48:26 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 440CE40CFD47; Wed, 31 May 2023 19:48:26 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from localhost (unknown [10.39.192.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id B545040CFD46; Wed, 31 May 2023 19:48:25 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 03/11] trace: remove vcpu_id from the TraceEvent structure Date: Wed, 31 May 2023 15:48:07 -0400 Message-Id: <20230531194815.1508961-4-stefanha@redhat.com> In-Reply-To: <20230531194815.1508961-1-stefanha@redhat.com> References: <20230531194815.1508961-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , libvir-list@redhat.com, Kyle Evans , Riku Voipio , Richard Henderson , Greg Kurz , Markus Armbruster , Yanan Wang , Stefan Hajnoczi , Michael Roth , Paolo Bonzini , Christian Schoenebeck , Eric Blake , Warner Losh , Richard Henderson Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Alex Bennée This does involve temporarily stubbing out some helper functions before we excise the rest of the code. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée Message-id: 20230526165401.574474-4-alex.bennee@linaro.org Message-Id: <20230524133952.3971948-4-alex.bennee@linaro.org> Signed-off-by: Stefan Hajnoczi --- trace/control-internal.h | 4 ++-- trace/event-internal.h | 2 -- trace/control.c | 10 ---------- scripts/tracetool/format/c.py | 6 ------ scripts/tracetool/format/h.py | 11 +---------- 5 files changed, 3 insertions(+), 30 deletions(-) diff --git a/trace/control-internal.h b/trace/control-internal.h index 8b2b50a7cf..0178121720 100644 --- a/trace/control-internal.h +++ b/trace/control-internal.h @@ -27,12 +27,12 @@ static inline uint32_t trace_event_get_id(TraceEvent *ev) static inline uint32_t trace_event_get_vcpu_id(TraceEvent *ev) { - return ev->vcpu_id; + return 0; } static inline bool trace_event_is_vcpu(TraceEvent *ev) { - return ev->vcpu_id != TRACE_VCPU_EVENT_NONE; + return false; } static inline const char * trace_event_get_name(TraceEvent *ev) diff --git a/trace/event-internal.h b/trace/event-internal.h index f63500b37e..0c24e01b52 100644 --- a/trace/event-internal.h +++ b/trace/event-internal.h @@ -19,7 +19,6 @@ /** * TraceEvent: * @id: Unique event identifier. - * @vcpu_id: Unique per-vCPU event identifier. * @name: Event name. * @sstate: Static tracing state. * @dstate: Dynamic tracing state @@ -33,7 +32,6 @@ */ typedef struct TraceEvent { uint32_t id; - uint32_t vcpu_id; const char * name; const bool sstate; uint16_t *dstate; diff --git a/trace/control.c b/trace/control.c index d24af91004..5dfb609954 100644 --- a/trace/control.c +++ b/trace/control.c @@ -68,16 +68,6 @@ void trace_event_register_group(TraceEvent **events) size_t i; for (i = 0; events[i] != NULL; i++) { events[i]->id = next_id++; - if (events[i]->vcpu_id == TRACE_VCPU_EVENT_NONE) { - continue; - } - - if (likely(next_vcpu_id < CPU_TRACE_DSTATE_MAX_EVENTS)) { - events[i]->vcpu_id = next_vcpu_id++; - } else { - warn_report("too many vcpu trace events; dropping '%s'", - events[i]->name); - } } event_groups = g_renew(TraceEventGroup, event_groups, nevent_groups + 1); event_groups[nevent_groups].events = events; diff --git a/scripts/tracetool/format/c.py b/scripts/tracetool/format/c.py index c390c1844a..69edf0d588 100644 --- a/scripts/tracetool/format/c.py +++ b/scripts/tracetool/format/c.py @@ -32,19 +32,13 @@ def generate(events, backend, group): out('uint16_t %s;' % e.api(e.QEMU_DSTATE)) for e in events: - if "vcpu" in e.properties: - vcpu_id = 0 - else: - vcpu_id = "TRACE_VCPU_EVENT_NONE" out('TraceEvent %(event)s = {', ' .id = 0,', - ' .vcpu_id = %(vcpu_id)s,', ' .name = \"%(name)s\",', ' .sstate = %(sstate)s,', ' .dstate = &%(dstate)s ', '};', event = e.api(e.QEMU_EVENT), - vcpu_id = vcpu_id, name = e.name, sstate = "TRACE_%s_ENABLED" % e.name.upper(), dstate = e.api(e.QEMU_DSTATE)) diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py index e94f0be7da..285d7b03a9 100644 --- a/scripts/tracetool/format/h.py +++ b/scripts/tracetool/format/h.py @@ -74,16 +74,7 @@ def generate(events, backend, group): out('}') - # tracer wrapper with checks (per-vCPU tracing) - if "vcpu" in e.properties: - trace_cpu = next(iter(e.args))[1] - cond = "trace_event_get_vcpu_state(%(cpu)s,"\ - " TRACE_%(id)s)"\ - % dict( - cpu=trace_cpu, - id=e.name.upper()) - else: - cond = "true" + cond = "true" out('', 'static inline void %(api)s(%(args)s)', From patchwork Wed May 31 19:48:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 687289 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1441519wru; Wed, 31 May 2023 12:48:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5eip4K+BRrPD+GW/hwb4xMeTj6I25Kg4dElZY7lNmTPdAtBEjtf4q8aGXciwVbWZ+7M18E X-Received: by 2002:a17:907:a42a:b0:96f:912d:7922 with SMTP id sg42-20020a170907a42a00b0096f912d7922mr5727313ejc.53.1685562518150; Wed, 31 May 2023 12:48:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685562518; cv=none; d=google.com; s=arc-20160816; b=0a4rD7NiLmlWX2OF4h2rvXsmmt3fuZLRQmJvLxE4HV9nXdzvzmq/Zggq94yruD7GHi rUEoGPC2pMbk/JXlTsSYHLr0SWG84k8UxrmHOSSTXIaSdGUU/S1SIE4v3oBnJMpucqgB WuBzCl+GOpg6F3IRhYhD65SIQgY+fT7Y1KL00tesN0fAZ4x9/zRg/w4XpBaq6TQnzImj aCxRYo1MNH9cl8mC0UsssvzNp9/hQ9RBM57zZB249nrvLgURDNL8krGgAQ0oTtQxd2ew i1PGwhpX8QJwNYLVu+t0Cs6+/h2syjV7OVFSmQTaZKOGmRUK3SIMESjbCQg5Z6IzukNV yYww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:sender:errors-to:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to:delivered-to:dkim-signature; bh=jmwIuqbKSBmYUUYZl+TDEkyLmw0sm6/vkiGhVfu4wao=; b=0HtlIHOWNqEG+2NfQyDk7ilYOhFI10VeyHjPbWnozGBbcqPkPgaZlAyyReN70OQp1Q MypN6rwOzfQwbnX1a4u1WMMpfKt9K+1EyC7dG7XbBBq88d1jgt/eNIl+X+yuQomlVPaP N6piggogTBUOtqj99fK64i2EexyY970ryppKcqWSWFrjxGE4YafhRI+vEe8EgZn2mc+o K2HmVMrxvM2vCPGCtb3WV72QmtwEyEBCq1TSxltuNX8vClnyFICH8s7bcalH2cje6vMy B+4WtHfM+QrQa34O7mDgBGQxmu94OWEhnsgcKd9/paEPU9ClF9UMFK6c9BwMCNF4hFxA EDUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B63pG8GG; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com. [170.10.133.124]) by mx.google.com with ESMTPS id n12-20020a170906724c00b009591dd6c71esi2641038ejk.896.2023.05.31.12.48.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 12:48:38 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B63pG8GG; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685562517; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=jmwIuqbKSBmYUUYZl+TDEkyLmw0sm6/vkiGhVfu4wao=; b=B63pG8GGBghuWqsniSjC+Ts7y12PK2pNdrk7mjtCi7zL4z3zHH3bqfJKB2iIsyVQcibBSO zMpx6cm+p0chZYsfmfBKkEWVg2Dd9AkWBUAmKCAHbmAbVdeySTzS+2MXAVTSRCHsv72MQy Vq2A5D9RPKUXKrCtns1K0r+DkkqnSBI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-590-FrHrteFiP5-Ndi7v1bZrdw-1; Wed, 31 May 2023 15:48:33 -0400 X-MC-Unique: FrHrteFiP5-Ndi7v1bZrdw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A04F2800141; Wed, 31 May 2023 19:48:30 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8AA31492B0C; Wed, 31 May 2023 19:48:30 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6F04819465B3; Wed, 31 May 2023 19:48:30 +0000 (UTC) X-Original-To: libvir-list@listman.corp.redhat.com Delivered-To: libvir-list@listman.corp.redhat.com Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 54A3B19465B7 for ; Wed, 31 May 2023 19:48:29 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 374EDC0448D; Wed, 31 May 2023 19:48:29 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from localhost (unknown [10.39.192.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94746C154DB; Wed, 31 May 2023 19:48:28 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 04/11] scripts/qapi: document the tool that generated the file Date: Wed, 31 May 2023 15:48:08 -0400 Message-Id: <20230531194815.1508961-5-stefanha@redhat.com> In-Reply-To: <20230531194815.1508961-1-stefanha@redhat.com> References: <20230531194815.1508961-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , libvir-list@redhat.com, Kyle Evans , Riku Voipio , Richard Henderson , Greg Kurz , Markus Armbruster , Yanan Wang , Stefan Hajnoczi , Michael Roth , Paolo Bonzini , Christian Schoenebeck , Eric Blake , Warner Losh , Richard Henderson Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Alex Bennée This makes it a little easier for developers to find where things where being generated. Reviewed-by: Richard Henderson Reviewed-by: Stefan Hajnoczi Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster Signed-off-by: Alex Bennée Message-id: 20230526165401.574474-5-alex.bennee@linaro.org Message-Id: <20230524133952.3971948-5-alex.bennee@linaro.org> Signed-off-by: Stefan Hajnoczi --- scripts/qapi/gen.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py index 8f8f784f4a..70bc576a10 100644 --- a/scripts/qapi/gen.py +++ b/scripts/qapi/gen.py @@ -13,6 +13,7 @@ from contextlib import contextmanager import os +import sys import re from typing import ( Dict, @@ -162,7 +163,7 @@ def __init__(self, fname: str, blurb: str, pydoc: str): def _top(self) -> str: return mcgen(''' -/* AUTOMATICALLY GENERATED, DO NOT MODIFY */ +/* AUTOMATICALLY GENERATED by %(tool)s DO NOT MODIFY */ /* %(blurb)s @@ -174,6 +175,7 @@ def _top(self) -> str: */ ''', + tool=os.path.basename(sys.argv[0]), blurb=self._blurb, copyright=self._copyright) def _bottom(self) -> str: @@ -195,7 +197,10 @@ def _bottom(self) -> str: class QAPIGenTrace(QAPIGen): def _top(self) -> str: - return super()._top() + '# AUTOMATICALLY GENERATED, DO NOT MODIFY\n\n' + return (super()._top() + + '# AUTOMATICALLY GENERATED by ' + + os.path.basename(sys.argv[0]) + + ', DO NOT MODIFY\n\n') @contextmanager From patchwork Wed May 31 19:48:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 687295 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1441640wru; Wed, 31 May 2023 12:49:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7reIOL2pt4guoyM2ifYgDE8DErBQCYO5l9WNkOsUFyj2D0tIj7kkDLu8IsDUkmbWP/i8r4 X-Received: by 2002:a17:907:268e:b0:973:93d6:18aa with SMTP id bn14-20020a170907268e00b0097393d618aamr6442335ejc.62.1685562540427; Wed, 31 May 2023 12:49:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685562540; cv=none; d=google.com; s=arc-20160816; b=GZvNMPLoAhGlU5g6fiodnNLpPIFfouJA+qr45BvAXh0jDAyxQwjqR2SyR27534eVLU KCd4xk1pwjZuCALyaVhTvKJtnK3BdCCECcn2XzN1LI20KOWpTb696vzKes7FskBrppvX b3GPTmmk9drlrDjPsrNYPcyihiDK2a7QzcLjNIZtlz+Qj6aWkjQIfys9PbX9YLknXZv4 u+bv/CPMycYmZu4hBHXYS+giemmk/xgXmLgJGQ1UTjdgIsomKImqAqhLB+IndkA9lRZG fJEWMUbp2GhVsNpRR/FyTlQK1mSD09428Ul5mLyalIIskEHWWoLmDCmgsGjd6HsIHqCW AY7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:sender:errors-to:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to:delivered-to:dkim-signature; bh=wKrE0cU6y/KvEa0jIUQsGcMo+tubjSZxaQI6tRZgCYg=; b=g94DQj2ipaBG+ZOt0GfoFS9L9obroPEPWola8c4ZqKjwZUd9AhxSpBsx7kS//7TFQv uzYcNjSRLOnpMsks4vGKniB7IhD3uZ2BgLBvzgdpwfHtYgToSUnf9yO5u8YEBHqVB6Sj YVxWX3HMALE1Hccbd5bidYpj+P995PapofKVTTU+MKrnYdtUX8WAU/g61dHY/fdOFaaZ OyBMF4s1SnQP4iWjnGL1aJvQ93JYh6HkYgKIM85K5xSNMDkWDNDKpvYwJ8r3trSxTWNb ki/WyDUHqBwStcK5hDDpoCkPuLAt8tbr+0i5Q3v6ZfWN+qbxiLawafUHxBWyEx4E77XB n/VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=N8PiDtex; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com. [170.10.133.124]) by mx.google.com with ESMTPS id md7-20020a170906ae8700b0096ace551abdsi9716992ejb.523.2023.05.31.12.49.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 12:49:00 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=N8PiDtex; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685562539; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=wKrE0cU6y/KvEa0jIUQsGcMo+tubjSZxaQI6tRZgCYg=; b=N8PiDtexEEobcgVFu2wmbliQidRptFH1WQH34rsBZjApo1XQ6J4VrOfTBl2QD5Abqk3uFr hXkhkcEpdtFEcnL4hb2zJCSGIJB8IDasehjUchkIcwwH+jC6/g+AZU8HPZ3lZWcwJQ0bTK LnHFQztw+OlqdMxBv05/l9yoE6lJBYE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-104-9tTHyoVEPcm5YhbAVTAQCw-1; Wed, 31 May 2023 15:48:54 -0400 X-MC-Unique: 9tTHyoVEPcm5YhbAVTAQCw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2EA1285A5BD; Wed, 31 May 2023 19:48:51 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B43C40C6EC4; Wed, 31 May 2023 19:48:51 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3983719452C3; Wed, 31 May 2023 19:48:50 +0000 (UTC) X-Original-To: libvir-list@listman.corp.redhat.com Delivered-To: libvir-list@listman.corp.redhat.com Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7BDD019465B1 for ; Wed, 31 May 2023 19:48:36 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 62553140E963; Wed, 31 May 2023 19:48:31 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from localhost (unknown [10.39.192.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD31D140E962; Wed, 31 May 2023 19:48:30 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 05/11] docs/deprecated: move QMP events bellow QMP command section Date: Wed, 31 May 2023 15:48:09 -0400 Message-Id: <20230531194815.1508961-6-stefanha@redhat.com> In-Reply-To: <20230531194815.1508961-1-stefanha@redhat.com> References: <20230531194815.1508961-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , libvir-list@redhat.com, Kyle Evans , Riku Voipio , Richard Henderson , Greg Kurz , Markus Armbruster , Yanan Wang , Stefan Hajnoczi , Michael Roth , Paolo Bonzini , Christian Schoenebeck , Eric Blake , Warner Losh , Richard Henderson Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Alex Bennée Also rename the section to make the fact this is part of the management protocol even clearer. Suggested-by: Markus Armbruster Signed-off-by: Alex Bennée Message-id: 20230526165401.574474-6-alex.bennee@linaro.org Signed-off-by: Stefan Hajnoczi --- docs/about/deprecated.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index e934e0a13a..7c45a64363 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -218,6 +218,15 @@ instruction per translated block" mode (which can be set on the command line or via the HMP, but not via QMP). The information remains available via the HMP 'info jit' command. +QEMU Machine Protocol (QMP) events +---------------------------------- + +``MEM_UNPLUG_ERROR`` (since 6.2) +'''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +Use the more generic event ``DEVICE_UNPLUG_GUEST_ERROR`` instead. + + Human Monitor Protocol (HMP) commands ------------------------------------- @@ -251,15 +260,6 @@ it. Since all recent x86 hardware from the past >10 years is capable of the 64-bit x86 extensions, a corresponding 64-bit OS should be used instead. -QEMU API (QAPI) events ----------------------- - -``MEM_UNPLUG_ERROR`` (since 6.2) -'''''''''''''''''''''''''''''''''''''''''''''''''''''''' - -Use the more generic event ``DEVICE_UNPLUG_GUEST_ERROR`` instead. - - System emulator machines ------------------------ From patchwork Wed May 31 19:48:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 687297 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1441748wru; Wed, 31 May 2023 12:49:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4vwVsNRzk7Bse2BGoN/XE1vDAfi3CDnglhvnv9PZVDid1bolLPdsFpp75HYjYOyqpsxBD/ X-Received: by 2002:a05:620a:3997:b0:75b:23a1:8328 with SMTP id ro23-20020a05620a399700b0075b23a18328mr6376916qkn.35.1685562562675; Wed, 31 May 2023 12:49:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685562562; cv=none; d=google.com; s=arc-20160816; b=WmjtXRfSnObmJSUksw8mVrXU7i6h8lMFopZzxrLjW9utQC1b/sT9np6wbMBgIbeeaY EeIyyiig3rjThueXSsTJ5S5S0XWD3nFhiyP3EHz6hjat2TrMgLtNfVoyI/az2ZkEt/ah 71Yb5p1OhlyBHE6jdOXLrNB6Dohk8T8VaqxjN41p2eEtTZx6wuvDo1hX8QjSUU9bWB8j EcMWElEQix/s96HsxQr1IkyEzj4LYNtixw5CYFOF0u/drTbHXuVm6DqArM0HKFbAj/nB fiYXYQTUBRtTz7W03s9dZX8M1IWWnz9s5C6NoEvSlum0V3VQ2somqCoO2S3iR+boipxZ 7yIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:sender:errors-to:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to:delivered-to:dkim-signature; bh=98jvU+feCca0uj4rnXF3/XaM0gWQFkEqAbMLDmu3sSg=; b=ed8KETyw6RkVa5raC4Bx42ZfrsmskCeWZ9NkdXHE+Fjs+s5XZT+Qi49CqM2UN509I9 7jjCqtIBZ8DZKwNQ7h9H8WnxJLTOYfUbz1mgbnWu+peozXs2VBAPArrUBwRZJhPaMXgD v2C0l++7YK9JRPBmQjcT+LCpQeGSE79Rw0j0xJjm/MXSlm1YkcnVHMv+JlkU7XMBhY/O 1FFAl+UTunki/nhDZYtDj3ihqFeRyy1X5AMLRC/njEU9kt7zn2kS4vxChM1pIAf9GluE p2WcfFjEg74k7/qBInR9Ro0Z/pb0m4+XTjvaGuTYMOT8OvDcmAl+Xz5N3A/D3CEl18Nq Z2Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WBXmSMZV; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com. [170.10.129.124]) by mx.google.com with ESMTPS id a8-20020a05620a16c800b00757970ad032si8343881qkn.86.2023.05.31.12.49.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 12:49:22 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WBXmSMZV; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685562562; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=98jvU+feCca0uj4rnXF3/XaM0gWQFkEqAbMLDmu3sSg=; b=WBXmSMZVv/3xI5zX1nvjbCXuw0PqZUB/uGAyAAUFejW0PiRVcthl/nAfXGIfD+0lDTiXF9 RB01Gl/X7nSHjlAHgsdoUlpvwOUwMRQkOmu4+jopOtYAA0fEwtKsCflW3yA8yI+CO/apBx iwvtTNU2osNxdPteto7qSEvi1B8S3P0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-474-VY9ODoTgNZGGwFSLNaUQKg-1; Wed, 31 May 2023 15:48:46 -0400 X-MC-Unique: VY9ODoTgNZGGwFSLNaUQKg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 95126811E97; Wed, 31 May 2023 19:48:43 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67DA440CFD4B; Wed, 31 May 2023 19:48:43 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 32B4C19452C9; Wed, 31 May 2023 19:48:43 +0000 (UTC) X-Original-To: libvir-list@listman.corp.redhat.com Delivered-To: libvir-list@listman.corp.redhat.com Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4538619452C3 for ; Wed, 31 May 2023 19:48:33 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9FE83492B0B; Wed, 31 May 2023 19:48:33 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from localhost (unknown [10.39.192.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03DC5492B0A; Wed, 31 May 2023 19:48:32 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 06/11] qapi: make the vcpu parameters deprecated for 8.1 Date: Wed, 31 May 2023 15:48:10 -0400 Message-Id: <20230531194815.1508961-7-stefanha@redhat.com> In-Reply-To: <20230531194815.1508961-1-stefanha@redhat.com> References: <20230531194815.1508961-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , libvir-list@redhat.com, Kyle Evans , Riku Voipio , Richard Henderson , Greg Kurz , Markus Armbruster , Yanan Wang , Stefan Hajnoczi , Michael Roth , Paolo Bonzini , Christian Schoenebeck , Eric Blake , Warner Losh , Richard Henderson Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Alex Bennée I don't think I can remove the parameters directly but certainly mark them as deprecated. Reviewed-by: Stefan Hajnoczi Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Message-id: 20230526165401.574474-7-alex.bennee@linaro.org Message-Id: <20230524133952.3971948-6-alex.bennee@linaro.org> Signed-off-by: Stefan Hajnoczi --- docs/about/deprecated.rst | 7 +++++++ qapi/trace.json | 40 +++++++++++++++++---------------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 7c45a64363..0743459862 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -226,6 +226,13 @@ QEMU Machine Protocol (QMP) events Use the more generic event ``DEVICE_UNPLUG_GUEST_ERROR`` instead. +``vcpu`` trace events (since 8.1) +''''''''''''''''''''''''''''''''' + +The ability to instrument QEMU helper functions with vCPU-aware trace +points was removed in 7.0. However QMP still exposed the vcpu +parameter. This argument has now been deprecated and the remaining +remaining trace points that used it are selected just by name. Human Monitor Protocol (HMP) commands ------------------------------------- diff --git a/qapi/trace.json b/qapi/trace.json index 6bf0af0946..39b752fc88 100644 --- a/qapi/trace.json +++ b/qapi/trace.json @@ -37,13 +37,14 @@ # # @vcpu: Whether this is a per-vCPU event (since 2.7). # -# An event is per-vCPU if it has the "vcpu" property in the -# "trace-events" files. +# Features: +# @deprecated: Member @vcpu is deprecated, and always ignored. # # Since: 2.2 ## { 'struct': 'TraceEventInfo', - 'data': {'name': 'str', 'state': 'TraceEventState', 'vcpu': 'bool'} } + 'data': {'name': 'str', 'state': 'TraceEventState', + 'vcpu': { 'type': 'bool', 'features': ['deprecated'] } } } ## # @trace-event-get-state: @@ -52,19 +53,15 @@ # # @name: Event name pattern (case-sensitive glob). # -# @vcpu: The vCPU to query (any by default; since 2.7). +# @vcpu: The vCPU to query (since 2.7). +# +# Features: +# @deprecated: Member @vcpu is deprecated, and always ignored. # # Returns: a list of @TraceEventInfo for the matching events # -# An event is returned if: -# -# - its name matches the @name pattern, and -# - if @vcpu is given, the event has the "vcpu" property. -# -# Therefore, if @vcpu is given, the operation will only match per-vCPU -# events, returning their state on the specified vCPU. Special case: -# if @name is an exact match, @vcpu is given and the event does not -# have the "vcpu" property, an error is returned. +# An event is returned if its name matches the @name pattern +# (There are no longer any per-vCPU events). # # Since: 2.2 # @@ -75,7 +72,8 @@ # <- { "return": [ { "name": "qemu_memalign", "state": "disabled", "vcpu": false } ] } ## { 'command': 'trace-event-get-state', - 'data': {'name': 'str', '*vcpu': 'int'}, + 'data': {'name': 'str', + '*vcpu': {'type': 'int', 'features': ['deprecated'] } }, 'returns': ['TraceEventInfo'] } ## @@ -91,15 +89,11 @@ # # @vcpu: The vCPU to act upon (all by default; since 2.7). # -# An event's state is modified if: +# Features: +# @deprecated: Member @vcpu is deprecated, and always ignored. # -# - its name matches the @name pattern, and -# - if @vcpu is given, the event has the "vcpu" property. -# -# Therefore, if @vcpu is given, the operation will only match per-vCPU -# events, setting their state on the specified vCPU. Special case: if -# @name is an exact match, @vcpu is given and the event does not have -# the "vcpu" property, an error is returned. +# An event is enabled if its name matches the @name pattern +# (There are no longer any per-vCPU events). # # Since: 2.2 # @@ -111,4 +105,4 @@ ## { 'command': 'trace-event-set-state', 'data': {'name': 'str', 'enable': 'bool', '*ignore-unavailable': 'bool', - '*vcpu': 'int'} } + '*vcpu': {'type': 'int', 'features': ['deprecated'] } } } From patchwork Wed May 31 19:48:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 687293 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1441607wru; Wed, 31 May 2023 12:48:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6x8Qjma2yoL0tyk2UFMAMQZ1ajb2gj9Ew21FLd8//IdATXqhYmPtq4JBcAToJHNoT2+Jr8 X-Received: by 2002:a05:620a:8394:b0:75b:23a0:e7d6 with SMTP id pb20-20020a05620a839400b0075b23a0e7d6mr7317505qkn.55.1685562532915; Wed, 31 May 2023 12:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685562532; cv=none; d=google.com; s=arc-20160816; b=t9ret1JaGqKYNUFWEpKdWfLM/n/fyuL72zm/885IoVi9IdPssHLASRy56b0NpMm+xj Ch814ReJwIDGKXj+dEQMp69w72I9gRNvDN1919qdfTnNukBxS9oAxw3IGhGofcqMVezd 6f+YxLIKeRfYs5fOVLbsmYcuzZxYDS4Jo+ZpMSkXI/bYol+CCi/THvgf4YJt4t7yWpSa c0utTc3npGLoQMjN2rev0XFOZcvw1xOmHb2m5cNpA7dF6vWAd3+T2/W4d33gXvH2Clk1 lgch8WwDHpjJu7DMIZt+RkiLbNZ0TMvzBCUCOt5wXxkGDtBbw5/pI/RdSCr6R8W8p7a8 i6/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:sender:errors-to:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to:delivered-to:dkim-signature; bh=65mEc0ocrW5/8QQ1+7JK5LehvTYH7uTMyUHkd4H2rps=; b=prBXqN07n04UILfg01YYdxtovbJaVDvaMA6hjG7EZXoYjzQ5KtLQk/xm1HuuuE4qrc ZYGDdEKkxJUjec+zQ8JN6B9JpA6iLqiUUgJtKxxLKB9D5GQORYfIkKN3Xo/Rg5iFGssk Vtzpjrwi1xsJruDvuQ0r65PvBJjOvOayb0Q0UuXFkM2M6pSbT+M/50P1UJs7LIv2wNxc FVk5f8U5bkGopCMypz9nkxObzW7cbdxxOM3x4AEap539k9HLy88We9FQUD08YHDw25jD w6Aui3VtHFLJ7l3vjhF5K9h455ySG2ywcxjS2xDNc4dezrrJZQEwz9CiwOiKPrXT0jz2 Qqcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YXdgFBVO; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com. [170.10.133.124]) by mx.google.com with ESMTPS id f11-20020a05620a12eb00b0075be5b1320bsi5437222qkl.112.2023.05.31.12.48.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 12:48:52 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YXdgFBVO; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685562532; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=65mEc0ocrW5/8QQ1+7JK5LehvTYH7uTMyUHkd4H2rps=; b=YXdgFBVOar1CJq5KZLLbCywmer+ulWl4u5sALQUDI0AKt6C8hh5U3xGGqwAA3m4eD1Pohb iSxVqNuUg9HrDFSqEWmsindh0O3EtetCjMNkjczFWjnbB47haIf7+qorOkgImsl1b4gZrG Es4NwyYtjDtqS9OBbHQqjEZGnYW4yu8= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-468-rK_x_qoAMaWFyPDj0VSXDg-1; Wed, 31 May 2023 15:48:46 -0400 X-MC-Unique: rK_x_qoAMaWFyPDj0VSXDg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2AFFE28EA6E1; Wed, 31 May 2023 19:48:43 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1686120296C6; Wed, 31 May 2023 19:48:43 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C2FC919465B6; Wed, 31 May 2023 19:48:42 +0000 (UTC) X-Original-To: libvir-list@listman.corp.redhat.com Delivered-To: libvir-list@listman.corp.redhat.com Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AF36019465B1 for ; Wed, 31 May 2023 19:48:36 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9C95E2166B2C; Wed, 31 May 2023 19:48:36 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from localhost (unknown [10.39.192.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id BDAE92166B25; Wed, 31 May 2023 19:48:35 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 07/11] trace: remove code that depends on setting vcpu Date: Wed, 31 May 2023 15:48:11 -0400 Message-Id: <20230531194815.1508961-8-stefanha@redhat.com> In-Reply-To: <20230531194815.1508961-1-stefanha@redhat.com> References: <20230531194815.1508961-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , libvir-list@redhat.com, Kyle Evans , Riku Voipio , Richard Henderson , Greg Kurz , Markus Armbruster , Yanan Wang , Stefan Hajnoczi , Michael Roth , Paolo Bonzini , Christian Schoenebeck , Eric Blake , Warner Losh , Richard Henderson Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Alex Bennée Now we no longer have any events that are for vcpus we can start excising the code from the trace control. As the vcpu parameter is encoded as part of QMP we just stub out the has_vcpu/vcpu parameters rather than alter the API. Reviewed-by: Stefan Hajnoczi Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée Message-id: 20230526165401.574474-8-alex.bennee@linaro.org Message-Id: <20230524133952.3971948-7-alex.bennee@linaro.org> Signed-off-by: Stefan Hajnoczi --- trace/control-internal.h | 10 ---- trace/control-vcpu.h | 16 ------ trace/control.h | 48 ----------------- hw/core/cpu-common.c | 2 - stubs/trace-control.c | 13 ----- trace/control-target.c | 108 ++++----------------------------------- trace/control.c | 16 ------ trace/qmp.c | 74 +++------------------------ trace/trace-hmp-cmds.c | 18 ++----- 9 files changed, 20 insertions(+), 285 deletions(-) diff --git a/trace/control-internal.h b/trace/control-internal.h index 0178121720..8d818d359b 100644 --- a/trace/control-internal.h +++ b/trace/control-internal.h @@ -25,16 +25,6 @@ static inline uint32_t trace_event_get_id(TraceEvent *ev) return ev->id; } -static inline uint32_t trace_event_get_vcpu_id(TraceEvent *ev) -{ - return 0; -} - -static inline bool trace_event_is_vcpu(TraceEvent *ev) -{ - return false; -} - static inline const char * trace_event_get_name(TraceEvent *ev) { assert(ev != NULL); diff --git a/trace/control-vcpu.h b/trace/control-vcpu.h index 0f98ebe7b5..800fc5a219 100644 --- a/trace/control-vcpu.h +++ b/trace/control-vcpu.h @@ -30,13 +30,6 @@ trace_event_get_vcpu_state_dynamic_by_vcpu_id( \ vcpu, _ ## id ## _EVENT.vcpu_id)) -/** - * trace_event_get_vcpu_state_dynamic: - * - * Get the dynamic tracing state of an event for the given vCPU. - */ -static bool trace_event_get_vcpu_state_dynamic(CPUState *vcpu, TraceEvent *ev); - #include "control-internal.h" static inline bool @@ -51,13 +44,4 @@ trace_event_get_vcpu_state_dynamic_by_vcpu_id(CPUState *vcpu, } } -static inline bool trace_event_get_vcpu_state_dynamic(CPUState *vcpu, - TraceEvent *ev) -{ - uint32_t vcpu_id; - assert(trace_event_is_vcpu(ev)); - vcpu_id = trace_event_get_vcpu_id(ev); - return trace_event_get_vcpu_state_dynamic_by_vcpu_id(vcpu, vcpu_id); -} - #endif diff --git a/trace/control.h b/trace/control.h index 23b8393b29..dfd209edd8 100644 --- a/trace/control.h +++ b/trace/control.h @@ -89,23 +89,6 @@ static bool trace_event_is_pattern(const char *str); */ static uint32_t trace_event_get_id(TraceEvent *ev); -/** - * trace_event_get_vcpu_id: - * - * Get the per-vCPU identifier of an event. - * - * Special value #TRACE_VCPU_EVENT_NONE means the event is not vCPU-specific - * (does not have the "vcpu" property). - */ -static uint32_t trace_event_get_vcpu_id(TraceEvent *ev); - -/** - * trace_event_is_vcpu: - * - * Whether this is a per-vCPU event. - */ -static bool trace_event_is_vcpu(TraceEvent *ev); - /** * trace_event_get_name: * @@ -172,21 +155,6 @@ static bool trace_event_get_state_dynamic(TraceEvent *ev); */ void trace_event_set_state_dynamic(TraceEvent *ev, bool state); -/** - * trace_event_set_vcpu_state_dynamic: - * - * Set the dynamic tracing state of an event for the given vCPU. - * - * Pre-condition: trace_event_get_vcpu_state_static(ev) == true - * - * Note: Changes for execution-time events with the 'tcg' property will not be - * propagated until the next TB is executed (iff executing in TCG mode). - */ -void trace_event_set_vcpu_state_dynamic(CPUState *vcpu, - TraceEvent *ev, bool state); - - - /** * trace_init_backends: * @@ -205,22 +173,6 @@ bool trace_init_backends(void); */ void trace_init_file(void); -/** - * trace_init_vcpu: - * @vcpu: Added vCPU. - * - * Set initial dynamic event state for a hot-plugged vCPU. - */ -void trace_init_vcpu(CPUState *vcpu); - -/** - * trace_fini_vcpu: - * @vcpu: Removed vCPU. - * - * Disable dynamic event state for a hot-unplugged vCPU. - */ -void trace_fini_vcpu(CPUState *vcpu); - /** * trace_list_events: * @f: Where to send output. diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 951477a7fd..f4e51c8a1b 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -211,7 +211,6 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp) } /* NOTE: latest generic point where the cpu is fully realized */ - trace_init_vcpu(cpu); } static void cpu_common_unrealizefn(DeviceState *dev) @@ -219,7 +218,6 @@ static void cpu_common_unrealizefn(DeviceState *dev) CPUState *cpu = CPU(dev); /* NOTE: latest generic point before the cpu is fully unrealized */ - trace_fini_vcpu(cpu); cpu_exec_unrealizefn(cpu); } diff --git a/stubs/trace-control.c b/stubs/trace-control.c index 7f856e5c24..b428f34c87 100644 --- a/stubs/trace-control.c +++ b/stubs/trace-control.c @@ -36,16 +36,3 @@ void trace_event_set_state_dynamic(TraceEvent *ev, bool state) } } } - -void trace_event_set_vcpu_state_dynamic(CPUState *vcpu, - TraceEvent *ev, bool state) -{ - /* should never be called on non-target binaries */ - abort(); -} - -void trace_init_vcpu(CPUState *vcpu) -{ - /* should never be called on non-target binaries */ - abort(); -} diff --git a/trace/control-target.c b/trace/control-target.c index a10752924b..97f21e476d 100644 --- a/trace/control-target.c +++ b/trace/control-target.c @@ -36,112 +36,22 @@ void trace_event_set_state_dynamic_init(TraceEvent *ev, bool state) void trace_event_set_state_dynamic(TraceEvent *ev, bool state) { - CPUState *vcpu; assert(trace_event_get_state_static(ev)); - if (trace_event_is_vcpu(ev) && likely(first_cpu != NULL)) { - CPU_FOREACH(vcpu) { - trace_event_set_vcpu_state_dynamic(vcpu, ev, state); - } - } else { - /* - * Without the "vcpu" property, dstate can only be 1 or 0. With it, we - * haven't instantiated any vCPU yet, so we will set a global state - * instead, and trace_init_vcpu will reconcile it afterwards. - */ - bool state_pre = *ev->dstate; - if (state_pre != state) { - if (state) { - trace_events_enabled_count++; - *ev->dstate = 1; - } else { - trace_events_enabled_count--; - *ev->dstate = 0; - } - } - } -} -static void trace_event_synchronize_vcpu_state_dynamic( - CPUState *vcpu, run_on_cpu_data ignored) -{ - bitmap_copy(vcpu->trace_dstate, vcpu->trace_dstate_delayed, - CPU_TRACE_DSTATE_MAX_EVENTS); - tcg_flush_jmp_cache(vcpu); -} - -void trace_event_set_vcpu_state_dynamic(CPUState *vcpu, - TraceEvent *ev, bool state) -{ - uint32_t vcpu_id; - bool state_pre; - assert(trace_event_get_state_static(ev)); - assert(trace_event_is_vcpu(ev)); - vcpu_id = trace_event_get_vcpu_id(ev); - state_pre = test_bit(vcpu_id, vcpu->trace_dstate); + /* + * There is no longer a "vcpu" property, dstate can only be 1 or + * 0. With it, we haven't instantiated any vCPU yet, so we will + * set a global state instead, and trace_init_vcpu will reconcile + * it afterwards. + */ + bool state_pre = *ev->dstate; if (state_pre != state) { if (state) { trace_events_enabled_count++; - set_bit(vcpu_id, vcpu->trace_dstate_delayed); - (*ev->dstate)++; + *ev->dstate = 1; } else { trace_events_enabled_count--; - clear_bit(vcpu_id, vcpu->trace_dstate_delayed); - (*ev->dstate)--; - } - if (vcpu->created) { - /* - * Delay changes until next TB; we want all TBs to be built from a - * single set of dstate values to ensure consistency of generated - * tracing code. - */ - async_run_on_cpu(vcpu, trace_event_synchronize_vcpu_state_dynamic, - RUN_ON_CPU_NULL); - } else { - trace_event_synchronize_vcpu_state_dynamic(vcpu, RUN_ON_CPU_NULL); - } - } -} - -static bool adding_first_cpu1(void) -{ - CPUState *cpu; - size_t count = 0; - CPU_FOREACH(cpu) { - count++; - if (count > 1) { - return false; - } - } - return true; -} - -static bool adding_first_cpu(void) -{ - QEMU_LOCK_GUARD(&qemu_cpu_list_lock); - - return adding_first_cpu1(); -} - -void trace_init_vcpu(CPUState *vcpu) -{ - TraceEventIter iter; - TraceEvent *ev; - trace_event_iter_init_all(&iter); - while ((ev = trace_event_iter_next(&iter)) != NULL) { - if (trace_event_is_vcpu(ev) && - trace_event_get_state_static(ev) && - trace_event_get_state_dynamic(ev)) { - if (adding_first_cpu()) { - /* check preconditions */ - assert(*ev->dstate == 1); - /* disable early-init state ... */ - *ev->dstate = 0; - trace_events_enabled_count--; - /* ... and properly re-enable */ - trace_event_set_vcpu_state_dynamic(vcpu, ev, true); - } else { - trace_event_set_vcpu_state_dynamic(vcpu, ev, true); - } + *ev->dstate = 0; } } } diff --git a/trace/control.c b/trace/control.c index 5dfb609954..1a48a7e266 100644 --- a/trace/control.c +++ b/trace/control.c @@ -262,22 +262,6 @@ void trace_init_file(void) #endif } -void trace_fini_vcpu(CPUState *vcpu) -{ - TraceEventIter iter; - TraceEvent *ev; - - trace_event_iter_init_all(&iter); - while ((ev = trace_event_iter_next(&iter)) != NULL) { - if (trace_event_is_vcpu(ev) && - trace_event_get_state_static(ev) && - trace_event_get_vcpu_state_dynamic(vcpu, ev)) { - /* must disable to affect the global counter */ - trace_event_set_vcpu_state_dynamic(vcpu, ev, false); - } - } -} - bool trace_init_backends(void) { #ifdef CONFIG_TRACE_SIMPLE diff --git a/trace/qmp.c b/trace/qmp.c index 3b4f4702b4..aa760f1fc4 100644 --- a/trace/qmp.c +++ b/trace/qmp.c @@ -13,20 +13,7 @@ #include "control-vcpu.h" -static CPUState *get_cpu(bool has_vcpu, int vcpu, Error **errp) -{ - if (has_vcpu) { - CPUState *cpu = qemu_get_cpu(vcpu); - if (cpu == NULL) { - error_setg(errp, "invalid vCPU index %u", vcpu); - } - return cpu; - } else { - return NULL; - } -} - -static bool check_events(bool has_vcpu, bool ignore_unavailable, bool is_pattern, +static bool check_events(bool ignore_unavailable, bool is_pattern, const char *name, Error **errp) { if (!is_pattern) { @@ -38,12 +25,6 @@ static bool check_events(bool has_vcpu, bool ignore_unavailable, bool is_pattern return false; } - /* error for non-vcpu event */ - if (has_vcpu && !trace_event_is_vcpu(ev)) { - error_setg(errp, "event \"%s\" is not vCPU-specific", name); - return false; - } - /* error for unavailable event */ if (!ignore_unavailable && !trace_event_get_state_static(ev)) { error_setg(errp, "event \"%s\" is disabled", name); @@ -70,22 +51,13 @@ TraceEventInfoList *qmp_trace_event_get_state(const char *name, bool has_vcpu, int64_t vcpu, Error **errp) { - Error *err = NULL; TraceEventInfoList *events = NULL; TraceEventIter iter; TraceEvent *ev; bool is_pattern = trace_event_is_pattern(name); - CPUState *cpu; - - /* Check provided vcpu */ - cpu = get_cpu(has_vcpu, vcpu, &err); - if (err) { - error_propagate(errp, err); - return NULL; - } /* Check events */ - if (!check_events(has_vcpu, true, is_pattern, name, errp)) { + if (!check_events(true, is_pattern, name, errp)) { return NULL; } @@ -93,33 +65,17 @@ TraceEventInfoList *qmp_trace_event_get_state(const char *name, trace_event_iter_init_pattern(&iter, name); while ((ev = trace_event_iter_next(&iter)) != NULL) { TraceEventInfo *value; - bool is_vcpu = trace_event_is_vcpu(ev); - if (has_vcpu && !is_vcpu) { - continue; - } value = g_new(TraceEventInfo, 1); - value->vcpu = is_vcpu; value->name = g_strdup(trace_event_get_name(ev)); if (!trace_event_get_state_static(ev)) { value->state = TRACE_EVENT_STATE_UNAVAILABLE; } else { - if (has_vcpu) { - if (is_vcpu) { - if (trace_event_get_vcpu_state_dynamic(cpu, ev)) { - value->state = TRACE_EVENT_STATE_ENABLED; - } else { - value->state = TRACE_EVENT_STATE_DISABLED; - } - } - /* else: already skipped above */ + if (trace_event_get_state_dynamic(ev)) { + value->state = TRACE_EVENT_STATE_ENABLED; } else { - if (trace_event_get_state_dynamic(ev)) { - value->state = TRACE_EVENT_STATE_ENABLED; - } else { - value->state = TRACE_EVENT_STATE_DISABLED; - } + value->state = TRACE_EVENT_STATE_DISABLED; } } QAPI_LIST_PREPEND(events, value); @@ -133,21 +89,12 @@ void qmp_trace_event_set_state(const char *name, bool enable, bool has_vcpu, int64_t vcpu, Error **errp) { - Error *err = NULL; TraceEventIter iter; TraceEvent *ev; bool is_pattern = trace_event_is_pattern(name); - CPUState *cpu; - - /* Check provided vcpu */ - cpu = get_cpu(has_vcpu, vcpu, &err); - if (err) { - error_propagate(errp, err); - return; - } /* Check events */ - if (!check_events(has_vcpu, has_ignore_unavailable && ignore_unavailable, + if (!check_events(has_ignore_unavailable && ignore_unavailable, is_pattern, name, errp)) { return; } @@ -155,14 +102,9 @@ void qmp_trace_event_set_state(const char *name, bool enable, /* Apply changes (all errors checked above) */ trace_event_iter_init_pattern(&iter, name); while ((ev = trace_event_iter_next(&iter)) != NULL) { - if (!trace_event_get_state_static(ev) || - (has_vcpu && !trace_event_is_vcpu(ev))) { + if (!trace_event_get_state_static(ev)) { continue; } - if (has_vcpu) { - trace_event_set_vcpu_state_dynamic(cpu, ev, enable); - } else { - trace_event_set_state_dynamic(ev, enable); - } + trace_event_set_state_dynamic(ev, enable); } } diff --git a/trace/trace-hmp-cmds.c b/trace/trace-hmp-cmds.c index 792876c34a..86211fce27 100644 --- a/trace/trace-hmp-cmds.c +++ b/trace/trace-hmp-cmds.c @@ -37,16 +37,10 @@ void hmp_trace_event(Monitor *mon, const QDict *qdict) { const char *tp_name = qdict_get_str(qdict, "name"); bool new_state = qdict_get_bool(qdict, "option"); - bool has_vcpu = qdict_haskey(qdict, "vcpu"); - int vcpu = qdict_get_try_int(qdict, "vcpu", 0); Error *local_err = NULL; - if (vcpu < 0) { - monitor_printf(mon, "argument vcpu must be positive"); - return; - } - - qmp_trace_event_set_state(tp_name, new_state, true, true, has_vcpu, vcpu, &local_err); + qmp_trace_event_set_state(tp_name, new_state, + true, true, false, 0, &local_err); if (local_err) { error_report_err(local_err); } @@ -80,8 +74,6 @@ void hmp_trace_file(Monitor *mon, const QDict *qdict) void hmp_info_trace_events(Monitor *mon, const QDict *qdict) { const char *name = qdict_get_try_str(qdict, "name"); - bool has_vcpu = qdict_haskey(qdict, "vcpu"); - int vcpu = qdict_get_try_int(qdict, "vcpu", 0); TraceEventInfoList *events; TraceEventInfoList *elem; Error *local_err = NULL; @@ -89,12 +81,8 @@ void hmp_info_trace_events(Monitor *mon, const QDict *qdict) if (name == NULL) { name = "*"; } - if (vcpu < 0) { - monitor_printf(mon, "argument vcpu must be positive"); - return; - } - events = qmp_trace_event_get_state(name, has_vcpu, vcpu, &local_err); + events = qmp_trace_event_get_state(name, false, 0, &local_err); if (local_err) { error_report_err(local_err); return; From patchwork Wed May 31 19:48:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 687296 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1441705wru; Wed, 31 May 2023 12:49:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6e9KPYkZHBLcVvU2oQB1tTo1Yj0bZUSR+q/64gwDGaGP/CpfrETtGC3Vm8kJ/ffWWnFcCq X-Received: by 2002:a05:620a:8c0a:b0:75b:23a1:46c with SMTP id qz10-20020a05620a8c0a00b0075b23a1046cmr6245731qkn.50.1685562552577; Wed, 31 May 2023 12:49:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685562552; cv=none; d=google.com; s=arc-20160816; b=sWOqU+8OrC1Onq9AWz2/uulpTyxkIHgQzVJOpuNqj/L9bwwDgAbmm1DWbyhD9cj300 Vj0PYBjtLtnludwk5+HXQ35S1minAckMV9G26F8Q/OdQnDrbcXETqU1SvUJQBE4oi/3e dO7Ioz2yiyUMrWR29BxNjLmyye06Bjl8L6ldU8pKEMiOZqiJ7jrd2alulpGi1D2+NMxW kqFQDxU3esssMkxfVdOuh/2R3l1szUW+FF0xSEnnmZFLsqWA9RWKw27vvFRC0FhlK92V xYOxwt6/i5X71kwPuyCw5v910hDZ7iH82qaEe59XIm/OGvH8mhlP3gdBYG8oyvGG0HTs 19ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:sender:errors-to:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to:delivered-to:dkim-signature; bh=l0mUomyf/Ox+xXMSaQ9IpuFfwKhp3csXMu7acYo6q+8=; b=FTgT3NjvYOr9nyuEPcuFlNC0jA49tcYeMQGvi2NGa5L5I+Tdrxl5gD3rduOGksevIh gXFvb2FwPTCkbZOx71AXFk41toQpquynyITZ8emB/AjJWQft3ObQkvZc7bjgW/5EbqBV jCzjlMfyTajUQRdl9HgqH8SunY9Mt/5nehrtj4R2mXc7K7aDvCusvrRSb0zfLEk5ZQ1t eUZ1jJUODNP4DCSXelaItZNfxRKbZt/YJo2pIIfHt+gLpJ8taqFrVmPWycOSEj69aW8V KC54+fEkCCBqYdkIan5h+ILKwuoUo49UF3Lc9CDJ4FDHAxXloIZToqLHw873xOY7RMgT BVVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TtrSyaIH; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com. [170.10.133.124]) by mx.google.com with ESMTPS id u8-20020ae9c008000000b0075cf2261b22si3949274qkk.470.2023.05.31.12.49.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 12:49:12 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TtrSyaIH; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685562552; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=l0mUomyf/Ox+xXMSaQ9IpuFfwKhp3csXMu7acYo6q+8=; b=TtrSyaIHZ+r6c5goxcHJoQYS991dxVRX5hbnYIizEk3K2ytKlJOOWpWutIDZtpKMquNebG TZqyJ/ka9GbCLNsjlzUqQP0GR/8OYNs6a4jD2qMVRZysbLxV7EB5P2Wwl5OnK+EikpJlN5 3qN3dThzxlclP+wP1e641rlyZfc4MpU= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-218-A3TbXJ1DNsuZQexBOzpgUw-1; Wed, 31 May 2023 15:49:05 -0400 X-MC-Unique: A3TbXJ1DNsuZQexBOzpgUw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C00EC1C0755F; Wed, 31 May 2023 19:49:02 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA1F0421DF; Wed, 31 May 2023 19:49:02 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 83EF019465B1; Wed, 31 May 2023 19:49:02 +0000 (UTC) X-Original-To: libvir-list@listman.corp.redhat.com Delivered-To: libvir-list@listman.corp.redhat.com Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 447F419452C1 for ; Wed, 31 May 2023 19:48:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id EEE1440CFD4C; Wed, 31 May 2023 19:48:38 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from localhost (unknown [10.39.192.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52B6840CFD46; Wed, 31 May 2023 19:48:38 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 08/11] trace: remove control-vcpu.h Date: Wed, 31 May 2023 15:48:12 -0400 Message-Id: <20230531194815.1508961-9-stefanha@redhat.com> In-Reply-To: <20230531194815.1508961-1-stefanha@redhat.com> References: <20230531194815.1508961-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , libvir-list@redhat.com, Kyle Evans , Riku Voipio , Richard Henderson , Greg Kurz , Markus Armbruster , Yanan Wang , Stefan Hajnoczi , Michael Roth , Paolo Bonzini , Christian Schoenebeck , Eric Blake , Warner Losh , Richard Henderson Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Alex Bennée Now we no longer have vcpu controlled trace events we can excise the code that allows us to query its status. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Stefan Hajnoczi Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée Message-id: 20230526165401.574474-9-alex.bennee@linaro.org Message-Id: <20230524133952.3971948-8-alex.bennee@linaro.org> Signed-off-by: Stefan Hajnoczi --- trace/control-vcpu.h | 47 ----------------------------------- trace/qmp.c | 2 +- scripts/tracetool/format/h.py | 5 +--- 3 files changed, 2 insertions(+), 52 deletions(-) delete mode 100644 trace/control-vcpu.h diff --git a/trace/control-vcpu.h b/trace/control-vcpu.h deleted file mode 100644 index 800fc5a219..0000000000 --- a/trace/control-vcpu.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Interface for configuring and controlling the state of tracing events. - * - * Copyright (C) 2011-2016 Lluís Vilanova - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef TRACE__CONTROL_VCPU_H -#define TRACE__CONTROL_VCPU_H - -#include "control.h" -#include "event-internal.h" -#include "hw/core/cpu.h" - -/** - * trace_event_get_vcpu_state: - * @vcpu: Target vCPU. - * @id: Event identifier name. - * - * Get the tracing state of an event (both static and dynamic) for the given - * vCPU. - * - * If the event has the disabled property, the check will have no performance - * impact. - */ -#define trace_event_get_vcpu_state(vcpu, id) \ - ((id ##_ENABLED) && \ - trace_event_get_vcpu_state_dynamic_by_vcpu_id( \ - vcpu, _ ## id ## _EVENT.vcpu_id)) - -#include "control-internal.h" - -static inline bool -trace_event_get_vcpu_state_dynamic_by_vcpu_id(CPUState *vcpu, - uint32_t vcpu_id) -{ - /* it's on fast path, avoid consistency checks (asserts) */ - if (unlikely(trace_events_enabled_count)) { - return test_bit(vcpu_id, vcpu->trace_dstate); - } else { - return false; - } -} - -#endif diff --git a/trace/qmp.c b/trace/qmp.c index aa760f1fc4..3e3971c6a8 100644 --- a/trace/qmp.c +++ b/trace/qmp.c @@ -10,7 +10,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qapi/qapi-commands-trace.h" -#include "control-vcpu.h" +#include "control.h" static bool check_events(bool ignore_unavailable, bool is_pattern, diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py index 285d7b03a9..ea126b07ea 100644 --- a/scripts/tracetool/format/h.py +++ b/scripts/tracetool/format/h.py @@ -16,10 +16,7 @@ def generate(events, backend, group): - if group == "root": - header = "trace/control-vcpu.h" - else: - header = "trace/control.h" + header = "trace/control.h" out('/* This file is autogenerated by tracetool, do not edit. */', '', From patchwork Wed May 31 19:48:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 687294 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1441636wru; Wed, 31 May 2023 12:49:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Bn7vAfNjeXNnPS6iVua5BTt++g7AJUjqjJvwzFdfjoByR6HPMcXXfuQJhXjHCMZDV98Cs X-Received: by 2002:a17:907:728f:b0:973:84af:66e5 with SMTP id dt15-20020a170907728f00b0097384af66e5mr5881265ejc.40.1685562539981; Wed, 31 May 2023 12:48:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685562539; cv=none; d=google.com; s=arc-20160816; b=yjfb82GdsIONggxO6BvHR6d8kLEY4ijU/iDPNBZHo6DElwZOecMp4j6C/ft5eco2aj SG28LpB5VB7/98s3q3u0poMXEW6JNilvYW8mCNHpQsmvv5dD9dfm9KxfxM7PN0p7uQDc Tni/hYiin4baqlByTjZuItH691ipn83rkrapBdJhUgErHoXv6DkSfwerJNPPrqq1mDxF XibbIEbMu26kSEk5OFoLFIAaU8tndZTBYysBiNkAu92kbKKaRYyqUxG1md9un69lpbyJ 5/qX4sA1lCOGHx09GrYW2lrAOX9Ru/Nrrzqf3FjwkzRGS8ruSf0/iPnWGpcXp5dfAQNp 4Fhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:sender:errors-to:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to:delivered-to:dkim-signature; bh=NqICW3GcmnO+a60Iohk8Y/M3AMHkcsRUs3FxixMsIy0=; b=HhtQoMneqlHRjsR6RGC3VeJT3sbPQvBeIJYYVThEB9FhaJBtCQHoI2wYBVoxOk5Cw2 hUE9Id0GdIW0fPiism9pDjXY+QRazosBD/hUMliUE6ZpiWIZsV1+fYM/+K+0u6CKKhHA vCOS+mky+2CdSGibpirBwhIctS5LrMdVbq3rBcXsjHvSXEHcHGVjZHpknCuemVB25vnN hqhBvX14BuDUKekD9aof8E4iTYjqQ7daWfqaVna9AKnxQEHbkwHTTRHa18TsG5cXGmBi CWK+Ka3ITm9agWFiSc7nb5ME9xDqNg/WRvGrkFPHk8kYdHjxYk/bJruwXJzuyIYw/6yL vUFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=X5zPYcKm; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com. [170.10.133.124]) by mx.google.com with ESMTPS id gj30-20020a170907741e00b009572d0759a8si10189170ejc.225.2023.05.31.12.48.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 12:48:59 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=X5zPYcKm; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685562539; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=NqICW3GcmnO+a60Iohk8Y/M3AMHkcsRUs3FxixMsIy0=; b=X5zPYcKmtecP0Xxd1jfa/xokJ5o9umUMFuYU1X/Z9Y4JlF0sOpqvV5BC4LreBds7lmMlCj KoWMsStXb3QjXr9pZj35KWJo18TUTStWdmVihXfLLypiNKHuFU9PELNX3kJfPYXe/AclYA cH5NdEi9TKWYV5P+JtO2Y2aVFxw3SGQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-208-4c4uLKESNrifjl1ZOT67Mg-1; Wed, 31 May 2023 15:48:57 -0400 X-MC-Unique: 4c4uLKESNrifjl1ZOT67Mg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2516A3C11CD6; Wed, 31 May 2023 19:48:55 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 128BD2029F6D; Wed, 31 May 2023 19:48:55 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CAC1919465B9; Wed, 31 May 2023 19:48:49 +0000 (UTC) X-Original-To: libvir-list@listman.corp.redhat.com Delivered-To: libvir-list@listman.corp.redhat.com Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4486019452C2 for ; Wed, 31 May 2023 19:48:41 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1F12B140E96E; Wed, 31 May 2023 19:48:41 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from localhost (unknown [10.39.192.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75951140E963; Wed, 31 May 2023 19:48:40 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 09/11] tcg: remove the final vestiges of dstate Date: Wed, 31 May 2023 15:48:13 -0400 Message-Id: <20230531194815.1508961-10-stefanha@redhat.com> In-Reply-To: <20230531194815.1508961-1-stefanha@redhat.com> References: <20230531194815.1508961-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , libvir-list@redhat.com, Kyle Evans , Riku Voipio , Richard Henderson , Greg Kurz , Markus Armbruster , Yanan Wang , Stefan Hajnoczi , Michael Roth , Paolo Bonzini , Christian Schoenebeck , Eric Blake , Warner Losh , Richard Henderson Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Alex Bennée Now we no longer have dynamic state affecting things we can remove the additional fields in cpu.h and simplify the TB hash calculation. For the benchmark: hyperfine -w 2 -m 20 \ "./arm-softmmu/qemu-system-arm -cpu cortex-a15 \ -machine type=virt,highmem=off \ -display none -m 2048 \ -serial mon:stdio \ -netdev user,id=unet,hostfwd=tcp::2222-:22 \ -device virtio-net-pci,netdev=unet \ -device virtio-scsi-pci \ -blockdev driver=raw,node-name=hd,discard=unmap,file.driver=host_device,file.filename=/dev/zen-disk/debian-bullseye-armhf \ -device scsi-hd,drive=hd -smp 4 \ -kernel /home/alex/lsrc/linux.git/builds/arm/arch/arm/boot/zImage \ -append 'console=ttyAMA0 root=/dev/sda2 systemd.unit=benchmark.service' \ -snapshot" It has a marginal effect on runtime, before: Time (mean ± σ): 26.279 s ± 2.438 s [User: 41.113 s, System: 1.843 s] Range (min … max): 24.420 s … 32.565 s 20 runs after: Time (mean ± σ): 24.440 s ± 2.885 s [User: 34.474 s, System: 2.028 s] Range (min … max): 21.663 s … 29.937 s 20 runs Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1358 Reviewed-by: Stefan Hajnoczi Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Message-id: 20230526165401.574474-10-alex.bennee@linaro.org Message-Id: <20230524133952.3971948-9-alex.bennee@linaro.org> Signed-off-by: Stefan Hajnoczi --- accel/tcg/tb-hash.h | 6 +++--- include/exec/exec-all.h | 3 --- include/hw/core/cpu.h | 5 ----- accel/tcg/cpu-exec.c | 7 +------ accel/tcg/tb-maint.c | 5 ++--- accel/tcg/translate-all.c | 6 ------ 6 files changed, 6 insertions(+), 26 deletions(-) diff --git a/accel/tcg/tb-hash.h b/accel/tcg/tb-hash.h index 83dc610e4c..1d19c69caa 100644 --- a/accel/tcg/tb-hash.h +++ b/accel/tcg/tb-hash.h @@ -61,10 +61,10 @@ static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc) #endif /* CONFIG_SOFTMMU */ static inline -uint32_t tb_hash_func(tb_page_addr_t phys_pc, target_ulong pc, uint32_t flags, - uint32_t cf_mask, uint32_t trace_vcpu_dstate) +uint32_t tb_hash_func(tb_page_addr_t phys_pc, target_ulong pc, + uint32_t flags, uint32_t cf_mask) { - return qemu_xxhash7(phys_pc, pc, flags, cf_mask, trace_vcpu_dstate); + return qemu_xxhash6(phys_pc, pc, flags, cf_mask); } #endif diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 4d2b151986..3b1b57f6ad 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -545,9 +545,6 @@ struct TranslationBlock { #define CF_CLUSTER_MASK 0xff000000 /* Top 8 bits are cluster ID */ #define CF_CLUSTER_SHIFT 24 - /* Per-vCPU dynamic tracing state used to generate this TB */ - uint32_t trace_vcpu_dstate; - /* * Above fields used for comparing */ diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 39150cf8f8..383456d1b3 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -266,7 +266,6 @@ typedef void (*run_on_cpu_func)(CPUState *cpu, run_on_cpu_data data); struct qemu_work_item; #define CPU_UNSET_NUMA_NODE_ID -1 -#define CPU_TRACE_DSTATE_MAX_EVENTS 32 /** * CPUState: @@ -407,10 +406,6 @@ struct CPUState { /* Use by accel-block: CPU is executing an ioctl() */ QemuLockCnt in_ioctl_lock; - /* Used for events with 'vcpu' and *without* the 'disabled' properties */ - DECLARE_BITMAP(trace_dstate_delayed, CPU_TRACE_DSTATE_MAX_EVENTS); - DECLARE_BITMAP(trace_dstate, CPU_TRACE_DSTATE_MAX_EVENTS); - DECLARE_BITMAP(plugin_mask, QEMU_PLUGIN_EV_MAX); #ifdef CONFIG_PLUGIN diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 0e741960da..4a1dce98ff 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -175,7 +175,6 @@ struct tb_desc { tb_page_addr_t page_addr0; uint32_t flags; uint32_t cflags; - uint32_t trace_vcpu_dstate; }; static bool tb_lookup_cmp(const void *p, const void *d) @@ -187,7 +186,6 @@ static bool tb_lookup_cmp(const void *p, const void *d) tb_page_addr0(tb) == desc->page_addr0 && tb->cs_base == desc->cs_base && tb->flags == desc->flags && - tb->trace_vcpu_dstate == desc->trace_vcpu_dstate && tb_cflags(tb) == desc->cflags) { /* check next page if needed */ tb_page_addr_t tb_phys_page1 = tb_page_addr1(tb); @@ -228,7 +226,6 @@ static TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc, desc.cs_base = cs_base; desc.flags = flags; desc.cflags = cflags; - desc.trace_vcpu_dstate = *cpu->trace_dstate; desc.pc = pc; phys_pc = get_page_addr_code(desc.env, pc); if (phys_pc == -1) { @@ -236,7 +233,7 @@ static TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc, } desc.page_addr0 = phys_pc; h = tb_hash_func(phys_pc, (cflags & CF_PCREL ? 0 : pc), - flags, cflags, *cpu->trace_dstate); + flags, cflags); return qht_lookup_custom(&tb_ctx.htable, &desc, h, tb_lookup_cmp); } @@ -263,7 +260,6 @@ static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc, jc->array[hash].pc == pc && tb->cs_base == cs_base && tb->flags == flags && - tb->trace_vcpu_dstate == *cpu->trace_dstate && tb_cflags(tb) == cflags)) { return tb; } @@ -282,7 +278,6 @@ static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc, tb->pc == pc && tb->cs_base == cs_base && tb->flags == flags && - tb->trace_vcpu_dstate == *cpu->trace_dstate && tb_cflags(tb) == cflags)) { return tb; } diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 991746f80f..bc1961ea55 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -50,7 +50,6 @@ static bool tb_cmp(const void *ap, const void *bp) a->cs_base == b->cs_base && a->flags == b->flags && (tb_cflags(a) & ~CF_INVALID) == (tb_cflags(b) & ~CF_INVALID) && - a->trace_vcpu_dstate == b->trace_vcpu_dstate && tb_page_addr0(a) == tb_page_addr0(b) && tb_page_addr1(a) == tb_page_addr1(b)); } @@ -888,7 +887,7 @@ static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list) /* remove the TB from the hash list */ phys_pc = tb_page_addr0(tb); h = tb_hash_func(phys_pc, (orig_cflags & CF_PCREL ? 0 : tb->pc), - tb->flags, orig_cflags, tb->trace_vcpu_dstate); + tb->flags, orig_cflags); if (!qht_remove(&tb_ctx.htable, tb, h)) { return; } @@ -969,7 +968,7 @@ TranslationBlock *tb_link_page(TranslationBlock *tb, tb_page_addr_t phys_pc, /* add in the hash table */ h = tb_hash_func(phys_pc, (tb->cflags & CF_PCREL ? 0 : tb->pc), - tb->flags, tb->cflags, tb->trace_vcpu_dstate); + tb->flags, tb->cflags); qht_insert(&tb_ctx.htable, tb, h, &existing_tb); /* remove TB from the page(s) if we couldn't insert it */ diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index c87648b99e..bf814b9e81 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -65,11 +65,6 @@ #include "internal.h" #include "perf.h" -/* Make sure all possible CPU event bits fit in tb->trace_vcpu_dstate */ -QEMU_BUILD_BUG_ON(CPU_TRACE_DSTATE_MAX_EVENTS > - sizeof_field(TranslationBlock, trace_vcpu_dstate) - * BITS_PER_BYTE); - TBContext tb_ctx; /* @@ -352,7 +347,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tb->cs_base = cs_base; tb->flags = flags; tb->cflags = cflags; - tb->trace_vcpu_dstate = *cpu->trace_dstate; tb_set_page_addr0(tb, phys_pc); tb_set_page_addr1(tb, -1); tcg_ctx->gen_tb = tb; From patchwork Wed May 31 19:48:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 687291 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1441588wru; Wed, 31 May 2023 12:48:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ73lPsJMJmiOVs6a2N1zj/FqN0C6/GUFSx89fDVN+zvVC0tPpmn3Oz9D6CZd6guuVMScJH+ X-Received: by 2002:a05:620a:2541:b0:75b:23a0:d9e9 with SMTP id s1-20020a05620a254100b0075b23a0d9e9mr6946110qko.63.1685562530624; Wed, 31 May 2023 12:48:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685562530; cv=none; d=google.com; s=arc-20160816; b=FQCe2mRzelGGwsg+4fHldfmYRAK6RUSbKLMurnPyegkZ5rOFBZDwh3D3dpZJg5Inww PY6mCIrRnwyAWDCIQekF7eYdq6f2ea5kb3k+bsxx/CD0mrtBwIATwuYDMJQwaCyqzxU5 cvPA1tHsse5ULic/0hmt52IsPyyJmq9bMU2d3ZHExdmGzvVd4H7cFW6GPYMieG8WYKwS JfURQc3IIf5Bbqs7q+xyf4zZCJqQLvHmidqspgMhD8aFMnRkUvEk7Ozi7JwW8KMvdVia N7UW8m5WG3shvH5XfMIavxB0G4lnbTzBLPs0gT/WwNgjJbS+Y2FtC1glLWviTS3BLkby stQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:sender:errors-to:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to:delivered-to:dkim-signature; bh=c+XyfxTZMzK3ja4GbAtJLCIzXpCGwY8IXwOAZg5IFGI=; b=RfdLBQSfACwPkZ6yUMk2RmiHXqwqZm1Oo5C6zLSvBWPiDrWOKIQS+kg4WkjVIs4DpF PsQWcvfTKuI0iAWjOgvezLi3oloGzikU/LO1IFO3VLI6gnZV1E4Nm/YC5r1o2Q3S4fxO OvyfgvlsbPD6SzGPfZz4Qy2QnBPPZCXmfDWbu789MfbXKTFxQj7dyfxJFkO6ohZmk5mb ZKWoOw1WWK2Pgq3uKO24MwcqhRHSR2LiCG2Pz1EpRFDeokd7jVpzBQ1bBQV2afRL3vbc RbE6NUZxR00LrZW42uIc6hA8tgKWwcGlWWRwDl+ZWQZAMjTRwzf40H0a2NiDfMwE3nRi 7huA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BaGIJV2c; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com. [170.10.133.124]) by mx.google.com with ESMTPS id m23-20020ae9e717000000b0071b2303a52csi8546778qka.752.2023.05.31.12.48.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 12:48:50 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BaGIJV2c; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685562530; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=c+XyfxTZMzK3ja4GbAtJLCIzXpCGwY8IXwOAZg5IFGI=; b=BaGIJV2cHfXxWvePriqTwKntGZliXibuiwhIsRIdrzacOI1IL+VTzNI2gNP4ON85JqO5qQ xo2Gq5nLCxbP8nsIt1Zvbtk8wddE+8hrZkVwXTqHYv4ZjxldQgLRuC+hQogk883eCpr5Wi 5iFT3nu99iy1MjYRuEcr5VKwv/1OHJw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-136-bUvqo0UmPC-mushz5nijag-1; Wed, 31 May 2023 15:48:48 -0400 X-MC-Unique: bUvqo0UmPC-mushz5nijag-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D52358037AD; Wed, 31 May 2023 19:48:44 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id BF6D9112132D; Wed, 31 May 2023 19:48:44 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 921951946A42; Wed, 31 May 2023 19:48:44 +0000 (UTC) X-Original-To: libvir-list@listman.corp.redhat.com Delivered-To: libvir-list@listman.corp.redhat.com Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 05D7819465B1 for ; Wed, 31 May 2023 19:48:44 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id DA9F1140E966; Wed, 31 May 2023 19:48:43 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from localhost (unknown [10.39.192.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F43D140E965; Wed, 31 May 2023 19:48:42 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 10/11] hw/9pfs: use qemu_xxhash4 Date: Wed, 31 May 2023 15:48:14 -0400 Message-Id: <20230531194815.1508961-11-stefanha@redhat.com> In-Reply-To: <20230531194815.1508961-1-stefanha@redhat.com> References: <20230531194815.1508961-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , libvir-list@redhat.com, Kyle Evans , Riku Voipio , Richard Henderson , Greg Kurz , Markus Armbruster , Yanan Wang , Stefan Hajnoczi , Michael Roth , Paolo Bonzini , Christian Schoenebeck , Eric Blake , Warner Losh , Richard Henderson Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Alex Bennée No need to pass zeros as we have helpers that do that for us. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Christian Schoenebeck Reviewed-by: Stefan Hajnoczi Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée Message-id: 20230526165401.574474-11-alex.bennee@linaro.org Message-Id: <20230524133952.3971948-10-alex.bennee@linaro.org> Signed-off-by: Stefan Hajnoczi --- hw/9pfs/9p.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 9621ec1341..991645adca 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -738,15 +738,14 @@ static VariLenAffix affixForIndex(uint64_t index) return invertAffix(&prefix); /* convert prefix to suffix */ } -/* creative abuse of tb_hash_func7, which is based on xxhash */ static uint32_t qpp_hash(QppEntry e) { - return qemu_xxhash7(e.ino_prefix, e.dev, 0, 0, 0); + return qemu_xxhash4(e.ino_prefix, e.dev); } static uint32_t qpf_hash(QpfEntry e) { - return qemu_xxhash7(e.ino, e.dev, 0, 0, 0); + return qemu_xxhash4(e.ino, e.dev); } static bool qpd_cmp_func(const void *obj, const void *userp) From patchwork Wed May 31 19:48:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 687292 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1441603wru; Wed, 31 May 2023 12:48:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ftd/DyclqMWQMsmqZcrJdMT8t6ED8lg5Y+fFZgMUGhz3SRTHlNBTHGeIN2hSk85O+ftS2 X-Received: by 2002:a05:620a:4041:b0:75b:23a0:de9d with SMTP id i1-20020a05620a404100b0075b23a0de9dmr9872210qko.27.1685562532772; Wed, 31 May 2023 12:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685562532; cv=none; d=google.com; s=arc-20160816; b=o3I4wlECqsFUIzv6bFubbx+LMohaclci/JBpYNTSlAJlrN7sLGgRdU5RmP/6b9U4bx 595isR2tq2EWa3hnPk5Zo9rfeTqLVwffjgsW1X/hXr4CwkHq2tTi0Ehv4Eh2aQ3qxUFQ TYZEj5+p0hxa6vm4ZlwFcVu/riZHR09U/WFIQICt/fPlkx9Td0194VdaLsic+d2jvusf Siydksdo2L0Gt1WmApEXm0l0p/HXrjSnKfOMzrlryM9lDIThsP0parmoVnQ8sF8G2Dgy eXtYrBu4taIMip8UAlFU+LC+268yXLhX4KJ4TD+YhDf1yYA7rcd8w74Ici/sWxZ++JXH bX2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:sender:errors-to:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to:delivered-to:dkim-signature; bh=l0bRHaw6a/XCO9x1BsFkywdp6jnak01uQbrcuI2sOX0=; b=kv90Y6ywOKmOTmIQAXuV8ktg+DtV/cBSVOhNpYxmzn0qlbNwSk/cVs+ls93rsOB4UQ TatV1Rpmixyg4oMWQ/Edyu/SPPgVFge0DqQjr/Un46vLMG+QHfkghNbZdZEHc4Gr5EAi HF7T36I3XjuSbE5ZYi+LOIbsP3OTodT7N4ECVvEuWj0+Vvaegc+NVqlPken7QNL0OYAW IWTiSO7YyVtvu8BMF279Aa8JC+/cL6kGG8iHvZ8mX6sqf2Ct976S4hJjwf6mFo7E1QHW DihqG+qoPg/AS1kLyDim5qEUwm3bL2XLO49otylGkkviyqu1x4Q7wZlEOISkkfSCxFzn 5Gqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VRcmuaYT; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com. [170.10.129.124]) by mx.google.com with ESMTPS id o16-20020ae9f510000000b0075cddc29768si5713337qkg.738.2023.05.31.12.48.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 12:48:52 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VRcmuaYT; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685562532; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=l0bRHaw6a/XCO9x1BsFkywdp6jnak01uQbrcuI2sOX0=; b=VRcmuaYTlnPobOGrX1ILuh1XVz4zGcgxm9Mj+nUp0uE19VqOOl2R0P4sR5ypCTCk0JKnyo 3rnnhNzLe3529b4+dciQaKv86B70Mz7eW53BgRQjUXpwb7maHkyRs8KW4sjCBxwBXbC7fx cvpE6ktfI1n0eQ8ois/bi4iz3JSLw1I= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-119-_ftDExK8ORyTwy6G32K19A-1; Wed, 31 May 2023 15:48:49 -0400 X-MC-Unique: _ftDExK8ORyTwy6G32K19A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 24DC1811E78; Wed, 31 May 2023 19:48:47 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D6B92166B25; Wed, 31 May 2023 19:48:47 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E6F6019465B6; Wed, 31 May 2023 19:48:46 +0000 (UTC) X-Original-To: libvir-list@listman.corp.redhat.com Delivered-To: libvir-list@listman.corp.redhat.com Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3946619465BB for ; Wed, 31 May 2023 19:48:46 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 292692166B29; Wed, 31 May 2023 19:48:46 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from localhost (unknown [10.39.192.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94F332166B25; Wed, 31 May 2023 19:48:45 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PULL 11/11] accel/tcg: include cs_base in our hash calculations Date: Wed, 31 May 2023 15:48:15 -0400 Message-Id: <20230531194815.1508961-12-stefanha@redhat.com> In-Reply-To: <20230531194815.1508961-1-stefanha@redhat.com> References: <20230531194815.1508961-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , libvir-list@redhat.com, Kyle Evans , Riku Voipio , Richard Henderson , Greg Kurz , Markus Armbruster , Yanan Wang , Stefan Hajnoczi , Michael Roth , Paolo Bonzini , Christian Schoenebeck , Eric Blake , Warner Losh , Richard Henderson Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com From: Alex Bennée We weren't using cs_base in the hash calculations before. Since the arm front end moved a chunk of flags in a378206a20 (target/arm: Move mode specific TB flags to tb->cs_base) they comprise of an important part of the execution state. Widen the tb_hash_func to include cs_base and expand to qemu_xxhash8() to accommodate it. My initial benchmark shows very little difference in the runtime. Before: armhf ➜ hyperfine -w 2 -m 20 "./arm-softmmu/qemu-system-arm -cpu cortex-a15 -machine type=virt,highmem=off -display none -m 2048 -serial mon:stdio -netdev user,id=unet,hostfwd=tcp::2222-:22 -device virtio-net-pci,netdev=unet -device virtio-scsi-pci -blockdev driver=raw,node-name=hd,discard=unmap,file.driver=host_device,file.filename=/dev/zen-disk/debian-bullseye-armhf -device scsi-hd,drive=hd -smp 4 -kernel /home/alex/lsrc/linux.git/builds/arm/arch/arm/boot/zImage -append 'console=ttyAMA0 root=/dev/sda2 systemd.unit=benchmark.service' -snapshot" Benchmark 1: ./arm-softmmu/qemu-system-arm -cpu cortex-a15 -machine type=virt,highmem=off -display none -m 2048 -serial mon:stdio -netdev user,id=unet,hostfwd=tcp::2222-:22 -device virtio-net-pci,netdev=unet -device virtio-scsi-pci -blockdev driver=raw,node-name=hd,discard=unmap,file.driver=host_device,file.filename=/dev/zen-disk/debian-bullseye-armhf -device scsi-hd,drive=hd -smp 4 -kernel /home/alex/lsrc/linux.git/builds/arm/arch/arm/boot/zImage -append 'console=ttyAMA0 root=/dev/sda2 systemd.unit=benchmark.service' -snapshot Time (mean ± σ): 24.627 s ± 2.708 s [User: 34.309 s, System: 1.797 s] Range (min … max): 22.345 s … 29.864 s 20 runs arm64 ➜ hyperfine -w 2 -n 20 "./qemu-system-aarch64 -cpu max,pauth-impdef=on -machine type=virt,virtualization=on,gic-version=3 -display none -serial mon:stdio -netdev user,id=unet,hostfwd=tcp::2222-:22,hostfwd=tcp::1234-:1234 -device virtio-net-pci,netdev=unet -device virtio-scsi-pci -blockdev driver=raw,node-name=hd,discard=unmap,file.driver=host_device,file.filename=/dev/zen-disk/debian-bullseye-arm64 -device scsi-hd,drive=hd -smp 4 -kernel ~/lsrc/linux.git/builds/arm64/arch/arm64/boot/Image.gz -append 'console=ttyAMA0 root=/dev/sda2 systemd.unit=benchmark-pigz.service' -snapshot" Benchmark 1: 20 Time (mean ± σ): 62.559 s ± 2.917 s [User: 189.115 s, System: 4.089 s] Range (min … max): 59.997 s … 70.153 s 10 runs After: armhf Benchmark 1: ./arm-softmmu/qemu-system-arm -cpu cortex-a15 -machine type=virt,highmem=off -display none -m 2048 -serial mon:stdio -netdev user,id=unet,hostfwd=tcp::2222-:22 -device virtio-net-pci,netdev=unet -device virtio-scsi-pci -blockdev driver=raw,node-name=hd,discard=unmap,file.driver=host_device,file.filename=/dev/zen-disk/debian-bullseye-armhf -device scsi-hd,drive=hd -smp 4 -kernel /home/alex/lsrc/linux.git/builds/arm/arch/arm/boot/zImage -append 'console=ttyAMA0 root=/dev/sda2 systemd.unit=benchmark.service' -snapshot Time (mean ± σ): 24.223 s ± 2.151 s [User: 34.284 s, System: 1.906 s] Range (min … max): 22.000 s … 28.476 s 20 runs arm64 hyperfine -w 2 -n 20 "./qemu-system-aarch64 -cpu max,pauth-impdef=on -machine type=virt,virtualization=on,gic-version=3 -display none -serial mon:stdio -netdev user,id=unet,hostfwd=tcp::2222-:22,hostfwd=tcp::1234-:1234 -device virtio-net-pci,netdev=unet -device virtio-scsi-pci -blockdev driver=raw,node-name=hd,discard=unmap,file.driver=host_device,file.filename=/dev/zen-disk/debian-bullseye-arm64 -device scsi-hd,drive=hd -smp 4 -kernel ~/lsrc/linux.git/builds/arm64/arch/arm64/boot/Image.gz -append 'console=ttyAMA0 root=/dev/sda2 systemd.unit=benchmark-pigz.service' -snapshot" Benchmark 1: 20 Time (mean ± σ): 62.769 s ± 1.978 s [User: 188.431 s, System: 5.269 s] Range (min … max): 60.285 s … 66.868 s 10 runs Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Message-id: 20230526165401.574474-12-alex.bennee@linaro.org Message-Id: <20230524133952.3971948-11-alex.bennee@linaro.org> Signed-off-by: Stefan Hajnoczi --- accel/tcg/tb-hash.h | 4 ++-- include/qemu/xxhash.h | 23 +++++++++++++++++------ accel/tcg/cpu-exec.c | 2 +- accel/tcg/tb-maint.c | 4 ++-- util/qsp.c | 2 +- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/accel/tcg/tb-hash.h b/accel/tcg/tb-hash.h index 1d19c69caa..2ba2193731 100644 --- a/accel/tcg/tb-hash.h +++ b/accel/tcg/tb-hash.h @@ -62,9 +62,9 @@ static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc) static inline uint32_t tb_hash_func(tb_page_addr_t phys_pc, target_ulong pc, - uint32_t flags, uint32_t cf_mask) + uint32_t flags, uint64_t flags2, uint32_t cf_mask) { - return qemu_xxhash6(phys_pc, pc, flags, cf_mask); + return qemu_xxhash8(phys_pc, pc, flags2, flags, cf_mask); } #endif diff --git a/include/qemu/xxhash.h b/include/qemu/xxhash.h index c2dcccadbf..0259bbef18 100644 --- a/include/qemu/xxhash.h +++ b/include/qemu/xxhash.h @@ -48,8 +48,8 @@ * xxhash32, customized for input variables that are not guaranteed to be * contiguous in memory. */ -static inline uint32_t -qemu_xxhash7(uint64_t ab, uint64_t cd, uint32_t e, uint32_t f, uint32_t g) +static inline uint32_t qemu_xxhash8(uint64_t ab, uint64_t cd, uint64_t ef, + uint32_t g, uint32_t h) { uint32_t v1 = QEMU_XXHASH_SEED + PRIME32_1 + PRIME32_2; uint32_t v2 = QEMU_XXHASH_SEED + PRIME32_2; @@ -59,6 +59,8 @@ qemu_xxhash7(uint64_t ab, uint64_t cd, uint32_t e, uint32_t f, uint32_t g) uint32_t b = ab >> 32; uint32_t c = cd; uint32_t d = cd >> 32; + uint32_t e = ef; + uint32_t f = ef >> 32; uint32_t h32; v1 += a * PRIME32_2; @@ -89,6 +91,9 @@ qemu_xxhash7(uint64_t ab, uint64_t cd, uint32_t e, uint32_t f, uint32_t g) h32 += g * PRIME32_3; h32 = rol32(h32, 17) * PRIME32_4; + h32 += h * PRIME32_3; + h32 = rol32(h32, 17) * PRIME32_4; + h32 ^= h32 >> 15; h32 *= PRIME32_2; h32 ^= h32 >> 13; @@ -100,23 +105,29 @@ qemu_xxhash7(uint64_t ab, uint64_t cd, uint32_t e, uint32_t f, uint32_t g) static inline uint32_t qemu_xxhash2(uint64_t ab) { - return qemu_xxhash7(ab, 0, 0, 0, 0); + return qemu_xxhash8(ab, 0, 0, 0, 0); } static inline uint32_t qemu_xxhash4(uint64_t ab, uint64_t cd) { - return qemu_xxhash7(ab, cd, 0, 0, 0); + return qemu_xxhash8(ab, cd, 0, 0, 0); } static inline uint32_t qemu_xxhash5(uint64_t ab, uint64_t cd, uint32_t e) { - return qemu_xxhash7(ab, cd, e, 0, 0); + return qemu_xxhash8(ab, cd, 0, e, 0); } static inline uint32_t qemu_xxhash6(uint64_t ab, uint64_t cd, uint32_t e, uint32_t f) { - return qemu_xxhash7(ab, cd, e, f, 0); + return qemu_xxhash8(ab, cd, 0, e, f); +} + +static inline uint32_t qemu_xxhash7(uint64_t ab, uint64_t cd, uint64_t ef, + uint32_t g) +{ + return qemu_xxhash8(ab, cd, ef, g, 0); } /* diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 4a1dce98ff..60ca9e229e 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -233,7 +233,7 @@ static TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc, } desc.page_addr0 = phys_pc; h = tb_hash_func(phys_pc, (cflags & CF_PCREL ? 0 : pc), - flags, cflags); + flags, cs_base, cflags); return qht_lookup_custom(&tb_ctx.htable, &desc, h, tb_lookup_cmp); } diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index bc1961ea55..892eecda2d 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -887,7 +887,7 @@ static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list) /* remove the TB from the hash list */ phys_pc = tb_page_addr0(tb); h = tb_hash_func(phys_pc, (orig_cflags & CF_PCREL ? 0 : tb->pc), - tb->flags, orig_cflags); + tb->flags, tb->cs_base, orig_cflags); if (!qht_remove(&tb_ctx.htable, tb, h)) { return; } @@ -968,7 +968,7 @@ TranslationBlock *tb_link_page(TranslationBlock *tb, tb_page_addr_t phys_pc, /* add in the hash table */ h = tb_hash_func(phys_pc, (tb->cflags & CF_PCREL ? 0 : tb->pc), - tb->flags, tb->cflags); + tb->flags, tb->cs_base, tb->cflags); qht_insert(&tb_ctx.htable, tb, h, &existing_tb); /* remove TB from the page(s) if we couldn't insert it */ diff --git a/util/qsp.c b/util/qsp.c index 8562b14a87..2fe3764906 100644 --- a/util/qsp.c +++ b/util/qsp.c @@ -144,7 +144,7 @@ uint32_t do_qsp_callsite_hash(const QSPCallSite *callsite, uint64_t ab) uint32_t e = callsite->line; uint32_t f = callsite->type; - return qemu_xxhash6(ab, cd, e, f); + return qemu_xxhash8(ab, cd, 0, e, f); } static inline