From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612995220; cv=none; d=zohomail.com; s=zohoarc; b=GRnFPGEL4CUxH5Mux72pjkIwCgy+XvZmSgkL7b1X1OyoUIutC8gTz146XqR2ISrpduM7b1uFaTmPSsoX6dLFVZlHH0CoIi1QmCKtDfzNGoCEFNwW03vn1v2lZk9FjTGmnEh4RvjLeoXjLKjofX1sj0amuYwHhAynSvQhilnc1NU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612995220; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jmoVvCJIZ5hgn5Z6/1kOCx1zfxEb1vqsWzWnY3mB7y4=; b=e2AlULfnsOAX5Lq5aoriaKjLXh5+AZRYlcZibHul27LyHgi/vBrt4P4HSsSLrLkPdFcGMIvWwl4lS9IpgOO6dBcdbraDkDuXFNC3r1yc73RrosYSbyHj5F7yCaTNiiEVNP7XtsGUI5HNkf3keU3rVLPX9MwraaxtGzDlphuT2iE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161299522053196.28160119590052; Wed, 10 Feb 2021 14:13:40 -0800 (PST) Received: from localhost ([::1]:52422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xju-0007cn-4h for importer@patchew.org; Wed, 10 Feb 2021 17:13:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xhM-0005tf-3W for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:00 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:55736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xhJ-0003Bm-L1 for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:10:59 -0500 Received: by mail-wm1-x332.google.com with SMTP id o15so1414082wmq.5 for ; Wed, 10 Feb 2021 14:10:56 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id z63sm5137411wme.8.2021.02.10.14.10.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:10:54 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 939901FF87; Wed, 10 Feb 2021 22:10:53 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jmoVvCJIZ5hgn5Z6/1kOCx1zfxEb1vqsWzWnY3mB7y4=; b=DqHSKAKTmho5ktC2M0s65TCYaACCF29xxddGi9+tt+v6M8G3DV8OPXrV/IKMYzXdZN NXZtboATRYSenbU6YZmLuJ9bKpzD2CraP74TeU5y7H2qXRzoiAQ+39lyV7GVWZjG2GuZ ptdrqImjzRcX5ZGbq6XcYD27nN54gRPZYHXdbTd330imoDXhpHj3P963+bHus8wB8J+E Gn48RibY4GuVG6n/1dTk4+qxsmh8m+sgF1WGbEYB2zcuCU6xOKuot9lJdnG2xJMnw/3Z DTOC0fiynvznv4z8B2yUMLzoW2Dua/k9TRg6xvcLUXSZfHLEn9EfP7bF8m8IHhDAUDhG mO5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jmoVvCJIZ5hgn5Z6/1kOCx1zfxEb1vqsWzWnY3mB7y4=; b=PlXjtHCkto9ADf7uvH1F2d4SMGUCx1JxsxL2yQO0WmQMDGTqkwxeq0jjHGQ6c//aPa FZsCIftEFlNKtQy53+InKxjIJvGK4RL/P7YDhLz9MDXmIHiysVMEZBshMUi/nrssVL8Q gAEadWwNH3Gb9hELTmQBMOpzYbIlrG8zIZbRnTuWytjRIBbnV/mVos+vKsEY2L4JoY2m X0TBP1k9fNsAv080Rgn8QcCgEP23xNS/GH3CIW/x7C8OvmsB4scqsllWoucLTxdP7REQ 7qQeCyL81nDoU50sqRHZy3AE5U8RaOt0SqUgMkEhzue4BygElQRV/6GNBWs9t745wEx6 Bqrg== X-Gm-Message-State: AOAM531ZATpCG3Ff3E/tZwLzqd91nz7XJ3llh2hZ924P4/r1gOC7BFii /guagPs8FKLzxDlpD7ija3Ifag== X-Google-Smtp-Source: ABdhPJxMjNPMg+XROeLITWcloSddEEByq8qQ8GoNF031i0ipwmUIq8VspiemAvNtWITL9+8v3ZkYJQ== X-Received: by 2002:a1c:b156:: with SMTP id a83mr1137663wmf.11.1612995055939; Wed, 10 Feb 2021 14:10:55 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 01/21] hw/virtio/pci: include vdev name in registered PCI sections Date: Wed, 10 Feb 2021 22:10:33 +0000 Message-Id: <20210210221053.18050-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Michael S . Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) When viewing/debugging memory regions it is sometimes hard to figure out which PCI device something belongs to. Make the names unique by including the vdev name in the name string. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin Message-Id: <20200713200415.26214-10-alex.bennee@linaro.org> --- hw/virtio/virtio-pci.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 094c36aa3e..883045a223 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1423,7 +1423,8 @@ static void virtio_pci_device_write(void *opaque, hwa= ddr addr, } } =20 -static void virtio_pci_modern_regions_init(VirtIOPCIProxy *proxy) +static void virtio_pci_modern_regions_init(VirtIOPCIProxy *proxy, + const char *vdev_name) { static const MemoryRegionOps common_ops =3D { .read =3D virtio_pci_common_read, @@ -1470,36 +1471,41 @@ static void virtio_pci_modern_regions_init(VirtIOPC= IProxy *proxy) }, .endianness =3D DEVICE_LITTLE_ENDIAN, }; + g_autoptr(GString) name =3D g_string_new(NULL); =20 - + g_string_printf(name, "virtio-pci-common-%s", vdev_name); memory_region_init_io(&proxy->common.mr, OBJECT(proxy), &common_ops, proxy, - "virtio-pci-common", + name->str, proxy->common.size); =20 + g_string_printf(name, "virtio-pci-isr-%s", vdev_name); memory_region_init_io(&proxy->isr.mr, OBJECT(proxy), &isr_ops, proxy, - "virtio-pci-isr", + name->str, proxy->isr.size); =20 + g_string_printf(name, "virtio-pci-device-%s", vdev_name); memory_region_init_io(&proxy->device.mr, OBJECT(proxy), &device_ops, proxy, - "virtio-pci-device", + name->str, proxy->device.size); =20 + g_string_printf(name, "virtio-pci-notify-%s", vdev_name); memory_region_init_io(&proxy->notify.mr, OBJECT(proxy), ¬ify_ops, proxy, - "virtio-pci-notify", + name->str, proxy->notify.size); =20 + g_string_printf(name, "virtio-pci-notify-pio-%s", vdev_name); memory_region_init_io(&proxy->notify_pio.mr, OBJECT(proxy), ¬ify_pio_ops, proxy, - "virtio-pci-notify-pio", + name->str, proxy->notify_pio.size); } =20 @@ -1654,7 +1660,7 @@ static void virtio_pci_device_plugged(DeviceState *d,= Error **errp) =20 struct virtio_pci_cfg_cap *cfg_mask; =20 - virtio_pci_modern_regions_init(proxy); + virtio_pci_modern_regions_init(proxy, vdev->name); =20 virtio_pci_modern_mem_region_map(proxy, &proxy->common, &cap); virtio_pci_modern_mem_region_map(proxy, &proxy->isr, &cap); --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612996067; cv=none; d=zohomail.com; s=zohoarc; b=AltQfCHWXVb0I+xU8sc7voqbkQaUNP5idNi3vS8xIQAelBLkZ89DpNz1tseUvQu6lHADz3GTKfpq+CIwng53zCCLg3KUcgqpnhC+tuL956XlKcj6ukrzX+qSJi70XieZHhDty7X6WEmNu6Nn6eCse+cufyHoPTC58cADGuaqL4k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612996067; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=y0m7VVtf4raaNuNx2ajjykIh+1usimL3d/eZHQe+IRc=; b=H8pYZFI5ldmTtDexwAkf9vwnqbKn2BwOiriBnUjIn3+JOr/WqF9DW6SdQSGleLIlXo/upMYIn3mMidmGSUBB4WEbaNPgH1+4xbR6I/qcev9UkbfmCAVZwi6tQFUsoxURhjmPuoiY2GTH9TCUSIg8GKqbYQCHP5EUVUiWOyAi77g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16129960669531018.9845835387747; Wed, 10 Feb 2021 14:27:46 -0800 (PST) Received: from localhost ([::1]:55418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xxZ-0005Iu-O9 for importer@patchew.org; Wed, 10 Feb 2021 17:27:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56680) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xhR-0005vM-Dg for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:06 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:51418) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xhM-0003CC-IY for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:04 -0500 Received: by mail-wm1-x32a.google.com with SMTP id t142so3200000wmt.1 for ; Wed, 10 Feb 2021 14:10:59 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id t197sm17939984wmt.3.2021.02.10.14.10.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:10:54 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id ADF7E1FF8C; Wed, 10 Feb 2021 22:10:53 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=y0m7VVtf4raaNuNx2ajjykIh+1usimL3d/eZHQe+IRc=; b=Pv4k8SK356+dY5TXKSodwj3Ot+IS+03+aEIHJkkKnbInzlySRFq1LxDDxKgfLu91NH SgG7N5hQcuzqwA4sWhcwiica8A1oG7eAaQIfqBaE6XVY4Qd7K79mMTA2T7R9M8GjvMIu GZqecjZUpQ2XzvJ0QgAwKxN4BPRxVe/mTH9hlLukTs2M3cz6xrX8eNsikXGuIlA60rfm l+BiedjPSWpsFGpbjiyx0EZbfyCtEtcIeLm5Mw0w/I9cJ99SXQL/SycG8FUDttTDLm3n epA2xNn2hp9lZ3Xaqxk+4jL5Bi4DCGV0wVXPrc2ALzgzTQYzVRN1yWK3I10FXEMt9Ivx S9wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y0m7VVtf4raaNuNx2ajjykIh+1usimL3d/eZHQe+IRc=; b=td9o0VQLAEKFGudDH0Sdxl0xO5cW3XWLGxXt4Ei/3udj8qYcT/RrqsuGJb8VSvyoB9 /GESQhdm0ZPktXD9ahvd8VgqaJ17UzKBolpkmTvBQcZhTRaK7jGzj8S7hPejUazripBP RjSL5MyN42ARru25VJuJZEsimPF4ZXEo198m0mG5YNOx4jKA2p31FwpKTNkIdnwplfCV tw9JyaI6QX0lwbuc+Bl1bgQHmVp1x3PpWtt2vMWED7cP9Rll14UQbTqkxlrfa/NMdTJp Ly15ZRiNp7Odx0ILt+Id26a3KbJYcNlU9Ima1VwX1EoFjvIR6PCE6yisnEXuLAcp7ON6 /9+A== X-Gm-Message-State: AOAM533xogYvGC7A/QdUYwf8+aJtXeI2ja0m5j35zg4r09RjsJgjGhr6 xVtcaYpWpgjHe8qhkYl8gUwcBA== X-Google-Smtp-Source: ABdhPJwV28jEJ/vxmWZIaE1a7uMgPNT0PEM89crf99StLgMRmDJ/Gyqvxdv6WaFsQDotStsAy1VJUQ== X-Received: by 2002:a1c:bcc3:: with SMTP id m186mr1184901wmf.165.1612995057840; Wed, 10 Feb 2021 14:10:57 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 02/21] plugins: add API to return a name for a IO device Date: Wed, 10 Feb 2021 22:10:34 +0000 Message-Id: <20210210221053.18050-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, Clement Deschamps , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This may well end up being anonymous but it should always be unique. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Clement Deschamps Reviewed-by: Emilio G. Cota Reviewed-by: Richard Henderson Message-Id: <20200713200415.26214-11-alex.bennee@linaro.org> --- v4 - use g_intern_static_string for static strings --- include/qemu/qemu-plugin.h | 6 ++++++ plugins/api.c | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 5775e82c4e..c66507fe8f 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -330,6 +330,12 @@ struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu= _plugin_meminfo_t info, bool qemu_plugin_hwaddr_is_io(const struct qemu_plugin_hwaddr *haddr); uint64_t qemu_plugin_hwaddr_device_offset(const struct qemu_plugin_hwaddr = *haddr); =20 +/* + * Returns a string representing the device. The string is valid for + * the lifetime of the plugin. + */ +const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr= *h); + typedef void (*qemu_plugin_vcpu_mem_cb_t)(unsigned int vcpu_index, qemu_plugin_meminfo_t info, uint64_t vaddr, diff --git a/plugins/api.c b/plugins/api.c index bbdc5a4eb4..5dc8e6f934 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -303,6 +303,26 @@ uint64_t qemu_plugin_hwaddr_device_offset(const struct= qemu_plugin_hwaddr *haddr return 0; } =20 +const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr= *h) +{ +#ifdef CONFIG_SOFTMMU + if (h && h->is_io) { + MemoryRegionSection *mrs =3D h->v.io.section; + if (!mrs->mr->name) { + unsigned long maddr =3D 0xffffffff & (uintptr_t) mrs->mr; + g_autofree char *temp =3D g_strdup_printf("anon%08lx", maddr); + return g_intern_string(temp); + } else { + return g_intern_string(mrs->mr->name); + } + } else { + return g_intern_static_string("RAM"); + } +#else + return g_intern_static_string("Invalid"); +#endif +} + /* * Queries to the number and potential maximum number of vCPUs there * will be. This helps the plugin dimension per-vcpu arrays. --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612995888; cv=none; d=zohomail.com; s=zohoarc; b=fsozB4zthLeraUeLYm17s391ajmUbfUjzWV/9nOhEhwABBW/xl22AJvUGXQ+Z+Oopj1fGcbw+Pj8+Rol9SuaNMKZ1zhsM3iBWsvsrrETvTBJaXjJydGWnVoZOu/IwbT9oydFFzIP1V7AE1LPGJq+ZDhgl8G9zUhD8z9nbPRGr7M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612995888; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cA1mms/KC7D4GEashRpyD31vpirMAJEbz5RpC4ZLHNc=; b=dMjEmtVKqITIxRscUFmNYpgBNggxCS+YV8vSiLsambW7d3iulWAeJ95FksJ47QwdRDbXF0wgUcRrwE+hnqjXySkwu5O8KVD6jxb3TugPafb/1AwibDs1oliPAx8wTbGPvvJunLBfboDN5I/lOwlL89W7RcBrMGB/3EvHaixA3+Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161299588826489.42326290813548; Wed, 10 Feb 2021 14:24:48 -0800 (PST) Received: from localhost ([::1]:49328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xug-00024M-OS for importer@patchew.org; Wed, 10 Feb 2021 17:24:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xhb-0006BQ-2C for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:15 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:50619) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xhO-0003DM-A1 for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:14 -0500 Received: by mail-wm1-x334.google.com with SMTP id 190so3197766wmz.0 for ; Wed, 10 Feb 2021 14:11:00 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id j17sm4536846wmc.28.2021.02.10.14.10.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:10:56 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id CB42D1FF8F; Wed, 10 Feb 2021 22:10:53 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cA1mms/KC7D4GEashRpyD31vpirMAJEbz5RpC4ZLHNc=; b=b45mrV1t6o43kheVyTrkaCTikMh1zbavGNZDTu9wfKjqCWugBEpyoxxzpuMyZKYCVN qNgiYRBNi+4fq3qi7OrU0yADLkluKClWuDpY1TuZnNGclJ+sUIhlHFiEs3AhEfjTS7Tz oUEHpFYZNMLo0lEgYhRvsiaBBzG/yh5BdJ3FXc4xIO+IxZCAcMUQ+3vNvDxt8PDqvDZL +T6E8lvDDHbJwDYoEonoVrBW8qKzzE4D2riCJSs/IsGN17NxPDIl1MvYNxeIJKFGcGaQ lpJ4KAzmhGgIYpsGFE7BZFeOO11fNJs5gWPwLX+8Ijpc6XYlnGKrjqia0Ao0v2erDwBU mYkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cA1mms/KC7D4GEashRpyD31vpirMAJEbz5RpC4ZLHNc=; b=dcfcjJeXcSKu7wY3xwwmBbcx3WJ3G15yLGD5VpBIG9sj8ugs4gR9DV4oBoGsgxZ111 y6WtlTVoeG5PlsbWCK/UF8ozA0PddwfmZYy9hYcKDwRJRnknUr0r5slwWls0C+VybElm lE7vT+aRey07646v+JtCSKHORQ3B8zD/bH/8nx1QmtLeV8+PY0nwjsGVRk0epz9PNwHn G2eXF7wHRrbUxRZfOZEkKZwZfIUSI9+kgXk5drJ5Mr4xtUTAmB6ehjQWmDH4Ios79ZQJ yOVo2tmk9yUpTJeFVxYK4c8hv5HMSfZ0cIStBkh+WymJ369m0lYaXnjM89XoWQatRovi IHDA== X-Gm-Message-State: AOAM532vCA4cMGSwjhcFftdyYPSVkFDdfiYX7ZxAaVGdUPUA5Jie2FLQ ZxewkJ8qp7yOgn7e6pCyyNXngA== X-Google-Smtp-Source: ABdhPJwyX8q+56hR9eWrWDUV/aK9W212eYVGarmElb48B7qw7V+56U5Qccdmj1XhkjxmkQoAsK4pgw== X-Received: by 2002:a1c:c904:: with SMTP id f4mr1233652wmb.14.1612995059599; Wed, 10 Feb 2021 14:10:59 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 03/21] plugins: new hwprofile plugin Date: Wed, 10 Feb 2021 22:10:35 +0000 Message-Id: <20210210221053.18050-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robert Foley , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This is a plugin intended to help with profiling access to various bits of system hardware. It only really makes sense for system emulation. It takes advantage of the recently exposed helper API that allows us to see the device name (memory region name) associated with a device. You can specify arg=3Dread or arg=3Dwrite to limit the tracking to just reads or writes (by default it does both). The pattern option: -plugin ./tests/plugin/libhwprofile.so,arg=3Dpattern will allow you to see the access pattern to devices, eg: gic_cpu @ 0xffffffc010040000 off:00000000, 8, 1, 8, 1 off:00000000, 4, 1, 4, 1 off:00000000, 2, 1, 2, 1 off:00000000, 1, 1, 1, 1 The source option: -plugin ./tests/plugin/libhwprofile.so,arg=3Dsource will track the virtual source address of the instruction making the access: pl011 @ 0xffffffc010031000 pc:ffffffc0104c785c, 1, 4, 0, 0 pc:ffffffc0104c7898, 1, 4, 0, 0 pc:ffffffc010512bcc, 2, 1867, 0, 0 You cannot mix source and pattern. Finally the match option allow you to limit the tracking to just the devices you care about. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Robert Foley Tested-by: Robert Foley Message-Id: <20200713200415.26214-12-alex.bennee@linaro.org> --- vN - add some notes to tcg-plugins.rst --- docs/devel/tcg-plugins.rst | 34 ++++ contrib/plugins/hwprofile.c | 305 ++++++++++++++++++++++++++++++++++++ contrib/plugins/Makefile | 1 + 3 files changed, 340 insertions(+) create mode 100644 contrib/plugins/hwprofile.c diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst index 0568dfa6a4..39ce86ed96 100644 --- a/docs/devel/tcg-plugins.rst +++ b/docs/devel/tcg-plugins.rst @@ -280,3 +280,37 @@ which will eventually report:: previously @ 0x000000ffd08098/5 (809900593 insns) previously @ 0x000000ffd080c0/1 (809900588 insns) =20 +- contrib/plugins/hwprofile + +The hwprofile tool can only be used with system emulation and allows +the user to see what hardware is accessed how often. It has a number of op= tions: + + * arg=3Dread or arg=3Dwrite + + By default the plugin tracks both reads and writes. You can use one + of these options to limit the tracking to just one class of accesses. + + * arg=3Dsource + + Will include a detailed break down of what the guest PC that made the + access was. Not compatible with arg=3Dpattern. Example output:: + + cirrus-low-memory @ 0xfffffd00000a0000 + pc:fffffc0000005cdc, 1, 256 + pc:fffffc0000005ce8, 1, 256 + pc:fffffc0000005cec, 1, 256 + + * arg=3Dpattern + + Instead break down the accesses based on the offset into the HW + region. This can be useful for seeing the most used registers of a + device. Example output:: + + pci0-conf @ 0xfffffd01fe000000 + off:00000004, 1, 1 + off:00000010, 1, 3 + off:00000014, 1, 3 + off:00000018, 1, 2 + off:0000001c, 1, 2 + off:00000020, 1, 2 + ... diff --git a/contrib/plugins/hwprofile.c b/contrib/plugins/hwprofile.c new file mode 100644 index 0000000000..6dac1d5f85 --- /dev/null +++ b/contrib/plugins/hwprofile.c @@ -0,0 +1,305 @@ +/* + * Copyright (C) 2020, Alex Benn=C3=A9e + * + * HW Profile - breakdown access patterns for IO to devices + * + * License: GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +QEMU_PLUGIN_EXPORT int qemu_plugin_version =3D QEMU_PLUGIN_VERSION; + +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + +typedef struct { + uint64_t cpu_read; + uint64_t cpu_write; + uint64_t reads; + uint64_t writes; +} IOCounts; + +typedef struct { + uint64_t off_or_pc; + IOCounts counts; +} IOLocationCounts; + +typedef struct { + const char *name; + uint64_t base; + IOCounts totals; + GHashTable *detail; +} DeviceCounts; + +static GMutex lock; +static GHashTable *devices; + +/* track the access pattern to a piece of HW */ +static bool pattern; +/* track the source address of access to HW */ +static bool source; +/* track only matched regions of HW */ +static bool check_match; +static gchar **matches; + +static enum qemu_plugin_mem_rw rw =3D QEMU_PLUGIN_MEM_RW; + +static inline bool track_reads(void) +{ + return rw =3D=3D QEMU_PLUGIN_MEM_RW || rw =3D=3D QEMU_PLUGIN_MEM_R; +} + +static inline bool track_writes(void) +{ + return rw =3D=3D QEMU_PLUGIN_MEM_RW || rw =3D=3D QEMU_PLUGIN_MEM_W; +} + +static void plugin_init(void) +{ + devices =3D g_hash_table_new(NULL, NULL); +} + +static gint sort_cmp(gconstpointer a, gconstpointer b) +{ + DeviceCounts *ea =3D (DeviceCounts *) a; + DeviceCounts *eb =3D (DeviceCounts *) b; + return ea->totals.reads + ea->totals.writes > + eb->totals.reads + eb->totals.writes ? -1 : 1; +} + +static gint sort_loc(gconstpointer a, gconstpointer b) +{ + IOLocationCounts *ea =3D (IOLocationCounts *) a; + IOLocationCounts *eb =3D (IOLocationCounts *) b; + return ea->off_or_pc > eb->off_or_pc; +} + +static void fmt_iocount_record(GString *s, IOCounts *rec) +{ + if (track_reads()) { + g_string_append_printf(s, ", %"PRIx64", %"PRId64, + rec->cpu_read, rec->reads); + } + if (track_writes()) { + g_string_append_printf(s, ", %"PRIx64", %"PRId64, + rec->cpu_write, rec->writes); + } +} + +static void fmt_dev_record(GString *s, DeviceCounts *rec) +{ + g_string_append_printf(s, "%s, 0x%"PRIx64, + rec->name, rec->base); + fmt_iocount_record(s, &rec->totals); + g_string_append_c(s, '\n'); +} + +static void plugin_exit(qemu_plugin_id_t id, void *p) +{ + g_autoptr(GString) report =3D g_string_new(""); + GList *counts; + + if (!(pattern || source)) { + g_string_printf(report, "Device, Address"); + if (track_reads()) { + g_string_append_printf(report, ", RCPUs, Reads"); + } + if (track_writes()) { + g_string_append_printf(report, ", WCPUs, Writes"); + } + g_string_append_c(report, '\n'); + } + + counts =3D g_hash_table_get_values(devices); + if (counts && g_list_next(counts)) { + GList *it; + + it =3D g_list_sort(counts, sort_cmp); + + while (it) { + DeviceCounts *rec =3D (DeviceCounts *) it->data; + if (rec->detail) { + GList *accesses =3D g_hash_table_get_values(rec->detail); + GList *io_it =3D g_list_sort(accesses, sort_loc); + const char *prefix =3D pattern ? "off" : "pc"; + g_string_append_printf(report, "%s @ 0x%"PRIx64"\n", + rec->name, rec->base); + while (io_it) { + IOLocationCounts *loc =3D (IOLocationCounts *) io_it->= data; + g_string_append_printf(report, " %s:%08"PRIx64, + prefix, loc->off_or_pc); + fmt_iocount_record(report, &loc->counts); + g_string_append_c(report, '\n'); + io_it =3D io_it->next; + } + } else { + fmt_dev_record(report, rec); + } + it =3D it->next; + }; + g_list_free(it); + } + + qemu_plugin_outs(report->str); +} + +static DeviceCounts *new_count(const char *name, uint64_t base) +{ + DeviceCounts *count =3D g_new0(DeviceCounts, 1); + count->name =3D name; + count->base =3D base; + if (pattern || source) { + count->detail =3D g_hash_table_new(NULL, NULL); + } + g_hash_table_insert(devices, (gpointer) name, count); + return count; +} + +static IOLocationCounts *new_location(GHashTable *table, uint64_t off_or_p= c) +{ + IOLocationCounts *loc =3D g_new0(IOLocationCounts, 1); + loc->off_or_pc =3D off_or_pc; + g_hash_table_insert(table, (gpointer) off_or_pc, loc); + return loc; +} + +static void hwprofile_match_hit(DeviceCounts *rec, uint64_t off) +{ + g_autoptr(GString) report =3D g_string_new("hwprofile: match @ offset"= ); + g_string_append_printf(report, "%"PRIx64", previous hits\n", off); + fmt_dev_record(report, rec); + qemu_plugin_outs(report->str); +} + +static void inc_count(IOCounts *count, bool is_write, unsigned int cpu_ind= ex) +{ + if (is_write) { + count->writes++; + count->cpu_write |=3D (1 << cpu_index); + } else { + count->reads++; + count->cpu_read |=3D (1 << cpu_index); + } +} + +static void vcpu_haddr(unsigned int cpu_index, qemu_plugin_meminfo_t memin= fo, + uint64_t vaddr, void *udata) +{ + struct qemu_plugin_hwaddr *hwaddr =3D qemu_plugin_get_hwaddr(meminfo, = vaddr); + + if (!hwaddr || !qemu_plugin_hwaddr_is_io(hwaddr)) { + return; + } else { + const char *name =3D qemu_plugin_hwaddr_device_name(hwaddr); + uint64_t off =3D qemu_plugin_hwaddr_device_offset(hwaddr); + bool is_write =3D qemu_plugin_mem_is_store(meminfo); + DeviceCounts *counts; + + g_mutex_lock(&lock); + counts =3D (DeviceCounts *) g_hash_table_lookup(devices, name); + + if (!counts) { + uint64_t base =3D vaddr - off; + counts =3D new_count(name, base); + } + + if (check_match) { + if (g_strv_contains((const char * const *)matches, counts->nam= e)) { + hwprofile_match_hit(counts, off); + inc_count(&counts->totals, is_write, cpu_index); + } + } else { + inc_count(&counts->totals, is_write, cpu_index); + } + + /* either track offsets or source of access */ + if (source) { + off =3D (uint64_t) udata; + } + + if (pattern || source) { + IOLocationCounts *io_count =3D g_hash_table_lookup(counts->det= ail, + (gpointer) of= f); + if (!io_count) { + io_count =3D new_location(counts->detail, off); + } + inc_count(&io_count->counts, is_write, cpu_index); + } + + g_mutex_unlock(&lock); + } +} + +static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) +{ + size_t n =3D qemu_plugin_tb_n_insns(tb); + size_t i; + + for (i =3D 0; i < n; i++) { + struct qemu_plugin_insn *insn =3D qemu_plugin_tb_get_insn(tb, i); + gpointer udata =3D (gpointer) (source ? qemu_plugin_insn_vaddr(ins= n) : 0); + qemu_plugin_register_vcpu_mem_cb(insn, vcpu_haddr, + QEMU_PLUGIN_CB_NO_REGS, + rw, udata); + } +} + +QEMU_PLUGIN_EXPORT +int qemu_plugin_install(qemu_plugin_id_t id, const qemu_info_t *info, + int argc, char **argv) +{ + int i; + + for (i =3D 0; i < argc; i++) { + char *opt =3D argv[i]; + if (g_strcmp0(opt, "read") =3D=3D 0) { + rw =3D QEMU_PLUGIN_MEM_R; + } else if (g_strcmp0(opt, "write") =3D=3D 0) { + rw =3D QEMU_PLUGIN_MEM_W; + } else if (g_strcmp0(opt, "pattern") =3D=3D 0) { + pattern =3D true; + } else if (g_strcmp0(opt, "source") =3D=3D 0) { + source =3D true; + } else if (g_str_has_prefix(opt, "match")) { + gchar **parts =3D g_strsplit(opt, "=3D", 2); + check_match =3D true; + matches =3D g_strsplit(parts[1], ",", -1); + g_strfreev(parts); + } else { + fprintf(stderr, "option parsing failed: %s\n", opt); + return -1; + } + } + + if (source && pattern) { + fprintf(stderr, "can only currently track either source or pattern= .\n"); + return -1; + } + + if (!info->system_emulation) { + fprintf(stderr, "hwprofile: plugin only useful for system emulatio= n\n"); + return -1; + } + + /* Just warn about overflow */ + if (info->system.smp_vcpus > 64 || + info->system.max_vcpus > 64) { + fprintf(stderr, "hwprofile: can only track up to 64 CPUs\n"); + } + + plugin_init(); + + qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans); + qemu_plugin_register_atexit_cb(id, plugin_exit, NULL); + return 0; +} diff --git a/contrib/plugins/Makefile b/contrib/plugins/Makefile index 7801b08b0d..b9d7935e5e 100644 --- a/contrib/plugins/Makefile +++ b/contrib/plugins/Makefile @@ -17,6 +17,7 @@ NAMES +=3D hotblocks NAMES +=3D hotpages NAMES +=3D howvec NAMES +=3D lockstep +NAMES +=3D hwprofile =20 SONAMES :=3D $(addsuffix .so,$(addprefix lib,$(NAMES))) =20 --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612995228; cv=none; d=zohomail.com; s=zohoarc; b=Eq/fT8NOJFzQSF6f5RGgbZALCXo0SMjqKtqv5pC9zN9jRuyX8QW50P6pIpbsqPD19j8W0n6Jt+QZ+Iuq8JEQvl4+SSVFYJZCGIEKAg271Wrywb5y5ySO63vW3hBIOpRHkMUDip4d/4bjqjVJE7xAGpWbotXZ4jYPf+/eTwiPCBc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612995228; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gin79Zz+8fQ2Ye/3RKVC4CivONugqR+e7doP6QGVOF4=; b=cJ5wN7qL+b46HHTFyXEdYWMkkEsUBJ/I9Ts8GS3+VJWnyM5CKfUFf4hziM10dv3eUs6/6bwFtEF4Y/TRSdzwYQfEGZFXKFfedM3JTe45EKMNpC90bBUMGsUp5XZ/uhnZUA212HoN0DsWzude4EwlWPEcaKlbQQM9DkjGMxeI1+o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612995227701843.1760025799471; Wed, 10 Feb 2021 14:13:47 -0800 (PST) Received: from localhost ([::1]:52808 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xk2-0007mg-Jg for importer@patchew.org; Wed, 10 Feb 2021 17:13:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56698) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xhS-0005vt-FR for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:06 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:55155) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xhQ-0003Eg-IU for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:06 -0500 Received: by mail-wm1-x32d.google.com with SMTP id w4so3189680wmi.4 for ; Wed, 10 Feb 2021 14:11:04 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id h14sm4761231wmq.45.2021.02.10.14.10.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:10:58 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E7DCB1FF90; Wed, 10 Feb 2021 22:10:53 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gin79Zz+8fQ2Ye/3RKVC4CivONugqR+e7doP6QGVOF4=; b=S1PCQsspKnCmXiUBFn/obax8LFPY7g7Ov1ngutDxNVFiTyGl3g4U+GQZxoicXHwD0F SPEzLUgRmQLXLwtZlp780A67lHwBa8I48TCKwYkHfXMKHvrxX/ECjHhEhM1kO/0OZVZe vJw8bT+hA2NwWrdngFfAM33wNQBd8V/nvvhM4mp4/869m7Ff2gvjfoprwoDov8rFN3zD y4Uo22DWrmCRKvbl1erHX/cm3mOVeBHFlS268Re8Y/pDlVzdZCn4eRoqmAIId/n5MDep aSpEvL284/9v2Qm0YusR3PNcsSoSdpDHRSCQsLDBtOHZ8PKJXKD8hl6fW5HuV4uf3qX9 8RMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gin79Zz+8fQ2Ye/3RKVC4CivONugqR+e7doP6QGVOF4=; b=nSlSyjjzUTMXmMEIDa3Aoz2wQZr1qyqNiCU0Moclitz7+2HLrXtsc93v3QWnBx5kMZ MZ7+NLTDgJEToFHVkywGJnbPMbI6hQmOEEThDANpcwceSDKWMgP2RCBYR+Agzr0SOAb8 tJZbP1Ogi2q4Af1CD5q2IgedTo3nEtRB5xnOVe/yjNiFePJQd0Z1kqtPWE4hxMxrUNj4 iV35Oq7X1t0BX2AXwDgC2ZBMrg9zDcNZZb2vpf0TAxkEgzralrC3SJ8GaH2ssV636Paj HF5eojRLDfGuy/yu/jb5DBAzQFSiNrNDSTUSXMmIPps+OCxEot/GyDWIhEs6puCf/hdY onXg== X-Gm-Message-State: AOAM532Cymxk/V1FRXZoE10TstMbgCd5uvSxRC2qbhxBcz/GWrv75iee QYMdjBAwVRiaX9xy9ThtewQmOb8AUT9o3M1m X-Google-Smtp-Source: ABdhPJzEgcDykpbDxCbbd0kpY2p7Vdm8GhCAH9gc26T9UFOe66jeNFaVmUI8SPKFIsRqYBYETJOU1A== X-Received: by 2002:a1c:480a:: with SMTP id v10mr1204256wma.132.1612995063217; Wed, 10 Feb 2021 14:11:03 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 04/21] contrib: Don't use '#' flag of printf format Date: Wed, 10 Feb 2021 22:10:36 +0000 Message-Id: <20210210221053.18050-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: zhouyang , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: zhouyang I am reading contrib related code and found some style problems while check the code using checkpatch.pl. This commit fixs the misuse of '#' flag of printf format Signed-off-by: zhouyang Signed-off-by: Alex Benn=C3=A9e Message-Id: <20210118031004.1662363-2-zhouyang789@huawei.com> --- contrib/plugins/hotblocks.c | 2 +- contrib/plugins/hotpages.c | 2 +- contrib/plugins/howvec.c | 2 +- contrib/plugins/lockstep.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c index 37435a3fc7..4b08340143 100644 --- a/contrib/plugins/hotblocks.c +++ b/contrib/plugins/hotblocks.c @@ -63,7 +63,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) =20 for (i =3D 0; i < limit && it->next; i++, it =3D it->next) { ExecCount *rec =3D (ExecCount *) it->data; - g_string_append_printf(report, "%#016"PRIx64", %d, %ld, %"PRId= 64"\n", + g_string_append_printf(report, "0x%016"PRIx64", %d, %ld, %"PRI= d64"\n", rec->start_addr, rec->trans_count, rec->insns, rec->exec_count); } diff --git a/contrib/plugins/hotpages.c b/contrib/plugins/hotpages.c index ecd6c18732..eacc678eac 100644 --- a/contrib/plugins/hotpages.c +++ b/contrib/plugins/hotpages.c @@ -88,7 +88,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) for (i =3D 0; i < limit && it->next; i++, it =3D it->next) { PageCounters *rec =3D (PageCounters *) it->data; g_string_append_printf(report, - "%#016"PRIx64", 0x%04x, %"PRId64 + "0x%016"PRIx64", 0x%04x, %"PRId64 ", 0x%04x, %"PRId64"\n", rec->page_address, rec->cpu_read, rec->reads, diff --git a/contrib/plugins/howvec.c b/contrib/plugins/howvec.c index 3b9a6939f2..6e602aaccf 100644 --- a/contrib/plugins/howvec.c +++ b/contrib/plugins/howvec.c @@ -209,7 +209,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) i++, counts =3D g_list_next(counts)) { InsnExecCount *rec =3D (InsnExecCount *) counts->data; g_string_append_printf(report, - "Instr: %-24s\t(%ld hits)\t(op=3D%#08x/= %s)\n", + "Instr: %-24s\t(%ld hits)\t(op=3D0x%08x= /%s)\n", rec->insn, rec->count, rec->opcode, diff --git a/contrib/plugins/lockstep.c b/contrib/plugins/lockstep.c index 5aad50869d..7fd35eb669 100644 --- a/contrib/plugins/lockstep.c +++ b/contrib/plugins/lockstep.c @@ -134,7 +134,7 @@ static void report_divergance(ExecState *us, ExecState = *them) =20 /* Output short log entry of going out of sync... */ if (verbose || divrec.distance =3D=3D 1 || diverged) { - g_string_printf(out, "@ %#016lx vs %#016lx (%d/%d since last)\n", + g_string_printf(out, "@ 0x%016lx vs 0x%016lx (%d/%d since last)\n", us->pc, them->pc, g_slist_length(divergence_log), divrec.distance); qemu_plugin_outs(out->str); @@ -144,7 +144,7 @@ static void report_divergance(ExecState *us, ExecState = *them) int i; GSList *entry; =20 - g_string_printf(out, "=CE=94 insn_count @ %#016lx (%ld) vs %#016lx= (%ld)\n", + g_string_printf(out, "=CE=94 insn_count @ 0x%016lx (%ld) vs 0x%016= lx (%ld)\n", us->pc, us->insn_count, them->pc, them->insn_count= ); =20 for (entry =3D log, i =3D 0; @@ -152,7 +152,7 @@ static void report_divergance(ExecState *us, ExecState = *them) entry =3D g_slist_next(entry), i++) { ExecInfo *prev =3D (ExecInfo *) entry->data; g_string_append_printf(out, - " previously @ %#016lx/%ld (%ld insns)= \n", + " previously @ 0x%016lx/%ld (%ld insns= )\n", prev->block->pc, prev->block->insns, prev->insn_count); } --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612995667; cv=none; d=zohomail.com; s=zohoarc; b=ACbnCoJWs3T01GQ2x843SjqhpeBzZu7BZ2XrTWRpE/3YulRpU8n/XAazZwjOvau/SepfWh/vvLU39JN68i2tTqOrDHcB0HmtBvcJHtPG0PhqA0v6lpiNb0vrMZ0DVX5XXCJ6eFONZ2hRwwV7BrxGf8/l6NzymLLYrNTBHwbw9qs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612995667; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qsAlB8eC1+WOxOlJ6bcLRTNHUdtdlZsz5JZgZPTBx5w=; b=aqYtJW9CbfK+EpcaNNgJmQ2PdJeSabvwGfYBE7J9p7gcvi30jdau6vahOGXpEbA/qkHyM/z9XGkUJgllfHdjWL0BNW7SCLzWf5/YlmUnxZsHdJAbPRLuBzRE30jFqSjzluaLZ3SNqaqrYj5xGjgwu2HYUearNryXjuymUTYnMSw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161299566738322.51107751189852; Wed, 10 Feb 2021 14:21:07 -0800 (PST) Received: from localhost ([::1]:40868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xr8-0006Su-5T for importer@patchew.org; Wed, 10 Feb 2021 17:21:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56776) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xhZ-00067X-HY for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:13 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:37464) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xhW-0003HN-9Y for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:12 -0500 Received: by mail-wm1-x32a.google.com with SMTP id m1so3299133wml.2 for ; Wed, 10 Feb 2021 14:11:09 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id z185sm5427790wmb.0.2021.02.10.14.10.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:10:58 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 093551FF91; Wed, 10 Feb 2021 22:10:54 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qsAlB8eC1+WOxOlJ6bcLRTNHUdtdlZsz5JZgZPTBx5w=; b=m2lyRN5Reh9Dj22oLqBx3id4+wVDwzL4KB5tbf/Ly6ahdITvQxJU8Eii45iufhj1rB ocTYIRH+QJV8s6qZEm7w+zNtZSPCJKI1XYiWdR0VUwuvLdaR1f68IUiOmhoTaZ7n3QEa mM7/XjOUbmL7/anZg7aUyrPangkRfJljYIJdS1qSbtUZw++WD/9avwiZQ+eseDHzufoB fhGsIbCDO5e/urBMQ3d2huyZjMxo1EnVtfS3FSwkVnCanJc7wu1T3EO5+Wu/Bk3wLVHj AZxwta/slRfo5259d+jmhylsOiCisFB6At3AXeOmNYXMyU/H4kiMadP4Dqon5Y3FeARm 3PHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qsAlB8eC1+WOxOlJ6bcLRTNHUdtdlZsz5JZgZPTBx5w=; b=eUanQ+aWOZ426N23wkR+Cm8bR0y5xC8WEJhQe64gxVdoL/mrR0PVwWtO7kRdXWmr0M 6qzVGwrdbaSOMw76CUPrSxWzzXeManIfu/moXAlDGyK47NFbBYGjosCNH0XFbhIGUNdp h4dm3AeVv/8wkGdzNP9rMIa3BDxRcyyWEdc5ePiYXVlqWUh/EXVzr20WkQTvW8TCQvQA yqEsxlBsPxHBXTkgA2F+H6ZKzq5IU4/Bn6kK+3dG1wFVRKEFbRtuTtP39wb9py2vvA7r 9Pe5x7crC4ABMc0aRzxWMRPfFvNgyx3oYhIg7ygOlJIhqtCdfTS8bJzYZpbxvTMA48LW Mkyw== X-Gm-Message-State: AOAM533CM+ry3Z30nT2YCryiHxMzPRzywNElodOQjWMSfZOa9XS6LsJu BQBiIUpSHFrisJaMyMBNfrM9D8saG0+AOYxW X-Google-Smtp-Source: ABdhPJwGUuzZ92zgTCJj28UWIWtKlbq7zZ2ybIQeWAzEUfX0qP2725uBCnQg+i75OtlSc+7bGctckA== X-Received: by 2002:a1c:f415:: with SMTP id z21mr1194592wma.114.1612995068912; Wed, 10 Feb 2021 14:11:08 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 05/21] contrib: Fix some code style problems, ERROR: "foo * bar" should be "foo *bar" Date: Wed, 10 Feb 2021 22:10:37 +0000 Message-Id: <20210210221053.18050-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: zhouyang , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: zhouyang I am reading contrib related code and found some style problems while check the code using checkpatch.pl. This commit fixs the issue below: ERROR: "foo * bar" should be "foo *bar" Signed-off-by: zhouyang Signed-off-by: Alex Benn=C3=A9e Message-Id: <20210118031004.1662363-3-zhouyang789@huawei.com> --- contrib/plugins/howvec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/plugins/howvec.c b/contrib/plugins/howvec.c index 6e602aaccf..2f892da17d 100644 --- a/contrib/plugins/howvec.c +++ b/contrib/plugins/howvec.c @@ -235,7 +235,7 @@ static void vcpu_insn_exec_before(unsigned int cpu_inde= x, void *udata) (*count)++; } =20 -static uint64_t * find_counter(struct qemu_plugin_insn *insn) +static uint64_t *find_counter(struct qemu_plugin_insn *insn) { int i; uint64_t *cnt =3D NULL; --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612995460; cv=none; d=zohomail.com; s=zohoarc; b=TJQnmks1wQazj9yhxGBpyIZMY9CpLaObek5w5AIBOfp7dKB2xzhAGmQKvtrKJWkL5oljlGDJwxxpaVEcQ47s3569WXpUHjOfgfxpRYdjhyRFfWKUEmR4PceclZ742OObMac2mftGTTEKEDFTq8U9Nwyjh7pEC2wzPR7bruAbOyE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612995460; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UHNi1hWLbrIySFeJtKPpCbGfvhbQp8V4grjS5oASwHk=; b=ARL1BTLKcFTsDoY4w2i1GjDnxGz4wqRYD2uGOh1mrLdWhniqoKbnr853G/77fplm42y1KeQjO+yVXlHsOaU6iQFliO68sZE+AlKJmIJTz/in2jY+w8AIq2+DozCYHgY3ioOe+RUBUGCqPqWF5FP74UqL9U6SRyQzIoONcpO4yRI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612995459877670.5507123614223; Wed, 10 Feb 2021 14:17:39 -0800 (PST) Received: from localhost ([::1]:60938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xnm-0002wD-Qh for importer@patchew.org; Wed, 10 Feb 2021 17:17:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xhc-0006E2-LX for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:17 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:53803) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xha-0003J0-Ms for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:16 -0500 Received: by mail-wm1-x32f.google.com with SMTP id j11so3188553wmi.3 for ; Wed, 10 Feb 2021 14:11:14 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id t126sm4989453wmf.3.2021.02.10.14.10.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:10:58 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 1F4161FF92; Wed, 10 Feb 2021 22:10:54 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UHNi1hWLbrIySFeJtKPpCbGfvhbQp8V4grjS5oASwHk=; b=deFZY/34/EwGU8nSwmvwxsSDeSKC6R+Yq60AoViWbNYHV/a2k6O7vicy1+NkW51Rr3 JntNnIbJDqAK5JeB+E/nxNQ1Ph7LULEyL7IFWEAx/te6sU9UY2VHJ712+306tZMjLGpu RRsOILPdnGmtFkX434qmgCw+65qaXxB8ETDRWIoev+ydIQodboShIfOIaQfDbTtYZkZH lEFmb2kJm0NSXZQ/IpakJcN1CfdzM12knkV5JEmfMq6sIKCgCBYqkqxso/bQYwXTa+jC qkTo9Gnl4HUtWMNuCJxbh7pFyDz6uAgfW5DyoeKWPb2kiwC7nsbGoIs1uoP6sX97xQJ7 BynA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UHNi1hWLbrIySFeJtKPpCbGfvhbQp8V4grjS5oASwHk=; b=q7jEezoTbsXIXtVLh30BOKw99V2sYGXbTrwaeg5WGD84cOushWcONQWARbcR0XX+w8 G1PnGikuMdEScEIKjRihnkhd2NAJ0t5JJF1XOaXv1IXKwEkxkRtfuziNiZG5mwJPLlPf P2dibTWT9HSh/FprOlFNXX+1SKNC3sXvyddqGYQq4da6Xag+HI+hWpxEf6eYmPFNSwcp BqcvSJM5kvxEnHG4ClFSts6nQG83WgOGsWacrvTkWtQv5autVFOe3VLgKQuIKC4lWlMC dbepp4DxvMuM/ecHUz/d/9AwGAWQWEEZ/b2uxzPzn7tNa9ABMlM0upkg0DKBA4wM1q5c EJmg== X-Gm-Message-State: AOAM530R/80+RCXRpCsVXh6krd94Ep4Tv7cikGpAwLnCB5VHpwDdZHvO W7N+z+w8YcpPawBClHuA/VMRqA== X-Google-Smtp-Source: ABdhPJzFffQgc6t5zMmfLYyEX4zQHTOafX2jOk2kpBokHESQpbut0b5fSczEkPp/0Azf0BHXdmfxRg== X-Received: by 2002:a7b:c215:: with SMTP id x21mr1243016wmi.61.1612995073174; Wed, 10 Feb 2021 14:11:13 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 06/21] contrib: Add spaces around operator Date: Wed, 10 Feb 2021 22:10:38 +0000 Message-Id: <20210210221053.18050-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: zhouyang , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: zhouyang I am reading contrib related code and found some style problems while check the code using checkpatch.pl. This commit fixs the issue below: ERROR: spaces required around that '*' Signed-off-by: zhouyang Signed-off-by: Alex Benn=C3=A9e Message-Id: <20210118031004.1662363-4-zhouyang789@huawei.com> --- contrib/ivshmem-server/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/ivshmem-server/main.c b/contrib/ivshmem-server/main.c index ee08c4ced0..224dbeb547 100644 --- a/contrib/ivshmem-server/main.c +++ b/contrib/ivshmem-server/main.c @@ -17,7 +17,7 @@ #define IVSHMEM_SERVER_DEFAULT_PID_FILE "/var/run/ivshmem-server.pid" #define IVSHMEM_SERVER_DEFAULT_UNIX_SOCK_PATH "/tmp/ivshmem_socket" #define IVSHMEM_SERVER_DEFAULT_SHM_PATH "ivshmem" -#define IVSHMEM_SERVER_DEFAULT_SHM_SIZE (4*1024*1024) +#define IVSHMEM_SERVER_DEFAULT_SHM_SIZE (4 * 1024 * 1024) #define IVSHMEM_SERVER_DEFAULT_N_VECTORS 1 =20 /* used to quit on signal SIGTERM */ --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612996138; cv=none; d=zohomail.com; s=zohoarc; b=GzkND+4DDkDnCQynzqEpI3b8B+3JVnZZpsr7+CI088PIAqzRAJ3ckGvFh1CmmPrvSfgkuW7wBh/nLibTs4rPwSzxMZ/kxqvrEVjxH3Bpy5/ux9uS8gASel0GrtEOcH2FAlsrwf3DclAy/ujFmUZ4ScPH8051T100JWfmJWw6Emo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612996138; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=h0dd8w0ozAtK/o2h3emwaj/X9ik48CwXQg6fa8mR0bQ=; b=B8FK7HI7q9d4U14TpYqN3nmBnsfG67WG+wVprKXXcMiYaA6hd9W4lvkjZVnKYbMrvsxByYmWZ+OgTrFphGi5oJBv1jRgB72TWYJsTJ/B3F8vXuiQKcJZZPLpxhM0UxW8Sl/kCU2I1Pli1TEU1AHtbIDt9068DHzsW1Y1VKGXk7k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612996137789516.6858920073653; Wed, 10 Feb 2021 14:28:57 -0800 (PST) Received: from localhost ([::1]:58310 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xyi-0006Xc-NZ for importer@patchew.org; Wed, 10 Feb 2021 17:28:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xho-0006Ld-GG for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:28 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:55164) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xhY-0003Hf-B1 for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:28 -0500 Received: by mail-wm1-x336.google.com with SMTP id w4so3189896wmi.4 for ; Wed, 10 Feb 2021 14:11:11 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id r11sm4638314wmh.9.2021.02.10.14.10.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:10:58 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 3478C1FF93; Wed, 10 Feb 2021 22:10:54 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=h0dd8w0ozAtK/o2h3emwaj/X9ik48CwXQg6fa8mR0bQ=; b=fVXT+5JODp4OzzUrngoC6e9m5ail8EpuF7IhwsOvvjVTCNz97ZXGKMZ6UIGAAgtplb W1GxQISulJiEghz2se1k7M5Rb79Y0x2aOdZsGczRosKOUPLHQC70NLzQqjP6R2yUAA4r 3lvvVJLT0dsogJpcxNdaJwh/ncJI03vEKP9ZFPD6fGlQEnGoBFyqJkyHJ7uZg5oSeqZV WR6hn6X78UUzcCpEoiuML+d+6bNaE6rjSj3ma7QaRrdkzWW70dWFoBLggUiZafYVFgOj rBvGnU8j7qmkdGpFiKkGyA4jCzRSq7PVmhQyo0EirQm6Sa87wrigQS2f8lWT0d30bHb3 +ryg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=h0dd8w0ozAtK/o2h3emwaj/X9ik48CwXQg6fa8mR0bQ=; b=Po9C7pulPCl6Y/QdUeyBOQWMcAdnQGXdXTJx2acTgfRCAwwJ/NPmEBON+DJ4rgxo2Q FBiyX6rGViZ4QLcJxgnT29DeVAsmpsdnBHlKkWQy1zye6G8ZOGY69zeVrxfBUnkeZ23u 45wGfs+qrsukJuxKWD33nmtS3uNAPZ5ZFDkeEM+Xx++gFR6ta24Ex/KsywT51uzp2Kui JrAmYovXM3fF0Lzq0AUU07YMcwOMa6PMbgM5oCiXAb/1G5O1uDJ0pCk3f0z29/EHh7hm ff5sZ9CQ43KZ82xTXpPKuXXyYmLGbXsJMH8bMl/mykN3D32uH3CGGIm3Zp82JU5q7l/G QKAA== X-Gm-Message-State: AOAM530zKhyEdNXfNQ5cPH9uYuSZc4LoD/FFKpeoWr8q59qsMbz5JjEK R9ksYTfybhk0x1pjh/AE+G7pPA== X-Google-Smtp-Source: ABdhPJzBDEu+XStdYir4WvzL6HunKTBlFWnXw82ingAK+kChNrgKQGvP8zwiBAngRd+C9/vZPDnkdA== X-Received: by 2002:a1c:c242:: with SMTP id s63mr1228826wmf.9.1612995070723; Wed, 10 Feb 2021 14:11:10 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 07/21] contrib: space required after that ',' Date: Wed, 10 Feb 2021 22:10:39 +0000 Message-Id: <20210210221053.18050-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: zhouyang , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: zhouyang I am reading contrib related code and found some style problems while check the code using checkpatch.pl. This commit fixs the issue below: ERROR: space required after that ',' Signed-off-by: zhouyang Signed-off-by: Alex Benn=C3=A9e Message-Id: <20210118031004.1662363-5-zhouyang789@huawei.com> --- contrib/plugins/howvec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/plugins/howvec.c b/contrib/plugins/howvec.c index 2f892da17d..9d6fa33297 100644 --- a/contrib/plugins/howvec.c +++ b/contrib/plugins/howvec.c @@ -68,7 +68,7 @@ static InsnClassExecCount aarch64_insn_classes[] =3D { { "Reserved", "res", 0x1e000000, 0x00000000, COUNT_CLASS= }, /* Data Processing Immediate */ { " PCrel addr", "pcrel", 0x1f000000, 0x10000000, COUNT_CLASS= }, - { " Add/Sub (imm,tags)","asit", 0x1f800000, 0x11800000, COUNT_CLASS= }, + { " Add/Sub (imm,tags)", "asit", 0x1f800000, 0x11800000, COUNT_CLAS= S}, { " Add/Sub (imm)", "asi", 0x1f000000, 0x11000000, COUNT_CLASS= }, { " Logical (imm)", "logi", 0x1f800000, 0x12000000, COUNT_CLASS= }, { " Move Wide (imm)", "movwi", 0x1f800000, 0x12800000, COUNT_CLASS= }, @@ -91,17 +91,17 @@ static InsnClassExecCount aarch64_insn_classes[] =3D { { "Branches", "branch", 0x1c000000, 0x14000000, COUNT_CLASS= }, /* Loads and Stores */ { " AdvSimd ldstmult", "advlsm", 0xbfbf0000, 0x0c000000, COUNT_CLASS= }, - { " AdvSimd ldstmult++","advlsmp",0xbfb00000, 0x0c800000, COUNT_CLASS= }, + { " AdvSimd ldstmult++", "advlsmp", 0xbfb00000, 0x0c800000, COUNT_CLA= SS}, { " AdvSimd ldst", "advlss", 0xbf9f0000, 0x0d000000, COUNT_CLASS= }, - { " AdvSimd ldst++", "advlssp",0xbf800000, 0x0d800000, COUNT_CLASS= }, + { " AdvSimd ldst++", "advlssp", 0xbf800000, 0x0d800000, COUNT_CLAS= S}, { " ldst excl", "ldstx", 0x3f000000, 0x08000000, COUNT_CLASS= }, { " Prefetch", "prfm", 0xff000000, 0xd8000000, COUNT_CLASS= }, { " Load Reg (lit)", "ldlit", 0x1b000000, 0x18000000, COUNT_CLASS= }, - { " ldst noalloc pair", "ldstnap",0x3b800000, 0x28000000, COUNT_CLASS= }, + { " ldst noalloc pair", "ldstnap", 0x3b800000, 0x28000000, COUNT_CLAS= S}, { " ldst pair", "ldstp", 0x38000000, 0x28000000, COUNT_CLASS= }, { " ldst reg", "ldstr", 0x3b200000, 0x38000000, COUNT_CLASS= }, { " Atomic ldst", "atomic", 0x3b200c00, 0x38200000, COUNT_CLASS= }, - { " ldst reg (reg off)","ldstro", 0x3b200b00, 0x38200800, COUNT_CLASS= }, + { " ldst reg (reg off)", "ldstro", 0x3b200b00, 0x38200800, COUNT_CLAS= S}, { " ldst reg (pac)", "ldstpa", 0x3b200200, 0x38200800, COUNT_CLASS= }, { " ldst reg (imm)", "ldsti", 0x3b000000, 0x39000000, COUNT_CLASS= }, { "Loads & Stores", "ldst", 0x0a000000, 0x08000000, COUNT_CLASS= }, @@ -202,7 +202,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) =20 counts =3D g_hash_table_get_values(insns); if (counts && g_list_next(counts)) { - g_string_append_printf(report,"Individual Instructions:\n"); + g_string_append_printf(report, "Individual Instructions:\n"); counts =3D g_list_sort(counts, cmp_exec_count); =20 for (i =3D 0; i < limit && g_list_next(counts); --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612995223; cv=none; d=zohomail.com; s=zohoarc; b=ZyC9QE2/hF9NLe8ETHAegmmm/q2XMfnI8ULCvpmcHguhZq5Mp2Pr30NK5ACtfHcjKKtp2OrCobo/Wuk7iHrZtkObn9vX8AG39eMxMqDtIVwWIMjBpeqQ0/qIqtqu4p0fyzQ6/3I8D3cWaS+KBmrfLQ5rFBE3qMdy4Xp6Xlcy4/E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612995223; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PU9rNaQh7vkDttDYTlGc5gKeO+PSzP4WvxcncEhBalo=; b=QzB/Slu4Zyu1ypoWI25yzTOFRNDjqg3gf2DcqiENhgboA1ni2jfxhQ94NGKDwnIwfBuffgM7XsCHGkn0XodAsh5j/WhRaT83amF3orlQiixDAGUJpLCrynw6ugAwi4X943c2ltqY/Q+ubTPWHrjhdcZ4sB3GJ8q1bdu1hEA1K7E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161299522299634.624471379368856; Wed, 10 Feb 2021 14:13:42 -0800 (PST) Received: from localhost ([::1]:52668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xjx-0007jC-Uk for importer@patchew.org; Wed, 10 Feb 2021 17:13:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56712) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xhU-0005xu-IM for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:08 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:34834) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xhR-0003Eo-HC for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:07 -0500 Received: by mail-wm1-x32e.google.com with SMTP id n10so1432691wmq.0 for ; Wed, 10 Feb 2021 14:11:05 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id 16sm4443605wmi.43.2021.02.10.14.10.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:10:58 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 4B2751FF96; Wed, 10 Feb 2021 22:10:54 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PU9rNaQh7vkDttDYTlGc5gKeO+PSzP4WvxcncEhBalo=; b=hdILOJggMXoxOdu1cEeZQFhgPBdDg5z3LpQBYe0/UGKYdjIwj7l+7AMZzFmTSypXD0 saaczdSIf8dApg6nIMvQCqjU3k6rEGhNHOw9hg0t2yKZmejVnJKtF+Zi02ObqDNOeJeO 2b5vBlo1QuxrMyQenEKqEY1hesaZAP95cnelm36tfW6+QUeUZ5dlEYKEazuAd+jkbrmz luwL6n/xXpz7ghRwYi2kcb8UpTYKfl1FNo0+rjDXixbAs8nqgu1nJ6NRR1sfjrNfEoHW TiaLOWdcFAkI8ymuMSMhCvq6otVAN1YvUAmvSWaPosH95AEMURvJKALDLig0/NqRzyNO P0Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PU9rNaQh7vkDttDYTlGc5gKeO+PSzP4WvxcncEhBalo=; b=KfT1gOhzhtpN/okFboGzmjE3qUQsFcZ4X79/M23GS1DNDh43/izw0ib2M/pfgUWPgv W67Xibww2X0YhDoMvyLEE1APOPyZyluZdRLAWF6FfaU2DCK3uZDY9x7klOR7/cZ6pe57 mSamGNNoSd4uvJREm7jb6TAZOa4Xyh6iYqJDxxWVCZ08siIxsDTa7O9JuG80zOd0l9I8 cAWEQ9++l1RFWO5WIdPbpA/U4a5kR2RcjF8P45kYvN920kFnC8hlgVXOnTDCQZ4GvQdo Shfl/t+1PWv8oPh/wIkvqS/3AFGCNzTwCkOkTZuLl40Wv+s0H5Wu0uJelKVLrjJlG/90 d0tw== X-Gm-Message-State: AOAM531JlT5uboQVJR09kGEZF3GJR/1jtoEVx+7mtSFKTqoFsDeLo9Rc xju7TJh5FilQefAH2wdTbhrUcw== X-Google-Smtp-Source: ABdhPJy7HpG3QC2QkXGNRAZV+x+eZ3QlXMUTGqr30xOx7HOKdpmB5q3CeCioX0XR/6eYu7u0XsPsYw== X-Received: by 2002:a1c:6402:: with SMTP id y2mr1164558wmb.43.1612995064189; Wed, 10 Feb 2021 14:11:04 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 08/21] contrib: Open brace '{' following struct go on the same line Date: Wed, 10 Feb 2021 22:10:40 +0000 Message-Id: <20210210221053.18050-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: zhouyang , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: zhouyang I found some style problems whil check the code using checkpatch.pl. This commit fixs the issue below: ERROR: that open brace { should be on the previous line Signed-off-by: zhouyang Signed-off-by: Alex Benn=C3=A9e Message-Id: <20210118031004.1662363-6-zhouyang789@huawei.com> --- contrib/plugins/howvec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contrib/plugins/howvec.c b/contrib/plugins/howvec.c index 9d6fa33297..600f7facc1 100644 --- a/contrib/plugins/howvec.c +++ b/contrib/plugins/howvec.c @@ -145,8 +145,7 @@ typedef struct { int table_sz; } ClassSelector; =20 -static ClassSelector class_tables[] =3D -{ +static ClassSelector class_tables[] =3D { { "aarch64", aarch64_insn_classes, ARRAY_SIZE(aarch64_insn_classes) }, { "sparc", sparc32_insn_classes, ARRAY_SIZE(sparc32_insn_classes) }, { "sparc64", sparc64_insn_classes, ARRAY_SIZE(sparc64_insn_classes) }, --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612995477; cv=none; d=zohomail.com; s=zohoarc; b=WLrSjjsDGbXJ9oYyIdSbRchFCvT2ygEb5DmkAGfcXz8HYQ5vZ9Br7nDNpm/gnlSKQws+q4VGsDxCPxiQgvY3zvW/wnz+8qKW3eczGR7GzB7uexyJowSWt8FUa4wK5aMuUtW35SRKOSuI3j1TRXMFYiaV7xDeeW4VrnBOvxgxEx4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612995477; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=o81Mz4W9KCvutw0rCkPpru0KeoeXZKNx1XZY/IHOEHo=; b=BJ4m9bAgFCaZsP0sk3tyrsE+gVlMPZndTL3/CztWPJNZT8KXvEH9lwrnTFRw1y/f8JP2Ex0aCMdp+z6FPfz6bbp5b8PlCvJa+yBrak83QrrKd/qrlt3lclRlZ7uNUEPI2GnhsgwbQX4lULmKDBNhVJFyvDr124o9aEqG8YNsRnc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612995477278107.68119695103348; Wed, 10 Feb 2021 14:17:57 -0800 (PST) Received: from localhost ([::1]:33094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xo3-00035u-A9 for importer@patchew.org; Wed, 10 Feb 2021 17:17:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xhk-0006Gr-NY for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:24 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:51425) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xhf-0003Ku-Ch for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:24 -0500 Received: by mail-wm1-x32f.google.com with SMTP id t142so3200570wmt.1 for ; Wed, 10 Feb 2021 14:11:18 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id o124sm5304658wmb.5.2021.02.10.14.10.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:11:13 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 60B5D1FF98; Wed, 10 Feb 2021 22:10:54 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o81Mz4W9KCvutw0rCkPpru0KeoeXZKNx1XZY/IHOEHo=; b=S6cHlkWEYWDuU77TQtbJkZlDr+0/+TkKe6tT8EbUjDKj4PnwHS3g+nf8ngx2pbI0Xv NL/wvdbj6EB5KKeX8/1VdX5VWntmBQaa5qreZQVsHOYkQDUAneoSW1AX+4mDJv/WN2Wc Ac5qVloPOQc+p8+RHN3BIWZG3DDMiaVYAdkos8NSrRuLflKwFo8LDlEFWmsIwmGlHI1I w80RcZSnttxC8U4JbjTwqE30SgMwueJydjUKzWCXbD1yJHiTiqwAg7us6cewysbRQwjv yZjtPeh+P0YPzj0dM2vWliadAARiQM0dXdpDeLefXZUSmMrToUe3mE2vLaiaBdneHHVr WL/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o81Mz4W9KCvutw0rCkPpru0KeoeXZKNx1XZY/IHOEHo=; b=sbdgDJyU9RRtXM5WQPDbCF+aNEdmeqClVf7O5Ust7vmMT9SjwbcrpXkHwIQkKDeP4u 1hBLTOp74Au2kKK/a8zTI3s7jm6QtCBXqjahy6o6IDiUzaJ1Inr8AIEHTMw+XPKk9Fgf oKpyEs7yHPuvLJB9XgDZ1giSdY3VYuoTrkJ7ZkbnCZpTPdofX+xvje7Db7oPrToX7Emc QAfusdkAnNBLHbRASrMty6hP4g4SZB01+LZ2wtWQH49ixGH70WtqfV3Cwh3d3fDRRV8C rr2XIwsgAPVLclh8g09zeN1oy1pE1NnWfJ3QJ9Lr3hE7NPov6TOPtj0S1B8cJuyECs3C iucA== X-Gm-Message-State: AOAM533MbMET4YdkLJsMcEsTmxGfl5ozoXxOnpjYFynuRqFnUpfulzkB I9nzlmGdjgHpGFnEtWo/DHokbQ== X-Google-Smtp-Source: ABdhPJz9QfVdymzu+DZVmPiEGKTXi9UjPLtcDZCtL4kDvDsPeqBWdkgFQmrh4ENlxoXAsDgMCvLDtw== X-Received: by 2002:a1c:220a:: with SMTP id i10mr1162872wmi.102.1612995078102; Wed, 10 Feb 2021 14:11:18 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 09/21] accel/tcg/plugin-gen: fix the call signature for inline callbacks Date: Wed, 10 Feb 2021 22:10:41 +0000 Message-Id: <20210210221053.18050-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini , kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) A recent change to the handling of constants in TCG changed the pattern of ops emitted for a constant add. We no longer emit a mov and the constant can be applied directly to the TCG_op_add arguments. This was causing SEGVs when running the insn plugin with arg=3Dinline. Fix this by updating copy_add_i64 to do the right thing while also adding a comment at the top of the append section as an aide memoir if something like this happens again. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Cc: Emilio G. Cota Message-Id: <20210210172751.11669-1-alex.bennee@linaro.org> --- accel/tcg/plugin-gen.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index e5dc9d0ca9..8a1bb801e0 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -320,22 +320,6 @@ static TCGOp *copy_const_ptr(TCGOp **begin_op, TCGOp *= op, void *ptr) return op; } =20 -static TCGOp *copy_const_i64(TCGOp **begin_op, TCGOp *op, uint64_t v) -{ - if (TCG_TARGET_REG_BITS =3D=3D 32) { - /* 2x mov_i32 */ - op =3D copy_op(begin_op, op, INDEX_op_mov_i32); - op->args[1] =3D tcgv_i32_arg(tcg_constant_i32(v)); - op =3D copy_op(begin_op, op, INDEX_op_mov_i32); - op->args[1] =3D tcgv_i32_arg(tcg_constant_i32(v >> 32)); - } else { - /* mov_i64 */ - op =3D copy_op(begin_op, op, INDEX_op_mov_i64); - op->args[1] =3D tcgv_i64_arg(tcg_constant_i64(v)); - } - return op; -} - static TCGOp *copy_extu_tl_i64(TCGOp **begin_op, TCGOp *op) { if (TARGET_LONG_BITS =3D=3D 32) { @@ -374,14 +358,17 @@ static TCGOp *copy_st_i64(TCGOp **begin_op, TCGOp *op) return op; } =20 -static TCGOp *copy_add_i64(TCGOp **begin_op, TCGOp *op) +static TCGOp *copy_add_i64(TCGOp **begin_op, TCGOp *op, uint64_t v) { if (TCG_TARGET_REG_BITS =3D=3D 32) { /* all 32-bit backends must implement add2_i32 */ g_assert(TCG_TARGET_HAS_add2_i32); op =3D copy_op(begin_op, op, INDEX_op_add2_i32); + op->args[4] =3D tcgv_i32_arg(tcg_constant_i32(v)); + op->args[5] =3D tcgv_i32_arg(tcg_constant_i32(v >> 32)); } else { op =3D copy_op(begin_op, op, INDEX_op_add_i64); + op->args[2] =3D tcgv_i64_arg(tcg_constant_i64(v)); } return op; } @@ -431,6 +418,12 @@ static TCGOp *copy_call(TCGOp **begin_op, TCGOp *op, v= oid *empty_func, return op; } =20 +/* + * When we append/replace ops here we are sensitive to changing patterns of + * TCGOps generated by the tcg_gen_FOO calls when we generated the + * empty callbacks. This will assert very quickly in a debug build as + * we assert the ops we are replacing are the correct ones. + */ static TCGOp *append_udata_cb(const struct qemu_plugin_dyn_cb *cb, TCGOp *begin_op, TCGOp *op, int *cb_idx) { @@ -462,11 +455,8 @@ static TCGOp *append_inline_cb(const struct qemu_plugi= n_dyn_cb *cb, /* ld_i64 */ op =3D copy_ld_i64(&begin_op, op); =20 - /* const_i64 */ - op =3D copy_const_i64(&begin_op, op, cb->inline_insn.imm); - /* add_i64 */ - op =3D copy_add_i64(&begin_op, op); + op =3D copy_add_i64(&begin_op, op, cb->inline_insn.imm); =20 /* st_i64 */ op =3D copy_st_i64(&begin_op, op); --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612996682; cv=none; d=zohomail.com; s=zohoarc; b=cAzTIDIRIoGAFLhpQulrlH5diQMEttwOBSverr+7tx2w1gC2kUCa3FULHszyBo8n6hJh6yWsDrksJrvjcwJY/7mcwHs6aOJOzTmeZbYgQQfZanuEuGqNezWYpWHGOcz1LlW+6gmIU9uxCJEotGT2sMaYWy1TdzHsfPT23IYtMKQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612996682; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Edh2u0iWFLyAxZ4TZrNGtVngWGS/6wsGB/21/wljo0k=; b=g+Srnu3JdoMgdmRAoqQd971LaAaW0JhCI9IbPiNCIWsPKfOKiriKY1GkajR5zMOKbSxroocTIf+CsmwlUSiVEPuJUFebZGbJc9+uKSjXrk4v2dqOeSCuySyylvhYj5tvtDoX0OGhQGZl3hIAm8Vebg+Mva9pihgnuDCGUAPXXA4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161299668179883.8825131047007; Wed, 10 Feb 2021 14:38:01 -0800 (PST) Received: from localhost ([::1]:47538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9y7U-0005rD-F1 for importer@patchew.org; Wed, 10 Feb 2021 17:38:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xhq-0006MY-Tg for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:30 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:55161) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xhk-0003Lk-FR for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:29 -0500 Received: by mail-wm1-x332.google.com with SMTP id w4so3190221wmi.4 for ; Wed, 10 Feb 2021 14:11:23 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id u206sm4998554wme.12.2021.02.10.14.10.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:11:13 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 87F3B1FF99; Wed, 10 Feb 2021 22:10:54 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Edh2u0iWFLyAxZ4TZrNGtVngWGS/6wsGB/21/wljo0k=; b=df0Bh5pw9Vyy2xiLzgESsHspyCtuPFM2d3HHlu4sBF51fvrG5JMT0ki91+tuf0VaCF Z2kUWipMxrJI2xNrQiAxqxvVgAb3HW79cwcS7WwsnKUYOhYbYUoSO9ydIksv5dIJ4T+o e+iEZj+7/EzPHn3Ka4JEJyjtJ/yp8Il61LV8JwYKX48dRKyr/9/yB7aLZOhYfNQlSDpy ckMTEaY05UOylci54NU8G6j38wG7bpNIdQhITmVMCDoLwTJ8dDZSf5+JJw8cc7F8JnE0 3vap1HvwZ+xeFzWyOc5esv3jeeGuhqvSan+SwuR7kDXRWORQI8OuWpRAq9E1UCyyCRoL gnsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Edh2u0iWFLyAxZ4TZrNGtVngWGS/6wsGB/21/wljo0k=; b=UQiTukGL8bd9/ODQOb1ZdH2vbRMnwN2r6J2w4hFjt4DXoVqbNOSzVZAqGdBHgaZcYa iR47f4nW5vLgoE8UfKTzujrQ0TEex5HQN1ZoArVTazELdr97sfxJ/sjc2bbr/3gcTx83 5ErFWD5Z0jGEM6T1cYP8Ln8OvCp29GAOIulsdVNrKmAOvFNa4kZK++Yag2CGxqaY9wsw 4VIqDYDkRVfjnmOtZ2P6ES0moc258cPSPa9P96/5aIsWKAwcUm2B9i4BrT+lrJXRFE5/ TkT/TUnstGhDDOw/TZ48xS1NtaMz188SK8VXdhPoInssNDSdo3f1R9mk9ksIFermf5r8 ohuA== X-Gm-Message-State: AOAM532YUtADjKSzaMPK6yUz/zSvQzhvrAdlIrlbSlF9pnZ6UWMW6Yx7 nnpFLZxCyDopZ1hUPXRZDNQQtQ== X-Google-Smtp-Source: ABdhPJwhoL6+tMue+toDIZZ6fp69A2uVLJiZ215BZZeLfqlaY34GEbZYg3TvLS2JBPBUcj26ssy2BA== X-Received: by 2002:a1c:730f:: with SMTP id d15mr1145992wmb.135.1612995081262; Wed, 10 Feb 2021 14:11:21 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 10/21] exec: Move TranslationBlock typedef to qemu/typedefs.h Date: Wed, 10 Feb 2021 22:10:42 +0000 Message-Id: <20210210221053.18050-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Anthony Green , Richard Henderson , Michael Walle , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini , kuhn.chenqun@huawei.com, Guan Xuetao , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Edgar E. Iglesias" , "open list:ARM TCG CPUs" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Richard Henderson This also means we don't need an extra declaration of the structure in hw/core/cpu.h. Signed-off-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Alex Benn=C3=A9e Message-Id: <20210208233906.479571-2-richard.henderson@linaro.org> Message-Id: <20210209182749.31323-2-alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/exec/tb-context.h | 1 - include/hw/core/cpu.h | 4 +--- include/hw/core/tcg-cpu-ops.h | 3 +-- include/qemu/typedefs.h | 1 + target/arm/internals.h | 3 +-- target/cris/translate.c | 2 +- target/lm32/translate.c | 2 +- target/moxie/translate.c | 2 +- target/unicore32/translate.c | 2 +- 9 files changed, 8 insertions(+), 12 deletions(-) diff --git a/include/exec/tb-context.h b/include/exec/tb-context.h index ec4c13b455..cc33979113 100644 --- a/include/exec/tb-context.h +++ b/include/exec/tb-context.h @@ -26,7 +26,6 @@ #define CODE_GEN_HTABLE_BITS 15 #define CODE_GEN_HTABLE_SIZE (1 << CODE_GEN_HTABLE_BITS) =20 -typedef struct TranslationBlock TranslationBlock; typedef struct TBContext TBContext; =20 struct TBContext { diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 38d813c389..c005d3dc2d 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -74,8 +74,6 @@ typedef enum MMUAccessType { =20 typedef struct CPUWatchpoint CPUWatchpoint; =20 -struct TranslationBlock; - /* see tcg-cpu-ops.h */ struct TCGCPUOps; =20 @@ -375,7 +373,7 @@ struct CPUState { IcountDecr *icount_decr_ptr; =20 /* Accessed in parallel; all accesses must be atomic */ - struct TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE]; + TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE]; =20 struct GDBRegisterState *gdb_regs; int gdb_num_regs; diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h index ccc97d1894..ac3bb051f2 100644 --- a/include/hw/core/tcg-cpu-ops.h +++ b/include/hw/core/tcg-cpu-ops.h @@ -30,8 +30,7 @@ struct TCGCPUOps { * If more state needs to be restored, the target must implement a * function to restore all the state, and register it here. */ - void (*synchronize_from_tb)(CPUState *cpu, - const struct TranslationBlock *tb); + void (*synchronize_from_tb)(CPUState *cpu, const TranslationBlock *tb); /** @cpu_exec_enter: Callback for cpu_exec preparation */ void (*cpu_exec_enter)(CPUState *cpu); /** @cpu_exec_exit: Callback for cpu_exec cleanup */ diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index dc39b05c30..ee60eb3de4 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -120,6 +120,7 @@ typedef struct ReservedRegion ReservedRegion; typedef struct SavedIOTLB SavedIOTLB; typedef struct SHPCDevice SHPCDevice; typedef struct SSIBus SSIBus; +typedef struct TranslationBlock TranslationBlock; typedef struct VirtIODevice VirtIODevice; typedef struct Visitor Visitor; typedef struct VMChangeStateEntry VMChangeStateEntry; diff --git a/target/arm/internals.h b/target/arm/internals.h index 448982dd2f..7d26ce0c9d 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -172,8 +172,7 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu= ); void arm_translate_init(void); =20 #ifdef CONFIG_TCG -void arm_cpu_synchronize_from_tb(CPUState *cs, - const struct TranslationBlock *tb); +void arm_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb); #endif /* CONFIG_TCG */ =20 =20 diff --git a/target/cris/translate.c b/target/cris/translate.c index c893f877ab..65c168c0c7 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -132,7 +132,7 @@ typedef struct DisasContext { =20 int delayed_branch; =20 - struct TranslationBlock *tb; + TranslationBlock *tb; int singlestep_enabled; } DisasContext; =20 diff --git a/target/lm32/translate.c b/target/lm32/translate.c index 030b232d66..20c70d03f1 100644 --- a/target/lm32/translate.c +++ b/target/lm32/translate.c @@ -93,7 +93,7 @@ typedef struct DisasContext { unsigned int tb_flags, synced_flags; /* tb dependent flags. */ int is_jmp; =20 - struct TranslationBlock *tb; + TranslationBlock *tb; int singlestep_enabled; =20 uint32_t features; diff --git a/target/moxie/translate.c b/target/moxie/translate.c index d5fb27dfb8..24a742b25e 100644 --- a/target/moxie/translate.c +++ b/target/moxie/translate.c @@ -36,7 +36,7 @@ =20 /* This is the state at translation time. */ typedef struct DisasContext { - struct TranslationBlock *tb; + TranslationBlock *tb; target_ulong pc, saved_pc; uint32_t opcode; uint32_t fp_status; diff --git a/target/unicore32/translate.c b/target/unicore32/translate.c index 962f9877a0..370709c9ea 100644 --- a/target/unicore32/translate.c +++ b/target/unicore32/translate.c @@ -34,7 +34,7 @@ typedef struct DisasContext { int condjmp; /* The label that will be jumped to when the instruction is skipped. = */ TCGLabel *condlabel; - struct TranslationBlock *tb; + TranslationBlock *tb; int singlestep_enabled; #ifndef CONFIG_USER_ONLY int user; --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612996445; cv=none; d=zohomail.com; s=zohoarc; b=IqGmjPtJOCgw7hT/jjA4AXIZ9wdZVoLAJYRAPDoJL2beVmFENM2UgHGuM6tNzzuCzKDdNB6XtUKTjUtc6+0ceHnhoR30jZCShoYKyT1czK8fVMgdp8TIUNFVHzjZX3apCWme/lHksXjQJamUa77TdP/1fklPAAcyjWYlN7P2Agw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612996445; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=V8hRFPoVc8c8eXrlr06JCpkJWOT8xslFBNNz5Wo6GrU=; b=ZFTZ89/LQN63sn1FVCdbEeHp0b9zGafC1mZ95EVU8fhSzf4gbMTBaK1WdiaSCpyvTWHnEYfwP5J060rbkvCqfJQubi+yz3cZfrboBWiVbcyHgXDe5EyeRViF7Gl2SBPiAvup/q2iKhiD6sN9ubKJGc59f0hsCpVoL5b9MFH6iuc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612996445390916.9883387714247; Wed, 10 Feb 2021 14:34:05 -0800 (PST) Received: from localhost ([::1]:38856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9y3g-00023T-AM for importer@patchew.org; Wed, 10 Feb 2021 17:34:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56962) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xhp-0006MK-8o for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:30 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:55736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xhd-0003Ka-Dr for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:28 -0500 Received: by mail-wm1-x330.google.com with SMTP id o15so1414629wmq.5 for ; Wed, 10 Feb 2021 14:11:17 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id u142sm5099604wmu.3.2021.02.10.14.11.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:11:13 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A2E8A1FF9A; Wed, 10 Feb 2021 22:10:54 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V8hRFPoVc8c8eXrlr06JCpkJWOT8xslFBNNz5Wo6GrU=; b=NP7/0bpwusTxvB0ZhU+x0q1nVL4wyjUhWnuD++OoZz/gHQyzI6yHJnv0F6IgHS1D5M mEPcBkWsV30X8fIWbpKWB59bea7gPPt7KaezQapMch5rBqnBH6Ogj/x33L5EvUBIdaNU NHzU48FjGCVkHkNJ0UiPO1Nzoje/OxViKYBGSh4QatSGTuDyvOU/VrGVY6IWNWfvQKre U29u4RQD/YxUyAV3PGg5axBgyHlCS/8QYTuEogpWYAlbHcExyhm5Xski+PHASZwLTgxc z2u+ErGXNaOKgvj9q9XnDWTg4e+RZleFlnCd0GRVHfWr0LWMM0YoRnwD/+OBuD1s5mZ2 LBoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V8hRFPoVc8c8eXrlr06JCpkJWOT8xslFBNNz5Wo6GrU=; b=XZp0xb5enmNMeNzrT1uR1c2qnAMYEgZBmed/x9HsQNefMY8y8598ER8nM4upRmk/Fk AvwkFqDfa5r+HVZ9mN/np/KYSLrCOsn01DmOX5pw3DgTO+uUsKeiVJ7rzjSwmpW2/dkK 9yCy2QB+aDgDCJfEZvrGlCJg9qktCqtJ2QyRigUkZlMt7VAwGN0pzjYgQiYHLHo2AGEe wNiZVVRSwgo3dGEhxkEqRHnb7kTFaF6CN828QVFsvzA1O+gFHnCk4ubHzxaHMqenl5Bx xIHxRTjjL7YBcoXN1Dm+rNBIfMn9k3JEqKuWNUQPjt1U/iN7nqV695IVEJPMafhyA5zP LLtg== X-Gm-Message-State: AOAM533iU2kN1QVcFFSdWZtXvSqnkX6Ia0WzUaVnzLtaZfSY/lMlOl/Z w23gv3ZKxoAcyO9yadPEKegZbg== X-Google-Smtp-Source: ABdhPJx27FFNMbbiYzgKSgLztIOIU2v6/P2xGIK8RkZE/87vFUeTob59+N/RyMgtKgCv01Sos6nemg== X-Received: by 2002:a05:600c:4105:: with SMTP id j5mr1237592wmi.0.1612995076109; Wed, 10 Feb 2021 14:11:16 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 11/21] accel/tcg: Create io_recompile_replay_branch hook Date: Wed, 10 Feb 2021 22:10:43 +0000 Message-Id: <20210210221053.18050-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini , kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Richard Henderson Create a hook in which to split out the mips and sh4 ifdefs from cpu_io_recompile. [AJB: s/stoped/stopped/] Signed-off-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Alex Benn=C3=A9e Message-Id: <20210208233906.479571-3-richard.henderson@linaro.org> Message-Id: <20210209182749.31323-3-alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/core/tcg-cpu-ops.h | 10 ++++++++++ accel/tcg/translate-all.c | 17 +++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h index ac3bb051f2..72d791438c 100644 --- a/include/hw/core/tcg-cpu-ops.h +++ b/include/hw/core/tcg-cpu-ops.h @@ -88,6 +88,16 @@ struct TCGCPUOps { */ bool (*debug_check_watchpoint)(CPUState *cpu, CPUWatchpoint *wp); =20 + /** + * @io_recompile_replay_branch: Callback for cpu_io_recompile. + * + * The cpu has been stopped, and cpu_restore_state_from_tb has been + * called. If the faulting instruction is in a delay slot, and the + * target architecture requires re-execution of the branch, then + * adjust the cpu state as required and return true. + */ + bool (*io_recompile_replay_branch)(CPUState *cpu, + const TranslationBlock *tb); #endif /* CONFIG_SOFTMMU */ #endif /* NEED_CPU_H */ =20 diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 81d4c83f22..6eb37883bd 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -60,6 +60,7 @@ #include "sysemu/cpu-timers.h" #include "sysemu/tcg.h" #include "qapi/error.h" +#include "hw/core/tcg-cpu-ops.h" #include "internal.h" =20 /* #define DEBUG_TB_INVALIDATE */ @@ -2420,6 +2421,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retadd= r) CPUArchState *env =3D cpu->env_ptr; #endif TranslationBlock *tb; + CPUClass *cc; uint32_t n; =20 tb =3D tcg_tb_lookup(retaddr); @@ -2429,11 +2431,18 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t reta= ddr) } cpu_restore_state_from_tb(cpu, tb, retaddr, true); =20 - /* On MIPS and SH, delay slot instructions can only be restarted if - they were already the first instruction in the TB. If this is not - the first instruction in a TB then re-execute the preceding - branch. */ + /* + * Some guests must re-execute the branch when re-executing a delay + * slot instruction. When this is the case, adjust icount and N + * to account for the re-execution of the branch. + */ n =3D 1; + cc =3D CPU_GET_CLASS(cpu); + if (cc->tcg_ops->io_recompile_replay_branch && + cc->tcg_ops->io_recompile_replay_branch(cpu, tb)) { + cpu_neg(cpu)->icount_decr.u16.low++; + n =3D 2; + } #if defined(TARGET_MIPS) if ((env->hflags & MIPS_HFLAG_BMASK) !=3D 0 && env->active_tc.PC !=3D tb->pc) { --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612996341; cv=none; d=zohomail.com; s=zohoarc; b=EiDfgKkUHvj0XbGMSbv+F/7bHwh5ajkV8Z1ywUb5SRq5D4ixQOCW8/y2h5GR/z16owgxWIDGxAVMyo1oBP5PjaHqK7PriytgAjoswj7sMEUSNzi2q09YohCIQaLox5UPJZ8dc/yVF8iNEuMAWbKBQqsyXMuZ7laZBRFkXx7eKm4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612996341; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=maKaI/qzwTXOe899gbp1Af9qP827gN0VYDNXRtqE7f8=; b=fNNq8zzNgXIVK6yucxx6hm4smlfYolw3iacVKFKq8nX5a6+sSfg4UeAoLZinre1stOcQ1Va8nsTMHlXLDJ01tIPlU+VGJFbsTcvgIj1awCjPQhtW/FNOF8HyXtYnauB35kIvZzXu8rufE+NUybI48Q9Zuo3fdN5GpDJcmQZKI2o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612996340633116.22080844386062; Wed, 10 Feb 2021 14:32:20 -0800 (PST) Received: from localhost ([::1]:35928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9y1x-0000ky-Ji for importer@patchew.org; Wed, 10 Feb 2021 17:32:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xhl-0006Ii-45 for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:26 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:38224) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xhg-0003L5-Ev for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:24 -0500 Received: by mail-wm1-x32b.google.com with SMTP id y134so3307329wmd.3 for ; Wed, 10 Feb 2021 14:11:20 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id j17sm4537337wmc.28.2021.02.10.14.11.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:11:13 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id BC52D1FF9B; Wed, 10 Feb 2021 22:10:54 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=maKaI/qzwTXOe899gbp1Af9qP827gN0VYDNXRtqE7f8=; b=BnRJ6TMA1Fz8nSbo6qVYjZzR/6j+e3mCokFjSS18/v7JeRZUFspfyqFGl0fV4GocSI FvwLegdVMCNjiTfrq7n3B7eC7kqhgxKVl0BfwCQKi/AFsSSf1yerk8mp+fVFc0jdRpyo /chpAte7At3NS0x807qy+5SpuBCBlFUiFOipd9aoMAnlWgo7ADP+0pGU3U3/wrj5s2rE SKOBTHM66BACAUuSDaUbHxx3AdjsAFcmir2g+F1pq+Iw0D50IX1KIdE4CkrDOLkBsyIr jwSOfE91+2xIyX75wYV2SUVS5UIZvKyay0oosN1FWbSBXSwGZNxpO//4M7MW8L/C3MCQ /rtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=maKaI/qzwTXOe899gbp1Af9qP827gN0VYDNXRtqE7f8=; b=iQAz4vlTDP8oj453DH3qNmYEQO8YO9+iAw/tL8GTNh6oArdYLZx3u6EzcpfedSnzgj gKZ1gTRQ9dSUFBCUwDKQXf58RV/29pvHiWJ8QrXb9kFFd+2NLIlMHZ3N2yEcLrje65Ce pEFZtBWEPfBTVooD4IYKdt/PhuGFT9VYSkhCp0Oko4ulxrEbbIrhukdD/FwkuPeyrjc8 XUsJlvzVW6mfOceEHD0GetiSzeeuYR3xGhmhKpiLQAS7I0qlUSsrdHpTNVraFsgDpxEw 2Q/z1yesQOedPXsXLG24HWhiNj0gHdWqSL3cHM1Qk/dQz3KY1oguQFgDIp0sBu/Ya5j6 DOWg== X-Gm-Message-State: AOAM532GYhIz1yaiSMxiY8IpSmKzePgF3ajp6PEnn2DMccNcoAWq2ndW dkRYRNSOA61SjgROTCXcbsS7BA== X-Google-Smtp-Source: ABdhPJxRYsPFYy58IQ6r4t73WTS1IMGMgv/HyUp+bMSfQEG9YdDH6pXp6Xfpv16DQrath/FGvYC5hg== X-Received: by 2002:a05:600c:3506:: with SMTP id h6mr1192328wmq.21.1612995079131; Wed, 10 Feb 2021 14:11:19 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 12/21] target/mips: Create mips_io_recompile_replay_branch Date: Wed, 10 Feb 2021 22:10:44 +0000 Message-Id: <20210210221053.18050-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini , kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Richard Henderson Move the code from accel/tcg/translate-all.c to target/mips/cpu.c. Signed-off-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Alex Benn=C3=A9e Message-Id: <20210208233906.479571-4-richard.henderson@linaro.org> Message-Id: <20210209182749.31323-4-alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- accel/tcg/translate-all.c | 12 ++---------- target/mips/cpu.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 6eb37883bd..470657b02a 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2417,7 +2417,7 @@ void tb_check_watchpoint(CPUState *cpu, uintptr_t ret= addr) */ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) { -#if defined(TARGET_MIPS) || defined(TARGET_SH4) +#if defined(TARGET_SH4) CPUArchState *env =3D cpu->env_ptr; #endif TranslationBlock *tb; @@ -2443,15 +2443,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retad= dr) cpu_neg(cpu)->icount_decr.u16.low++; n =3D 2; } -#if defined(TARGET_MIPS) - if ((env->hflags & MIPS_HFLAG_BMASK) !=3D 0 - && env->active_tc.PC !=3D tb->pc) { - env->active_tc.PC -=3D (env->hflags & MIPS_HFLAG_B16 ? 2 : 4); - cpu_neg(cpu)->icount_decr.u16.low++; - env->hflags &=3D ~MIPS_HFLAG_BMASK; - n =3D 2; - } -#elif defined(TARGET_SH4) +#if defined(TARGET_SH4) if ((env->flags & ((DELAY_SLOT | DELAY_SLOT_CONDITIONAL))) !=3D 0 && env->pc !=3D tb->pc) { env->pc -=3D 2; diff --git a/target/mips/cpu.c b/target/mips/cpu.c index ad163ead62..bf70c77295 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -268,6 +268,23 @@ static void mips_cpu_synchronize_from_tb(CPUState *cs, env->hflags &=3D ~MIPS_HFLAG_BMASK; env->hflags |=3D tb->flags & MIPS_HFLAG_BMASK; } + +# ifndef CONFIG_USER_ONLY +static bool mips_io_recompile_replay_branch(CPUState *cs, + const TranslationBlock *tb) +{ + MIPSCPU *cpu =3D MIPS_CPU(cs); + CPUMIPSState *env =3D &cpu->env; + + if ((env->hflags & MIPS_HFLAG_BMASK) !=3D 0 + && env->active_tc.PC !=3D tb->pc) { + env->active_tc.PC -=3D (env->hflags & MIPS_HFLAG_B16 ? 2 : 4); + env->hflags &=3D ~MIPS_HFLAG_BMASK; + return true; + } + return false; +} +# endif /* !CONFIG_USER_ONLY */ #endif /* CONFIG_TCG */ =20 static bool mips_cpu_has_work(CPUState *cs) @@ -679,6 +696,7 @@ static struct TCGCPUOps mips_tcg_ops =3D { .do_interrupt =3D mips_cpu_do_interrupt, .do_transaction_failed =3D mips_cpu_do_transaction_failed, .do_unaligned_access =3D mips_cpu_do_unaligned_access, + .io_recompile_replay_branch =3D mips_io_recompile_replay_branch, #endif /* !CONFIG_USER_ONLY */ }; #endif /* CONFIG_TCG */ --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612996901; cv=none; d=zohomail.com; s=zohoarc; b=E3dGsoa3iNYfqTHrXI1GIqmvz07Cl5rlpMbcWIpG2lUcbI3CQuKwcKVFVdwTQaJStguLt0q3lCwdESxRfEv3DthZdyFayAaB44/90sr8l8o136fQvsn+08w0M3/5BW7lvN+l3gmMLr8nmnnlWos+YS/ipRESutvwhXB4hc6q5so= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612996901; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=C092gDUqg+6i3/7PDEneZh7D36z03pG1+b/EutVVLjE=; b=eVqAOZ3qhqAlVDOw35R6/GxnqbrFcbo+aS+985crsfVDFFbsZsY2GFC8D8+N04lbdSEvWjLAtZwHiDwaMzAhV7DvWGux9tddBzSi6qKNoZrS+COdUcotjZycj48gnroYXmzsrhPIfxXXnrqgs7DQxI6YGdY6UvBMVoHtms2rEpI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612996900803578.3985834010208; Wed, 10 Feb 2021 14:41:40 -0800 (PST) Received: from localhost ([::1]:53980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9yB1-0000Lh-Mq for importer@patchew.org; Wed, 10 Feb 2021 17:41:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56976) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xhq-0006MZ-Vx for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:32 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:37469) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xhk-0003Ln-Fc for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:28 -0500 Received: by mail-wm1-x32e.google.com with SMTP id m1so3299517wml.2 for ; Wed, 10 Feb 2021 14:11:23 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id w4sm4502230wmc.13.2021.02.10.14.11.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:11:13 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D420D1FF9C; Wed, 10 Feb 2021 22:10:54 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C092gDUqg+6i3/7PDEneZh7D36z03pG1+b/EutVVLjE=; b=rcl0EaxV/R0yqpKO0l1CQpHyWAzbi0k7XsPOnGO9M+bMLWx/4hU7noUOPg+OVShvlh zU8Q3b5xUCLKeb3SUzlp5zR/+UkhfwI09duyevVlQsvc+B559FfYY9rLoFY/yGcdtnsp 5WOVWTEHMf2U9W0/RXQQFI7qjdMmxtjbEMnLkU9IoKPbDC2PgparevAgNk0WgGH7qMFi HTxTqWiKpLRcczaNdZJbqQFuPzRFSga7hUARPKTCn0T87e1q3sIDb7sN7L1t8Gpi3pHo EgMM3qNWc0NCmCG7/21zxRo0upULMQRvXyG90mQ2slqWIMjeCR14rC9FhjWp4omCyufW 7uZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=C092gDUqg+6i3/7PDEneZh7D36z03pG1+b/EutVVLjE=; b=RM9fnoliq0HSK1cdPlcKAgVyXYFpawDwTkik3SRjGu+4uUCygNV3Zg5jEqeMLnUiHW bGO4Buz2R7ug6ggFDk/M8qby032q77Px0nSzOOYob1aIPhjapYQTrHpeEx4VVLGmCJth iL2eb3ANjww5pehmM7gZVCt8mfVw1aAO/+iLuDvQCIyDzssrutusUQK6xxeFSI0lznQK NXrC2I8pio8Br+QQiTLwpoDH4uplTFa43BT0PPpUxZUZ9QNgJucQZ5SezHB6HZk69q01 ti/pPgEmXXjj7niNvcqA7UDbz4+ID71yFHVRIWeWUEdvNJ/m/f9EdXChOsl1/hZAYDLj jmGw== X-Gm-Message-State: AOAM532FfuL+QkThD4TEbWFtd6kPvVO66aOMARKASPQaLPn5QvgAHf/0 lgktpAz/3YHHl52VyX19Xjf9pQ== X-Google-Smtp-Source: ABdhPJw32QAHLahOPHHS7QWaiKH4TYNQZzdSlwyBFBZU6mBMMLv/kfuNBYafLfvPx9mcsjHWU3/HxQ== X-Received: by 2002:a1c:6289:: with SMTP id w131mr1273386wmb.0.1612995082212; Wed, 10 Feb 2021 14:11:22 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 13/21] target/sh4: Create superh_io_recompile_replay_branch Date: Wed, 10 Feb 2021 22:10:45 +0000 Message-Id: <20210210221053.18050-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yoshinori Sato , Richard Henderson , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini , kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Richard Henderson Move the code from accel/tcg/translate-all.c to target/sh4/cpu.c. Signed-off-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Alex Benn=C3=A9e Message-Id: <20210208233906.479571-5-richard.henderson@linaro.org> Message-Id: <20210209182749.31323-5-alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- accel/tcg/translate-all.c | 12 ------------ target/sh4/cpu.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 470657b02a..b8ad95aa1b 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2417,9 +2417,6 @@ void tb_check_watchpoint(CPUState *cpu, uintptr_t ret= addr) */ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) { -#if defined(TARGET_SH4) - CPUArchState *env =3D cpu->env_ptr; -#endif TranslationBlock *tb; CPUClass *cc; uint32_t n; @@ -2443,15 +2440,6 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retad= dr) cpu_neg(cpu)->icount_decr.u16.low++; n =3D 2; } -#if defined(TARGET_SH4) - if ((env->flags & ((DELAY_SLOT | DELAY_SLOT_CONDITIONAL))) !=3D 0 - && env->pc !=3D tb->pc) { - env->pc -=3D 2; - cpu_neg(cpu)->icount_decr.u16.low++; - env->flags &=3D ~(DELAY_SLOT | DELAY_SLOT_CONDITIONAL); - n =3D 2; - } -#endif =20 /* Generate a new TB executing the I/O insn. */ cpu->cflags_next_tb =3D curr_cflags() | CF_LAST_IO | n; diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index a78d283bc8..ac65c88f1f 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -43,6 +43,23 @@ static void superh_cpu_synchronize_from_tb(CPUState *cs, cpu->env.flags =3D tb->flags & TB_FLAG_ENVFLAGS_MASK; } =20 +#ifndef CONFIG_USER_ONLY +static bool superh_io_recompile_replay_branch(CPUState *cs, + const TranslationBlock *tb) +{ + SuperHCPU *cpu =3D SUPERH_CPU(cs); + CPUSH4State *env =3D &cpu->env; + + if ((env->flags & ((DELAY_SLOT | DELAY_SLOT_CONDITIONAL))) !=3D 0 + && env->pc !=3D tb->pc) { + env->pc -=3D 2; + env->flags &=3D ~(DELAY_SLOT | DELAY_SLOT_CONDITIONAL); + return true; + } + return false; +} +#endif + static bool superh_cpu_has_work(CPUState *cs) { return cs->interrupt_request & CPU_INTERRUPT_HARD; @@ -217,6 +234,7 @@ static struct TCGCPUOps superh_tcg_ops =3D { #ifndef CONFIG_USER_ONLY .do_interrupt =3D superh_cpu_do_interrupt, .do_unaligned_access =3D superh_cpu_do_unaligned_access, + .io_recompile_replay_branch =3D superh_io_recompile_replay_branch, #endif /* !CONFIG_USER_ONLY */ }; =20 --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612996159; cv=none; d=zohomail.com; s=zohoarc; b=Vzv2UoxCw189bm9rfVRpahKioBq74/+cO5+iUZBLi0TYLn3cLH3dL1WvmT8PmJpSRh+G1Sg5aVEevPI2rB4e7VLsg8F/njDeBzLevF+E3aJd5PaZlngEsnrnIcwAC0cLaKRvigjNkZCNkQri7lXsFsBbyNQ4XDZ8SHNl5gzJAh8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612996159; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Im2/9eo7/fnC2asN2YmX8UWgpnbFcH4spWB/cPGWcw8=; b=BRH8NEkR+eYttUFJGZKY8ZRcTchH54/P/MyhpuIy+fuNmq5RcTS2HLKLpvw5RF8WyTT7tX1zKRlbGYvaU65NUOPugzelZ8ubyyUDv4C3HfC72LTNaQC/AvSRF9r/4I3zNFA4vGTKKjp1VTwyQYfHpM/qGx7lh9u3+jijXX2AoGg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612996159492729.8319376724087; Wed, 10 Feb 2021 14:29:19 -0800 (PST) Received: from localhost ([::1]:59774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xz4-0007Be-Bo for importer@patchew.org; Wed, 10 Feb 2021 17:29:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58802) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xqJ-00070f-0M for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:20:16 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:51476) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xqG-0006q2-2b for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:20:14 -0500 Received: by mail-wm1-x335.google.com with SMTP id t142so3216083wmt.1 for ; Wed, 10 Feb 2021 14:20:11 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id o124sm5364205wmb.5.2021.02.10.14.20.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:20:04 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id F08241FF9D; Wed, 10 Feb 2021 22:10:54 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Im2/9eo7/fnC2asN2YmX8UWgpnbFcH4spWB/cPGWcw8=; b=n7iyfsnkx8PySQbwwndsyjpcKLXOOgc2QrrWDyNF5e8Nf66O+yAHmZFPdUHju7lHGg TmIMrT2CM+rEx/cEhZMDGGWt3RJj9/ah3M+29JeDC19PTRWjVc7/TyW/QUQQJKQr+TrB 0qo9kM+eduMSy/zQEt8wl8753Sx08BSxZfQ9HBxl4C0IWAKYsH3Dr5L118iItEULQuEi Q1YBacEqvIh8D26DtpRLRy0MA62A92EcslUHePj2WKQwIA6Tu6LyrLwMZMBtToQ+NQC6 KClzKaApNmIt6XzPFALE9B9DtvAiFukUHOghz56aavbKLYVgEB0zvEhvEbfZaH8Iwxsl 1HZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Im2/9eo7/fnC2asN2YmX8UWgpnbFcH4spWB/cPGWcw8=; b=WG36uTAvuRn20NQEMronP0M5cKYBWVWy65oZUGRW+A+9bw6XuvxCk5Urn02W8LX0v0 4AgpC/zf0jRZzgTpSl20OUtm2cjzppYl1IBXehtDMihAwi5wgg0FBzpW07TGUvWxjWgM rkS9BHERWNr9IVKJhmj/4Od2GIrLX4L2ouU3ysCgHyrdcl9kHzGYljG4Er1nbpiWIH0k gElJLxpwUuZ8iteUb0GlLhYSAdBntpc7N2rqmCwroaYy7x7uU2mg35lRQU/4bq9eDwmE YFlwZCAb6X5tnYFbXq0qj4puoaSCqt55/Ok0Jd6XIyGyO8/8m6IYPEq79//oEumNzwAr 7TwQ== X-Gm-Message-State: AOAM532X9IgSbs4dSOZXOGqIV6GRiRKyJdHNZisjxmA/POtpONVcmMWj U96p7xVzoBB0QNNVO6XbbThGSSR8CHw92oca X-Google-Smtp-Source: ABdhPJw9iHqtEWr4+xLqBqSd2T7asFwRq+Ri8ORmAkjmcx/ZGe0RbT3fZq7S9tfZXqa/vE/LVfUXVA== X-Received: by 2002:a1c:dcd7:: with SMTP id t206mr1182684wmg.108.1612995610348; Wed, 10 Feb 2021 14:20:10 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 14/21] tests/plugin: expand insn test to detect duplicate instructions Date: Wed, 10 Feb 2021 22:10:46 +0000 Message-Id: <20210210221053.18050-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Richard Henderson , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini , kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) A duplicate insn is one that is appears to be executed twice in a row. This is currently possible due to -icount and cpu_io_recompile() causing a re-translation of a block. On it's own this won't trigger any tests though. The heuristics that the plugin use can't deal with the x86 rep instruction which (validly) will look like executing the same instruction several times. To avoid problems later we tweak the rules for x86 to run the "inline" version of the plugin. This also has the advantage of increasing coverage of the plugin code (see bugfix in previous commit). Signed-off-by: Alex Benn=C3=A9e Message-Id: <20210209182749.31323-6-alex.bennee@linaro.org> --- v2 - make i386/x86_64 run inline version --- tests/plugin/insn.c | 12 +++++++++++- tests/tcg/i386/Makefile.softmmu-target | 10 ++++++++++ tests/tcg/i386/Makefile.target | 7 +++++++ tests/tcg/x86_64/Makefile.softmmu-target | 10 ++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/tests/plugin/insn.c b/tests/plugin/insn.c index a9a6e41237..c253980ec8 100644 --- a/tests/plugin/insn.c +++ b/tests/plugin/insn.c @@ -21,6 +21,14 @@ static bool do_inline; =20 static void vcpu_insn_exec_before(unsigned int cpu_index, void *udata) { + static uint64_t last_pc; + uint64_t this_pc =3D GPOINTER_TO_UINT(udata); + if (this_pc =3D=3D last_pc) { + g_autofree gchar *out =3D g_strdup_printf("detected repeat executi= on @ 0x%" + PRIx64 "\n", this_pc); + qemu_plugin_outs(out); + } + last_pc =3D this_pc; insn_count++; } =20 @@ -36,8 +44,10 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qe= mu_plugin_tb *tb) qemu_plugin_register_vcpu_insn_exec_inline( insn, QEMU_PLUGIN_INLINE_ADD_U64, &insn_count, 1); } else { + uint64_t vaddr =3D qemu_plugin_insn_vaddr(insn); qemu_plugin_register_vcpu_insn_exec_cb( - insn, vcpu_insn_exec_before, QEMU_PLUGIN_CB_NO_REGS, NULL); + insn, vcpu_insn_exec_before, QEMU_PLUGIN_CB_NO_REGS, + GUINT_TO_POINTER(vaddr)); } } } diff --git a/tests/tcg/i386/Makefile.softmmu-target b/tests/tcg/i386/Makefi= le.softmmu-target index 5266f2335a..fa9b1b9f90 100644 --- a/tests/tcg/i386/Makefile.softmmu-target +++ b/tests/tcg/i386/Makefile.softmmu-target @@ -33,5 +33,15 @@ EXTRA_RUNS+=3D$(MULTIARCH_RUNS) =20 memory: CFLAGS+=3D-DCHECK_UNALIGNED=3D1 =20 +# non-inline runs will trigger the duplicate instruction heuristics in lib= insn.so +run-plugin-%-with-libinsn.so: + $(call run-test, $@, \ + $(QEMU) -monitor none -display none \ + -chardev file$(COMMA)path=3D$@.out$(COMMA)id=3Doutput \ + -plugin ../../plugin/libinsn.so$(COMMA)arg=3Dinline \ + -d plugin -D $*-with-libinsn.so.pout \ + $(QEMU_OPTS) $*, \ + "$* on $(TARGET_NAME)") + # Running QEMU_OPTS+=3D-device isa-debugcon,chardev=3Doutput -device isa-debug-exit,= iobase=3D0xf4,iosize=3D0x4 -kernel diff --git a/tests/tcg/i386/Makefile.target b/tests/tcg/i386/Makefile.target index ad187cb2c9..c4a6f91966 100644 --- a/tests/tcg/i386/Makefile.target +++ b/tests/tcg/i386/Makefile.target @@ -48,6 +48,13 @@ else SKIP_I386_TESTS+=3Dtest-i386-fprem endif =20 +# non-inline runs will trigger the duplicate instruction heuristics in lib= insn.so +run-plugin-%-with-libinsn.so: + $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \ + -plugin ../../plugin/libinsn.so$(COMMA)arg=3Dinline \ + -d plugin -D $*-with-libinsn.so.pout $*, \ + "$* (inline) on $(TARGET_NAME)") + # Update TESTS I386_TESTS:=3D$(filter-out $(SKIP_I386_TESTS), $(ALL_X86_TESTS)) TESTS=3D$(MULTIARCH_TESTS) $(I386_TESTS) diff --git a/tests/tcg/x86_64/Makefile.softmmu-target b/tests/tcg/x86_64/Ma= kefile.softmmu-target index 1bd763f2e6..9896319f0e 100644 --- a/tests/tcg/x86_64/Makefile.softmmu-target +++ b/tests/tcg/x86_64/Makefile.softmmu-target @@ -33,5 +33,15 @@ EXTRA_RUNS+=3D$(MULTIARCH_RUNS) =20 memory: CFLAGS+=3D-DCHECK_UNALIGNED=3D1 =20 +# non-inline runs will trigger the duplicate instruction heuristics in lib= insn.so +run-plugin-%-with-libinsn.so: + $(call run-test, $@, \ + $(QEMU) -monitor none -display none \ + -chardev file$(COMMA)path=3D$@.out$(COMMA)id=3Doutput \ + -plugin ../../plugin/libinsn.so$(COMMA)arg=3Dinline \ + -d plugin -D $*-with-libinsn.so.pout \ + $(QEMU_OPTS) $*, \ + "$* on $(TARGET_NAME)") + # Running QEMU_OPTS+=3D-device isa-debugcon,chardev=3Doutput -device isa-debug-exit,= iobase=3D0xf4,iosize=3D0x4 -kernel --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612997570; cv=none; d=zohomail.com; s=zohoarc; b=Z/9+h9QLOR8k0gZsuc5VZJWZJBuXpEwJWv415X8PvksQxeMfLGwqmQAnJ/xOhFrdOhxnGOzQXEpTWHwI95sYc03Ihq9+xOUWLRb30aXji0OtiOorDvBGBeiENCJTfsEQ5AM4onHbQxuwra67Xic529OrrQOD/ZmJZijr0zh3xAM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612997570; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=j4XmWVEBX2ENQRRduA5gKPU5AX0OB2Qj1ZjmkgHICaE=; b=A8mNJFUsW7OGWNHQt41Ro7xIU3mN17+6VZXabbWrtjVan/jLYVquGJVgz2H9PHx7Oupj/fi32vEVGB53HM761+9CJ/4t/Cnnc3YuSe2Kifqf+rIwS96QES92sn8kspfGM2Gp1NQ7QJnh6HhHS0rGZRhImf9/ksN4r8dg/luUaYg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612997569676998.5377139708917; Wed, 10 Feb 2021 14:52:49 -0800 (PST) Received: from localhost ([::1]:44806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9yLo-0000EC-GM for importer@patchew.org; Wed, 10 Feb 2021 17:52:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xqD-0006w2-Na for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:20:09 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:55202) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xqA-0006oI-DX for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:20:09 -0500 Received: by mail-wm1-x330.google.com with SMTP id w4so3205138wmi.4 for ; Wed, 10 Feb 2021 14:20:05 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id o83sm5038838wme.37.2021.02.10.14.20.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:20:04 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 1376C1FF9E; Wed, 10 Feb 2021 22:10:55 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=j4XmWVEBX2ENQRRduA5gKPU5AX0OB2Qj1ZjmkgHICaE=; b=fa6NFK/B+UnoWsiE/5MwVW2nbwy14i6XChQfMDtKBl/B1grK17ouQUx9SpYU12Aqit UU8dDvjIfrZGxX0fcBDVAdV/qAwWasvnxNkrFqkNYRckV9Jmlx/5XMiDODyCxOYte9Pf dr6r8D2qHzmxpLdCJrLdEF/U6PYsocIjzBTv20XMm8hVURCF/HM/xuKlPfsQ6ZwkDAAc HOa/5YynFMSs9PTp+IndKQDcVSv1knnbg08Z+IKTfpU96Nk2dcy8wgTE4VhpfyFf44fb o2EwG4TLfJsIf4BisEHKpybzi3lCQNhNw7kzM+ZAtU/Q4H3Q/aPQEEOVzvNFSXLgS/Wk 2aGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=j4XmWVEBX2ENQRRduA5gKPU5AX0OB2Qj1ZjmkgHICaE=; b=QQ/huGELzLY3ahgOqtBWbe3R37MblahT312ju9/lwkLVSvNOiB5EJKu/d9GV6VTR6P G7a9eOiIPTVUYwiDDSKDfBjw5/J2YlmZClWnn4nOYfYoKCQUM7SFcwQwMVyruWZvaylx flI7bCHRANxYpu22/eQJkvECVPadz97M5rZZ0REOAw6ZZBa3JneEaz8+VGZe+m8cY3n5 trVxzxYTL5KAAG4/QQLDIUZy33A3aGN8LhD5g4jCDYeDxlMqR1AMV8Ty8ZkMvq/We1Qs RKJPhBQ+KUxbUWfepBn2yfiPkFmNuGjH/AXURND4kiNtS9i+wiudHgR+NyJnl4LHTIOZ JduQ== X-Gm-Message-State: AOAM5325PpQlZ1rh0XRbahBkMSfbuMBWljZwY2D2ziXEqxmdcZ4XSRCr fi5v+fYp0rsyG5kAcJoiyUridQ== X-Google-Smtp-Source: ABdhPJz1jj45n1Fg1lpol9+hw5S4VqPh5Youuzip+n6bEgyy92RhM/4qrG0MzzUit/ovqgrfC+DxZA== X-Received: by 2002:a1c:c904:: with SMTP id f4mr1270608wmb.14.1612995604850; Wed, 10 Feb 2021 14:20:04 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 15/21] tests/acceptance: add a new set of tests to exercise plugins Date: Wed, 10 Feb 2021 22:10:47 +0000 Message-Id: <20210210221053.18050-16-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, Wainer dos Santos Moschetta , Cleber Rosa , kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This is just a simple test to count the instructions executed by a kernel. However a later test will detect a failure condition when icount is enabled. Signed-off-by: Alex Benn=C3=A9e Message-Id: <20210209182749.31323-7-alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Wainer dos Santos Moschetta --- tests/acceptance/tcg_plugins.py | 103 ++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 tests/acceptance/tcg_plugins.py diff --git a/tests/acceptance/tcg_plugins.py b/tests/acceptance/tcg_plugins= .py new file mode 100644 index 0000000000..b512979769 --- /dev/null +++ b/tests/acceptance/tcg_plugins.py @@ -0,0 +1,103 @@ +# TCG Plugins tests +# +# These are a little more involved than the basic tests run by check-tcg. +# +# Copyright (c) 2021 Linaro +# +# Author: +# Alex Benn=C3=A9e +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import logging +import time +import tempfile +import mmap +import re + +from boot_linux_console import LinuxKernelTest + + +class PluginKernelBase(LinuxKernelTest): + """ + Boots a Linux kernel with a TCG plugin enabled. + """ + + timeout =3D 120 + KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D1 panic=3D-1 ' + + def run_vm(self, kernel_path, kernel_command_line, + plugin, plugin_log, console_pattern, args): + + logger =3D logging.getLogger('plugin') + start_time =3D time.time() + vm =3D self.get_vm() + vm.set_console() + vm.add_args('-kernel', kernel_path, + '-append', kernel_command_line, + '-plugin', plugin, + '-d', 'plugin', + '-D', plugin_log, + '-net', 'none', + '-no-reboot') + if args: + vm.add_args(*args) + + try: + vm.launch() + except: + # fails if plugins not enabled + self.cancel("TCG Plugins not enabled") + + self.wait_for_console_pattern(console_pattern, vm) + elapsed =3D time.time() - start_time + logger.info('elapsed time %.2f sec' % elapsed) + # ensure logs are flushed + vm.shutdown() + return elapsed + + +class PluginKernelNormal(PluginKernelBase): + + def _grab_aarch64_kernel(self): + kernel_url =3D ('http://security.debian.org/' + 'debian-security/pool/updates/main/l/linux-signed-ar= m64/' + 'linux-image-4.19.0-12-arm64_4.19.152-1_arm64.deb') + kernel_sha1 =3D '2036c2792f80ac9c4ccaae742b2e0a28385b6010' + kernel_deb =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_sh= a1) + kernel_path =3D self.extract_from_deb(kernel_deb, + "/boot/vmlinuz-4.19.0-12-arm64= ") + return kernel_path + + def test_aarch64_virt_insn(self): + """ + :avocado: tags=3Daccel:tcg + :avocado: tags=3Darch:aarch64 + :avocado: tags=3Dmachine:virt + :avocado: tags=3Dcpu:cortex-a57 + """ + kernel_path =3D self._grab_aarch64_kernel() + kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + + 'console=3DttyAMA0') + console_pattern =3D 'Kernel panic - not syncing: VFS:' + + plugin_log =3D tempfile.NamedTemporaryFile(mode=3D"r+t", prefix=3D= "plugin", + suffix=3D".log") + + self.run_vm(kernel_path, kernel_command_line, + "tests/plugin/libinsn.so", plugin_log.name, + console_pattern, + args=3D('-cpu', 'cortex-a53')) + + logger =3D logging.getLogger() + + with plugin_log as lf, \ + mmap.mmap(lf.fileno(), 0, access=3Dmmap.ACCESS_READ) as s: + + m =3D re.search(br"insns: (?P\d+)", s) + if "count" in m.groupdict(): + logger.debug("reported %d instructions", + int(m.group("count"))) + else: + logger.debug("Failed to find instruction count") + self.fail --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612997853; cv=none; d=zohomail.com; s=zohoarc; b=G3SZ3sEHm7Vpm7tna4yHtV7TEs/OhWdDHELf90MGVcPIjy5seKkOJCPw8LBwYWiJ4snvkLmgAl8DcImHosRMoLjSAqTQrJ8x7Cd0HSeEWIqly4sI2oWN7u/gnKZJZVHJO88MnhONuYY1ou89n2xsK141/6tKT9F6A3vzq0b6vbM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612997853; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HGyTKfyrMC02NQIDciJuv0x1b/kxlzbJP/1nTgEUSN0=; b=W1Ikxmwen1WgFEtJDnJKEY8EVZRxt10755MdmOr3KGlwH/g2dztNETHkz6J/YPn9ByoOG6td6kIS6fbwG/Y3CixTU/Co7PF8Jf4DdTtwPxB42I6bkVPRaBy52qieFhusBUkFrEXTkXz5l3jmaz8Ug9DiN2qLBiXzLuA0JVsBMvI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612997853541594.0886069079553; Wed, 10 Feb 2021 14:57:33 -0800 (PST) Received: from localhost ([::1]:52248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9yQO-0003Wm-Hk for importer@patchew.org; Wed, 10 Feb 2021 17:57:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xqS-00071Q-Dd for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:20:28 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:53848) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xqI-0006rY-OJ for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:20:23 -0500 Received: by mail-wm1-x32f.google.com with SMTP id j11so3203819wmi.3 for ; Wed, 10 Feb 2021 14:20:13 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id 17sm4871093wmf.32.2021.02.10.14.20.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:20:12 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 2AD7C1FF9F; Wed, 10 Feb 2021 22:10:55 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HGyTKfyrMC02NQIDciJuv0x1b/kxlzbJP/1nTgEUSN0=; b=gR/uZKibyVFlrqalLm+DNQ7QTCzXkJqMl4ixYc8w1+ZU1CYThBDMbBUo5Bh97jxceH olwGv99ZTFoQxukoCi35pUBZNvvjRCzPOvLso6tcMNys0I3QIqx5zM2UmjXe0x2qQeKd lyba2kcKoDUN9jhFa29MbjHBwUMSL4to3qU2wwAHrp+rojFhFdVvbIOxO9lcYH1Ttc9O qdkjuEwok/xGKcoFXVVM/kUrbY/j/M7Zn993+zS5vcJFLQ+lATMuhMgAr/AJMyfkFop8 /zwEjKO+oRo2QNoR6+OICuGFYi20TJ8aU3eea5IfzVp77HCUrMVkE7+Q4ZiRMhozorvs ZICw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HGyTKfyrMC02NQIDciJuv0x1b/kxlzbJP/1nTgEUSN0=; b=WNbnQQdn03YIq/Ns1ySLaBsKmCQwKHiVnBUatUJkYnxXoXyC652/e+tfcyQ07fknJc TMIe10GX/U4Z+6lSvKDycDbMrOlN88ADsCr5rL9wOsC5YgwoYgNcWtsULgQ1QjWI1jNm aXGtsFqr0WgQzFRuZ1U/eKA5OkCESYIV5CvMINZ+t3JqZfFaA/Ot2ZGpuidipuAvT17D +rgbmXeA3ti2aP5wc+f9IfQh/ITahVCj1VvxueWlXZ2D9QqO+DkxnZnCaGYmykZlBYfG YX/Bd6Mxgyh1mjISfFIgz5EnxSCpklo9YMMmkTQ3+ALqrEnOHQsc7C87C9zHZMZq56FT HXKA== X-Gm-Message-State: AOAM531pm7IMGTFoQVCE6RLWaYXxoncLq9HMJx7dW1bw35GIciCi/mbB CTOX0aLnRQNFzjIKSi8c5mBDjg== X-Google-Smtp-Source: ABdhPJwBDy0Ky3RWW7bCjsfCHHKsgH3cWh6uN4fPYUmPVcRGTgpQlLnGRsgegWsvAbFZH+u+v05j2Q== X-Received: by 2002:a1c:f203:: with SMTP id s3mr1219378wmc.152.1612995613038; Wed, 10 Feb 2021 14:20:13 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 16/21] accel/tcg: actually cache our partial icount TB Date: Wed, 10 Feb 2021 22:10:48 +0000 Message-Id: <20210210221053.18050-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini , kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) When we exit a block under icount with instructions left to execute we might need a shorter than normal block to take us to the next deterministic event. Instead of creating a throwaway block on demand we use the existing compile flags mechanism to ensure we fetch (or compile and fetch) a block with exactly the number of instructions we need. Signed-off-by: Alex Benn=C3=A9e Message-Id: <20210209182749.31323-8-alex.bennee@linaro.org> Reviewed-by: Richard Henderson --- v2 - drop pointless assert --- accel/tcg/cpu-exec.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index d9ef69121c..5b6a4fe84b 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -730,16 +730,17 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, Tr= anslationBlock *tb, /* Ensure global icount has gone forward */ icount_update(cpu); /* Refill decrementer and continue execution. */ - insns_left =3D MIN(0xffff, cpu->icount_budget); + insns_left =3D MIN(CF_COUNT_MASK, cpu->icount_budget); cpu_neg(cpu)->icount_decr.u16.low =3D insns_left; cpu->icount_extra =3D cpu->icount_budget - insns_left; - if (!cpu->icount_extra && insns_left < tb->icount) { - /* Execute any remaining instructions, then let the main loop - * handle the next event. - */ - if (insns_left > 0) { - cpu_exec_nocache(cpu, insns_left, tb, false); - } + + /* + * If the next tb has more instructions than we have left to + * execute we need to ensure we find/generate a TB with exactly + * insns_left instructions in it. + */ + if (!cpu->icount_extra && insns_left > 0 && insns_left < tb->icount) { + cpu->cflags_next_tb =3D (tb->cflags & ~CF_COUNT_MASK) | insns_left; } #endif } --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612995776; cv=none; d=zohomail.com; s=zohoarc; b=cYP20H09FZdUKOCpA3E8PG6f+wTejze5lyAU6cPFqMpvD7DHH5VmmGGXNIcsaX9u3/i89ISQRvByNIS2WAy4w4wuFHYt9HvTtma+xlwCSxHOm/ojXy3v3/dlPtePVqjpuTmt+7uzYvW3koNqMexfJdkMUxHt/SOU6WLCuwJ6QBo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612995776; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qQYFii8fnhcRgQp6avqKpRK9gTI4aiIkYZihF9RilXM=; b=lp1tGj9h/tB1c3qv5w5MQV6f05UAv2vzYoQ5RDPZ/fb1GkhaH75s/8Ojn5k6TsL4HDe5OAWS2EiiAr7hpc4sVG1gO9obSqI1KPtROk4Prs7HqktebOVi/yOVKdJxfeJ5e8LZyie1pKHMm5+6p67ewtLcdX2fs2D/gt6ZwFriQUA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612995776216779.2605564587627; Wed, 10 Feb 2021 14:22:56 -0800 (PST) Received: from localhost ([::1]:45804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xst-0000a7-4B for importer@patchew.org; Wed, 10 Feb 2021 17:22:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xqG-0006zU-TA for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:20:12 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:55208) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xqE-0006pm-JZ for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:20:12 -0500 Received: by mail-wm1-x336.google.com with SMTP id w4so3205244wmi.4 for ; Wed, 10 Feb 2021 14:20:09 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id g16sm4494445wmi.30.2021.02.10.14.20.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:20:04 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 41B991FF7E; Wed, 10 Feb 2021 22:10:55 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qQYFii8fnhcRgQp6avqKpRK9gTI4aiIkYZihF9RilXM=; b=P3IxKJr2hx0mDkoGv0TQGQn+8ktXb14eGW/eVkdaKZfHE2mMJE1Ihn1y7NZ7V8Blxe lBPq2vGTCZiaNFGIiXVmSA41VRMz//sQuk3i7hvxkx8glwPhlJ4JpEZYCmpgJ/KPQyHZ Tysz939duvpgNG9ePwpUfA5OYrURRfNU+Rus6063EyTk0pfD77Mo75lwTwX6jO01u2uH u91LxLpXG+lRmdrjTb0mWG8gdHpQyhO/ouJ0+5GuwIb1Iw4jkjSa4JPX9dAjvrR6Cfu9 AtJC6n8N6Ko5QyLRc46LMz6v6CzjTHT/3AzQOX8D64oT6742PdA5OrbOaZp0a3zqBgvo UohQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qQYFii8fnhcRgQp6avqKpRK9gTI4aiIkYZihF9RilXM=; b=p5S7MXeK0SiilGNW3IjxL8IoODCqX1guSeH1jwYOZ2znFH5zFN9pjb4JsXEtERSayD 5kvxqPXglvXufP4MtCcmlsgomUs5GknG4ZsPwi7aBh7lBdYXekLJYRZCZqnyMjQCuDDi LyfaluevXnvZNzGFOS6IuNg8bcAVJx75wdQm4BKIFflUjLUYFZeyY21iPCkogdIKKw6D iI9xUfsHKJ8qJ6+4ultGQpZz1r0pBTABcBM55Lh07Gxm/86hQtEo+aOnHsTzOZTaukLc Aulpa/Gjey1EM7uV6XY1ALf2bR7iOIvNUIE79H3DdGregPXRAryxTcwHBKlxZhFETdFa h52A== X-Gm-Message-State: AOAM531PVyCfftZRFQnMS8f9QdKzE1Lpkw6eo75hTovlgKFofwvn1FXp gXsRixsXPprmxwd7C+/iYnQ/uA== X-Google-Smtp-Source: ABdhPJxUZzVk+iBlKGYnvr00mEEah/ITcG1+fE3SRJnKOR0LO1Q/Ytdp0eseEjO8rkEebb96+NKf6A== X-Received: by 2002:a1c:b684:: with SMTP id g126mr1252465wmf.94.1612995608583; Wed, 10 Feb 2021 14:20:08 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 17/21] accel/tcg: cache single instruction TB on pending replay exception Date: Wed, 10 Feb 2021 22:10:49 +0000 Message-Id: <20210210221053.18050-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini , kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Again there is no reason to jump through the nocache hoops to execute a single instruction block. We do have to add an additional wrinkle to the cpu_handle_interrupt case to ensure we let through a TB where we have specifically disabled icount for the block. As the last user of cpu_exec_nocache we can now remove the function. Further clean-up will follow in subsequent patches. Signed-off-by: Alex Benn=C3=A9e Message-Id: <20210209182749.31323-9-alex.bennee@linaro.org> --- accel/tcg/cpu-exec.c | 44 ++++---------------------------------------- 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 5b6a4fe84b..438fece73b 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -224,40 +224,6 @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int = *tb_exit) return last_tb; } =20 -#ifndef CONFIG_USER_ONLY -/* Execute the code without caching the generated code. An interpreter - could be used if available. */ -static void cpu_exec_nocache(CPUState *cpu, int max_cycles, - TranslationBlock *orig_tb, bool ignore_icount) -{ - TranslationBlock *tb; - uint32_t cflags =3D curr_cflags() | CF_NOCACHE; - int tb_exit; - - if (ignore_icount) { - cflags &=3D ~CF_USE_ICOUNT; - } - - /* Should never happen. - We only end up here when an existing TB is too long. */ - cflags |=3D MIN(max_cycles, CF_COUNT_MASK); - - mmap_lock(); - tb =3D tb_gen_code(cpu, orig_tb->pc, orig_tb->cs_base, - orig_tb->flags, cflags); - tb->orig_tb =3D orig_tb; - mmap_unlock(); - - /* execute the generated code */ - trace_exec_tb_nocache(tb, tb->pc); - cpu_tb_exec(cpu, tb, &tb_exit); - - mmap_lock(); - tb_phys_invalidate(tb, -1); - mmap_unlock(); - tcg_tb_remove(tb); -} -#endif =20 static void cpu_exec_enter(CPUState *cpu) { @@ -524,15 +490,12 @@ static inline bool cpu_handle_exception(CPUState *cpu= , int *ret) #ifndef CONFIG_USER_ONLY if (replay_has_exception() && cpu_neg(cpu)->icount_decr.u16.low + cpu->icount_extra =3D= =3D 0) { - /* try to cause an exception pending in the log */ - cpu_exec_nocache(cpu, 1, tb_find(cpu, NULL, 0, curr_cflags()),= true); + /* Execute just one insn to trigger exception pending in the l= og */ + cpu->cflags_next_tb =3D (curr_cflags() & ~CF_USE_ICOUNT) | 1; } #endif - if (cpu->exception_index < 0) { - return false; - } + return false; } - if (cpu->exception_index >=3D EXCP_INTERRUPT) { /* exit request from the cpu execution loop */ *ret =3D cpu->exception_index; @@ -688,6 +651,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, /* Finally, check if we need to exit to the main loop. */ if (unlikely(qatomic_read(&cpu->exit_request)) || (icount_enabled() + && (cpu->cflags_next_tb =3D=3D -1 || cpu->cflags_next_tb & CF_= USE_ICOUNT) && cpu_neg(cpu)->icount_decr.u16.low + cpu->icount_extra =3D= =3D 0)) { qatomic_set(&cpu->exit_request, 0); if (cpu->exception_index =3D=3D -1) { --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612995967; cv=none; d=zohomail.com; s=zohoarc; b=n7zWpQmxtiIe3z/b0w1d04nBltpS3/o+Zq1cxbJod9Le3Ia15AOSy76K7EUOJi++pCI7ufjx3NhaDs6Fig3whopkLhDyEOVVfeRQLuC1cL5WY9nTQZQVqD/Yc++UeciR9qlcLAr0mMUqqKnRQtBEgc1CpO47zIqHbPXN6OQRTPk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612995967; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zi1c0Q20m9EGw/QfIztoiD94DW+qzR6K9/2yw9fZmXc=; b=g9GmVqfiJ4TVHxIkB99OfjOy45rOoVdRNOQaCqmA6tjYZMzZQOEulKlkJCYSs1VVcFvhVZCIRyyfzosTjMCzcAqe7GZvvBDPqKtcQLEZW4QLrcgqqXj/6pfeU/wUcl/WPhxiOSa4lkutQtMe8EHe+l6RgzMxHzEU1pQIqXBZ3CQ= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612995966873257.72046546778745; Wed, 10 Feb 2021 14:26:06 -0800 (PST) Received: from localhost ([::1]:51312 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xvx-0003Px-Qu for importer@patchew.org; Wed, 10 Feb 2021 17:26:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xqD-0006uu-Ax for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:20:09 -0500 Received: from mail-wm1-f52.google.com ([209.85.128.52]:40094) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xqB-0006oP-Ci for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:20:09 -0500 Received: by mail-wm1-f52.google.com with SMTP id o24so3309081wmh.5 for ; Wed, 10 Feb 2021 14:20:06 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id m2sm4329332wml.34.2021.02.10.14.20.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:20:04 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 57B311FFA5; Wed, 10 Feb 2021 22:10:55 +0000 (GMT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zi1c0Q20m9EGw/QfIztoiD94DW+qzR6K9/2yw9fZmXc=; b=ewm8sO4qgysB3SiXiFdi3RDZCc1SKRY82XXvucpiIIG3DBtMlJ9HkovrH/GZAwm5J6 B5DO7w7mwh5a6DIUXWqjouooUZ62Op/Yf2xhWcq687A7lJf5DziSvP7ur/kSAyyeK0sR xsSOZSVme4dXyxVyBvsfcaG01BdmxYMXLAiRt12LqirHG/hQxJnXhfUNysnIyVcs+Ht7 ug35PYszpnLCvdA7S/Z6a+5pk4gudXnnlluDG4G6a1Ps5A4bqN/BuSImBfqoBx7ycvVF yO15V/GACRWbX8T/bwCNGafoxaexpJotub+PASVUOiwDh1OV+whjaXoupUpW37phqdTo Dp0w== X-Gm-Message-State: AOAM532d9RIeAuajMropuHnWu60oZ69EJYw243brpoV4YL/l0GK9NAea tz34/C3jkzYZglo7MxVUlclkIg== X-Google-Smtp-Source: ABdhPJzZJ3WRI8g82xIBBeot/afxddw7EyWHm3Bfq9s/LUjl7hovkctFbCn2nSHPL5GM17w5Ec3FLg== X-Received: by 2002:a1c:7402:: with SMTP id p2mr1230441wmc.43.1612995605733; Wed, 10 Feb 2021 14:20:05 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 18/21] accel/tcg: re-factor non-RAM execution code Date: Wed, 10 Feb 2021 22:10:50 +0000 Message-Id: <20210210221053.18050-19-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=209.85.128.52; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-f52.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini , kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" There is no real need to use CF_NOCACHE here. As long as the TB isn't linked to other TBs or included in the QHT or jump cache then it will only get executed once. Signed-off-by: Alex Benn=C3=A9e Message-Id: <20210209182749.31323-10-alex.bennee@linaro.org> Reviewed-by: Richard Henderson --- accel/tcg/translate-all.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index b8ad95aa1b..7e62d8ad97 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1778,7 +1778,8 @@ static inline void tb_page_add(PageDesc *p, Translati= onBlock *tb, #endif } =20 -/* add a new TB and link it to the physical page tables. phys_page2 is +/* + * Add a new TB and link it to the physical page tables. phys_page2 is * (-1) to indicate that only one page contains the TB. * * Called with mmap_lock held for user-mode emulation. @@ -1797,17 +1798,6 @@ tb_link_page(TranslationBlock *tb, tb_page_addr_t ph= ys_pc, =20 assert_memory_lock(); =20 - if (phys_pc =3D=3D -1) { - /* - * If the TB is not associated with a physical RAM page then - * it must be a temporary one-insn TB, and we have nothing to do - * except fill in the page_addr[] fields. - */ - assert(tb->cflags & CF_NOCACHE); - tb->page_addr[0] =3D tb->page_addr[1] =3D -1; - return tb; - } - /* * Add the TB to the page list, acquiring first the pages's locks. * We keep the locks held until after inserting the TB in the hash tab= le, @@ -1880,9 +1870,8 @@ TranslationBlock *tb_gen_code(CPUState *cpu, phys_pc =3D get_page_addr_code(env, pc); =20 if (phys_pc =3D=3D -1) { - /* Generate a temporary TB with 1 insn in it */ - cflags &=3D ~CF_COUNT_MASK; - cflags |=3D CF_NOCACHE | 1; + /* Generate a one-shot TB with 1 insn in it */ + cflags =3D (cflags & ~CF_COUNT_MASK) | 1; } =20 cflags &=3D ~CF_CLUSTER_MASK; @@ -2096,6 +2085,17 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tb_reset_jump(tb, 1); } =20 + /* + * If the TB is not associated with a physical RAM page then + * it must be a temporary one-insn TB, and we have nothing to do + * except fill in the page_addr[] fields. Return early before + * attempting to link to other TBs or add to the lookup table. + */ + if (phys_pc =3D=3D -1) { + tb->page_addr[0] =3D tb->page_addr[1] =3D -1; + return tb; + } + /* check next page if needed */ virt_page2 =3D (pc + tb->size - 1) & TARGET_PAGE_MASK; phys_page2 =3D -1; --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612997709; cv=none; d=zohomail.com; s=zohoarc; b=d0U7d39x3L5NDEg9Gn3J1PrTTOXCf0IRRsPgCUTLFDgiai8V3FDQwSn7nJ2lM8aeDxKIzGYcESOxggyBqHIITrrfftkcZN3yRIZrVLZK7/JL6kxS8V7mxHXnoiALlhoBpzNj6xqJktKI2RFGcZleXUFvfFWATX9F5Rcg9YrsB7g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612997709; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lUQfSvO41ymeVYxkOJOoiNQ8fcoV5S/zkovOyoqGlLk=; b=hFIH6fYeEVJ7Fxc37FYTbKgWaIgv8wXXddjdo5V2EWDTXzx/alduJHacGYc99Lrf60ZME4FFMO0obsDJZS8Iud7c7HvRZlbtaX+JQmqHrdtCJB2mULSR71F2l/BUWQngVUROpoUAwe0z9tNXmkAZu6y2xb2CcLUV7ytwdGeBXsQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612997709090729.6798382456725; Wed, 10 Feb 2021 14:55:09 -0800 (PST) Received: from localhost ([::1]:48490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9yO3-0001rk-Vf for importer@patchew.org; Wed, 10 Feb 2021 17:55:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58758) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xqG-0006xf-0T for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:20:12 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:50660) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xqD-0006op-32 for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:20:11 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 190so3213370wmz.0 for ; Wed, 10 Feb 2021 14:20:08 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id c62sm5227677wmd.43.2021.02.10.14.20.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:20:04 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 718831FFA6; Wed, 10 Feb 2021 22:10:55 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lUQfSvO41ymeVYxkOJOoiNQ8fcoV5S/zkovOyoqGlLk=; b=d2fLenfgJCtLiAxKfrMG7H3Kcg7om9NxfIh8cOE1LyPfKDGW7kcZq4drgbwvCA/oiT LlAlz/IC0EYILyJwQQWg9HzWsAyv87aktJe8R+ZbIB+2T25+E9uZZYcA50n0CbfyCCGk iLkTD380eH0SCp6shQpqxceAnjqZslItGh22h4CXI7BZsJDLUEScOkVLONFE2gUxVhC7 TS1iB/6xx2dJ/32idjgfIp0cP+YwbilQ+IdKR9g/4P/9pJKizrPYXOmuKYFFyLo2iiwl p77r+774dMBApnYGmTnlMPI8vWbEBtUlwyKvs2Uu+0m9QnXj1HRxw8fveapCoZ1B+u4c 19KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lUQfSvO41ymeVYxkOJOoiNQ8fcoV5S/zkovOyoqGlLk=; b=PViBdLm/bs9oA2DpoSB0vVG7FtVEBkA8I+AIhs14NjOo3YNh5Ll+ijVW4OK17YgRdM HJjIqTTdH6VCp2TMB5M0mYkUXn2ZcfxG6gV9cmTMYjAaUgq9A4c1Xevzy5prvOJsX3pu 1oJqjoQwWK/udBIo306/pQK6ZyFt9d9Jvfy6fNMmv2+TZdIxsOWrZrkkLpdr3kmrO/9a c+8U2SSZ7Z2vZbMwiXLuemk3Fkcn4sklKvxyZyAAu05CuWK6GovWF6msI4yooX+r4rVB Wu+HqYA/h1oTegS6RriWS6SbertxE3Jiy+O/ocizaVUDOLlXu4ZStiuLoanNNSLsoTCB mrjg== X-Gm-Message-State: AOAM532oSs7weEwAkHcXLfpo53VHq/GjfBUWZNspzQccapbNNIBghC2b ctZ0tS3t3Gfk3e3cvQr5pWsYrg== X-Google-Smtp-Source: ABdhPJwYKkXKHP5SfNdmBlV64nxyeWFe6q7w3PaNT31kIqoYZSaNcoB1oDGlqIDZqXQyAhw6RjWV6A== X-Received: by 2002:a7b:ce95:: with SMTP id q21mr1200190wmj.178.1612995607667; Wed, 10 Feb 2021 14:20:07 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 19/21] accel/tcg: remove CF_NOCACHE and special cases Date: Wed, 10 Feb 2021 22:10:51 +0000 Message-Id: <20210210221053.18050-20-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini , kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Now we no longer generate CF_NOCACHE blocks we can remove a bunch of the special case handling for them. While we are at it we can remove the unused tb->orig_tb field and save a few bytes on the TB structure. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Message-Id: <20210209182749.31323-11-alex.bennee@linaro.org> --- include/exec/exec-all.h | 3 --- accel/tcg/translate-all.c | 51 ++++++++++++--------------------------- 2 files changed, 15 insertions(+), 39 deletions(-) diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index f933c74c44..e08179de34 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -454,7 +454,6 @@ struct TranslationBlock { uint32_t cflags; /* compile flags */ #define CF_COUNT_MASK 0x00007fff #define CF_LAST_IO 0x00008000 /* Last insn may be an IO access. */ -#define CF_NOCACHE 0x00010000 /* To be freed after execution */ #define CF_USE_ICOUNT 0x00020000 #define CF_INVALID 0x00040000 /* TB is stale. Set with @jmp_lock held = */ #define CF_PARALLEL 0x00080000 /* Generate code for a parallel context = */ @@ -469,8 +468,6 @@ struct TranslationBlock { =20 struct tb_tc tc; =20 - /* original tb when cflags has CF_NOCACHE */ - struct TranslationBlock *orig_tb; /* first and second physical page containing code. The lower bit of the pointer tells the index in page_next[]. The list is protected by the TB's page('s) lock(s) */ diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 7e62d8ad97..0666f9ef14 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -409,12 +409,6 @@ bool cpu_restore_state(CPUState *cpu, uintptr_t host_p= c, bool will_exit) TranslationBlock *tb =3D tcg_tb_lookup(host_pc); if (tb) { cpu_restore_state_from_tb(cpu, tb, host_pc, will_exit); - if (tb_cflags(tb) & CF_NOCACHE) { - /* one-shot translation, invalidate it immediately */ - tb_phys_invalidate(tb, -1); - tcg_tb_remove(tb); - tb_destroy(tb); - } return true; } } @@ -1633,8 +1627,7 @@ static void do_tb_phys_invalidate(TranslationBlock *t= b, bool rm_from_page_list) phys_pc =3D tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK); h =3D tb_hash_func(phys_pc, tb->pc, tb->flags, tb_cflags(tb) & CF_HASH= _MASK, tb->trace_vcpu_dstate); - if (!(tb->cflags & CF_NOCACHE) && - !qht_remove(&tb_ctx.htable, tb, h)) { + if (!qht_remove(&tb_ctx.htable, tb, h)) { return; } =20 @@ -1795,6 +1788,8 @@ tb_link_page(TranslationBlock *tb, tb_page_addr_t phy= s_pc, { PageDesc *p; PageDesc *p2 =3D NULL; + void *existing_tb =3D NULL; + uint32_t h; =20 assert_memory_lock(); =20 @@ -1814,25 +1809,20 @@ tb_link_page(TranslationBlock *tb, tb_page_addr_t p= hys_pc, tb->page_addr[1] =3D -1; } =20 - if (!(tb->cflags & CF_NOCACHE)) { - void *existing_tb =3D NULL; - uint32_t h; - - /* add in the hash table */ - h =3D tb_hash_func(phys_pc, tb->pc, tb->flags, tb->cflags & CF_HAS= H_MASK, - tb->trace_vcpu_dstate); - qht_insert(&tb_ctx.htable, tb, h, &existing_tb); + /* add in the hash table */ + h =3D tb_hash_func(phys_pc, tb->pc, tb->flags, tb->cflags & CF_HASH_MA= SK, + tb->trace_vcpu_dstate); + qht_insert(&tb_ctx.htable, tb, h, &existing_tb); =20 - /* remove TB from the page(s) if we couldn't insert it */ - if (unlikely(existing_tb)) { - tb_page_remove(p, tb); - invalidate_page_bitmap(p); - if (p2) { - tb_page_remove(p2, tb); - invalidate_page_bitmap(p2); - } - tb =3D existing_tb; + /* remove TB from the page(s) if we couldn't insert it */ + if (unlikely(existing_tb)) { + tb_page_remove(p, tb); + invalidate_page_bitmap(p); + if (p2) { + tb_page_remove(p2, tb); + invalidate_page_bitmap(p2); } + tb =3D existing_tb; } =20 if (p2 && p2 !=3D p) { @@ -1905,7 +1895,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tb->cs_base =3D cs_base; tb->flags =3D flags; tb->cflags =3D cflags; - tb->orig_tb =3D NULL; tb->trace_vcpu_dstate =3D *cpu->trace_dstate; tcg_ctx->tb_cflags =3D cflags; tb_overflow: @@ -2444,16 +2433,6 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retad= dr) /* Generate a new TB executing the I/O insn. */ cpu->cflags_next_tb =3D curr_cflags() | CF_LAST_IO | n; =20 - if (tb_cflags(tb) & CF_NOCACHE) { - if (tb->orig_tb) { - /* Invalidate original TB if this TB was generated in - * cpu_exec_nocache() */ - tb_phys_invalidate(tb->orig_tb, -1); - } - tcg_tb_remove(tb); - tb_destroy(tb); - } - qemu_log_mask_and_addr(CPU_LOG_EXEC, tb->pc, "cpu_io_recompile: rewound execution of TB to " TARGET_FMT_lx "\n", tb->pc); --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612996033; cv=none; d=zohomail.com; s=zohoarc; b=iHrLedx+r1r6iFf0O+SW02HuPBneYlp6TlGbEv3z96bJN2Vl3vL4RwsZXbfwYKnqBqik0Kw6G1bB3ox1WvzkQWUNreQ4ZLMpq7RNmbRKkwJnZYJtvs/QqGIwBaO78NnNFzZXU5Zv2Hb1m70uxY6U3rW3dpJkw9uDRzKSpsOc8AI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612996033; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iIGttXBi7A2QRRl9A62rr2JtZ8SZ+5Uy9wRQiTVHIjk=; b=Y346B3jTfQbWrrzrmsdHsSZJZ7YlpcG9b/CYPru551UEfeC8cQbTqNzwNFJ0Zqcy/lriwoD8ZjWINi+bDduDnA8GcXEgnOEK1F6asoPrJAVeEvTwNSykBVsqo/1LyIVe+nR4wd4dMtD1HRRgitvFY6rIH/YAVIYMdCG/YIa9Zfo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612996033490686.5972155571809; Wed, 10 Feb 2021 14:27:13 -0800 (PST) Received: from localhost ([::1]:54380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xx2-0004tT-DF for importer@patchew.org; Wed, 10 Feb 2021 17:27:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58892) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xqW-000735-H1 for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:20:28 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:34320) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xqL-0006ri-5N for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:20:28 -0500 Received: by mail-wm1-x329.google.com with SMTP id o10so4637377wmc.1 for ; Wed, 10 Feb 2021 14:20:14 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id p4sm3138111wma.36.2021.02.10.14.20.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:20:12 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 8E3E61FFA9; Wed, 10 Feb 2021 22:10:55 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iIGttXBi7A2QRRl9A62rr2JtZ8SZ+5Uy9wRQiTVHIjk=; b=sKjMSOEnpDuClrP+bjAn3ZKUE5pTIbg4O0ig9ut0qyqzW8ENyEJ2Iq0n6ML5abHcRI B42UMT8yAnL1s9izqA94FnXo9hNC2W3FClVZ9xrlyz82ZM0rj+llr//1wqExICCmiyfd GwCXNK58zYA40OAMbHXuw8yhpoy9AYu9KAizciIrlezLFnRa8xNtew6N+kwVZ5Oph81j zrUvqvvSlErMt9P8/zj2VHrGcB6GmSwWMcWjGrfA6y4H0bAuHJkRbkpjoTIX79TiyXdn YBZvSYmj7xyB+F2pJCIy/u/zO9UUtNq9HI7Slx9RVMvA8zvzQN4PB/veUGX+8aydJjZU rjHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iIGttXBi7A2QRRl9A62rr2JtZ8SZ+5Uy9wRQiTVHIjk=; b=ozX407S/z3QgyKtUCSz625RrkGvNlVeqLHsb1RCy09RUMWiO99gmvqDyCgFSJcDW0+ NtDRy4Yop/gSFFAoPp0IL1Wx/jaovnRtZUd4fRczIvo7b2pNksDgcDzN3i+3kMfBqsus P9YkbeOW3n7vysX+d2V5K6whGrQYpWYSFha28pIIY6gfW2dBMExIe8nwkDcNJf/QUG09 4ZJ3PODWY9T4OaoLdYwdlmswJxCokHdDeftITwYoBiF7LmxbnfpBZ4iZ9V3FINMHxsw2 owiwj+ciZckwYYmwPsoKSXQBtgYaF8e5o4R5XHc4tl3nu3bYJYIuTbnpvdi5OfGp0TqI zV8w== X-Gm-Message-State: AOAM532HR8O7OAwPKy7eOL8J9Fv76ZlAxZXgErIWwrxcO65ZdDA739Fa 05I6+KUToCvZhhk2PLTd8RUivQ== X-Google-Smtp-Source: ABdhPJywzwnnjNnc8jtL4nSDdw8yzoZ7kmzvb3uW9Z02NIu/Ak4fS/cTsth3W+eN3ETSOnmc0faYuA== X-Received: by 2002:a05:600c:230c:: with SMTP id 12mr1268447wmo.30.1612995613713; Wed, 10 Feb 2021 14:20:13 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 20/21] accel/tcg: allow plugin instrumentation to be disable via cflags Date: Wed, 10 Feb 2021 22:10:52 +0000 Message-Id: <20210210221053.18050-21-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini , kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) When icount is enabled and we recompile an MMIO access we end up double counting the instruction execution. To avoid this we introduce the CF_NOINSTR cflag which disables instrumentation for the next TB. As this is part of the hashed compile flags we will only execute the generated TB while coming out of a cpu_io_recompile. While we are at it delete the old TODO. We might as well keep the translation handy as it's likely you will repeatedly hit it on each MMIO access. Reported-by: Aaron Lindsay Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Message-Id: <20210209182749.31323-12-alex.bennee@linaro.org> --- v2 - squashed CH_HASHMASK to ~CF_INVALID --- include/exec/exec-all.h | 6 +++--- accel/tcg/translate-all.c | 17 ++++++++--------- accel/tcg/translator.c | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index e08179de34..299282cc59 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -454,14 +454,14 @@ struct TranslationBlock { uint32_t cflags; /* compile flags */ #define CF_COUNT_MASK 0x00007fff #define CF_LAST_IO 0x00008000 /* Last insn may be an IO access. */ +#define CF_NOINSTR 0x00010000 /* Disable instrumentation of TB */ #define CF_USE_ICOUNT 0x00020000 #define CF_INVALID 0x00040000 /* TB is stale. Set with @jmp_lock held = */ #define CF_PARALLEL 0x00080000 /* Generate code for a parallel context = */ #define CF_CLUSTER_MASK 0xff000000 /* Top 8 bits are cluster ID */ #define CF_CLUSTER_SHIFT 24 -/* cflags' mask for hashing/comparison */ -#define CF_HASH_MASK \ - (CF_COUNT_MASK | CF_LAST_IO | CF_USE_ICOUNT | CF_PARALLEL | CF_CLUSTER= _MASK) +/* cflags' mask for hashing/comparison, basically ignore CF_INVALID */ +#define CF_HASH_MASK (~CF_INVALID) =20 /* Per-vCPU dynamic tracing state used to generate this TB */ uint32_t trace_vcpu_dstate; diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 0666f9ef14..32a3d8fe24 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2399,7 +2399,8 @@ void tb_check_watchpoint(CPUState *cpu, uintptr_t ret= addr) } =20 #ifndef CONFIG_USER_ONLY -/* in deterministic execution mode, instructions doing device I/Os +/* + * In deterministic execution mode, instructions doing device I/Os * must be at the end of the TB. * * Called by softmmu_template.h, with iothread mutex not held. @@ -2430,19 +2431,17 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t reta= ddr) n =3D 2; } =20 - /* Generate a new TB executing the I/O insn. */ - cpu->cflags_next_tb =3D curr_cflags() | CF_LAST_IO | n; + /* + * Exit the loop and potentially generate a new TB executing the + * just the I/O insns. We also disable instrumentation so we don't + * double count the instruction. + */ + cpu->cflags_next_tb =3D curr_cflags() | CF_NOINSTR | CF_LAST_IO | n; =20 qemu_log_mask_and_addr(CPU_LOG_EXEC, tb->pc, "cpu_io_recompile: rewound execution of TB to " TARGET_FMT_lx "\n", tb->pc); =20 - /* TODO: If env->pc !=3D tb->pc (i.e. the faulting instruction was not - * the first in the TB) then we end up generating a whole new TB and - * repeating the fault, which is horribly inefficient. - * Better would be to execute just this insn uncached, or generate a - * second new TB. - */ cpu_loop_exit_noexc(cpu); } =20 diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index a49a794065..14d1ea795d 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -58,7 +58,7 @@ void translator_loop(const TranslatorOps *ops, DisasConte= xtBase *db, ops->tb_start(db, cpu); tcg_debug_assert(db->is_jmp =3D=3D DISAS_NEXT); /* no early exit */ =20 - plugin_enabled =3D plugin_gen_tb_start(cpu, tb); + plugin_enabled =3D !(tb_cflags(db->tb) & CF_NOINSTR) && plugin_gen_tb_= start(cpu, tb); =20 while (true) { db->num_insns++; --=20 2.20.1 From nobody Sat May 18 15:38:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1612997093; cv=none; d=zohomail.com; s=zohoarc; b=haG2yAqTEuiHCYBzgYzvSZ0mRDymCYekK8vJG8Kltv4pxW8p3buYfm4uETKsosP+2EQfMP9I1X9z5p5lrvEYu1gMEWJVJqtZsIwii4Eui01OX/cPErlqx42LXYGDtNfTGpUm22NfP5c0Vo1FWSE3CW1GajWEV8mTXC9nY0r3s3s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612997093; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NvekATJKlJ7jP2wzTkI6nrkZoiKtJSAd7gzRekefiEE=; b=ebkN9Bgfonje6rQy6EPuDsay+JzWphDcULJPB2ENzcNQckhBX4UTY0Tdl8E4o0WRKlA8JtJWItlwBrx54mVgs1jkpkm2ZMapbtlRgsOg2aoQkBdHuiIx/VlcGqeq7ybxf2J7cY96h1Ru3gjQCMgwDtQ5z5zFSdSERXiVoeX0hWc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612997093405984.5245185806455; Wed, 10 Feb 2021 14:44:53 -0800 (PST) Received: from localhost ([::1]:59132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9yE8-0002bz-3b for importer@patchew.org; Wed, 10 Feb 2021 17:44:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9xhy-0006Zh-7Y for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:38 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:55736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9xhm-0003M6-GT for qemu-devel@nongnu.org; Wed, 10 Feb 2021 17:11:37 -0500 Received: by mail-wm1-x32f.google.com with SMTP id o15so1414910wmq.5 for ; Wed, 10 Feb 2021 14:11:25 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id x125sm5179811wmx.6.2021.02.10.14.11.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Feb 2021 14:11:15 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A44181FFAA; Wed, 10 Feb 2021 22:10:55 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NvekATJKlJ7jP2wzTkI6nrkZoiKtJSAd7gzRekefiEE=; b=KWTu4zS8VKFWwdJG3b+CSTJ8Q7Q698lsmJqTBHinWpWiHyRr2t3X4gtYWcI2mCkXIC H6Gs3WGIlhn2KacRtbeTZ7KYAZ0q8htqc1D4MOyJPcsv5PijhaOJgWHfDl8qAkc1cvSv aP/Fiq9aabTWkqfYcLxxA+NE0eCm8KWXP/vUPTB3dvB0BnVmSTURrYPjo8r1sRrvhcUs FL4KRd5nriJulmynKavQvwcxM0mi7ug1UJ5mDZ/Rwo5IrxYSZ/3xqPnQWaSZO9M7AURk 51hcfY1IG5SJ5MW0CTREsqv61w0EImWmr/N4TedBcxXbUZayzGIo0FjDvy2n1zaQ7XCh KXhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NvekATJKlJ7jP2wzTkI6nrkZoiKtJSAd7gzRekefiEE=; b=N3bCrvJlEMQCpTMOwYTG9uQgnb7DEGEJmKwrLYroHATotfGDDIFZ++OflZHrufDRQx 30OPDmNIahLp2GalEC3d+7vHzLbCQQlnwpdhbUSKT/AKmTQPl+KoepsL86mn5UKluwhF cS12bKwFdzpWk3MufchouC8KY2Shop8YwouobOgG6zMUuAyZRN+J++CjNLsfKjXblmcq CSSRRuU3n6SFud12MK/rE0uQnCNeG4KNxnYxQ0iSAjzOzgpyzPt16y+sDgf98ELvq17V H5n8hjSThXr5+F5UzAnljqpngJAvE2lpUNnCHyD7XEVjU/YiZlMKc5LXH3XfSOWsdtkM QzZg== X-Gm-Message-State: AOAM530wn0KFlMVS8XDUHWmU3YhnwXSm1B14GTm6/y6WpoL7v8myG1B4 ceeWGrzVRL4mXqfeY2TUU/9cWw== X-Google-Smtp-Source: ABdhPJxm4d9id4m5cvO6ZEc5K9Tg8OTfUETDyHUOMUTkhYiBefKRVUoVpGIBbxu6fUkdL6QxNjuDag== X-Received: by 2002:a05:600c:2246:: with SMTP id a6mr1195632wmm.170.1612995084836; Wed, 10 Feb 2021 14:11:24 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 21/21] tests/acceptance: add a new tests to detect counting errors Date: Wed, 10 Feb 2021 22:10:53 +0000 Message-Id: <20210210221053.18050-22-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210210221053.18050-1-alex.bennee@linaro.org> References: <20210210221053.18050-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, Wainer dos Santos Moschetta , Cleber Rosa , kuhn.chenqun@huawei.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The insn plugin has a simple heuristic to detect if an instruction is detected running twice in a row. Check the plugin log after the run and pass accordingly. Signed-off-by: Alex Benn=C3=A9e Message-Id: <20210209182749.31323-13-alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Wainer dos Santos Moschetta --- tests/acceptance/tcg_plugins.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/acceptance/tcg_plugins.py b/tests/acceptance/tcg_plugins= .py index b512979769..acab599505 100644 --- a/tests/acceptance/tcg_plugins.py +++ b/tests/acceptance/tcg_plugins.py @@ -101,3 +101,34 @@ class PluginKernelNormal(PluginKernelBase): else: logger.debug("Failed to find instruction count") self.fail + + def test_aarch64_virt_insn_icount(self): + """ + :avocado: tags=3Daccel:tcg + :avocado: tags=3Darch:aarch64 + :avocado: tags=3Dmachine:virt + :avocado: tags=3Dcpu:cortex-a57 + """ + kernel_path =3D self._grab_aarch64_kernel() + kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + + 'console=3DttyAMA0') + console_pattern =3D 'Kernel panic - not syncing: VFS:' + + plugin_log =3D tempfile.NamedTemporaryFile(mode=3D"r+t", prefix=3D= "plugin", + suffix=3D".log", delete= =3DFalse) + + self.run_vm(kernel_path, kernel_command_line, + "tests/plugin/libinsn.so", plugin_log.name, + console_pattern, + args=3D('-cpu', 'cortex-a53', '-icount', 'shift=3D1')) + + logger =3D logging.getLogger() + + with plugin_log as lf, \ + mmap.mmap(lf.fileno(), 0, access=3Dmmap.ACCESS_READ) as s: + m =3D re.search(br"detected repeat execution @ (?P0x[0-9= A-Fa-f]+)", s) + if m is not None and "addr" in m.groupdict(): + logger.debug("detected repeat instructions") + self.fail("detected repeated instructions") + else: + logger.debug("no repeats detected: %s", m) --=20 2.20.1