From patchwork Wed Feb 10 22:10:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380236 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1554614jah; Wed, 10 Feb 2021 14:12:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZNClcJ1rxwhDJbGer/HTkKmjFcBA1lzonlY5I7negWgd+phGskK6DOkYSQrSmjq1to+YZ X-Received: by 2002:a25:83cc:: with SMTP id v12mr7375138ybm.293.1612995158710; Wed, 10 Feb 2021 14:12:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612995158; cv=none; d=google.com; s=arc-20160816; b=yedEP88fo8h14EGOgpAvAp4sYk6DN6DcPcf1zLPiMP28QFJHo9mFIL4TAcWpIQHVHC y3yUEYtJzMh2oB+8ZdqU+lUcPAg/yy7qNbDUWpemEwn+qEFuJnJ5a+FB7mqg+nT029cn tmUTJFguyh5GCO1Bc34zfS2z0U9KUQsBriDVflZUYdBb5cowXkjjFazo6NAaF1wPuysG AR92EfFI8nUQ+aGMmu+BlOjGoIKUnq20sDRFHJ/nWGQCJQyGz1iSEnfuvliW33o6D2VP sIeJgXWuu1umg57QvVjNyRlEFld4nqL1LyYxTEoj93ZeVpNklJrYUw2L5jZXDkexhAUu ENXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=jmoVvCJIZ5hgn5Z6/1kOCx1zfxEb1vqsWzWnY3mB7y4=; b=VB3teTX9s5h0FNT4sCz+/3JRRL3G5pfmWw+WCXNLabmVQvhiH4PySTmA2MXcD4t18p aeD14pdNpDBF0vcjDhMSOEtK7Z8zEhhEJ0T9k6yzMFw1MR/QqaK5TNRO5T75kWnA8xsR f8v2MwifXH0epE6/yyeY/zpfkahBi28Ba6cjVGrjzew7h4kq7m0YISGCnbMcBBZoP63a CNkmhOfCAMI3HJUzUUj5pVdk9KOEagi1u8ecCzqfBCZigutBifabVlxVdMeTGKUSbip/ rqxr8+xezFBmb0iATsDy7I/jb4O9XJqe3XjgXgudugoYqPBo0giMMD7DXYZVZE2YJ2X4 oF8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DqHSKAKT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q11si3249315ybp.304.2021.02.10.14.12.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:12:38 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DqHSKAKT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xiv-0005uS-Pc for patch@linaro.org; Wed, 10 Feb 2021 17:12:37 -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) 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-Received: by 2002:a1c:b156:: with SMTP id a83mr1137663wmf.11.1612995055939; Wed, 10 Feb 2021 14:10:55 -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) From: =?utf-8?q?Alex_Benn=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 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_Mathieu-Dau?= =?utf-8?b?ZMOp?= , robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Reviewed-by: Philippe Mathieu-Daudé 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(-) -- 2.20.1 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, hwaddr addr, } } -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 = { .read = virtio_pci_common_read, @@ -1470,36 +1471,41 @@ static void virtio_pci_modern_regions_init(VirtIOPCIProxy *proxy) }, .endianness = DEVICE_LITTLE_ENDIAN, }; + g_autoptr(GString) name = g_string_new(NULL); - + 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); + 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); + 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); + 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); + 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); } @@ -1654,7 +1660,7 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) struct virtio_pci_cfg_cap *cfg_mask; - virtio_pci_modern_regions_init(proxy); + virtio_pci_modern_regions_init(proxy, vdev->name); virtio_pci_modern_mem_region_map(proxy, &proxy->common, &cap); virtio_pci_modern_mem_region_map(proxy, &proxy->isr, &cap); From patchwork Wed Feb 10 22:10:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380247 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1562198jah; Wed, 10 Feb 2021 14:25:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8pV/6UMiOPpd4SwU2SwX+foGV2NBX/fHuhjOx1xZWNv6tPQ0irbraWPXSHsnXTfUa5pMh X-Received: by 2002:a25:1086:: with SMTP id 128mr7243939ybq.375.1612995958963; Wed, 10 Feb 2021 14:25:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612995958; cv=none; d=google.com; s=arc-20160816; b=RG8zoMxmt7sr5Tac4x/d6u7bz9r5vZinJt/jVVCbg0T5tgwLzTbuJ1oQk6iALwq8V3 pX/VUx+qUyKsaqKF3owtbeBgRaHOZhPseITRdsxOhvvqCeCJNh6/dmS3aXwodIQRj9dB qm9ppI9ojS/OpF4PDhjC55vTIy3Vhxbjs/u64BkjkGQm6uWf7OYZsdwJ271Dke9CPkTM J2Iss3aKKmPvZ9fDzUR8nT+WlVADM7ljwG14HbjUORkMLCdrmJabiIF36FNlyO85GEQ/ yfdb26CbBQC3NosNazcFc6j129KZWt9xMTUB0wJQu++dKoxD3NGCVt6PW4HdRTfR+Je8 RU2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=y0m7VVtf4raaNuNx2ajjykIh+1usimL3d/eZHQe+IRc=; b=lo31VzPhYOFgme6Op54/SlX8VWoAeOlS6py4YapvoX74Tbm71ue+j9R/XmcV4iBHs8 pMhxKCE8yabI3TDncrmT33UwWkqxqShgo16/K5IOXjPYGW7mT61cZtHYX7vXWl861r4f CZYkH5K4w6vXiUmzFKEPe9kZ2U/2T0Dzm/bIglr4l9SA307LGZHG2GiiHu0CkkkMw/SC 3dSBsUgoTL5W0e8DnqTYI38QScO37jWMDpnIT8v2eRIvlcRGWSOXvE8eE8uKYcaaLqF2 1Ah+psxKJbZVRwmqAtQTeH8kgYkg/OPcJLLMVKTkVOS/Ctqutr5jErg1m4CbmobmleDA lr2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Pv4k8SK3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 130si2706022ybv.287.2021.02.10.14.25.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:25:58 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Pv4k8SK3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xvq-0003Ml-Fo for patch@linaro.org; Wed, 10 Feb 2021 17:25:58 -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) 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-Received: by 2002:a1c:bcc3:: with SMTP id m186mr1184901wmf.165.1612995057840; Wed, 10 Feb 2021 14:10:57 -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) From: =?utf-8?q?Alex_Benn=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 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_B?= =?utf-8?b?ZW5uw6ll?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This may well end up being anonymous but it should always be unique. Signed-off-by: Alex Bennée 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(+) -- 2.20.1 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); +/* + * 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; } +const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h) +{ +#ifdef CONFIG_SOFTMMU + if (h && h->is_io) { + MemoryRegionSection *mrs = h->v.io.section; + if (!mrs->mr->name) { + unsigned long maddr = 0xffffffff & (uintptr_t) mrs->mr; + g_autofree char *temp = 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. From patchwork Wed Feb 10 22:10:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380244 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1560454jah; Wed, 10 Feb 2021 14:22:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJyKAFvWtKb2iIdbzUEStMwQpPzkHwAlESONAQ2ofGqmqm/vKm/V43oU3aQxPXqwCCwHvK9b X-Received: by 2002:a25:38c9:: with SMTP id f192mr4374124yba.120.1612995760972; Wed, 10 Feb 2021 14:22:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612995760; cv=none; d=google.com; s=arc-20160816; b=AOMIFg1TReQfK7m4FpxlkFNMkjdi8W1fNWtUhFBDMBzioy16prqRVVQ5mVuVdRQZXE WPj5d1dK4Yhss+/q9b8uOE3HxtYiszBs31LnHgyIpuc0+JHznSpQJZIa9MX2TwhGViGn yb9SS3S0XonNgLVjvG6mlcEmq/stLybHs+QN4VwWXKUQWwsha/PIbsEI61N0HA9hVmq4 lAMXyte1SiGYG24tcAGC3P28kUKKMAmLgtAos0JPdFbPIO4qr112GBo7p2gp+HQTeMbb n1Fn58leOQwg/4Mow3ECYyKJpQtuse1dVOcc6nYveE1MNrIWKC/9FgwANdb/HIu7dvl5 54sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=cA1mms/KC7D4GEashRpyD31vpirMAJEbz5RpC4ZLHNc=; b=Zb++ONIewDI7wWd8w9ciEkUKF86SL7BzUqLTaAIED5MaGsroMheWZNLFhh1LvdS1Vt j9HQy00Q0J2R3DUwFTKe5zlU9W5gdN9LLKqwnr25s2UJLRPcJSPuGl+NRwsFjSo6it8e MYo+g2D1Xi1ZS+fSqvWkZRPZfCeOOmpvsf1jWJRwQWZpn+42FRF+XGA3saL/IIjLyHeC 16WWP7uSquv5368MwHu+jlnp7BHcsGxWb+TXyuOT7sxJH9xaF4vH9Al8fl0oj0LUI357 6QMlwqpr5QraQr7cUAiEpioZd07NW2jVHjxpdUMfw4seuizNiplYUZBWteWgzRBZ1/Eq U+ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=b45mrV1t; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r5si3120795ybb.128.2021.02.10.14.22.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:22:40 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=b45mrV1t; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xse-0000JE-Dj for patch@linaro.org; Wed, 10 Feb 2021 17:22:40 -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) 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-Received: by 2002:a1c:c904:: with SMTP id f4mr1233652wmb.14.1612995059599; Wed, 10 Feb 2021 14:10:59 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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=read or arg=write to limit the tracking to just reads or writes (by default it does both). The pattern option: -plugin ./tests/plugin/libhwprofile.so,arg=pattern 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=source 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ée 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 -- 2.20.1 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) +- 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 options: + + * arg=read or arg=write + + 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=source + + Will include a detailed break down of what the guest PC that made the + access was. Not compatible with arg=pattern. Example output:: + + cirrus-low-memory @ 0xfffffd00000a0000 + pc:fffffc0000005cdc, 1, 256 + pc:fffffc0000005ce8, 1, 256 + pc:fffffc0000005cec, 1, 256 + + * arg=pattern + + 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ée + * + * 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 = 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 = QEMU_PLUGIN_MEM_RW; + +static inline bool track_reads(void) +{ + return rw == QEMU_PLUGIN_MEM_RW || rw == QEMU_PLUGIN_MEM_R; +} + +static inline bool track_writes(void) +{ + return rw == QEMU_PLUGIN_MEM_RW || rw == QEMU_PLUGIN_MEM_W; +} + +static void plugin_init(void) +{ + devices = g_hash_table_new(NULL, NULL); +} + +static gint sort_cmp(gconstpointer a, gconstpointer b) +{ + DeviceCounts *ea = (DeviceCounts *) a; + DeviceCounts *eb = (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 = (IOLocationCounts *) a; + IOLocationCounts *eb = (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 = 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 = g_hash_table_get_values(devices); + if (counts && g_list_next(counts)) { + GList *it; + + it = g_list_sort(counts, sort_cmp); + + while (it) { + DeviceCounts *rec = (DeviceCounts *) it->data; + if (rec->detail) { + GList *accesses = g_hash_table_get_values(rec->detail); + GList *io_it = g_list_sort(accesses, sort_loc); + const char *prefix = pattern ? "off" : "pc"; + g_string_append_printf(report, "%s @ 0x%"PRIx64"\n", + rec->name, rec->base); + while (io_it) { + IOLocationCounts *loc = (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 = io_it->next; + } + } else { + fmt_dev_record(report, rec); + } + it = it->next; + }; + g_list_free(it); + } + + qemu_plugin_outs(report->str); +} + +static DeviceCounts *new_count(const char *name, uint64_t base) +{ + DeviceCounts *count = g_new0(DeviceCounts, 1); + count->name = name; + count->base = base; + if (pattern || source) { + count->detail = 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_pc) +{ + IOLocationCounts *loc = g_new0(IOLocationCounts, 1); + loc->off_or_pc = 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 = 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_index) +{ + if (is_write) { + count->writes++; + count->cpu_write |= (1 << cpu_index); + } else { + count->reads++; + count->cpu_read |= (1 << cpu_index); + } +} + +static void vcpu_haddr(unsigned int cpu_index, qemu_plugin_meminfo_t meminfo, + uint64_t vaddr, void *udata) +{ + struct qemu_plugin_hwaddr *hwaddr = qemu_plugin_get_hwaddr(meminfo, vaddr); + + if (!hwaddr || !qemu_plugin_hwaddr_is_io(hwaddr)) { + return; + } else { + const char *name = qemu_plugin_hwaddr_device_name(hwaddr); + uint64_t off = qemu_plugin_hwaddr_device_offset(hwaddr); + bool is_write = qemu_plugin_mem_is_store(meminfo); + DeviceCounts *counts; + + g_mutex_lock(&lock); + counts = (DeviceCounts *) g_hash_table_lookup(devices, name); + + if (!counts) { + uint64_t base = vaddr - off; + counts = new_count(name, base); + } + + if (check_match) { + if (g_strv_contains((const char * const *)matches, counts->name)) { + 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 = (uint64_t) udata; + } + + if (pattern || source) { + IOLocationCounts *io_count = g_hash_table_lookup(counts->detail, + (gpointer) off); + if (!io_count) { + io_count = 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 = qemu_plugin_tb_n_insns(tb); + size_t i; + + for (i = 0; i < n; i++) { + struct qemu_plugin_insn *insn = qemu_plugin_tb_get_insn(tb, i); + gpointer udata = (gpointer) (source ? qemu_plugin_insn_vaddr(insn) : 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 = 0; i < argc; i++) { + char *opt = argv[i]; + if (g_strcmp0(opt, "read") == 0) { + rw = QEMU_PLUGIN_MEM_R; + } else if (g_strcmp0(opt, "write") == 0) { + rw = QEMU_PLUGIN_MEM_W; + } else if (g_strcmp0(opt, "pattern") == 0) { + pattern = true; + } else if (g_strcmp0(opt, "source") == 0) { + source = true; + } else if (g_str_has_prefix(opt, "match")) { + gchar **parts = g_strsplit(opt, "=", 2); + check_match = true; + matches = 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 emulation\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 += hotblocks NAMES += hotpages NAMES += howvec NAMES += lockstep +NAMES += hwprofile SONAMES := $(addsuffix .so,$(addprefix lib,$(NAMES))) From patchwork Wed Feb 10 22:10:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380238 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1554669jah; Wed, 10 Feb 2021 14:12:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/vJvT7nTvnZUzgogSWglcStXl6/rXIiFdONnhJXc6jnl0ZTNPy/6F+SeVJtcz/xD8Zvp6 X-Received: by 2002:a25:f07:: with SMTP id 7mr7577530ybp.399.1612995163865; Wed, 10 Feb 2021 14:12:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612995163; cv=none; d=google.com; s=arc-20160816; b=DrFT8jOR349fUi4nci0RJz8RsiXArwXuL2ZkUCpeGc2ksHDd7l0Ysml71pdn5qLstp pJKUaVAPr3z0mmty5zndZIABac5lxtReglf8HWiHQ/c2d77QoN0h9gLezgNtEA77aOlw 6zkQTCTDmj1ZrFmuJt4YlxfGpJymppexggYGTIZc1yV5k8jQ3seZgqI6ONS6TWANdlL2 gWdlgUrztHqnlv1IEl28OobRlISYC3V80eDqTbGsFUrzYKM4dqUNCdDC8QCW2MBy9lQN gEPJikXnZ1KCgurZFpIAGWgOLBo2BGNZGo4TGxG1K64OV3cdvCTLe2MmmPwcu/bCwXeZ PENQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=gin79Zz+8fQ2Ye/3RKVC4CivONugqR+e7doP6QGVOF4=; b=EQ+onnN3sFjvaaf7xdb6ZWQHHEg0arayqkxm1vCRlvPj06ZgpVgIoSQ+HRNhLJsHWT eduTfI36SFko6LEucrR3ccw+iesNH3XpfmnDiAOQ8c4eDF5bqHQq5PPNjbYP7DNeIGeu hYjOoZ7issvB/y8JeC34hgcDzR9VUx40baqS6xauaKDzhlXDYuow0K1b/kIqzLcUIwii yZx+D9gHPXbbfFAqJJUzXXIqdyR+uI58hFDfOJuueXM+lJ8UbeS8QkogH733/hNrTsjR SGJmol6XJ0VHtK2mOSz0RCNt8cC9VD+e5zVgTfXT92OiSpuW/m0HngQjewLq44OGru5b XYjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=S1PCQssp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d21si3262915yba.476.2021.02.10.14.12.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:12:43 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=S1PCQssp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xj1-00062X-BB for patch@linaro.org; Wed, 10 Feb 2021 17:12:43 -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) 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-Received: by 2002:a1c:480a:: with SMTP id v10mr1204256wma.132.1612995063217; Wed, 10 Feb 2021 14:11:03 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée 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(-) -- 2.20.1 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) for (i = 0; i < limit && it->next; i++, it = it->next) { ExecCount *rec = (ExecCount *) it->data; - g_string_append_printf(report, "%#016"PRIx64", %d, %ld, %"PRId64"\n", + g_string_append_printf(report, "0x%016"PRIx64", %d, %ld, %"PRId64"\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 = 0; i < limit && it->next; i++, it = it->next) { PageCounters *rec = (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 = g_list_next(counts)) { InsnExecCount *rec = (InsnExecCount *) counts->data; g_string_append_printf(report, - "Instr: %-24s\t(%ld hits)\t(op=%#08x/%s)\n", + "Instr: %-24s\t(%ld hits)\t(op=0x%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) /* Output short log entry of going out of sync... */ if (verbose || divrec.distance == 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; - g_string_printf(out, "Δ insn_count @ %#016lx (%ld) vs %#016lx (%ld)\n", + g_string_printf(out, "Δ insn_count @ 0x%016lx (%ld) vs 0x%016lx (%ld)\n", us->pc, us->insn_count, them->pc, them->insn_count); for (entry = log, i = 0; @@ -152,7 +152,7 @@ static void report_divergance(ExecState *us, ExecState *them) entry = g_slist_next(entry), i++) { ExecInfo *prev = (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); } From patchwork Wed Feb 10 22:10:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380242 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1558793jah; Wed, 10 Feb 2021 14:19:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2iNajbh/DS8apGLPnyK0v09J1zZQ1DVlb2RgxhTUUnARAzH5czX/e/SHJE5PaNEkRkSxM X-Received: by 2002:a25:d803:: with SMTP id p3mr7516170ybg.98.1612995594296; Wed, 10 Feb 2021 14:19:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612995594; cv=none; d=google.com; s=arc-20160816; b=qISYnQ6amQvI2uwrQ+H9jV5W2PARkcByYFkELJoAxOxh9O0qfirHdvyTNNL4zZQ/ka A5lg4gfA51TZDdJlq9P/m+ZloKt+Kgdc+G5GYJrfHfr7gdelFxJZLox0z7zYbGCkBwZt bG6yMrFT2fhb8uyhcaMa50znt444FUdczdmFdz7hPxBkfJgC5Wn0lwmRgg6ZvySGUwD4 p3d7o/gUOv7NiPrW9R4krwW0gIiDDMW7HGXEI6K4kHPzNfNrQ3TUXbcM4A4ELtA4pRmU AxySH8q3W8MCbkHHp84MVI8frAuBq1XlNdQNmgHUG0wqWCYmw4dBJub/R91/ZlqlBL4k CFgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=qsAlB8eC1+WOxOlJ6bcLRTNHUdtdlZsz5JZgZPTBx5w=; b=041bY/zXcn8FAjUotWWmCHOWfWUsrgAMSV8S3D6AK3sr1rKHvNL2RmUGwWt8EYFFmH Unh5WSf8iAtpXgUbBOjyISQT5Rg3D0eRQpNt7/AKz6jqJqGVIttpHI4rijaSsiN17gCw cMqoeyp2AxgshLcKNvgtvVgWk1cp41dHj4LCphT5ZjWcLnR+8lVvx6SOxdZ1deA4Sx+7 Fjl51DRJUgT5BRarXqgPD5nfStd9Yy/aS4OQ98rY+fqw0NKQlrDQtP+NFmfegUZxe36V xj7yxPNOUGoBUC7qViZS/lFvjGgwYmZ2tQp2AbdpvEUaedOU/8khfgB8Ke497qV+pJJf YOTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=m2lyRN5R; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c2si3241109ybe.400.2021.02.10.14.19.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:19:54 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=m2lyRN5R; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xpx-0004ia-OE for patch@linaro.org; Wed, 10 Feb 2021 17:19:53 -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) 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-Received: by 2002:a1c:f415:: with SMTP id z21mr1194592wma.114.1612995068912; Wed, 10 Feb 2021 14:11:08 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Message-Id: <20210118031004.1662363-3-zhouyang789@huawei.com> --- contrib/plugins/howvec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 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_index, void *udata) (*count)++; } -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 = NULL; From patchwork Wed Feb 10 22:10:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380240 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1557126jah; Wed, 10 Feb 2021 14:16:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzyLoycpLuXWURAs5xYUUObHhDOjlXFJlvUOPE3UU2bkZEtkeTnefCIwt6JZgxLGNxUgyAX X-Received: by 2002:a25:2747:: with SMTP id n68mr7216479ybn.190.1612995412497; Wed, 10 Feb 2021 14:16:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612995412; cv=none; d=google.com; s=arc-20160816; b=es6X5Xeua5hcrPeZi1DTWCDJQ1bm3lwVnL3+BhbejXPSBxxU5TrKnMvJzSk49Dsgnz Pcv95EHGtk+jN/Pv//sdW1lKLKt5pO7nzfo9rcOTEWMLQ+eevW07DZHU7g9Mup761VcP 2HxM0FEiDn9duL2u4Bpye5zckxJ08VJJVEzHvxE06W8TrzeY8PZuZKwBYdJjII7EGrkM 7FfXIzi31WSaK41xZJdtV4vnIfQUWo3ToQn6RpY3eU+pJnrqWX1B7z9suHnQP0rDuuVO dyUIaVoQshZjCUfosF1oVemnMJyKmvSzZrVE5gS9/tRUuAu3DWxsW+axRuXrWuZrHgsu cDqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=UHNi1hWLbrIySFeJtKPpCbGfvhbQp8V4grjS5oASwHk=; b=GIPZ6F7hjM5JHy0321MF/Jb0NmFBmaw4BP2R2z/1ZWSS/9URSif12mbyw0N6II17IU AY/KbuLm3oAaDmVor5fuee02vwqRN1yVdSjC/DlK2qPzNitgywIBCS51uZl31IsAqpyB 5uCl7Uj0fAc6qnC8ud3Ipr1cHmcfW0DkJd976Wb8f/Ukfrl/E3Rv2EEkixAKxvFuYshH dJVyL441XG1QnvAD97hqxTHOK2m8yJM2VY5o5ZPToTkWYkkIN7rHrbpVWfqZwVmbuWh3 vWXye9fmVi8B+8mOTA1v0JRxZyX7hftoYVYuBIJm3pENzuLfKb1yPDC1OCyWQqgm1EYx pGng== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="deFZY/34"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e17si3668304ybp.405.2021.02.10.14.16.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:16:52 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="deFZY/34"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xn1-0001Ak-U1 for patch@linaro.org; Wed, 10 Feb 2021 17:16:51 -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) 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-Received: by 2002:a7b:c215:: with SMTP id x21mr1243016wmi.61.1612995073174; Wed, 10 Feb 2021 14:11:13 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Message-Id: <20210118031004.1662363-4-zhouyang789@huawei.com> --- contrib/ivshmem-server/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 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 /* used to quit on signal SIGTERM */ From patchwork Wed Feb 10 22:10:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380248 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1563091jah; Wed, 10 Feb 2021 14:27:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJx4g4099vyDXVQAZ8P3/MbSwn3fNeHm6maUcGvh5V/slbwawgx/ML7VEuyTtrWbePLTFMlC X-Received: by 2002:a25:cc89:: with SMTP id l131mr7099314ybf.346.1612996077746; Wed, 10 Feb 2021 14:27:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612996077; cv=none; d=google.com; s=arc-20160816; b=W4WDt4awSqPM2JPdqUxIH4PxIoQjKHwYJ37NlMPX+rr4dsRutU8vjDVmKn2Jl5zQYE AapZXnOV2+SsrIdpCNiXyhlISww8W4pUb03XMH4qG/Rru5DotsXRNOxLgXbA5IdkPGNO zq7L5R4iGO5cdt2tMrlKDa3ItDywY0zd5pfW2k/w30h98Wwd7gFHlhQ4XS/KMnDcqE3b RwVd8YCdZGEDDpc31FCeMYLB2RgirJxSsbJVKEExq1pJvmwlv8Gac5v+5oMOpMqrruKV 5XWWIFPNQ5potGDOYzA5jWIQOBlAJbUdGxGb1N/JhVchR9c8s9Nz/olTyMl5i/Q8rBbG orTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=h0dd8w0ozAtK/o2h3emwaj/X9ik48CwXQg6fa8mR0bQ=; b=DkepQ8hZhGe2kqdlhvR26v4uArJzpMytLhQT73s4ruq4Vzq2LdyhnWw/ZINY6OsKxC OSIUidnv1cgLSHMOtzoBsldl6OuITT3+mXl5V3kUuCbl9+aFBprfE8zuz2GtcU1w96DJ RjfcXvvjluqzqdu5VBP6WZpnWgakA4Er9xfKzk6Z3foX/amks0+tJCVdkQXjhJKNePuv Vw+hIUnCl27IZ/p1URrEB71ezKkXe0iXwJRToN5fqC8Wflgv047psNwIvM/elr9ffSdl o1BsvqUqIl4M/CCy8nVH5R4ZFhF3Tx1Bfjtpe2DeGKmd0jpcY8nurzS1Pimx2PpE69v2 sZ8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fVXT+5JO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r35si2798519ybd.335.2021.02.10.14.27.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:27:57 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fVXT+5JO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xxl-0004lp-8R for patch@linaro.org; Wed, 10 Feb 2021 17:27:57 -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) 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-Received: by 2002:a1c:c242:: with SMTP id s63mr1228826wmf.9.1612995070723; Wed, 10 Feb 2021 14:11:10 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Message-Id: <20210118031004.1662363-5-zhouyang789@huawei.com> --- contrib/plugins/howvec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.20.1 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[] = { { "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_CLASS}, { " 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[] = { { "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_CLASS}, { " AdvSimd ldst", "advlss", 0xbf9f0000, 0x0d000000, COUNT_CLASS}, - { " AdvSimd ldst++", "advlssp",0xbf800000, 0x0d800000, COUNT_CLASS}, + { " AdvSimd ldst++", "advlssp", 0xbf800000, 0x0d800000, COUNT_CLASS}, { " 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_CLASS}, { " 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_CLASS}, { " 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) counts = 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 = g_list_sort(counts, cmp_exec_count); for (i = 0; i < limit && g_list_next(counts); From patchwork Wed Feb 10 22:10:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380237 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1554639jah; Wed, 10 Feb 2021 14:12:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJz0U5DuuJ/G/xJqnPAPZB6gXCNrf0bDy0jz+DCyaNiktP9y8/1w225S8LkYG9ClNL7KRx1s X-Received: by 2002:a25:7693:: with SMTP id r141mr2484427ybc.49.1612995161056; Wed, 10 Feb 2021 14:12:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612995161; cv=none; d=google.com; s=arc-20160816; b=cgIv3CPAPGlZuTRhtKb+Y4azuJn19udrTUP6lAQj+Pcpokrfn1YiDHQyWhgj4HAzQ9 t3ELQchwLM9iZbV9TYIuasOcssyf6N3QTdCj0eT5vlUq/nXTeyYlexU9QxLppKGmQnpd w8qaMF3nb7R3NvGs7G4mc6o21nlXcMo07CSXY0x8D51Wt9/+Tt5m3XjHprV/OehR5cjq PX5SZFrFtMhxwn2cwZCNN1hBjHgYJXeZkhVq65kmB+BzNuPF/QBUoZx4wsaCTUSxjrYP 8f95qh3Bl3SQ7bvdoL7gNQVAS96rGhw/tQwFuIz6oFIZbMrH+x0tglN/+oiGtGAqOf7p xPIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=PU9rNaQh7vkDttDYTlGc5gKeO+PSzP4WvxcncEhBalo=; b=T9ThOoyn7Qeq2eHexFVNZ2plqpJkaVEG0gA4tiiwJY+CmcJoTz6dG4fn08RlI6vI+W IJ428la7ez8HV0U0MZUDhuVEVgj2EwtS/AEcLD4wd5CJV8AhcOYCUnNTSxl+xXdGrZZe 21sJzOEZE9e18DOeD5Czspp17krAy8ZM2xpwThhNIEvldUWaqzyfvBE5RV2WQV8S6hUs MB4LTz4x0PblS248c1zg6cv0jSdZg5jQMKqv7Xv3AnPANLW0F92CObztHUlN3D92YwcY KgzgwKuJKBgTa+OTs2SJn+jlnAxRSPQ69uoq0NOQfW4w9H0AzSxmMWQ8KmuiV08gsLYq IZEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hdILOJgg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d11si3105208ybq.114.2021.02.10.14.12.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:12:41 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hdILOJgg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xiy-00061J-FM for patch@linaro.org; Wed, 10 Feb 2021 17:12:40 -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) 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-Received: by 2002:a1c:6402:: with SMTP id y2mr1164558wmb.43.1612995064189; Wed, 10 Feb 2021 14:11:04 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Message-Id: <20210118031004.1662363-6-zhouyang789@huawei.com> --- contrib/plugins/howvec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.20.1 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; -static ClassSelector class_tables[] = -{ +static ClassSelector class_tables[] = { { "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) }, From patchwork Wed Feb 10 22:10:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380241 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1557170jah; Wed, 10 Feb 2021 14:16:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3lEVzzJns/Fy/xTPR5DRtfiKSmRNQnwqYlyGQHufvAc9LqmPSrQHF38sp/3bhC8tsJTBH X-Received: by 2002:a25:910a:: with SMTP id v10mr7500961ybl.506.1612995418128; Wed, 10 Feb 2021 14:16:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612995418; cv=none; d=google.com; s=arc-20160816; b=smAJ8U8GtbyJOAZcEpIOlcd2ypd8LOaSdt7yk833BL+b2ZGRJrB2roycsMThVZlAmu rdGXry4yVAxSnyBvXXWN+5wl0Ps0uHkqR2LVD5/xegkCX/xiFdfPlSr0nVxZgphh2nro W94uwE0x5j62M4EKo34fNDc/ZvOucGgXl9nZ2TLPWSaue/o+0QVwOPjWVknqNdZ8adyZ NjQd9Cc2jcGjizXJdh633vIofG3B6cse80+eZzCmWUifvna0gx30M1kFLNpbzjdWaOE0 S2qeC0PiediravH5aUagNjTivCugAH/+Eq+4klx1c5Wv1c9NK1dUFaVp5BXZFmzJxeVY D1KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=o81Mz4W9KCvutw0rCkPpru0KeoeXZKNx1XZY/IHOEHo=; b=E+bTcykDaL3LXMGiKSOYwKeXZmZqye8aJAuIZxp1XtCyqBdiypz+rfP+oTPZneIaTk AIaaQGupRgG1dP2rCGFTVUb1Clsgvq9s/EWE0buzMch+nBfM8/D46MuNIBfQdRj+THRx rsD9QbrJ+lWAL2tjXZdT/ABDnxKZV6tuOrP1voBo4NviuzNxq5LjKdmkKr6VKcHMvtes 6jDmVMTtO/W4OjxyfYSd0KAPzDAzOE/5BdGMc3G6S1hRWrmH3zPVm8tLYErhPTZ5Y4ZV xLH7yYLd1KZIs7uG3X0U5NvF9MY9vPsCDPn9dSifjDUxTXaoIwPVyAgYlA5D7yoBiy2l 98gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=S6cHlkWE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i14si2782589ybe.71.2021.02.10.14.16.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:16:58 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=S6cHlkWE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xn7-0001L4-Gc for patch@linaro.org; Wed, 10 Feb 2021 17:16:57 -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) 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-Received: by 2002:a1c:220a:: with SMTP id i10mr1162872wmi.102.1612995078102; 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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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=inline. 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ée 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(-) -- 2.20.1 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; } -static TCGOp *copy_const_i64(TCGOp **begin_op, TCGOp *op, uint64_t v) -{ - if (TCG_TARGET_REG_BITS == 32) { - /* 2x mov_i32 */ - op = copy_op(begin_op, op, INDEX_op_mov_i32); - op->args[1] = tcgv_i32_arg(tcg_constant_i32(v)); - op = copy_op(begin_op, op, INDEX_op_mov_i32); - op->args[1] = tcgv_i32_arg(tcg_constant_i32(v >> 32)); - } else { - /* mov_i64 */ - op = copy_op(begin_op, op, INDEX_op_mov_i64); - op->args[1] = tcgv_i64_arg(tcg_constant_i64(v)); - } - return op; -} - static TCGOp *copy_extu_tl_i64(TCGOp **begin_op, TCGOp *op) { if (TARGET_LONG_BITS == 32) { @@ -374,14 +358,17 @@ static TCGOp *copy_st_i64(TCGOp **begin_op, TCGOp *op) return op; } -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 == 32) { /* all 32-bit backends must implement add2_i32 */ g_assert(TCG_TARGET_HAS_add2_i32); op = copy_op(begin_op, op, INDEX_op_add2_i32); + op->args[4] = tcgv_i32_arg(tcg_constant_i32(v)); + op->args[5] = tcgv_i32_arg(tcg_constant_i32(v >> 32)); } else { op = copy_op(begin_op, op, INDEX_op_add_i64); + op->args[2] = tcgv_i64_arg(tcg_constant_i64(v)); } return op; } @@ -431,6 +418,12 @@ static TCGOp *copy_call(TCGOp **begin_op, TCGOp *op, void *empty_func, return op; } +/* + * 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_plugin_dyn_cb *cb, /* ld_i64 */ op = copy_ld_i64(&begin_op, op); - /* const_i64 */ - op = copy_const_i64(&begin_op, op, cb->inline_insn.imm); - /* add_i64 */ - op = copy_add_i64(&begin_op, op); + op = copy_add_i64(&begin_op, op, cb->inline_insn.imm); /* st_i64 */ op = copy_st_i64(&begin_op, op); From patchwork Wed Feb 10 22:10:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380255 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1568137jah; Wed, 10 Feb 2021 14:36:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDPGNp4ZE5y/juVImUspdc2e8N4+zexqlxz8rTuQshZA0tP/aoD7XIE44nNNa+d1dFhdOd X-Received: by 2002:a25:6110:: with SMTP id v16mr7552355ybb.435.1612996591695; Wed, 10 Feb 2021 14:36:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612996591; cv=none; d=google.com; s=arc-20160816; b=eGravqfFjSBxlq69xA3FGWH+corLadXYh5eG7bxHx8ZyGUWyo+SvVaxZhbubtupsia ZulBkWgmcM03+2zchBmfpLJc9nViEDVU13diByXzlnY9O0ZQ1mA5yuG8JTJLvolv/ctG P5xsFIXWTwwwkZOT4r0fpo4TTqLkqX4t8CYs03ybSZ81X/NePEvu8TJ+rWxRBBwGMS+I XvfsUOdY1aBPF8rFUviFNOEbgWkRRuVMrtVYXRdhAGNdg8QLuIKoboTEQxKrdfo76cyQ ff3f25b0ki0+sRFhT3OlZoulJGG8tQHZkpaglJKnLFv4Wrjq/tqDuGIUEQ+KtbgqVURA Pmkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Edh2u0iWFLyAxZ4TZrNGtVngWGS/6wsGB/21/wljo0k=; b=v7MxJ3+OJUCjpvFVh0y1dwizGyijifnZTiVDCWlEkIQyNacYZey7Jy4pLqTKg0wQNV cLE6bGyrMvUdVGm5Dj4KOE4FWpt/98b2rCHPh2mGGl2vp6a5UkHctHNUbI8Xbs7nxOj5 Hs2BA5jXDkyd5zGYsacF+FAdARDVd0BjOrV4vn/r57SWHlCLrkZ80nHkXSL51iu8n0Fo U3Pupa+bjxi7Nkwc13X+sgTh14e9CD1kKEnCXJd0oHS8NowMUX4jOiEVwpnIwTodoN4Q yItHdrRMFVp/x8iImPBx0lwZBs2TpM9akTmTRrXgY/WJ+2DEhQiQ/bB2hGrYf6bWjdSo i6hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=df0Bh5pw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w4si2873452ybg.438.2021.02.10.14.36.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:36:31 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=df0Bh5pw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9y62-0004HO-JS for patch@linaro.org; Wed, 10 Feb 2021 17:36:31 -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) 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-Received: by 2002:a1c:730f:: with SMTP id d15mr1145992wmb.135.1612995081262; Wed, 10 Feb 2021 14:11:21 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= , "Edgar E. Iglesias" , "open list:ARM TCG CPUs" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Reviewed-by: Alex Bennée Message-Id: <20210208233906.479571-2-richard.henderson@linaro.org> Message-Id: <20210209182749.31323-2-alex.bennee@linaro.org> --- 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(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé 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) -typedef struct TranslationBlock TranslationBlock; typedef struct TBContext TBContext; 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 { typedef struct CPUWatchpoint CPUWatchpoint; -struct TranslationBlock; - /* see tcg-cpu-ops.h */ struct TCGCPUOps; @@ -375,7 +373,7 @@ struct CPUState { IcountDecr *icount_decr_ptr; /* 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]; 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); #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 */ 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 { int delayed_branch; - struct TranslationBlock *tb; + TranslationBlock *tb; int singlestep_enabled; } DisasContext; 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; - struct TranslationBlock *tb; + TranslationBlock *tb; int singlestep_enabled; 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 @@ /* 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; From patchwork Wed Feb 10 22:10:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380251 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1565051jah; Wed, 10 Feb 2021 14:31:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZYgq+RL0Yx02zteKZLZVnjSsMLSn9llPbAQdAuFl/JG9ukw+r4SblIgM1drpvyqrvr2cn X-Received: by 2002:a25:d916:: with SMTP id q22mr7166272ybg.377.1612996281513; Wed, 10 Feb 2021 14:31:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612996281; cv=none; d=google.com; s=arc-20160816; b=YZgYnQd6F7YytMpsdciNlnsizo6NW/voV+Hi7Pfo13Etzn01PW88Latu4XpmXJ8tch lfFPYKUVij2Eh0xqvZQJhIudFg4LGdPyIWajFvrUpn7Aj/pO54w4MGJJXqzCjLTXvZHt NZClzmUGAfurRmZBA4xqfVWKPdlx9V9BK92UDqFGQjvsCy4XA6wKETCP9N+vo5qqdF2P v04erxgPjxFiC/7uNlEabY4D0EMOXwlbO/GA2KFgXIvUKISCERvn1+VxfJ76a/xIFYDY HBCM3n35weVXxZNX2ordftZVt/Mp77oXm45XDLdfihhea1mVv4vQhRUqy/0b9cnZZcSO dqVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=V8hRFPoVc8c8eXrlr06JCpkJWOT8xslFBNNz5Wo6GrU=; b=d4cYIHXl03sZCklkgzbufG85sufNqK6Xbq5P1fC2YBS79Hu+h75sktz2onqaKWr0dV GPiofBZCda61GuFCNIYTH+yU0NjwMkgg3fYXWsJj8L+Mnux3qqJZkc4+IwN0iUZAAdLb IaqUYD87H2q+af78IpDpATk7OzZuQ+uawqSRAOHpdyhVkZS46at8aJUsT2pB2bYWfdOa mEUh0UA1rLw51cI3FHfwl/RTAHUHGEQjHf1CqZwVnDI1VxcZY6bsdACsdrDmT4Q4KPoL Fo9FtmtUAA1VHuCsZbmwVEI9fJl5XEKfmGlvvbxgha9RIaVZMCmrBaeP7zoEnBn1fhqU z5mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="NP7/0bpw"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s11si1294000ybl.154.2021.02.10.14.31.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:31:21 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="NP7/0bpw"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9y12-00006Y-WD for patch@linaro.org; Wed, 10 Feb 2021 17:31:21 -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) 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-Received: by 2002:a05:600c:4105:: with SMTP id j5mr1237592wmi.0.1612995076109; Wed, 10 Feb 2021 14:11:16 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Reviewed-by: Alex Bennée Message-Id: <20210208233906.479571-3-richard.henderson@linaro.org> Message-Id: <20210209182749.31323-3-alex.bennee@linaro.org> --- include/hw/core/tcg-cpu-ops.h | 10 ++++++++++ accel/tcg/translate-all.c | 17 +++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé 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); + /** + * @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 */ 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" /* #define DEBUG_TB_INVALIDATE */ @@ -2420,6 +2421,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) CPUArchState *env = cpu->env_ptr; #endif TranslationBlock *tb; + CPUClass *cc; uint32_t n; tb = tcg_tb_lookup(retaddr); @@ -2429,11 +2431,18 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) } cpu_restore_state_from_tb(cpu, tb, retaddr, true); - /* 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 = 1; + cc = 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 = 2; + } #if defined(TARGET_MIPS) if ((env->hflags & MIPS_HFLAG_BMASK) != 0 && env->active_tc.PC != tb->pc) { From patchwork Wed Feb 10 22:10:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380250 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1564995jah; Wed, 10 Feb 2021 14:31:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJw1t8YbOWw/7VXdtb91wlHqvyg7jlgL9IifCyvm9XjqxHwdviBEpGTU4YGo0oU5Oj1JPsIT X-Received: by 2002:a25:d803:: with SMTP id p3mr7575335ybg.98.1612996276635; Wed, 10 Feb 2021 14:31:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612996276; cv=none; d=google.com; s=arc-20160816; b=H7fZWQ+ChN0/MG9K+NqZNDttOeshJ2nukJn7BLB/om2YHm4qRLINQvq+I6jNNP+kCC KDJOVRPzyGg/BgSp3TaQa8DdRNiRidVUDVKNCTxHVL37DqHT3vsWSXkBKLmS0fpQoN6l PBl9gXD2U6f/zpl+YODU9ngaVk/AlimXNs+9EQ0DHfC/73Yj433YPbAnru7/LXAJnaEs QLw8P6xsc62BejmKGH/unPJ9oTpvh+4q6NGBL3Jrh78CJKDeST2q8j5cRGEV+J7wBXJ+ E5tVch4fuItzBw4u2wr4GTdo9fG6JUOY4vaRwebyKUB2ZbMukb38XDoiWnDU4ClJtgLq VPuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=maKaI/qzwTXOe899gbp1Af9qP827gN0VYDNXRtqE7f8=; b=YJ++Sc79sz1DoJVaukmZtb0H0M2yrrxPuRuAYTr7mzlmM10vhxGf/wcNvjsxJk7G7P sbBBUIvXpLG4v7hm8MqLfBfJ1oIQ6VZQpj1c7SL+Iw/+yNyQvCY7VF0C3gNoX7z5sRjW yL+Xmz06NNDVqieVbcgYzSdpH/nDHFV9Uf86Ys0h4kdAzoZtOLZzvbgmKrAlqtdNP1h6 nqzgvwNvfxifhYVZtDKxCCQna5ehMgBNl2HRTn1Zm/rvZaTGMRpgq0bVna6xHkafByVM Q5AjdFNRtQEoQqZIdaMVQ8ICBIoVBboe1ge6Y1F5IoRv8ILx4wXsXviEq1CX5d6d4I05 lPlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=BnRJ6TMA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x63si3026406ybh.326.2021.02.10.14.31.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:31:16 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=BnRJ6TMA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9y0x-0007Ik-Nd for patch@linaro.org; Wed, 10 Feb 2021 17:31:15 -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) 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-Received: by 2002:a05:600c:3506:: with SMTP id h6mr1192328wmq.21.1612995079131; Wed, 10 Feb 2021 14:11:19 -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) From: =?utf-8?q?Alex_Benn=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 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_Mathieu-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_Benn?= =?utf-8?b?w6ll?= , Aurelien Jarno Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Reviewed-by: Alex Bennée Message-Id: <20210208233906.479571-4-richard.henderson@linaro.org> Message-Id: <20210209182749.31323-4-alex.bennee@linaro.org> --- accel/tcg/translate-all.c | 12 ++---------- target/mips/cpu.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 10 deletions(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé 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 retaddr) */ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) { -#if defined(TARGET_MIPS) || defined(TARGET_SH4) +#if defined(TARGET_SH4) CPUArchState *env = cpu->env_ptr; #endif TranslationBlock *tb; @@ -2443,15 +2443,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) cpu_neg(cpu)->icount_decr.u16.low++; n = 2; } -#if defined(TARGET_MIPS) - if ((env->hflags & MIPS_HFLAG_BMASK) != 0 - && env->active_tc.PC != tb->pc) { - env->active_tc.PC -= (env->hflags & MIPS_HFLAG_B16 ? 2 : 4); - cpu_neg(cpu)->icount_decr.u16.low++; - env->hflags &= ~MIPS_HFLAG_BMASK; - n = 2; - } -#elif defined(TARGET_SH4) +#if defined(TARGET_SH4) if ((env->flags & ((DELAY_SLOT | DELAY_SLOT_CONDITIONAL))) != 0 && env->pc != tb->pc) { env->pc -= 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 &= ~MIPS_HFLAG_BMASK; env->hflags |= tb->flags & MIPS_HFLAG_BMASK; } + +# ifndef CONFIG_USER_ONLY +static bool mips_io_recompile_replay_branch(CPUState *cs, + const TranslationBlock *tb) +{ + MIPSCPU *cpu = MIPS_CPU(cs); + CPUMIPSState *env = &cpu->env; + + if ((env->hflags & MIPS_HFLAG_BMASK) != 0 + && env->active_tc.PC != tb->pc) { + env->active_tc.PC -= (env->hflags & MIPS_HFLAG_B16 ? 2 : 4); + env->hflags &= ~MIPS_HFLAG_BMASK; + return true; + } + return false; +} +# endif /* !CONFIG_USER_ONLY */ #endif /* CONFIG_TCG */ static bool mips_cpu_has_work(CPUState *cs) @@ -679,6 +696,7 @@ static struct TCGCPUOps mips_tcg_ops = { .do_interrupt = mips_cpu_do_interrupt, .do_transaction_failed = mips_cpu_do_transaction_failed, .do_unaligned_access = mips_cpu_do_unaligned_access, + .io_recompile_replay_branch = mips_io_recompile_replay_branch, #endif /* !CONFIG_USER_ONLY */ }; #endif /* CONFIG_TCG */ From patchwork Wed Feb 10 22:10:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380259 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1570515jah; Wed, 10 Feb 2021 14:40:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJxNJowUknrdKmeE2Rm3nXKkbdasm/5xidnfIHMV2m5zGh68UzeENSR/d4NuP6klwzh10QwB X-Received: by 2002:a25:b988:: with SMTP id r8mr6991932ybg.268.1612996842025; Wed, 10 Feb 2021 14:40:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612996842; cv=none; d=google.com; s=arc-20160816; b=VK0jQLFzp0luthEHvp9U/N6uKBV+HZre7/QQIsEp6qoKs1Kc+a0/xIjGa+pC3LQXDe S3P7bML8wqd3zmRZjXaKXSTPt2gzCsDN61ITDRhoF+JSvxEbQZNlWHGPGJF1joIImAk1 CzMWHb/u0sAkn3l14flYnNop2QYy8CBnOZhwSPvXfGq2NiPLdve51kI2xnjaGM51xRh3 /S5J0AmsDYmDx85lUjJkl3hrturc64C/Uum/xUskm/OpIxGtXLYEVl0mzkbgHo0A09/c fGbI66cjE2yMVArbF4fAx2NvhuMLnm0t/xMaxC7N5jHpZirg+etPWseHNEo7MpKYyQgd 38Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=C092gDUqg+6i3/7PDEneZh7D36z03pG1+b/EutVVLjE=; b=KuHBdM59uja3N5mGLsXzZEOPtsEfioiAaJj0K+4evANoCWTRvlrYuMNi478Dn6vWma K6CjDkuVlcS7W5BAMbpa252ckb2XfLN+deVv4foHFnTPwhIzI1z1+6aq8PH9s+P+p0Ua 6ivewLYZtJ4itB3QQR5GCeveHFRd8tf+oYxx7o4Kwk6n/H8Ax8haDnBQJxhd0GC4YKIZ EvvVvsZA36LfftJeGe7MhhBJw2mDlfhgNsB0ix/yV5Fvex+BaVqIbA0gXZLvXTOhaMR3 BHGBEhZOKyZCnzdXYT9q5rSEpbbvvie5m6nyGQo7CPgYjf6T5Y9GcINMCTtDNFR/EgiS WniQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rcl0EaxV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y126si2953224yba.489.2021.02.10.14.40.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:40:42 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rcl0EaxV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9yA5-0007P1-FT for patch@linaro.org; Wed, 10 Feb 2021 17:40:41 -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) 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-Received: by 2002:a1c:6289:: with SMTP id w131mr1273386wmb.0.1612995082212; Wed, 10 Feb 2021 14:11:22 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Reviewed-by: Alex Bennée Message-Id: <20210208233906.479571-5-richard.henderson@linaro.org> Message-Id: <20210209182749.31323-5-alex.bennee@linaro.org> --- accel/tcg/translate-all.c | 12 ------------ target/sh4/cpu.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 12 deletions(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé 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 retaddr) */ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) { -#if defined(TARGET_SH4) - CPUArchState *env = cpu->env_ptr; -#endif TranslationBlock *tb; CPUClass *cc; uint32_t n; @@ -2443,15 +2440,6 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) cpu_neg(cpu)->icount_decr.u16.low++; n = 2; } -#if defined(TARGET_SH4) - if ((env->flags & ((DELAY_SLOT | DELAY_SLOT_CONDITIONAL))) != 0 - && env->pc != tb->pc) { - env->pc -= 2; - cpu_neg(cpu)->icount_decr.u16.low++; - env->flags &= ~(DELAY_SLOT | DELAY_SLOT_CONDITIONAL); - n = 2; - } -#endif /* Generate a new TB executing the I/O insn. */ cpu->cflags_next_tb = 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 = tb->flags & TB_FLAG_ENVFLAGS_MASK; } +#ifndef CONFIG_USER_ONLY +static bool superh_io_recompile_replay_branch(CPUState *cs, + const TranslationBlock *tb) +{ + SuperHCPU *cpu = SUPERH_CPU(cs); + CPUSH4State *env = &cpu->env; + + if ((env->flags & ((DELAY_SLOT | DELAY_SLOT_CONDITIONAL))) != 0 + && env->pc != tb->pc) { + env->pc -= 2; + env->flags &= ~(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 = { #ifndef CONFIG_USER_ONLY .do_interrupt = superh_cpu_do_interrupt, .do_unaligned_access = superh_cpu_do_unaligned_access, + .io_recompile_replay_branch = superh_io_recompile_replay_branch, #endif /* !CONFIG_USER_ONLY */ }; From patchwork Wed Feb 10 22:10:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380249 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1563461jah; Wed, 10 Feb 2021 14:28:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPe2YEAUPu7ml7kGFZ2ytnM3RcLvOa0qMq7zb8Xw6Yg8gQHZ/rVLUqQeU5/nAMrlA/dppR X-Received: by 2002:a25:4843:: with SMTP id v64mr7333948yba.24.1612996119555; Wed, 10 Feb 2021 14:28:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612996119; cv=none; d=google.com; s=arc-20160816; b=XlN0ufL+vhHc3exvpMoWv3MnrZtldYKoGYZp+94X0TU631i9MVpRf2PC7Q9+wVQ065 chZkf7ql/0DZ+oh7KzsRVZZuUbLjDbsb4kaelrnkt7Aj4J0I1za1b0f2mpN3HfiF0aEt EqGXr0+l+ryoJFSpy2/pzEwRqYlLHzp8kSG9SHnyA0dgvXJp/GEaxkke1as04wKw8YxS gOiEv1sOmFs+yd/pLqj+6c3V6i9VFG3JGyWN8xoQzGcLJUza2/NLkEX6BMxbvaF4LZM2 TZEkWthOkF/JYLSwwal2u10Hh7oKuVDY7ABCiOU9HPcMkk99+CabFmoSwHWHKaY8KAgF n9qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Im2/9eo7/fnC2asN2YmX8UWgpnbFcH4spWB/cPGWcw8=; b=vKDc52VEie5Qvun7hrI/J8xzeEDMnIsqiWcW8Az9C6IINEZ8wgdNrprYLvpU6Rjfjl bgSI/inouQCqMnpwpFVkQncyiH19MnVRa6hCi2HzZ9urqcJ+9sMMAzyIgoKtR0bCV+10 GMdlEPw/c81VxUCcZEKUDuEe1vVx7tRTBUkoUfRkZf3kKkUWrVK1J0UG7Unm5HrGTT7l h2ktkL0OMSCdOgqY1Lq9IDpbC2Yyba1bRNRxyacJ6ahWkgH370/XqJYsd7U538IUgTG8 UzsIzPIxkdlnAEdFY6vd1Mjq5vBqvLn44kz+DkC/2rVzWTsaBXX6JjR/iCCcxW7Pv59u tLYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=n7iyfsnk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w7si2889461ybw.316.2021.02.10.14.28.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:28:39 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=n7iyfsnk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xyR-0005R0-1E for patch@linaro.org; Wed, 10 Feb 2021 17:28:39 -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) 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-Received: by 2002:a1c:dcd7:: with SMTP id t206mr1182684wmg.108.1612995610348; Wed, 10 Feb 2021 14:20:10 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée 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(-) -- 2.20.1 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; static void vcpu_insn_exec_before(unsigned int cpu_index, void *udata) { + static uint64_t last_pc; + uint64_t this_pc = GPOINTER_TO_UINT(udata); + if (this_pc == last_pc) { + g_autofree gchar *out = g_strdup_printf("detected repeat execution @ 0x%" + PRIx64 "\n", this_pc); + qemu_plugin_outs(out); + } + last_pc = this_pc; insn_count++; } @@ -36,8 +44,10 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) qemu_plugin_register_vcpu_insn_exec_inline( insn, QEMU_PLUGIN_INLINE_ADD_U64, &insn_count, 1); } else { + uint64_t vaddr = 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/Makefile.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+=$(MULTIARCH_RUNS) memory: CFLAGS+=-DCHECK_UNALIGNED=1 +# non-inline runs will trigger the duplicate instruction heuristics in libinsn.so +run-plugin-%-with-libinsn.so: + $(call run-test, $@, \ + $(QEMU) -monitor none -display none \ + -chardev file$(COMMA)path=$@.out$(COMMA)id=output \ + -plugin ../../plugin/libinsn.so$(COMMA)arg=inline \ + -d plugin -D $*-with-libinsn.so.pout \ + $(QEMU_OPTS) $*, \ + "$* on $(TARGET_NAME)") + # Running QEMU_OPTS+=-device isa-debugcon,chardev=output -device isa-debug-exit,iobase=0xf4,iosize=0x4 -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+=test-i386-fprem endif +# non-inline runs will trigger the duplicate instruction heuristics in libinsn.so +run-plugin-%-with-libinsn.so: + $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \ + -plugin ../../plugin/libinsn.so$(COMMA)arg=inline \ + -d plugin -D $*-with-libinsn.so.pout $*, \ + "$* (inline) on $(TARGET_NAME)") + # Update TESTS I386_TESTS:=$(filter-out $(SKIP_I386_TESTS), $(ALL_X86_TESTS)) TESTS=$(MULTIARCH_TESTS) $(I386_TESTS) diff --git a/tests/tcg/x86_64/Makefile.softmmu-target b/tests/tcg/x86_64/Makefile.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+=$(MULTIARCH_RUNS) memory: CFLAGS+=-DCHECK_UNALIGNED=1 +# non-inline runs will trigger the duplicate instruction heuristics in libinsn.so +run-plugin-%-with-libinsn.so: + $(call run-test, $@, \ + $(QEMU) -monitor none -display none \ + -chardev file$(COMMA)path=$@.out$(COMMA)id=output \ + -plugin ../../plugin/libinsn.so$(COMMA)arg=inline \ + -d plugin -D $*-with-libinsn.so.pout \ + $(QEMU_OPTS) $*, \ + "$* on $(TARGET_NAME)") + # Running QEMU_OPTS+=-device isa-debugcon,chardev=output -device isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel From patchwork Wed Feb 10 22:10:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380261 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1577597jah; Wed, 10 Feb 2021 14:52:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJyBwBWpCH54BN5ceaElrGmeOAh9+0TqVlhlvIq8TkbQfXAXFkL29jcBdN2SNMhn8nWfHR22 X-Received: by 2002:a25:b8ca:: with SMTP id g10mr7010198ybm.517.1612997526583; Wed, 10 Feb 2021 14:52:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612997526; cv=none; d=google.com; s=arc-20160816; b=JyQ9C4Etpx07me4Lx8E9JDGxz6kCX8ltb+Ijj+PIF8/Jpsx7F8xvrpXA01gG6a3EVk zGTbuSQV2TuinR6tiUmACaDqCkBM2TKeGB1jEuhSwgxxy9ljHXZtzOY0nTfOs81D9+9S Fi0CVZJPsngMNIVjYrdnhttLNiTCUpjWRuEbPwZx+YApXzZQ8UnSP/XlJD8PIFpipel6 Fkyq7qgh7IRd2AUJI2Qk+dHvOzc1If+mQbMgvg1BmKvRKn43kJFKTNDCsP7SaeFp+WCJ TugEYDGLAIeZfKSUIuKRG6L2QuVUxr2HRbcErY0rq8/ZQC0LB6Hw6nZ3fb2GczfdJGLK DhWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=j4XmWVEBX2ENQRRduA5gKPU5AX0OB2Qj1ZjmkgHICaE=; b=JZmuSS/K6kOILzg6mxvNmEOBj4H7g+NS/Uh8Axg9niopxS5TbXRSPb2uZYPgpFazJj jEMO4+8/dJyfsofGwJDcErkZrXitSvsaDonRQ3UWWczBhEAoGz5YTEBUU2dBmEea09gE EYpbAToiUEOymFMENdIVsEjM97JHZfY4kV/tLdQyDhxXyvfZxQK0mX+f7tK5JJza1mEs IZ/8Ykiz2CjFI2t9OrBWgP1vNHXE81nFtgzqSc37Jz0VIrxoO6ly5dxuFDcBB2NspJuE uXJvL92Jl+2eKRNczrOfdqcouzjpZ++tAXFJpyzrW3ktr4pHjNPiHIYIKW+juEMMpBDS SAsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="fa6NFK/B"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x71si862973ybg.103.2021.02.10.14.52.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:52:06 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="fa6NFK/B"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9yL8-0007x3-2O for patch@linaro.org; Wed, 10 Feb 2021 17:52:06 -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) 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-Received: by 2002:a1c:c904:: with SMTP id f4mr1270608wmb.14.1612995604850; Wed, 10 Feb 2021 14:20:04 -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) From: =?utf-8?q?Alex_Benn=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 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_Mathieu-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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Message-Id: <20210209182749.31323-7-alex.bennee@linaro.org> --- tests/acceptance/tcg_plugins.py | 103 ++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 tests/acceptance/tcg_plugins.py -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé Tested-by: Wainer dos Santos Moschetta 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ée +# +# 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 = 120 + KERNEL_COMMON_COMMAND_LINE = 'printk.time=1 panic=-1 ' + + def run_vm(self, kernel_path, kernel_command_line, + plugin, plugin_log, console_pattern, args): + + logger = logging.getLogger('plugin') + start_time = time.time() + vm = 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 = 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 = ('http://security.debian.org/' + 'debian-security/pool/updates/main/l/linux-signed-arm64/' + 'linux-image-4.19.0-12-arm64_4.19.152-1_arm64.deb') + kernel_sha1 = '2036c2792f80ac9c4ccaae742b2e0a28385b6010' + kernel_deb = self.fetch_asset(kernel_url, asset_hash=kernel_sha1) + kernel_path = self.extract_from_deb(kernel_deb, + "/boot/vmlinuz-4.19.0-12-arm64") + return kernel_path + + def test_aarch64_virt_insn(self): + """ + :avocado: tags=accel:tcg + :avocado: tags=arch:aarch64 + :avocado: tags=machine:virt + :avocado: tags=cpu:cortex-a57 + """ + kernel_path = self._grab_aarch64_kernel() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyAMA0') + console_pattern = 'Kernel panic - not syncing: VFS:' + + plugin_log = tempfile.NamedTemporaryFile(mode="r+t", prefix="plugin", + suffix=".log") + + self.run_vm(kernel_path, kernel_command_line, + "tests/plugin/libinsn.so", plugin_log.name, + console_pattern, + args=('-cpu', 'cortex-a53')) + + logger = logging.getLogger() + + with plugin_log as lf, \ + mmap.mmap(lf.fileno(), 0, access=mmap.ACCESS_READ) as s: + + m = 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 From patchwork Wed Feb 10 22:10:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380263 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1579892jah; Wed, 10 Feb 2021 14:56:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxnN7+aKnq2jOhcc314uQM0fplphCmFm/eP1SgjIsWsoimUy4Km12uQ2hdGYvaLeO5Efyi+ X-Received: by 2002:a25:8689:: with SMTP id z9mr4058939ybk.55.1612997782923; Wed, 10 Feb 2021 14:56:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612997782; cv=none; d=google.com; s=arc-20160816; b=FaPrp5MQEgoNmclZoI/Rt4VlQ4/SJs341MTp1MDgjTkqR7pDR1joGm/OgkxMN0Qg02 Abb8kBWIy2LxgDKly2IBtbl4an9cBe6b2nghcyZFn9P9ANEGtjcIfQYlCE4jXhRk8r4H iRu/6pzAHixgZNYEC93JZAzg8GmupSN04GCXO32KHv4ShayiwraYwGWvFUyfhmItXfwg OqilEryPO6Knmowvd7a40VoZUChGvxpeOpQGnmLONwQ4+8VEQKWtYsobnKaxBFaf45IC ykDBef/j/ya8YRokdhT1fWSxYm36otNzcvQrv06ydM2yaWvpDhyjHyhljeXgHFUfbC0O uCUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=HGyTKfyrMC02NQIDciJuv0x1b/kxlzbJP/1nTgEUSN0=; b=kLKHjjvytZK9r8sj1LVuWt9o+6RVLeNoczKTDhSTYm0U3BKBvI2Fb7rLNGPZLot0qa 010Ms4v0sXrGD+Nc2KDdyMekBFUDYJCcL4hvSU1oD6U8WiucBnqz4MX4NWbiHxgJLVmN LwVPMNWEGku7/OQN2JibYI94e6TjknhWl0GTGgPO9Ij+lbMOA4LJZZSS1f2RV4XGlnyN duXk3EJiiNimnMj7sqywLjQ0Uk/ulRxfARPNbBSqwj5b/cjY81+M5BH2ODC8KkdxrY6b l20KlAfz4JoHsm7h678iw0Li9wudnUR0rAH34FEE55U4r/B9omml6nkBWA/GRy2uLpJ2 9JNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="gR/uZKib"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k5si3135990ybp.301.2021.02.10.14.56.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:56:22 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="gR/uZKib"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50086 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9yPG-0002bM-Am for patch@linaro.org; Wed, 10 Feb 2021 17:56:22 -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) 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-Received: by 2002:a1c:f203:: with SMTP id s3mr1219378wmc.152.1612995613038; 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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Message-Id: <20210209182749.31323-8-alex.bennee@linaro.org> --- v2 - drop pointless assert --- accel/tcg/cpu-exec.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson 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, TranslationBlock *tb, /* Ensure global icount has gone forward */ icount_update(cpu); /* Refill decrementer and continue execution. */ - insns_left = MIN(0xffff, cpu->icount_budget); + insns_left = MIN(CF_COUNT_MASK, cpu->icount_budget); cpu_neg(cpu)->icount_decr.u16.low = insns_left; cpu->icount_extra = 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 = (tb->cflags & ~CF_COUNT_MASK) | insns_left; } #endif } From patchwork Wed Feb 10 22:10:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380243 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1560202jah; Wed, 10 Feb 2021 14:22:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8/V8wfyEBO8yDVJFRal6W4y2pqLrNP6d2owdVrY2Z2RBLOOJcX1PY5VvFUEDa7vdC8Zyj X-Received: by 2002:a25:4c8a:: with SMTP id z132mr7975098yba.350.1612995736492; Wed, 10 Feb 2021 14:22:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612995736; cv=none; d=google.com; s=arc-20160816; b=J2PVSakAGQuhiU8cc4j5uyCnQDuSc/OAc9PJjP1390GxYE9KmaycQgA/Dw1smce4Tn 2nhmT5vKxTNkiwdubirWU2fzK78yXKiNPOLS6DurjO6CE5Z/VaUpvXMEAKizL1s1eoXy etnw5E53gYGUW7FBT/6drBnq6nQm4ddG/BblAA/sZVnQmIFLBYRvBco/F3RiDi9KXtYU PMPR0IOdcdDIAkQXpfWwKoh1WsYvIT8ng+BqyD+wTjLPu7pnA54HebigYzkGllDYWLEd deE8qUglmjvGT0/QYluB1nzdf9c3dTskQAnE2Xsr1NIi5CEu/3zHkdotKKJf32CzTIDv 0Q4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=qQYFii8fnhcRgQp6avqKpRK9gTI4aiIkYZihF9RilXM=; b=vKV5jugcqki/jGi6VpOv4E1zo8ZxS7pbOz5F56s7RXQEu+Lnscy7Ns0x5dMZeH73KW AOJ+b6FRy1MnJxmbDWbLWEgTWba5tsly5TwnxL1Vf34xu40qkyM40T4rW2NEAKTlf0Rd nKoXyosOHv4jlxMAa8Mz/1sgvE7zeTgAH/qVa9pZVdJpsx7YqwK/eCIS9nSOy7t5sgZH qraE5NbEurzOiDt5vSO6zlNWxdVCih0SveINo21i9cWnLXRrp1LNyt57V07zenfW2NrD 1Am8FnRVAXmhVgqnje70if7Cbtpp+A5VWsSv6rr0MDNhpuYFVoA4YlMTpTuzB5v4rkXD UUEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=P3IxKJr2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j198si3189552ybj.27.2021.02.10.14.22.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:22:16 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=P3IxKJr2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xsF-000712-TP for patch@linaro.org; Wed, 10 Feb 2021 17:22:15 -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) 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-Received: by 2002:a1c:b684:: with SMTP id g126mr1252465wmf.94.1612995608583; Wed, 10 Feb 2021 14:20:08 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Message-Id: <20210209182749.31323-9-alex.bennee@linaro.org> --- accel/tcg/cpu-exec.c | 44 ++++---------------------------------------- 1 file changed, 4 insertions(+), 40 deletions(-) -- 2.20.1 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; } -#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 = curr_cflags() | CF_NOCACHE; - int tb_exit; - - if (ignore_icount) { - cflags &= ~CF_USE_ICOUNT; - } - - /* Should never happen. - We only end up here when an existing TB is too long. */ - cflags |= MIN(max_cycles, CF_COUNT_MASK); - - mmap_lock(); - tb = tb_gen_code(cpu, orig_tb->pc, orig_tb->cs_base, - orig_tb->flags, cflags); - tb->orig_tb = 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 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 == 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 log */ + cpu->cflags_next_tb = (curr_cflags() & ~CF_USE_ICOUNT) | 1; } #endif - if (cpu->exception_index < 0) { - return false; - } + return false; } - if (cpu->exception_index >= EXCP_INTERRUPT) { /* exit request from the cpu execution loop */ *ret = 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 == -1 || cpu->cflags_next_tb & CF_USE_ICOUNT) && cpu_neg(cpu)->icount_decr.u16.low + cpu->icount_extra == 0)) { qatomic_set(&cpu->exit_request, 0); if (cpu->exception_index == -1) { From patchwork Wed Feb 10 22:10:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380245 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1561536jah; Wed, 10 Feb 2021 14:24:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJxekKw4yiUTbGP3qyeH8urCFQ7qbTkU/RGedqZBk3KI5cM1NbE3/NyT4rFsMmTKRIDTcyL4 X-Received: by 2002:a25:fa02:: with SMTP id b2mr6462479ybe.382.1612995883477; Wed, 10 Feb 2021 14:24:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612995883; cv=none; d=google.com; s=arc-20160816; b=vz3X+OI0cQKvjN1PWfOiPxrb27GWA5XJQ/luNC/QkVrjNHn1p+ieMBRYzPsbul89fW v1Htxc9uH7rKMqWmQJJU+rYjkA6vAK1wH6ZKnOUGGmP+7PdR6cc2A109fIAc0yvB5W+Q Q4LtaJXd3bqeEOFINEZ038dY7dCZ1XkED6NKimlwjldjfGL+poIF2B7J2P+/iLMl3uv6 mnuqN219D0i4t+H7OJFBTNLqd19mOCTPeGrsFqZoXo5o8ZNrp7sZjKQcr/qi1sl//dra TDW5YPP6s6o+cldl4Q9D5CQspV2tNe9UUQxfeyvbW0LKp1UmlZ5vfNV7r1znCgxjqR9m VjfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=zi1c0Q20m9EGw/QfIztoiD94DW+qzR6K9/2yw9fZmXc=; b=BpY3Qh+8ao5nySpOSzvdc/FGQjyZk3KS700MP22fycPFwrPatWwbg+w86RcjfIQZvU VAoTJL3urRfls8es6WignXPOyKnxdR45UAL46ZiseevUO6nO8jRr+pOpCbfKOH4qwdb3 b84QMRFVRBgs5oCqkPLKZ8QMELFsOR0rQiZRxsX6nzJT0oYx1J7Hr/8TakgiRMysvB12 c5fP+kQuKN7PnFOU8UpokaAZcCypi4fl+dFxEeQutVSIW/fk2yi8NrAOrLy4zui3lgaM cEmz28bjeWyIl/qn3vqgjuruFhkwjYTRi/fQsTbRCRCd7zI17Gji/qk5V3JdZvgz0y6F qDsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z95si3744015ybh.58.2021.02.10.14.24.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:24:43 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xud-0001Og-0q for patch@linaro.org; Wed, 10 Feb 2021 17:24:43 -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) 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-Received: by 2002:a1c:7402:: with SMTP id p2mr1230441wmc.43.1612995605733; Wed, 10 Feb 2021 14:20:05 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.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ée Message-Id: <20210209182749.31323-10-alex.bennee@linaro.org> --- accel/tcg/translate-all.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson 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, TranslationBlock *tb, #endif } -/* 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 phys_pc, assert_memory_lock(); - if (phys_pc == -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] = tb->page_addr[1] = -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 table, @@ -1880,9 +1870,8 @@ TranslationBlock *tb_gen_code(CPUState *cpu, phys_pc = get_page_addr_code(env, pc); if (phys_pc == -1) { - /* Generate a temporary TB with 1 insn in it */ - cflags &= ~CF_COUNT_MASK; - cflags |= CF_NOCACHE | 1; + /* Generate a one-shot TB with 1 insn in it */ + cflags = (cflags & ~CF_COUNT_MASK) | 1; } cflags &= ~CF_CLUSTER_MASK; @@ -2096,6 +2085,17 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tb_reset_jump(tb, 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. Return early before + * attempting to link to other TBs or add to the lookup table. + */ + if (phys_pc == -1) { + tb->page_addr[0] = tb->page_addr[1] = -1; + return tb; + } + /* check next page if needed */ virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK; phys_page2 = -1; From patchwork Wed Feb 10 22:10:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380262 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1578992jah; Wed, 10 Feb 2021 14:54:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJycgmWYdiMaw5cCyGeO9quUHsRl/2KVw5DHroYXk/gfarWpfNoYcxwsY+n+fYi/nyMH6ST5 X-Received: by 2002:a5b:34e:: with SMTP id q14mr7698873ybp.291.1612997670361; Wed, 10 Feb 2021 14:54:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612997670; cv=none; d=google.com; s=arc-20160816; b=KCuZtFi6442Gb9rrEpJQMbDjPjTw/csjFB23uLVf+Xpoji6UwL3yeYtr2CDQlF5dRC kML2l0ye3hOKpK6VuneFIAF1/d9jeoW7312nSQ4Fl1W70yZ+dXQcmcCSv3Y+NHsy+jNd 38b8ESVufrvNnduUUpxz+5VQXm4s2Yigv/AjSuLNza7Kc9pSZPTA4kYwDLcgSPVTLIfF ZsX4RRfiZrKIl/YVys3rSWYP/ZEdBdxO6GIy5TYsVT69JpxjaL3oHfps6ceMtjEHxH3a vGit3nIKavKOTDUJB9JfPqMuHzzZo+RHbWByDko1BvXwetPOECNs9gMRHRtK0NP0Rzoe kyXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=lUQfSvO41ymeVYxkOJOoiNQ8fcoV5S/zkovOyoqGlLk=; b=i4fHKy7/PGJVCnv7hGSi31A8rY8LjR1NXevCKT3FzxKUomnxQ/106+CGchMuHG7KC9 RolU0uHCu1auXvrDz5+XdP1t3sBhAUBuJMm7ajoFoKM6zD8wk8t/HTEFf5WgIIvhyZCo 986AI3t/R8Uew3apVnROsfWUvLqxjk8WqHeic70dE/L+e7nUXjMDl8qNOPteCs2qQ7NX 9FeieUvNUnfOZ3RQ2F19WXSedRxLFgVd0qB1QQ0JKEJm+45t7aM1Ckcyvarhh2o0p57m 2ecrZvi2S6JqObb7tWCIJwe/rLxIdHuS7Jhklgxw9r3gzSK1/DapZen2ULn+bVCFdndG mFbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=d2fLenfg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g32si3079442ybi.183.2021.02.10.14.54.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:54:30 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=d2fLenfg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9yNR-0001E2-RD for patch@linaro.org; Wed, 10 Feb 2021 17:54:29 -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) 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-Received: by 2002:a7b:ce95:: with SMTP id q21mr1200190wmj.178.1612995607667; Wed, 10 Feb 2021 14:20:07 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée 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(-) -- 2.20.1 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 { struct tb_tc tc; - /* 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_pc, bool will_exit) TranslationBlock *tb = 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 *tb, bool rm_from_page_list) phys_pc = tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK); h = 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; } @@ -1795,6 +1788,8 @@ tb_link_page(TranslationBlock *tb, tb_page_addr_t phys_pc, { PageDesc *p; PageDesc *p2 = NULL; + void *existing_tb = NULL; + uint32_t h; assert_memory_lock(); @@ -1814,25 +1809,20 @@ tb_link_page(TranslationBlock *tb, tb_page_addr_t phys_pc, tb->page_addr[1] = -1; } - if (!(tb->cflags & CF_NOCACHE)) { - void *existing_tb = NULL; - uint32_t h; - - /* add in the hash table */ - h = tb_hash_func(phys_pc, tb->pc, tb->flags, tb->cflags & CF_HASH_MASK, - tb->trace_vcpu_dstate); - qht_insert(&tb_ctx.htable, tb, h, &existing_tb); + /* add in the hash table */ + h = tb_hash_func(phys_pc, tb->pc, tb->flags, tb->cflags & CF_HASH_MASK, + tb->trace_vcpu_dstate); + qht_insert(&tb_ctx.htable, tb, h, &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 = 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 = existing_tb; } if (p2 && p2 != p) { @@ -1905,7 +1895,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tb->cs_base = cs_base; tb->flags = flags; tb->cflags = cflags; - tb->orig_tb = NULL; tb->trace_vcpu_dstate = *cpu->trace_dstate; tcg_ctx->tb_cflags = cflags; tb_overflow: @@ -2444,16 +2433,6 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) /* Generate a new TB executing the I/O insn. */ cpu->cflags_next_tb = curr_cflags() | CF_LAST_IO | n; - 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); From patchwork Wed Feb 10 22:10:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380246 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1561593jah; Wed, 10 Feb 2021 14:24:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxJAL98e0ZEc76SwBSbt0vClGU+E1PiIcACSVUCYtzaehJVLfPrB7AOwMSOaC9Z1EbNPRBQ X-Received: by 2002:a25:7ac3:: with SMTP id v186mr7138105ybc.191.1612995889421; Wed, 10 Feb 2021 14:24:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612995889; cv=none; d=google.com; s=arc-20160816; b=ejhKKd3fLeY3slUKjL+4olBRf876+x46VFIjhLbcLtLyBUkoHHGbEZFXQBmeO8ZIU+ SkIAseQNJyIZ/XoHaCuZWHA47VLT0Oq4XK16aLzAGPwx+SGxNQ/POZzAZqhx/zLfMHJQ GM+C6iTANsv6JGEFTH4lqgXV0uqCJIRnBI7uU6WylBiKKWlDxAX2JP7Jz7jK3GrVsRf5 mF+M8ptZNKyV9gYZLJRav5D4i87uGFdFFjBWAuZ/ECBSTjPlkD7trgUNo9Zj86W28cjC tqe0RDF0QLBf6+HBe+QAduh061nN3JLoMR1BXwCspv8HEmE0OrZb9eTOvgQcArsfD3Xr mx9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=iIGttXBi7A2QRRl9A62rr2JtZ8SZ+5Uy9wRQiTVHIjk=; b=mNtLe6PbsAzYRFsGHYQvqvBNRBKiEJR6Zp+OV+oeTbeQH0XdzBkN9FGdd45ofNQogl n1LLFF41HNuPxtOYirfpQBxomhP/HkJIK3rkuQdz+x1zkfyltdg636jnIOgrZiLm8NvX icx68gHCbXXreUV14kxJSEtI43UmBcWhmjHIo0n16foWSrylEc5EuNkp7nakby2tCefW fd84E2+prt7HB5cCqoc2MeuqzOY5FtdrEsvkJoNymt3OBD6g7HrF8Pb6dxF3NWcNpN36 jI3czhFY/YjSoAGDbZC0FVCAGnHrGphR5mJOhbpESQTDyqvuqEctMZ8ZfMKCHOHK0tSg gl1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=sKjMSOEn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 2si2913120ybz.24.2021.02.10.14.24.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:24:49 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=sKjMSOEn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9xui-0002Vn-SF for patch@linaro.org; Wed, 10 Feb 2021 17:24:48 -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) 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-Received: by 2002:a05:600c:230c:: with SMTP id 12mr1268447wmo.30.1612995613713; Wed, 10 Feb 2021 14:20:13 -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) From: =?utf-8?q?Alex_Benn=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 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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée 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(-) -- 2.20.1 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) /* 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 retaddr) } #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 retaddr) n = 2; } - /* Generate a new TB executing the I/O insn. */ - cpu->cflags_next_tb = 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 = curr_cflags() | CF_NOINSTR | CF_LAST_IO | n; qemu_log_mask_and_addr(CPU_LOG_EXEC, tb->pc, "cpu_io_recompile: rewound execution of TB to " TARGET_FMT_lx "\n", tb->pc); - /* TODO: If env->pc != 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); } 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, DisasContextBase *db, ops->tb_start(db, cpu); tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ - plugin_enabled = plugin_gen_tb_start(cpu, tb); + plugin_enabled = !(tb_cflags(db->tb) & CF_NOINSTR) && plugin_gen_tb_start(cpu, tb); while (true) { db->num_insns++; From patchwork Wed Feb 10 22:10:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 380260 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1572477jah; Wed, 10 Feb 2021 14:44:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkz+qox49qQ7YeLkqGFn/37zeZodJpIkqconDBAEg/2BGvXiekT5DEpN6rvbS/gFw3rQxv X-Received: by 2002:a25:c407:: with SMTP id u7mr7487405ybf.449.1612997041510; Wed, 10 Feb 2021 14:44:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612997041; cv=none; d=google.com; s=arc-20160816; b=ADXiA64w7H+pKreNBeGIM3j9WrWuWi+LKkbEgGUduujEvFHSVpOjzVHsGLOFlYhJ+E TzYK5Aedq16ZXYAf+HpdsffOxhG17VDWIJf/++5f7kcSabLJRKUrXuawHFMkdFgPo99u ljSpwvBYtnJtTvC1B0ZtIYYtvEl1ktzsy6KJygBLwHobuHNNNnX0ywYTS88XN/p+fk0I VQio1T557Zl0wMyzUxmQIRQ7KLaQZLX5YTNfAZeXN7l8fdIg0UCovkDGDsWk1HZU+9e9 Y3elpKdNMx9FwFT315HzQrGy1AIOIMDpr7NsjDf1tv1Y5UexocVHUh6b+GJhjDY5n0lD muFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=NvekATJKlJ7jP2wzTkI6nrkZoiKtJSAd7gzRekefiEE=; b=nmWZc9BApK9P9BMKluWD8wo//dBc0dhftxzlBp42w++fZ19BEs74jQJznJeWOEWeh7 TkLjjwZ03Xkkw+cljAKZzpbWUc9E72nz11Y2DLhlEPmt1YEbibPpqaweGW5mm8ZbZgi8 IMH6aXxlv35pNy1V8Q/uMFpR9lqD0Zih/FCwYBIpy1eFOSrsL/v4RU23vgXb6QMIkLMe pWAXPpYc0nZ//cJgTm58Dz1Qhs/D4OEeLqlw0Nxcrwvl4am+n16ZJEOOxiiU2lrBKk1R 2G7Ih0hFHu5UMEUA9cBgc7fW6ZY446wmvo5Zn2EEvAh/XBBDjiA3Hbrqw+yvG+iX/zCm 9Crw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KWTu4zS8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w6si2946851ybc.255.2021.02.10.14.44.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Feb 2021 14:44:01 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KWTu4zS8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:56548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9yDI-0001VY-Uj for patch@linaro.org; Wed, 10 Feb 2021 17:44:00 -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) 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-Received: by 2002:a05:600c:2246:: with SMTP id a6mr1195632wmm.170.1612995084836; Wed, 10 Feb 2021 14:11:24 -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) From: =?utf-8?q?Alex_Benn=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 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_Mathieu-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_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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ée Message-Id: <20210209182749.31323-13-alex.bennee@linaro.org> --- tests/acceptance/tcg_plugins.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé Tested-by: Wainer dos Santos Moschetta 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=accel:tcg + :avocado: tags=arch:aarch64 + :avocado: tags=machine:virt + :avocado: tags=cpu:cortex-a57 + """ + kernel_path = self._grab_aarch64_kernel() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyAMA0') + console_pattern = 'Kernel panic - not syncing: VFS:' + + plugin_log = tempfile.NamedTemporaryFile(mode="r+t", prefix="plugin", + suffix=".log", delete=False) + + self.run_vm(kernel_path, kernel_command_line, + "tests/plugin/libinsn.so", plugin_log.name, + console_pattern, + args=('-cpu', 'cortex-a53', '-icount', 'shift=1')) + + logger = logging.getLogger() + + with plugin_log as lf, \ + mmap.mmap(lf.fileno(), 0, access=mmap.ACCESS_READ) as s: + m = re.search(br"detected repeat execution @ (?P0x[0-9A-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)