From patchwork Thu Feb 18 09:46: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: 384360 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3525976jao; Thu, 18 Feb 2021 01:48:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJxDwl4OldEX3EqteqzrAJ5X1+IlNj9elP7tHc+Soyp6qcbZzCfA+2ZxFdeYKvdd7J3IMHx1 X-Received: by 2002:a25:5cd6:: with SMTP id q205mr5654386ybb.489.1613641723799; Thu, 18 Feb 2021 01:48:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613641723; cv=none; d=google.com; s=arc-20160816; b=v+MNcXmZAUk9GLhXmluxhyJHGxZrjfkW8PlxObXP70bXI9Zgwf042905CJXBGhMP2E ZYlX3M4uc06XsA8WcBOd9SbxcArDdUrUUFapg1URuOZCmZKGXfzBSO12tl64HxXqkm03 pR4l0Wbr5hc88VbeIyIa61r5/2fyPFKUn0awOLOBtJXJqtbM3uAj4hoffPMAB9EwIRD0 hn1BOGQVBQGGaFUbSTQHZMYR32InNiO13oJ0jF30ULZb3p6Kb6BIH+55FNW16lNn5aZ6 TKI6wGnrULo3iMIAZ5HH1zuwzATcyGvlW/9mG/rddItKYnMs8j1m6M91cyYa/oCGJ99E qJtw== 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=t/CPTE/CDznZTD1WlBNg2STeH1CsnSCKnog1Lk63Lyg=; b=lTcy22ZtZYtZAJD4fV9bPMBYpu2NRjrYxx0EeS+sRZy9WzD7IGpz4kJNcQo7vnhcZ4 atrqt5qJYZxi4KkyJEXA9lwz2byRXhKq+QqTQtbd15w8bengugDLgNKkjl1gXuXRHJER ELkl1i0ugWUKB0N2mOObdVyRZE58RMEcgEqS3mHZJfyD/YadlNX2auZ1Q5xQKIUB6z1S 44oFULhhhv8dTosebG8wPfH8hwB9uh6jFrujUP0oQe5FI/v5OxkwXoQ6njU4lu0IqDGX tWEMpEv42OHYX/L0gMCgFxyLmoh357jmjMXXNywoZRU4QaNYSUH2yPIfDoG5baoLSiYM 7VgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pCIRah91; 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 185si5347778ybs.343.2021.02.18.01.48.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 01:48: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=pCIRah91; 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]:57798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCfvP-0006g9-8x for patch@linaro.org; Thu, 18 Feb 2021 04:48:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfu3-0006fl-Jp for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:19 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:52207) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCftu-0007BB-PP for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:19 -0500 Received: by mail-wm1-x32d.google.com with SMTP id o82so2315983wme.1 for ; Thu, 18 Feb 2021 01:47:10 -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=t/CPTE/CDznZTD1WlBNg2STeH1CsnSCKnog1Lk63Lyg=; b=pCIRah91814QnDanVJeQlwWs77okqTntoCd9ZPyAedo4pkoESiHHTqf6ubHJUBkw7H ef3e310DFf7zwG/lGeqPHSn+GfFOke36U3pjDppNsfT3BiyIh8k9AK/oYMwC3o0Knkka iFqkyqxhx7S+BVuMZRg89FQLxlrVWR5ALEu3CqAsegczjjjhSC2InuPULK7Khc4Sfn9l iVqBFBd8Fe/02h/2wj5eoHDKezlFPhsY9q+K13m1xhSO5iGi/Xj5KovRgi3e29U3VzK3 mpZVpTGhoK1NIOTT1pOoAbQbv77WPGy+vzx04im12GY0fd8KPgLwBSJaBt9UslTZlMjj c66A== 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=t/CPTE/CDznZTD1WlBNg2STeH1CsnSCKnog1Lk63Lyg=; b=D947eQ6II2c6Ozozz8UOXtJ0SKXfpG1YsFd3npKsj6mf+pwSR34IwSNPYWrYOmWjg6 k+/2Jn7vAXiDWhSeImtMdzy/5V0kfIOR6gD18r35Yck276cwLCE6PzuZ5CDAWOAZJ5wg uXbKd6Ir3CoYklfuWsrMNiWfN5bUgS1IIzBCm62OsrmzlwWbDQ6NBZjnWkxQFNU+bBB9 m0WsXOvyS37TsSRtkDvWNmH5BpdERj6kc3+ruzpFd6sg3hUK/cUpeoG4vNhnQ3ryPdgS EpmtEjU2Yv+wHZoXHXj/FwoB7K4QxrJESvCLS/H04SHqR7zT1fGvM2P1bHY01cvza+Ap AtGQ== X-Gm-Message-State: AOAM530IJVVtVZn2OumuBX6ncYdQ73P0i3dKv1DqsUxSwC/Nk/ercFxJ xrMDHlfLO6VgnL91jYJuuFeUzw== X-Received: by 2002:a05:600c:204e:: with SMTP id p14mr2783475wmg.157.1613641629179; Thu, 18 Feb 2021 01:47:09 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id y15sm8004938wrm.93.2021.02.18.01.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:47:07 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 02F661FF87; Thu, 18 Feb 2021 09:47:07 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 01/23] hw/virtio/pci: include vdev name in registered PCI sections Date: Thu, 18 Feb 2021 09:46:44 +0000 Message-Id: <20210218094706.23038-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, "Michael S . Tsirkin" 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: <20210213130325.14781-2-alex.bennee@linaro.org> -- 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 Thu Feb 18 09:46: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: 384368 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3531312jao; Thu, 18 Feb 2021 01:54:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJxFmwozKexFzBgKZg6RfpO166vOUh/WmiR9BuvdaZRRnve4uJVxsqOtPW4XtV8OhRidq2VL X-Received: by 2002:a25:560a:: with SMTP id k10mr5749381ybb.165.1613642067725; Thu, 18 Feb 2021 01:54:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613642067; cv=none; d=google.com; s=arc-20160816; b=Qcx7N2LNdrhauF4rNasDB1u72g+sREFr13BwO29Va2i7M6PnK0skHOFFq8gQ/LLQHD HbuCMcJx8GcX622eAfsMWITQTcLR6fMJoV9zck5cS7PYscVhIkvsflU8dr1whUehLuY9 tVO0OefupeeTJ/QF3bstbC5PkdxP+SAEzBeAQs4KBhfTxBpaG6AjIHNHZXg0poACRyiu iRobXx1iUpoKpOm2ZChjKlpdrWlSA9QKDJCi6V6ATCBz+hVfLVUbAfOW+1CgAwlQU4UV t2OhAecJSPjOHGl1t91txeo50WDZYBtrxsQmtFOkjeXavkKBfZ3PggQOw/QkpNFO9bCG DXZw== 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=pcSt1P/BVEiZ2RhZX9D0H6PtOh3Enb5UUvgBwhX22fo=; b=xkCuQ+vdkVvvZKXjAKH6bB2uCidj1vRRTog4EjaMQR+ZkP1etwdxY/8IWSC0GQGIAF KksUW3OfdlMjroK+W4n0bikdxI7QzyFBWjyleWbbsOxy96tNSq13Ek9X4MjKhzC3k5Nr 1jG2iqv2BMv/qTJPobCO7R7JQ/4uoxz4eGji4ObtHUxCun4kFR5ngyfDXyi3yD/+TBP8 z/CdqSgNQzSiScx/Ub7dw9/3YsxIHQnTnqwwWuVWs0XrAYFABVoGcKqSSujiok6GSi/3 9vQ85vyFtGtCWBhhCXUkDoWleknzimPJEEVxxORYMLJNhlj3+6f/TIquMBNzdXPJNxuA HsDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=a48abLEl; 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 z95si6886864ybh.58.2021.02.18.01.54.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 01:54:27 -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=a48abLEl; 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]:46786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCg0x-0005PL-86 for patch@linaro.org; Thu, 18 Feb 2021 04:54:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfu6-0006hq-CE for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:22 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:40047) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfu2-0007Ck-2Z for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:22 -0500 Received: by mail-wr1-x42e.google.com with SMTP id v14so2182369wro.7 for ; Thu, 18 Feb 2021 01:47: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=pcSt1P/BVEiZ2RhZX9D0H6PtOh3Enb5UUvgBwhX22fo=; b=a48abLElBHl5CcnqcFCdCWSeaeNVp4LBQFGFIpc3zLyY3+kr++MuaWEacw3sauI+yy RnNn2kKRPcfLImn6Ov1/9jazMZ3itSKcBnk978mup79wl1fwXM8dy6gmQE8Xtm168V83 L++iXZlcNXvuEbgs1j5lkcFcvYqp9mlQNu/Spxofa9PskSfuuCH8uJMLebgfSY3uZ9D7 vMKYYZ9Rroig6NDoRFNfTJ0omHTGNoYtREOCYCcjPji7leN3oHNQvf97HTLHgoNkdCe8 0InPWGxuWJIapKyEMQ78z2mn8wmFZrk/r9j3DbxHj2Ok9yhd3LTB095w6HKebH1JTK57 DXxw== 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=pcSt1P/BVEiZ2RhZX9D0H6PtOh3Enb5UUvgBwhX22fo=; b=op3iRvQ02DQu+bxiKs6WYg0Iz1r4Piutx9QMHt8ofj6EjomwT41JQPEofruHm8KYCp y9E94NJsPwuM0KkS+upnrkJNiutbqAIxz4KMCIAFULgHLarQvz6pN6Kt9RalQK0htZx7 yziy+CZNB7GRF2gm3Uwx8yQgxALsc7qoHOd0dkrGO9W2E6FJGJ7UzHZ+dSo4i5ErViG8 hm1mqIWvMhdA8jnHfqLkG+YDq7kkTU1PFtoAKSVQ+rK4Q7UjBu6uMWn8u6Qeh5iLa90/ 8w3a6KhtwFnHUZUl9cARTtCw2X8rdO1H5IWB3DlVzcIsJJx/7YHYXg/NJF0GJiRDPi3a Sj0g== X-Gm-Message-State: AOAM531K9mL8woByh+ZwDiaC9rskz1mRgO8Vb5b+EKQDtjCybxursmW9 qHrtEZt70+BwvH9eCxhGHy+0z4s8GdFgug== X-Received: by 2002:adf:fe0d:: with SMTP id n13mr3464492wrr.258.1613641633097; Thu, 18 Feb 2021 01:47:13 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id p9sm6160445wma.14.2021.02.18.01.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:47:07 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 1B1051FF8C; Thu, 18 Feb 2021 09:47:07 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 02/23] plugins: add API to return a name for a IO device Date: Thu, 18 Feb 2021 09:46:45 +0000 Message-Id: <20210218094706.23038-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42e.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 , Clement Deschamps , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, "Emilio G . Cota" 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: <20210213130325.14781-3-alex.bennee@linaro.org> -- 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 Thu Feb 18 09:46: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: 384365 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3527812jao; Thu, 18 Feb 2021 01:52:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJz5RzBSTRuDY5fXckVmvtoyw2eztCrJtFZNGgl3woqSIQUcCMLAs+ZRpRZfpcW9kKYb1C9V X-Received: by 2002:a05:6902:1025:: with SMTP id x5mr5348706ybt.96.1613641923640; Thu, 18 Feb 2021 01:52:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613641923; cv=none; d=google.com; s=arc-20160816; b=QG2n0y51PXgQxX5I53VE9RbXuDqLweBnDDxeXC80whbkDBSpxFA7SVWWO7ZKopkUKO 513SpA6DIvEKBofJF+rhGLYj63Q0tsxVqW10r6jFH3HsVUuYtnUkJoL0op7+lLz1WSqL 4gh0jk2SKOdPess6vpVrndGwFtwJzWdrT0cDVbs86v68hLuSOfGrGj441ME9QoLALBpj uF+KlzeLWzVO2/PKdl5I/kS2s90rL7jHkiTVzEmY/KgaawNSfCifEXWMMwB1bUkesqh5 XGpI8/d1KdQTbwVRXuHeUGFHE0otBZQ9YiFyzQXUTGwF/iMW58iBr/rPe/fCq//45Pqi seJQ== 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=rl8ZRT0OqWBmR3UZZZTXyRn0ej40LH89avepblI+Im8=; b=YGcFZwN21SArv4lN3j10fqslb06I/Hvz89veSuZochazBw39qJ/99645IwURzSyW7O wbHaadjztTEZKXl8vaAfk4IS+7G78mijplMsDUjTVpOju1oXnJ4naX39N0a53iHONbEQ WPGuCXYQ8Q2HIuE6Vmsz+ChSSf3F1AUVqL+3nQamWhE/M0VpVRJrCoWXHjhLCPe36hyi rktpRYMVmipIo1fOc2EVI4r3lxBP53UyLwFiAE6Er3RcENNpr5IatGWdL9k80R82vMTf BQZkPzxtwFpMLH07Ga9KDnbTZzAUniZQV8oOfsgO0yod0UpytMKwp/gf0b7iKarERKUS fm6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=v3dyhvBb; 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 i131si5419700ybg.59.2021.02.18.01.52.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 01:52:03 -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=v3dyhvBb; 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]:38110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCfyd-0001r7-1x for patch@linaro.org; Thu, 18 Feb 2021 04:52:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfu5-0006hU-VI for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:22 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:42602) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfu1-0007Cd-HL for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:21 -0500 Received: by mail-wr1-x434.google.com with SMTP id r21so2168320wrr.9 for ; Thu, 18 Feb 2021 01:47: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=rl8ZRT0OqWBmR3UZZZTXyRn0ej40LH89avepblI+Im8=; b=v3dyhvBbOX96hMUxEHW/s/PJ23ganpwqXohh/nxKGcvCGtjPVf/i8pddEHWLPDd/6F 7ajq4Xr6XwkHJnkKzwoM/l7crn7W9cirTr6v5q/xQvQmWe9vwTC19hlGemYtc5pn0ikK WA3IpeaHmfytxYDzkln1ohv8R2BhmmrmJidTGNqlUZm05NQREBqnKTRQSby+XgX7NF0D VfyysgK3JPdlCR5hQIcbSTLFaVIEE0+9GBCKcJPSn1NWdlhiWE4W03aMDqX7kJEJ+yhP i+yeSphCSNEkLefnX7880VkU9pTMrdFdUmdnMDEui5bQO2hfcbj60FV41MbFn3auCjd1 PVPg== 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=rl8ZRT0OqWBmR3UZZZTXyRn0ej40LH89avepblI+Im8=; b=ctsnhO2bwbIUF2hlfj2fmqjkJ7eOiLmicVoD0lZ6MqpA2mMui01zEJ0y7uOkCY6V+R S9+Lq42tY8ZSeax3dqIJCD3Ymf9OBik/FzlKAA/8Mwfo60+rgJ6jAb0F7vGp8Pnjl+wk QlW9hYEwKS5xGoFED53seY3+Lf6N1Y7BAidPeUxdJlHJb8/fD+Z9oQCC1Y6/XUyQNdbV jFOVTJ/CjzLrf3VlGWtMkv7mPkkKPFF5sAaFW5piW84cxgGE40Nq62SQdraOUiGX5p7R 96961tWnq/OnbyKRD57Fi7ppcgRdKbVHSzbB4A1tqch225thz9yZpMUgDmq5KADqupiL GNWw== X-Gm-Message-State: AOAM532i0IRpu3KoNMG0eJ9qPL0FQDt5ncYU5pcql2/fhqUw7lBasmfv kt5hYv8IX3I+8klcoLDM092ACg== X-Received: by 2002:a5d:680e:: with SMTP id w14mr3418646wru.322.1613641632193; Thu, 18 Feb 2021 01:47:12 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id w3sm8073367wrr.62.2021.02.18.01.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:47:07 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 399611FF8F; Thu, 18 Feb 2021 09:47:07 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 03/23] plugins: new hwprofile plugin Date: Thu, 18 Feb 2021 09:46:46 +0000 Message-Id: <20210218094706.23038-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.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?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Robert Foley 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 Tested-by: Robert Foley Reviewed-by: Robert Foley Message-Id: <20210213130325.14781-4-alex.bennee@linaro.org> -- 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 Thu Feb 18 09:46: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: 384363 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3527345jao; Thu, 18 Feb 2021 01:51:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJxyORq7/6pHU/AsIZoebwjmqZCvmktuVM7/DTqXEJbOb5EMDzpgwe7Wnfv7TnGXOnuI4K2f X-Received: by 2002:a25:3250:: with SMTP id y77mr5180286yby.154.1613641864947; Thu, 18 Feb 2021 01:51:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613641864; cv=none; d=google.com; s=arc-20160816; b=Ezwo57vREp2uSaVI3YAi7sIU4TE5LOlhYczOA2VLsW30YJJrxnj6jeKPs3oyyIke0C O+WxQPQjspPEZLHZB/P3q6rJGZMbFr02o+q4QziGVO7C6IpdQv0MRsFkHnthNsh6sm4j yK43TeudPfRnR2Xz0LMAym9W8yfZJCgb8AvWKbh4KaHO/s4UHrDVS4pLbpBybBdhCJfw sGH817spglEUCcZafAy2jg70WRVMoE7z/PWWqYmNbVcucvNaJICMVvBf63MqZwEHLePE UliBh9rFoaMUC7zlrkBa9j5iUGWb9gO0dLE4qYGDu5uzLaOtmM2lKp+5viTwhpoSBdSl oFNQ== 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=3wMc78pIuJOVyJ1kIY4dz6S3vDEP3+kX04z/lZIyERQ=; b=Njr2MBf+SmpXAJjnR2TsnJamCkWkYiDFGqXVdw05Bx5TJNJoBAMa5MxpxaIcR1NosG +LPgmWGLnn3GNMYaOWhGrdv7UbXeA0AQpBcsHKM4lMdKhNDD4/GJlY6ZX6P1rkA0zR6C B69OTkgD0UVNmQIl6vQfiWj5iiuj5sCCtySRVjDhMmeYJsxResqPbQpRSTujCIhvdZfw 8Vz2t+Wk97pZueGHN6GC1JkqtVGr3nL5bJuiWXIhrYUyDEm6OkGlenOL9JWL+D0F1wWo 03K6ittUa3SUf1iqxdZhWBOMbVTqO3bMDw+7AadJMrcPpya9w9j5hnco39rlWflpZgsU kO1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=m7jYKHEp; 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 g66si4837624ybg.205.2021.02.18.01.51.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 01:51:04 -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=m7jYKHEp; 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]:38008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCfxg-0001od-Be for patch@linaro.org; Thu, 18 Feb 2021 04:51:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfu4-0006fx-Sk for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:20 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:45083) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfu2-0007Co-2E for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:20 -0500 Received: by mail-wr1-x430.google.com with SMTP id f7so1031355wrt.12 for ; Thu, 18 Feb 2021 01:47:16 -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=3wMc78pIuJOVyJ1kIY4dz6S3vDEP3+kX04z/lZIyERQ=; b=m7jYKHEpS3WHQ6HD8uQyAaWmiEJxYYZqE3a3uPNwH+EublOOkjUvhS54Um3Qr3v1tL veo093Bo0RyaAAY4jv9C21pnwsvghFSnrF9ywaONYR1QRZ7KT0DGYJg46pQjUCVcMbPj bo5DmzebrivnqVwSbhVA46kXu79q9ytwXEG0rSNrR0qp+/RfFzrljJE3U7VWEeh172DB 8YMagx8JUq0Ng+r3KC8sV6zAO7FUl+6lEXfMF+bRAkczVFtxRCvT6vk8RIyMrPUdXh0C yhj3Hdt+qzNTL/581opI1WuMfDMs4Fzs3Yzaw7zU/vK4EEwsW4sNv2bMjzQlN7PXuknR 0f5w== 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=3wMc78pIuJOVyJ1kIY4dz6S3vDEP3+kX04z/lZIyERQ=; b=To55UO5wQPIEgYX1Bw691Rf7odteIyjB3EIP0zjOkvL6D8KfBULpFevG36lMVC3pBy FpjiwQSCk8QE9ckY4Q8N0FMbDkV9O4DZz57Sc8wsIYPg1+rs7jU3pSkr1Swhg+rYbi0s qjX1Aut3BnxuXXFtX9OjQwKTR/X8yEk9sHN8m9jnTkzUex24yoAa885QjVOycGW8uaY3 h35/IMewRUY7dUc0c2EYyNfWlkcIUDiijE0Qw3a4KYTyXU808P6h+4iemEnjnUzEtQXJ zAYfrPVd0rLPrUSHzoDqSKy5iTTLaSdkO8TNcXKyzd0LHjCdyuZjyFXnZWtxqmdOknLh hT8Q== X-Gm-Message-State: AOAM531JPwsNZlWGSsCwDk8QWhajQMsAY7FpoM7F1vgMUZOovBcdIPsH rNJwJGpdtWZ2MfxKLXDzavOSqA== X-Received: by 2002:adf:f80e:: with SMTP id s14mr3495342wrp.363.1613641635136; Thu, 18 Feb 2021 01:47:15 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id l1sm6717535wmi.48.2021.02.18.01.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:47:08 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 545211FF90; Thu, 18 Feb 2021 09:47:07 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 04/23] contrib: Don't use '#' flag of printf format Date: Thu, 18 Feb 2021 09:46:47 +0000 Message-Id: <20210218094706.23038-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x430.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?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, zhouyang 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> Message-Id: <20210213130325.14781-5-alex.bennee@linaro.org> -- 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 Thu Feb 18 09:46: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: 384372 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3534549jao; Thu, 18 Feb 2021 01:57:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxGcRCvicKvSIl/p4XoVdMMt08BW/HaMnni5uYL25oYZA8MvSLYseiyezWxjroGY2GqBFzb X-Received: by 2002:a25:e010:: with SMTP id x16mr5418890ybg.511.1613642261585; Thu, 18 Feb 2021 01:57:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613642261; cv=none; d=google.com; s=arc-20160816; b=OI3LiXR+QoYJwDVMY8AgOLl5GfvX/AOu401gEoA8rPw1o9ehq0E1UrZP9/xxmqDUaS cqLuIettnS2Er4L22Bnw3hIjpTKylwECbgTULCVwgfgRammbIf0aBdvmhBb6R7XK01hg dGPca+Q9QMyIwLOaxFG47KWpkZSbmwFQdGOVwPc6pKqT+m7jThbM0riiguQiuF1oEkRQ bgkCZQ8JtL5c84ChP/qd6ziKoV3x3jOkoeMIUykTaB9BKl3aC5f7j+zzTcKWF73hGcV1 pF7j//qEDR4bLcHwVzWsYOX/lMd+MKYhJlDhrr2SdEqNGlpERDwFNRo10h+n7mvuQjpS reEg== 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=AkfrVrYw2C9vmidmEBhY6XyexZR6Isj5PdFC64t5PyU=; b=AMXHBU87IBZItg005LfoDGFPDkcJjbZ1rrPRui2k2KPk0uOOC8uo9Zea6/jmJQY9qC RnUuvPa0nnTkjpr1NAeK53DtegHoZgJDJ+Hg6p85MV8AMzaXNv2VRRj8Kr30IoAFl787 3CBh8KmbqrP8EzD4eoyENAuV5zvIiVb5TXE9aLypoUMVqkf6jB50aWppeNFk2mBIJBi4 U6za8L7a/vvsugMN8T1S1/xJ8ODJtS7QGFW3QdrHML8TIXmGhSFO0j7FqZvqAiwsU6o1 uhVuS8XnnNpPDGJf0Yop6oBPgXSEMvqZAaJ4hrAfXJhAn57gmsVyCy0PEtYE9DQ29znM vCqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=eJEro473; 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 r3si5191308ybg.132.2021.02.18.01.57.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 01:57: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=eJEro473; 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]:56484 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCg45-00013z-14 for patch@linaro.org; Thu, 18 Feb 2021 04:57:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53318) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfu8-0006lt-7q for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:24 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:46099) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfu6-0007En-Kl for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:23 -0500 Received: by mail-wr1-x429.google.com with SMTP id t15so2121841wrx.13 for ; Thu, 18 Feb 2021 01:47:22 -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=AkfrVrYw2C9vmidmEBhY6XyexZR6Isj5PdFC64t5PyU=; b=eJEro47341UJl1NuK5X+r6MmO6teKHOYJQp+3UxrgOxMwvB3zrhn7ULyDFC7j5HAdT ie3IDuayxIH/H3rvfWrhdkUA5SJ2kexfPw0k8JDcx27+l0ef5MjWJG4gAVrR07I7YkOB R7V8CAWK2FL/7FwgAbfzMwH1Vg9qfHPGydCZ1LaRCDH0SZyTJ6NuXn/PJweU4SYtxUgP afh7CVh9qGR4I7+oJXA8JefAPB7ASCrcQ81Me2TCLyFRJahWqxr9qw41cpAdnEL54eLJ xnYxT/c3vQ8X598MZBJITAwCpqTvu1H6DXLVg9nI0f2NfPZpEjbPqqiV6VVe1PTE028v J3/A== 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=AkfrVrYw2C9vmidmEBhY6XyexZR6Isj5PdFC64t5PyU=; b=LWxkDfztJKtrvSoaPhU7bJgHfZlQdqzoDf+wZB1fKTCZmWsnWj27jOWKJc0OiDwiTr WFFT0yMvpETqaxpvsa05BLEB0Wv5kg0uNMj9PTzUlsXWspUv3B8YUVaS2FIjvIaCE/OM 4B2aCSMjogjI7PMsqnTONrKf4YUJeo9wnmRMPSgZQv1nciEAr4Y/8b24K32BocS5+s+X woF9CDcOUWv7CcV4xmlXAYddpDqmOTmcGVgz5piq6BTb0sZpUD/nbdqOGl6A8Yq9qjOY KVDkaSB3+TmLgFkWMiKqv+7CoPI51tDFN4Iy4vvnVpPc03IYoYYB+0bWVZHYo3q8t6jY 2JLw== X-Gm-Message-State: AOAM532AGN0Z4nlYyzMv0Bxj2SjBEBar58Mqt1jXtxchmNZC7CWadKlB 5KjS5L20VvdSQ1YDZDFPWlfgzA== X-Received: by 2002:a5d:4ad0:: with SMTP id y16mr3407219wrs.399.1613641641313; Thu, 18 Feb 2021 01:47:21 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id s23sm6355422wmc.35.2021.02.18.01.47.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:47:15 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 696B51FF91; Thu, 18 Feb 2021 09:47:07 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 05/23] contrib: Fix some code style problems, ERROR: "foo * bar" should be "foo *bar" Date: Thu, 18 Feb 2021 09:46:48 +0000 Message-Id: <20210218094706.23038-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x429.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?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, zhouyang 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> Message-Id: <20210213130325.14781-6-alex.bennee@linaro.org> -- 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 Thu Feb 18 09:46: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: 384366 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3528385jao; Thu, 18 Feb 2021 01:53:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxndCzMx5AeefdEoyiyvNFDy3u2Et0j8sZ52XeBoGN93sNVXXpWN83P43sqEDGzkJ03Wayc X-Received: by 2002:a25:cb8a:: with SMTP id b132mr5993269ybg.58.1613641998380; Thu, 18 Feb 2021 01:53:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613641998; cv=none; d=google.com; s=arc-20160816; b=HUq4zQ87KeiXe/cd+3//Wcq4XEsZL5Qyn4Sqiycp5cW3tVxWMAaLVMaJr0wxv7Qtki yrb67t2DRSh5MMrucgppBlN9w/Jl33FMqmqwDuXlcRx4hEbtTf/BWeZC+1Dwt+GGE0Jz H7DUur4DxGwzxhd2MypIAvHbC+QsRMfPPVb2iZTYnBhURcPyMFqRJW/isH5GXWxKqARz SW16+QqSYEQGPenxuUp37ONSjn0e28os2/sK4CX8WNTMftV2RXyuxgvzo+IT6Tl7cbHr DRijbWppUmxVcOBU4rMcH8dfRgo1+KfOiLXayR41hDavSecyyUVe2V64IokiKc4fPq6/ DiXw== 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=BOuZLIcS4uaxLwRAzY9t0EkJ3Dn2/0awYiFNeWK3R2w=; b=AAkl2uqLAiyHBRMH9OEEPH5LcBfBFkRltIfsBPNybje8ARbuSjv8hUuxT0jvgZ744u g1qp+/KOrPqrbiyMB/jJzNj5diwD2mK/GhuzNBt4Tb5N7DJRThLamjvADN/oPKvXn66c JunsfbaD4wdhttrcnO4AsbQwjC7185DkdEh2XereIuy/aFdbGHM7A0ZRvP78UIVCEknr +LX7NV0bUkSI+A9Bx2FHlVjhwNzLoKQteX61Zj4Q8X9OUBE1gnPJK9+XkX6hEyjdhxKc zOca6+SqUcA0JZPzNn9LQcvweNIfgsIrIXCHQW33kcGhOrGAFJdJaDKZJSfVTCFR72o3 U5Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bXovATF4; 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 m64si201716ybm.121.2021.02.18.01.53.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 01:53:18 -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=bXovATF4; 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]:41360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCfzp-0003BN-T5 for patch@linaro.org; Thu, 18 Feb 2021 04:53:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53352) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfuA-0006re-JK for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:26 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:33787) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfu8-0007Fm-OB for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:26 -0500 Received: by mail-wr1-x42a.google.com with SMTP id 7so2223036wrz.0 for ; Thu, 18 Feb 2021 01:47:24 -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=BOuZLIcS4uaxLwRAzY9t0EkJ3Dn2/0awYiFNeWK3R2w=; b=bXovATF4y2Xza73C97gAn+bYW018ZEfh6+AnKO1r0WwJ7dLst+sDK+z8WePLCkpCFY Vf7pVNkvzLUZn3UFu/Ix0w+9wF2jPvMsZbfpkL4WQYAUc2mF50eZGKquzXXdpS3cbUsg GXuV/ABN0DrSSy/hylIr5tUN50nrrPy0j+iemPCpwPx5yWVELHJOKX1+68ieO+71w7Wa 5fQVa8znGBEIqXKEwMgbIJr+T8PNFveRbDlOuhNNxUH/fnTq0Het89DkOp5NIqnrfgWp DDWiAGiJap3vQAwOd6y2njLQztIZgIQdXjFB44iKZkZc3Tmhwen54l5/64bJToldNEcV MxOA== 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=BOuZLIcS4uaxLwRAzY9t0EkJ3Dn2/0awYiFNeWK3R2w=; b=AyE1mAGjx+D+DiYasU5Fkej91VA89wwdFbjGCd418EqfeBIWzjqNbJDaU3STLR1d4r yKszoqbjTrXngVgJvsOqFaMI7EIMvgeqYMR5kxgBlwsTl7MtsIR9WlV4/JoQHctT07UE Kmmm0V5kwsh/udfttQ65qMorV96yoCp/US2GpGxLWQj67nDaxZGCeu+17azAyzHsyQ1B j15HmsyfGio5HW0A9s0C1mEnwFWFIzaD+SXuRJGXzC4SPtxh7US+2J2OEpkdoNb+JnlM UYA/IrFncdkKRh91RdPaQmG1cJ73LrFv1utEHelOgOQpl70O0O4H1xZ/LsSQASgelgwT oGBg== X-Gm-Message-State: AOAM531KSVLDdcXiFsbJQU/8V0OVvLVfHxpaivBUuYNQw0ajcLta/shV YkXEFLSUPP2m2A3BQl9zTvL9VQ== X-Received: by 2002:a05:6000:1092:: with SMTP id y18mr3614520wrw.248.1613641643267; Thu, 18 Feb 2021 01:47:23 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id f8sm7813238wrp.65.2021.02.18.01.47.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:47:15 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 7D0ED1FF92; Thu, 18 Feb 2021 09:47:07 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 06/23] contrib: Add spaces around operator Date: Thu, 18 Feb 2021 09:46:49 +0000 Message-Id: <20210218094706.23038-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, zhouyang 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> Message-Id: <20210213130325.14781-7-alex.bennee@linaro.org> -- 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 Thu Feb 18 09:46: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: 384364 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3527380jao; Thu, 18 Feb 2021 01:51:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzRBxadgX2habUrDv/O5mmFQU/eZ/rokEdQTDSv48r9pzFhVrtLe4SlTToHP3cHyIi/cbE5 X-Received: by 2002:a25:9b81:: with SMTP id v1mr4744478ybo.168.1613641868755; Thu, 18 Feb 2021 01:51:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613641868; cv=none; d=google.com; s=arc-20160816; b=rFAbmZMlY58Ve3ptwZGumXEMg+ef7x0P5yyfqPSAiODvtilBzJ2EuuVNGjEyXALH77 psbpRowcmOCaMpA3wH2iAtuSI/0QCkoDmXEcgglu3rlZhNworM49iKvZq6HGbLQ7Fe9h smtGvRoehFM+hoFb1h22DLMzr64BnaS4p81tz7k9Bsrorpeya0juwcYrflC/MZXGCx82 osG2rPp/7CBg+yIRZQc+epKGZNqaTiqLeDXbCZMLUQo6tCfi9KLzl3iLTKaXA5SBDPfQ 6nW5o/JCmFmlcNOqVpR6CQ+B4gduZqAOnUQ2a/Hbu6K9EJWoxxlsnTFZ161ISF9qzPP3 2fdQ== 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=soDGbh249xLp4FfxaOzhIPdsxS6zjpocVf6odP/GVEE=; b=ZO+7C1nyCGQ0sddQzAi7muvzP+M1ktNSZG6zH/RRIMV3VvkSc00NcyNFfret9sS7i4 dGm5VdN58QyOUvYN3dI4yHCqOY484VpfM8ufrD8i75mbzsIZNU37QNKR+0kMKk7JLYez 0KtPZSQ81TZ+0J6kR9yYaBQ/lKmUjGSso/4m27bewtffw+C8UuBBe0fvSFR93i8Gc8Zh knplBC/s2Hv3iBDxKxlGSttPI5daTdoAZpZ5yK4DI2JbS66/wABBtidyKQum+Al0WDGZ dAUVAtNqSjPjRuYrP/8xDc4/HV40a6CwCQctXgDtb1WYfDz6giI+FqUy2t5A+bm6ZnqW 2xOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WWANPjG4; 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 y3si4466005ybc.308.2021.02.18.01.51.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 01:51:08 -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=WWANPjG4; 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]:38374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCfxk-0001x8-85 for patch@linaro.org; Thu, 18 Feb 2021 04:51:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfu6-0006iN-Mg for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:22 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:55063) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfu3-0007DZ-NE for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:22 -0500 Received: by mail-wm1-x336.google.com with SMTP id w4so2273506wmi.4 for ; Thu, 18 Feb 2021 01:47:19 -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=soDGbh249xLp4FfxaOzhIPdsxS6zjpocVf6odP/GVEE=; b=WWANPjG4wXwbpshD2lLgLPNiqdufN4zVXig0iJfAjUQYh11XW+Kp/QmfIHBscCWbqV qX1zSKd2kGQ9nmC4yCJBFOf1z1c6s+iIiwUowWc304QZ6OUBrjb0YD68AXZ3zFOCXyqq 4jhrJCUhIOlIjhKY7s7TUYpOvNzbrzqaZKfoRpCiTMhTnqeOA0pqvIZjSwuX9IKfuRTf OZiSHOlmC7+I25rPzbOa2EOvx/WSymXOLwxHELUkyiOAtgI7vokWRks3CCCSmxLdxeGz QhYaXe0gQSme+Fljmlgs+FfouaU6aPasSLOI3d8ftXGaM1TZ8BmoQCpmbtomSCTkmnet 5s3Q== 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=soDGbh249xLp4FfxaOzhIPdsxS6zjpocVf6odP/GVEE=; b=S762vG3v9lci27PLtYF3X/sumYU+8XGA0ZCDI+wxVdmN2nF19aAs/NR5tuS6g/3wPW 0Xy004NMJ4Zpa9utV7QqhBdaFnyYom664sfmlXgW4ity5DGMDgATow15GODLuVSNmzBt X1ubq9zNW9krRB+gdNGSUK/9Auau85coQFEGYnFujVCmX9sJ24iAhZiFOXVLelgtiuXQ I2SuxmFCvobckJ5eUYV+fpwA4rl6Sr1daT1N72m8KozgKJYFW6NW6bIBvLzPg6DEOxrK YxoH6uIpPn3UVsGtt6pcLJCu7gVnaAA6NEjqOfAeGGgBjZxYqnQF11EVED17emuDqyay egMw== X-Gm-Message-State: AOAM530Owe+MP1yjEKV/Io1PXSilfAFhSQurFF4K8gWZWqqm/kGHwIff Ypdh79XS8zt2xm+e0svxMf5rkQ== X-Received: by 2002:a1c:6806:: with SMTP id d6mr2842123wmc.119.1613641638382; Thu, 18 Feb 2021 01:47:18 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id d29sm1417503wra.51.2021.02.18.01.47.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:47:15 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 910BA1FF93; Thu, 18 Feb 2021 09:47:07 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 07/23] contrib: space required after that ',' Date: Thu, 18 Feb 2021 09:46:50 +0000 Message-Id: <20210218094706.23038-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-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: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, zhouyang 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> Message-Id: <20210213130325.14781-8-alex.bennee@linaro.org> -- 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 Thu Feb 18 09:46: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: 384375 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3535900jao; Thu, 18 Feb 2021 01:59:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZhXMV7vjm1k4zE+gpoZBFkpE4HCTxICba043JfTzXe9QTiT7TpveH6AjlzE+phbGdsxYU X-Received: by 2002:a25:4d08:: with SMTP id a8mr5358544ybb.465.1613642398406; Thu, 18 Feb 2021 01:59:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613642398; cv=none; d=google.com; s=arc-20160816; b=EIa4XH3V3G035ah7DW4daLfKJ58rhAU0H+d+0tnFws511Q65uYpyRmDj/Q14EOnxbC TIkHJT3h1rWbtG1sfLrh6HjQmvg6VruTROFye9Iv6fXVKBXd32mvhT6MtO0mC5+Njc3d 6qjCaqGGcoPhF44N9YrA4hZHQ82YVBc+VcYr66oPuJSHVP2+OHw0hnjrQwF5Gwt5712L fUZGD0DgxpGjmv5+C0KogI9nJSYeBVcgMmtgJ/ryp0yyW/gV2NyywOQtCW8Xr04zhd7L pp1ZKBCkoQyNVhft+EKJBv1ZeElrT4/PIz2o1ffgeZdiUno0dxdHlZth813U3UD5lPhA HF3w== 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=EsPslm2y1fhMEDTOk9iiKfQlaLZSzr5r3t20sdQT3kc=; b=Cn4ipCUBz4cnJewXTFqtx/HMCvPR9mw0NBRoUkQuVX5PlliybqvV9KcZe12cTQKqD4 uIbJeJvYwV/V1iEFYnuYQGomGrxzbJZNIl6bCAAobTlZzdM1Rdd2VoIqHs+JauKsuflz SScMN/WeLInVfPbHpdZxrYelTr4urlwPqCeKLAIY7sh6YgPKfrrGup2Ap3caLlaYkLw/ M4B0Xfgey8fU+0/Pa8tzF7n7IJxERmd+yjY5YON0mbMZTvBkGgMd0iqjnpy77Oupeo9n Mn6KYCtaPB1hKo9PZxAhbuo+7TB/HrwBJ0Bn9vPPTSQQSzYsHnxp4Zz8B/JvJJK0PE6+ bWsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Y96TePjJ; 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 65si4790943yby.318.2021.02.18.01.59.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 01:59: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=Y96TePjJ; 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]:36688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCg6H-0004Wx-R1 for patch@linaro.org; Thu, 18 Feb 2021 04:59:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfu8-0006n9-Qh for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:24 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:36715) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfu4-0007E9-7q for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:24 -0500 Received: by mail-wr1-x430.google.com with SMTP id u14so2198169wri.3 for ; Thu, 18 Feb 2021 01:47:19 -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=EsPslm2y1fhMEDTOk9iiKfQlaLZSzr5r3t20sdQT3kc=; b=Y96TePjJ/MPimbCeVxACEY6qRJDwHzfjco0TkqxoBZL5MPShJ3WCzdadluR9N28ivT Q6A9Q8Y+YTU7RBh0HHfzW7rXWOHh7dRmcjSA9CNQaw/VF8ApB5lNiV99M4D4knEks7dm XHYP+0NdvPmp4+SgOnPMHZwLUzLqgqZD4+7IB+JcPrWMTkZ5CZw265170HmdcPTw7mYB agWyjNYNpPQy+Odgb3uljytjojCsIVRdHVUtbVtqCingWgoT6u9Yrp/ZX5rMGSaeVH9P cQPzykJwSsjA6tcZl2wx++IgWfytiU3+EKANmYS/8brEukrvedkuqi0uQ6EIGSAWVsyF YWUA== 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=EsPslm2y1fhMEDTOk9iiKfQlaLZSzr5r3t20sdQT3kc=; b=mV/zGkuHzZ41ZBTpBcReeXViVXDiQYrSFiRAx8AamEA9y+Aq2bAGW6N5ojlgvYVIpI zX7qevyZwCtUxNUCpwmEgDiR4+glKj8azXcCsRvQBiI2Vq8SwtHYElV8I3M1M+PkBKwE zQsWHXhB4FIoI6du/6KuN86Ygt2oMk6MNck9mYzduvSGmG9p4GdCVBnv+sb8oJHicDMl e1joyK68UDpFQsYSS6dMWYowY2Bl8OxLNTUXt+EEy08D8C4M7uUONw7TJgkzEE0xjKYU /gAWF8DEbguPscjjMR7mhlvOuf05PnRrolnjsx9JWmIU2xoRgRHoKqFDiyp+Rz5/1IZE y/Vg== X-Gm-Message-State: AOAM531E9qEHAnyJamdQOhSaj1H7fU6jZBxp/lrwpFjHqnm+xBQrHkCb 3HWx8/AwnBtk273vifkgADen/w== X-Received: by 2002:adf:fdd0:: with SMTP id i16mr3427762wrs.215.1613641638999; Thu, 18 Feb 2021 01:47:18 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id e12sm7584672wrv.59.2021.02.18.01.47.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:47:15 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A54841FF96; Thu, 18 Feb 2021 09:47:07 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 08/23] contrib: Open brace '{' following struct go on the same line Date: Thu, 18 Feb 2021 09:46:51 +0000 Message-Id: <20210218094706.23038-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x430.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?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, zhouyang 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> Message-Id: <20210213130325.14781-9-alex.bennee@linaro.org> -- 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 Thu Feb 18 09:46: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: 384380 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3541942jao; Thu, 18 Feb 2021 02:06:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJx6f7rFGm/pCzp1Jp4HyM96M2VH1ri4pIb9ESxay2H3XrKeMzhsAaQJ7JGQokyQXWPzNeqA X-Received: by 2002:a25:cecd:: with SMTP id x196mr5506722ybe.395.1613642810719; Thu, 18 Feb 2021 02:06:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613642810; cv=none; d=google.com; s=arc-20160816; b=TUyyXdRaMeWA+UZ5w8eOJAvsr5nDrnn0lUXTNGPnuPzCs8wF+VrLZ5YN49/VUbgJpE K+YWQw9O3xBqynJtcD1VnAis4q8e3f5Vkn+RX+n2RWLeaki2RfYB1QvvYv67JnCFDe+S dCRcIYssddXgS2x2tmV2mTYh3a2WJuIz6uLSj+rF/yyBBrmvq6nfeP1nlNOHyMFsm7x2 hPCa3L+0cU4UTg+OLbLfBwQofEePhp5Di+zGZXGK/2djkgt8Mc5z2pYu2rizChlNYoZ8 4tzv417MA3AAFdeZKmiq9/LN8IprODYmQ1FD9IKi2vwb0TOOh6Gjyh0FgfTShY6Q+G9o iQNA== 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=F+StAOu3qxmsqdNHe7+WWm/s4oEdZe+M8dtFdhw4Ux0=; b=I8Obv7aj482XEFcCpAl3me0hqwwCOEPl0bM9bzsfu6/F1lTMJN63Iw2xdy8VYaFMZd O2pAVc0bG8NMtkaYbjxXOXOzQjWJGumG9vYlWJPn9ryHe3xaZnQ8E+vb7DFqksU/Gtgi SoIh254Gj+u+XwsYiLoyvG455yed+B98aZtBSSukXnD3Fj/t7Zmbm6MeVJgVFgKHubYa QAZlQOvvJCJJMs6G4GsuOqclw/8tF6UDAWds4tYHNXgyqjxE8y+d9xW4K+z8iUzMm0Bf yKSsNnSm/47GdbiupqarKu3Q2w2jXwhMjjTCOjFykqTKRBf30aLytxZbNbybF6iB+LyQ g3Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=EGLehANv; 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 l84si5064963ybf.274.2021.02.18.02.06.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 02:06:50 -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=EGLehANv; 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]:52704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCgCw-0003DW-61 for patch@linaro.org; Thu, 18 Feb 2021 05:06:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfzP-0004TT-OG for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:52:53 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:32819) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfzN-0000yh-MY for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:52:51 -0500 Received: by mail-wr1-x42f.google.com with SMTP id 7so2242379wrz.0 for ; Thu, 18 Feb 2021 01:52:49 -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=F+StAOu3qxmsqdNHe7+WWm/s4oEdZe+M8dtFdhw4Ux0=; b=EGLehANvZVsBQm4hPQacFnA76oHvnmNtigYjR/HNt4UQnkJ4z1KCrpaRk8zYGm0XEN RP+1ISPuUgfOktAfJLRFNn/At1CXSKGdghQkR5djZnyiNR6nWGx4ChrAqAC3lvvgQ2+J aaRF7u3bGZj8AN+pso7kgfwENlNNyctawK2sX+O23JXihz8WW64XS6PAiivT51AjWtOj WghQF5DAxNvUs50jCDQiF6xhiiC1OLaGOLBmmfCiP74Yu7i+Bx1bQDUClcgMFPwtTJs8 mGqdOOw1hm6cY8ac0WyWpXYybm/0OCyuk7sLRdsuuPDBrEnDsRnoHvAxvHzRr6tiWpZm OmcA== 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=F+StAOu3qxmsqdNHe7+WWm/s4oEdZe+M8dtFdhw4Ux0=; b=IGjTZMte7hECMhIEH+eaCbebAQdtU05vUrRl75irG/0qmphUrYTOrpqFu/fct4kS6x QpqtQpFNSymEnt12hp9vPoAgRPBC9i0S+o2OcQbmp1UfraZgk+EES0+RaZxNwATxfk4D bHOdi5Jx6HplTr1fcZVRlf+rx+5NPeD9n3v7Xh+GrJntnB/YVbarlXtx//Ism2clLma1 CK8Bg+SvRVvuecMDon0/K4K0oNMiqGc41R/2ABMjf0lFxSd9RcT4H5Rr6f4CWh0MRJwc rjMKl5jAYYVlW39/noKuU7NvC/GLLjWmqhRHtivWSOvqoVCIiqNXXavhP94aqz3iJtNs Q1xQ== X-Gm-Message-State: AOAM5339Holf1ynefjfxHpPPz+pUPKaOO6YwN0Sm2byXdNQWJPShHRAu buXvipevbxcYVRqZQgeDxLoMFg== X-Received: by 2002:adf:dcc2:: with SMTP id x2mr3331994wrm.178.1613641968028; Thu, 18 Feb 2021 01:52:48 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id y16sm7809783wrw.46.2021.02.18.01.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:52:46 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id BA52C1FF98; Thu, 18 Feb 2021 09:47:07 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 09/23] accel/tcg/plugin-gen: fix the call signature for inline callbacks Date: Thu, 18 Feb 2021 09:46:52 +0000 Message-Id: <20210218094706.23038-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42f.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 , "Emilio G . Cota" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Paolo Bonzini 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: <20210213130325.14781-10-alex.bennee@linaro.org> -- 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 Thu Feb 18 09:46: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: 384362 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3526041jao; Thu, 18 Feb 2021 01:48:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJzPLnIQBniGljovEnJfXJRLNuS7UwPhGwoXWc//uDhcz9D7F25J+nSOLOSDO5RRt235g9CN X-Received: by 2002:a05:6902:6af:: with SMTP id j15mr5618747ybt.229.1613641729697; Thu, 18 Feb 2021 01:48:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613641729; cv=none; d=google.com; s=arc-20160816; b=jYD75f4DhqEZ8/ZqURij3w2zFimwH7nK08jZ7ZIOpc3Wv9n/vmQe/2ZNGLPaOM3dR3 V8c6ksLEiEZwudXP5j1JoDB38a8H+wA+FPHbCPx8UdU7R3ckTkEgv6bEiigFCKRDSEzD NWzaAdnxd5Q9Nvwyccsl0KHICC0V+/57qiE05twP4Eq8fUta8FTDabgiY97F34Iv+ZgJ QzG4fWwrXHl/NA4sUHMbOyujvAhBbol6XPeW7yFnk6o8qrdb3nvhSsi3tRkBi07VcUAt DEFhgA0FUD5W/AI+4TU37gwZ23YRLqLznvm/wD8Mot4D0KtME++hZlfxwNx77xZDNr8/ 7Nrw== 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=yOsJFfZzo2g8QQglvZg2aAHRWN3H1uP8oT2x1qASVNE=; b=l2BzDUP7GRE66GjzRI+Vb80WGnkIDWf08WEMTqlORDxEeKTNUkZmWxXRvdZO8eBhGY LgR1hayPus7gci/daydpxzXAFGbPjCYNFkSCoNoriZwzEechA+zveFcDE/JfbbFt+Iht HUh7gmFbhl16gnEhVjLO5b8hbLhom/ViM5HAbHiBE78VZelAWvcyS+rXkI40yBpTPePk c52uFNo3Ia4dE8CpUv/VIYwmHkodnPehocqq77QIJMMdC4iWpnioI75hGkBU0VxdhTnT 5uNXFv7Rf00DSBnEK/8/FMPF7giKOT+7NeD8gpdf/UW1sCskxb57PNizaOD1opPQQVnT JG1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HQMZlwm6; 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 j4si4892445ybc.203.2021.02.18.01.48.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 01:48: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=HQMZlwm6; 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]:57952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCfvV-0006kV-3a for patch@linaro.org; Thu, 18 Feb 2021 04:48:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfu5-0006gR-Gp for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:21 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:37237) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfu2-0007Ct-1c for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:21 -0500 Received: by mail-wm1-x331.google.com with SMTP id m1so2379405wml.2 for ; Thu, 18 Feb 2021 01:47: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=yOsJFfZzo2g8QQglvZg2aAHRWN3H1uP8oT2x1qASVNE=; b=HQMZlwm6VlPmweczxQ7YB6RMh7HDoA6JEOsx/IYHO2KR15Ke/K8qptYHQEAO4OCmAe L/KHhpR7NyqlV3lzOIsFjqS00f71vdtixLxxoePbBNWG1lxnLjTVsQ8cJlC/Qyrdh3MX hCxXrW69hXTThbpU8J53vKJ7bs+LBP8nR+aANlEvIkeRtCH3wp2SwDydjRhFpLkbwOD1 03m3oyXTM9ZULyKxU6gU+6Z/0urP2lwZ8ahuan+6cJX7pbZtzUHsiI6alORbxB7+OXNZ oGoOU9mZ15ZC1FvkQVZH2D9yUca/O41WT2dd0sDjrc8RU4gKPhfov3A7YlbHJxHdeZO0 B6Gw== 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=yOsJFfZzo2g8QQglvZg2aAHRWN3H1uP8oT2x1qASVNE=; b=Jb4SE8EFIWhLOaVHF47ea2WvxC20bvFtdQQX11+M3D7BsB4u4NstGcbUO7+8X6+DRS jiylk8umx7aOvpCjS5mUbzmTSLveXAfHIfTkjm6be2Es0f82pzJ41mQLXvtmjvWnYHLb ZpCiPM3orgDSW8kbe2yxrrCzq+n+MXQeqNswlLPP4bpbkO6VmRlgq+JHFr3g0dNdWNoY +feA2lJ4ZyOf07Dzu1f1Qblkm2u9vZO9vh6QBnDAzcDQ4rGR6IshO0MkdvfAcjI2w/+N DwBKobtOOvXOR3nwkXXdi6HhSCNEG6/hPBN0VkKsdbRTpUiWg5ew2X5RLvOYOEy5+T/M TQ9w== X-Gm-Message-State: AOAM5328bXJXF3h1fUI4ZEDf7eyP54ESeGFvoETkCX/TwZER455bejSA RI7G88HqfUPvPlVcdyfe5sPfsg== X-Received: by 2002:a1c:2d0b:: with SMTP id t11mr196370wmt.10.1613641636217; Thu, 18 Feb 2021 01:47:16 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id 2sm8712698wre.24.2021.02.18.01.47.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:47:16 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id DEFDE1FF99; Thu, 18 Feb 2021 09:47:07 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 10/23] exec: Move TranslationBlock typedef to qemu/typedefs.h Date: Thu, 18 Feb 2021 09:46:53 +0000 Message-Id: <20210218094706.23038-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Anthony Green , Richard Henderson , qemu-devel@nongnu.org, =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , Michael Walle , "open list:ARM TCG CPUs" , "Edgar E. Iglesias" , Paolo Bonzini , Guan Xuetao , =?utf-8?q?A?= =?utf-8?q?lex_Benn=C3=A9e?= 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 Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210208233906.479571-2-richard.henderson@linaro.org> Message-Id: <20210213130325.14781-11-alex.bennee@linaro.org> -- 2.20.1 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 c38d541017..05cebc8597 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -173,8 +173,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 Thu Feb 18 09:46:54 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: 384370 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3532096jao; Thu, 18 Feb 2021 01:55:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzcG1diHHHqUAzsu7Jro0arY0/GQH2tkgz7pBKJBtHakUMp7PKjEWtBE7Ox6TxibI44uab+ X-Received: by 2002:a25:1e89:: with SMTP id e131mr5502516ybe.459.1613642124595; Thu, 18 Feb 2021 01:55:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613642124; cv=none; d=google.com; s=arc-20160816; b=GaSgujPrSAMQ+Wh0W5zdujPTRWy3IDGGIvc88s8tbqDlUF0UE5kvxFWc8joK4e1oFC 0xh+VEIo03zQ5CMEEjc1c10TWbiE2Uv2312WH2chuA6CLpoOZvvlmbO6c3InVMFOgE+u PzW4UE/BJJcxKGhgyRQZAu9zHnJdUD1VwxGsSpLrvYe3WqPg26NVxXQmfo6iFn7dHDAz g5owfHcDFAZaO4hf0cHpD5R6rn94ZpT9wDJpgabOBdyHJTzgUEFBdH7rbpM05FzZXPfq VRr7QFAS7AUNJo91wdRqJhvpq30IniQzagphQqhEZvPIpA0Gh4u3jhikt//DtxPlJrZk tpcw== 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=B5NVJWShkqLmkp8M5PrhYPz2ELSI66dOr5HdtDYREdA=; b=SqX0Y5WXyPKrv2H+snggkHC2CNrhTfK/J5ZAZQeS6dZ1LRq81oeeTZAr/BrBaEzMcP mCmQMFpD+7IcynzKfgcLJkxekQEyo9cEG/0hIpQwAU80uJ+5i2Z6LYveMBG/IzW3rpdV ndxvbi1Ja22YvrqNCRnmNXEBdo3edOIWzkXH0nQoINN5jDgunurw1j/jolOw+eIlXt9M W/VGmY4id9JT4GtxdTugMg/bb3CFhUuDKjIjyB5t6hXaqTFbcpJWI+eSAweiuefnXEQI OOxMTPM9bcZUqW4UbFZDVH34uOX4SicCJcY74iMhoRYV5FH8piGxsKR3pYA2Eudq3h37 agYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wT0jqi7V; 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 y3si4475834ybc.308.2021.02.18.01.55.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 01:55:24 -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=wT0jqi7V; 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]:49966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCg1r-0006hl-W9 for patch@linaro.org; Thu, 18 Feb 2021 04:55:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfuB-0006uU-Nn for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:27 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:55057) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfu9-0007GX-SD for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:27 -0500 Received: by mail-wm1-x32e.google.com with SMTP id w4so2273780wmi.4 for ; Thu, 18 Feb 2021 01:47: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=B5NVJWShkqLmkp8M5PrhYPz2ELSI66dOr5HdtDYREdA=; b=wT0jqi7VqE4BoWpQSlohidTwNIMTKUQZ3bqI909iXR2WuPMBaWyzNRcAkaR2iKJhWr F4jMPB9BQ3eJgclM0/2+irNz//ZegBi4r18V2OU316EUk85MOg+thw81qWAqvMEI/4bg 1uNm3yJMltD484+3KD8gFFhVi4a3egROcNl4+7a17R8bNI38NliuF1cStGES8p+X/04y 8toJJYN+kBhfLXODI/IjmjDXdfqq36n8CZknH4ZBeksrXXbD9JJ+VgnGQZBhs9ds8AwF NCkPdbN9lK+sUekmrCbPCGFjXzI3mQkQp/lAQX4zStKBTs+7jhwmrTjwjBGKOhiUpu9U 7RWg== 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=B5NVJWShkqLmkp8M5PrhYPz2ELSI66dOr5HdtDYREdA=; b=ZxDAWrxd4LY+bVbg2iboV31MedPLBQtBepYbxSBwgjzgiwouYcI/lc5aif+WPkdsLu D2yZUNrL/j6ESZD5eVcO3ZgRA+a2YoK/UtGQqX9h2LsTlCnebGQKpRO0IMY0Qp2otIgx 27mkdGknFq9kscYREa4/cShjU4RnpKJdlSyPHv+BQP5vJw7RfPta5xr8NAqVqfurcmEj NWdIvg0/aPQU3IUpKeLofHRemj+GFwjZJRqHBMlokUqICk0Os1VW1j4g/jD725zhUktl MH/JPBYWxvMo3WsOKlke/QaI7HpMkI46ccqtRTsInkpHtSM1mm1aBYApnW1iflS/OA1l wCBQ== X-Gm-Message-State: AOAM531Hv+N8sdCbD/tB5BBS01ORDAZ2mjYJSyxaiV+PTT7f5xIpUfwk Qu15XWA/OV4QUJiPIO5xVJnoSw== X-Received: by 2002:a1c:7402:: with SMTP id p2mr2703841wmc.43.1613641644431; Thu, 18 Feb 2021 01:47:24 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id m2sm6234457wml.34.2021.02.18.01.47.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:47:16 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 082E11FF9A; Thu, 18 Feb 2021 09:47:08 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 11/23] accel/tcg: Create io_recompile_replay_branch hook Date: Thu, 18 Feb 2021 09:46:54 +0000 Message-Id: <20210218094706.23038-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-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: =?utf-8?q?Alex_Benn=C3=A9e?= , Paolo Bonzini , Richard Henderson , qemu-devel@nongnu.org, =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= 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 Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210208233906.479571-3-richard.henderson@linaro.org> Message-Id: <20210213130325.14781-12-alex.bennee@linaro.org> -- 2.20.1 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 2c34adccce..99ca6f36b9 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 */ @@ -2421,6 +2422,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); @@ -2430,11 +2432,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 Thu Feb 18 09:46:55 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: 384361 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3526032jao; Thu, 18 Feb 2021 01:48:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJz3zQA4SD8yRE33ganaw+Ut7g8WJLMsaIjCau7GWt6nERdjWKImg3gtdbrDrIwBF+oNludx X-Received: by 2002:a25:3387:: with SMTP id z129mr5668228ybz.239.1613641728845; Thu, 18 Feb 2021 01:48:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613641728; cv=none; d=google.com; s=arc-20160816; b=xQ3/VjdwVqt2FRs34M9Md91txWwxaBwNIsnn9LKb/90l/lMaxqBH1R+aFf+CChfs1k t7kaPAhWvqtlNwFpaPlT9xICe0FkApM8xGZcvLan0pmcV4+XhKgndgP2z+PkvkOpKz2X 9aY19sCpH6ouJCT5/mOXCWfZs694i3AfqmJcmjPTqQBpKB9M051j1o7PxYdr/rfHI4UB Rqb3xvWCOUTt9JiZo8HNWzClHwJsXNBiuNjg3bCtfkh/7fdVOsX7tqGC8LES23ujAhZI GZj3OzK8iUvsBhk+6FITJ92pn3Ta4RxysuJ7JueKT/XTBPk2pj2CmDxpNHE78WdBhGH4 ndVw== 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=FZz7tACrz3U3GSG6bPqxjSOF4K+wZRJaKMNCtQxN5KM=; b=iRtsCt01Wfy2fIJc9UuI6+aPgrRh/ZsC1aYRJPPQ62s9O+us6fEeKWSHU2U0N5/5Y1 eIpkqhA0zoDPesXQND0zis9OSjweXX6A8F8gELisWWXt5DIHhT43pO+6jOknjI1ENlWT 5h3Hypz9yzuqLM/XXYcjJhDVB/blxWgg++ca1AmPxTCWHlMsDhOh3joGmODiAaLvn9z0 zVqxX3qPILrmQhv4fUimVJBfwRjZlPqUtuO2FalM7AlnAz9HmaadgOzVPQOAE6x+eB+z ZjHZUYG9VFwU7+wbnTM8YSPQi+zY2aGQLesI9jnOoKE5QtsXJ2mcS+9yY44IVorI7hzq SHuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=rnxtAHO+; 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 l63si2885659ybf.74.2021.02.18.01.48.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 01:48:48 -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=rnxtAHO+; 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]:57894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCfvU-0006iw-B4 for patch@linaro.org; Thu, 18 Feb 2021 04:48:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfu5-0006g5-86 for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:21 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:37238) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfu2-0007Cw-2P for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:20 -0500 Received: by mail-wm1-x332.google.com with SMTP id m1so2379421wml.2 for ; Thu, 18 Feb 2021 01:47: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=FZz7tACrz3U3GSG6bPqxjSOF4K+wZRJaKMNCtQxN5KM=; b=rnxtAHO+6EeH2Zp0MHVbkW34s/wMVJ2eNeoAKmbMNr2zSr1ZkLPegwJg7zyx+aPjvf skY4JkFE/TW7jnQKCvex8iiTwxNDbqePw8VmkwNybLxt3j/dKo56J6JZsekkNWbR9W+A 1Zi9xBfW9hy1BmqgbFr7ChhIBVH6YqidNOw6CWzlTGGy6laew7agdmxyKwp79oAAt5IH rQV0Ssf93OemjL4F4v4YACmeeRKOHCoWAJcu6bns3EOVd4+kf0+INSzJVoIiGagg6RRw LZTYyIwrx4fiY0KoA15HqwmwCo6IeXdUqhRoYJdBv8uMKPkLmhpmiOs3tO76xpnoF9y/ 618Q== 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=FZz7tACrz3U3GSG6bPqxjSOF4K+wZRJaKMNCtQxN5KM=; b=YNlj+z2oKg+T75sszuk3Urm5mwW7Py575qYKfUJaHXpdSOLKAu1UJSaytRlOnfVTm5 /QxSygT9zBIEN6ZYuVXP/LdmtDRD90u1zS2TVsSY1w2h3iq3cmFzcdqSIzpkix3OPDgF wr60GThnEnNIie0VNiS13AnVZ/qMSM6p2XVUskP59mYUywJPmw6nHd49306iavQepOZH P1VDMzfrvCm/L/Uwn/sPpzDsyzYxAk1MBkQS8mgof9A/dRhWGI4GQ3XZurMquyX07/wp 2yTAno/0wl1PR9mnfRWMYWKnP0r1fyijDkx+Srg3fELs+t0AAULMmPRWseRQ1VELBxxC OVfA== X-Gm-Message-State: AOAM533gktTDs4ogYW+VwfMk4ZpynVzssO+IkpmoalXzZ8p4uL+xL/tt TmOUrz556OPQsSfDcPt836rSLw== X-Received: by 2002:a7b:c149:: with SMTP id z9mr2742335wmi.164.1613641636334; Thu, 18 Feb 2021 01:47:16 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id g15sm8057078wrx.1.2021.02.18.01.47.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:47:16 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 213111FF9B; Thu, 18 Feb 2021 09:47:08 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 12/23] target/mips: Create mips_io_recompile_replay_branch Date: Thu, 18 Feb 2021 09:46:55 +0000 Message-Id: <20210218094706.23038-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-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: Aleksandar Rikalo , Richard Henderson , qemu-devel@nongnu.org, =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , 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 Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210208233906.479571-4-richard.henderson@linaro.org> Message-Id: <20210213130325.14781-13-alex.bennee@linaro.org> -- 2.20.1 diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 99ca6f36b9..9fea5c0e59 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2418,7 +2418,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; @@ -2444,15 +2444,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 Thu Feb 18 09:46:56 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: 384379 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3541656jao; Thu, 18 Feb 2021 02:06:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJzKbkNw0tt7z6K4e3hZXXS23rOwuCAuCkZDe9v1MV+qbszDov2PVdkmOdIdcg2kgC/POIWc X-Received: by 2002:a25:cb13:: with SMTP id b19mr5280501ybg.119.1613642786547; Thu, 18 Feb 2021 02:06:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613642786; cv=none; d=google.com; s=arc-20160816; b=eBthdny/tMVJHI3beXLXbiMTxYoGMuKst/4YNDJWzSo/zQxkgQt+I5Z0lEDFXYmnNp BlGUsg2Rky73EDSwK7LLUdkA5ra1srqAEfS3Qz3bs9pQrpjZvC8LCsWuzPVoScK1P2yS Cj5ls/gi5R8fEeoqXonSdVUFbBdbPSbCkApG//OUMRbVGOjcXZLJt8l+d0TGY9q6zfJ1 x56mWp0x8D3n3usGUVxlgV8iXxgWdWv25v83hDvBqy7LYQL+7kp7Dn2eAXd/xzhKZFcy YCe2PP4AyvAjkR3F2//z1NMk0D7n1r6f4QRvqoQlPL4mf7ybGh5LuSetTHFSKkt513GU CTuA== 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=by4E5jCVC9bx2TQqGdZFWQRpu+EpcHBR3WGdgm6ocCw=; b=iqHU9UjPHHvqgv4wbedpytEsjLiMkWcXcD20vjxyMAMbrWJB88HEd9Onwi8kvQwekw Kt2Xqm7XdX6rmvYh7MhjdjeZVaRzd7b3vgwe7kl1T4y8fXUIl4KCE7c13610meEedhld jDk6bqEJ30JpAXCDqji/NLpeEPc+8xmv9/finJ2jCjyPpgGOTajSiiyNh5iWdgCj+v4i 1WzEB/wM9BIt/NG9AYaFQwXE+wqVTRYJaP7NnWBkbjpNhySV3zv9YaEH7kNppla1aFtM lkxNliFxgFIEPAuZp5IwzYz/2v7ox8LA4R6HU08SGXIzl9nMWR9Q3b5ZCvd+oIKESgo8 lUkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YXsB03va; 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 y145si6252617yby.396.2021.02.18.02.06.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 02:06:26 -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=YXsB03va; 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]:51478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCgCW-0002ho-9Q for patch@linaro.org; Thu, 18 Feb 2021 05:06:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfzO-0004Rq-Bq for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:52:50 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:33987) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfzM-0000yd-FF for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:52:49 -0500 Received: by mail-wm1-x331.google.com with SMTP id o10so2466909wmc.1 for ; Thu, 18 Feb 2021 01:52:47 -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=by4E5jCVC9bx2TQqGdZFWQRpu+EpcHBR3WGdgm6ocCw=; b=YXsB03vaUE3SBea0f2cktWvK++/AlwnJeKe3jGNVb1npz5Zgvl2IN42JczNO31qzf5 ItcIcrfwuEQwVxffptZM8FiATCKExWZgL782s4rwELwHGFkSemktiHH4DOeRne6xzQAN h9RY30VL/wz5kDDRq657VhKXA6wJnIVDs/RzvIzKebkJ7BorPcUtV7i7zeylgS7V0Uk/ aAKHtwTXblLDRk9GGRBkBUxMSvu2r5r77+uVtw9uQ6BhRaIw/3W3s/AnBpW/yQ8zyJmg fbrJh5hf7zfihr1VbbLdKlowF1Jt0fu9l9QST8awPEElGzhRdtr/F9+osYgYK0j8umPR cd0Q== 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=by4E5jCVC9bx2TQqGdZFWQRpu+EpcHBR3WGdgm6ocCw=; b=llbdBtD08XxgaDmuN0OVi+gFeRNhCkvja1x/9CSfhQUAzCEPzo8uVafI7vXvgV/Ynr t3LKJvkOfaycex1K/Vfeo2Zw9SmTj1H/GoFQNVe6XAV03k3tqRrdXhsf6iDujrAsmN/K kQIuKkKvyZT+gX2VuY8GxyiBRRUH1KJUe3xU+/c6G01jH+2CHHeg/8n2wyjC5RZhOeb8 jEiEEeuB2LMW+VfCeIftfASZgpQJtdbJKSAzsfcKTqVUBIBwzHEElAs9/s3DoAKKydgW 5MjJCTem5KxLhfw6mWythKl+gPspKAVRi7R6mwq5SIHzwG0BAGitFVX1vuNBOKrWMlw2 eFqg== X-Gm-Message-State: AOAM533ilKu83S+oXea1k6Kg3wH2CP9Wd2EM4mmLzgjleRjGhZIxI8Oj NpAt5LCMx9/B1uwc56by05K5ZQ== X-Received: by 2002:a7b:c5c7:: with SMTP id n7mr2779724wmk.63.1613641966989; Thu, 18 Feb 2021 01:52:46 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id g15sm8080303wrx.1.2021.02.18.01.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:52:46 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 395661FF9C; Thu, 18 Feb 2021 09:47:08 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 13/23] target/sh4: Create superh_io_recompile_replay_branch Date: Thu, 18 Feb 2021 09:46:56 +0000 Message-Id: <20210218094706.23038-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yoshinori Sato , Richard Henderson , qemu-devel@nongnu.org, =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?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 Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210208233906.479571-5-richard.henderson@linaro.org> Message-Id: <20210213130325.14781-14-alex.bennee@linaro.org> -- 2.20.1 diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 9fea5c0e59..c0b98e76b9 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2418,9 +2418,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; @@ -2444,15 +2441,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 Thu Feb 18 09:46:57 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: 384377 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3539742jao; Thu, 18 Feb 2021 02:03:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzqFqcqu8p0SO2a/5BqnpkHGQMQ9egptTpPzvcL8pmCj2gUHMzJnZmE9TXT6M891j3MEl1Z X-Received: by 2002:a25:858e:: with SMTP id x14mr5522149ybk.322.1613642614768; Thu, 18 Feb 2021 02:03:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613642614; cv=none; d=google.com; s=arc-20160816; b=WSvIVTXiEPWTR4jko46S18vuc1aBxEIsv5i2djMBEKZGaZlqINH8rsbCUbD75hjCoH iPrU6le0RQJJdjPYI4Vj9wXrsGtEYj9X5zS4GflMbMlcjUNr52EoVk391ivdIcJ+9/t2 yfVZiim6yD0RCt26oibGaw7P16PsZAsF7wsxVcZskTiJqEGh3/pD/VYcj3WF+IeHhgJ6 elJk/tFkTlMjg0yu06NQzrc3H489oXzacM7OjZQAsOrBbWQ9qYoQMujEd/TiNWgJs9XN yMKPysiO61XdUpndggQwnLNQJ52SJLMSxbwbxMC3TEsNB5MREJ0Pv4MDjn2kS12nADXG 3+UA== 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=URgrKoscFh5SeIM+x771X4c87xx5ce4C6s1fpPI8uTg=; b=MBA1rxVFK3reo8Gq4Zypv5qHmeLe+prmsADCJVt9095+3PrusvneKlCFNFJCXAu3rE o8b917NunTFMLYhW84NmmmtwbKZX7SfB7Z+BUeRfutHlw/iSrgv+8FelI1Yz1/GFRO6+ 7wpU/VLyCZjnozwXd/L8wCzVrf+NkdL7JSP3D3zf0yFW3YNgqtUX5QPfJeLLG+hgLn5M ANolXKQx9uH1l25oF1fhhHGHFstawsarlffyeJFsb02ozD2u+KzvzqZN1STxESxPeqDZ hkkvLFNXKmqe+yRoT/HELBW/jo4Jp1P+RCoSRYLBjgwMRkAFZH0O34e5UhaZQ6l68sd8 TtYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OT13xFdQ; 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 q12si5420441ybm.8.2021.02.18.02.03.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 02:03:34 -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=OT13xFdQ; 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]:44636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCg9m-0007xs-5y for patch@linaro.org; Thu, 18 Feb 2021 05:03:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfzW-0004UU-Fy for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:52:58 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:39717) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfzQ-000104-3F for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:52:57 -0500 Received: by mail-wr1-x432.google.com with SMTP id v1so2206744wrd.6 for ; Thu, 18 Feb 2021 01:52:51 -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=URgrKoscFh5SeIM+x771X4c87xx5ce4C6s1fpPI8uTg=; b=OT13xFdQNme59mP1u1TAAGN7q60WNwp1Mcp/lBtDPS0+p/vTEcM6aBW7+LIrBV0HyM 8c5isV2P09mchje6vLoUy+lmHqIJ9NkhUmcvnN1nueuw61warvJORkAYzVaCUXlqKLzW bXcGTD6CFTx79VmL7mJoFulFjmAAMI9fazrx25jb6VSYYyJIgSwrD+RDzWFHEDYpoCGv q9UIr6PRZxrhV19Bz5Q/1Huqi/DsOE3dn9CC06NyX4Sph8NVZiKEb2KAJq2Qyt1gJkZm obK+vQhephyDkRyDj2WzbDS8v0HTS0NzsI/WVvw6jcpCbdd7oiMH1JO3QNL7eBZjMsCE q1Ug== 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=URgrKoscFh5SeIM+x771X4c87xx5ce4C6s1fpPI8uTg=; b=QisFgiOzr/xeqm51rw/OHYR7PKDlpTWDlzgVZw7A3d742mJBEf7toEVDV424VZbZu2 IjLETjdTvxPjNv5HEtxZfNEbz5UOcZKYlDyR3MrJ1IsLVf1N3A2lvvEmL4GHPwUI12te mdX+ClF/nFg5p64vOnd85K55bnG8g3RuojuhW7OI8ftePq4tmraqykgQ7RRKAW3SM+Cg KLxboZ16k1JqmvnUKS5/kaeN9O+wS82JlZNEUEjI8kxllPlFgZH09uCYvEVQsWisJfFW 1U84JaTHFQodv+yd3urUqnTQXYCdycEmoxJMogbd5xaS/jZu6dvVV2zNDXgvC2S5C72y NOgA== X-Gm-Message-State: AOAM5304Xa9iTzDOuUKqxGcJUV0xgWNMwDc9X31PUIRuIGlDxOJ5ix7U Xy2bPLTIEgM2QzrwEs4UOrb5pQ== X-Received: by 2002:a5d:6b42:: with SMTP id x2mr3386128wrw.117.1613641970805; Thu, 18 Feb 2021 01:52:50 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id p12sm6242489wmq.1.2021.02.18.01.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:52:46 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 542831FF9D; Thu, 18 Feb 2021 09:47:08 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 14/23] tests/plugin: expand insn test to detect duplicate instructions Date: Thu, 18 Feb 2021 09:46:57 +0000 Message-Id: <20210218094706.23038-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x432.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 , =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , qemu-devel@nongnu.org, Eduardo Habkost , Paolo Bonzini 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 Reviewed-by: Richard Henderson Message-Id: <20210213130325.14781-15-alex.bennee@linaro.org> -- 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 Thu Feb 18 09:46:58 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: 384369 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3531364jao; Thu, 18 Feb 2021 01:54:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZE9+W3baxNQxGqMjTgO72BsekEZQ+scA6UGW3Mtj7j9BO9jNcnwu4wFEeafXsBuMVeL6H X-Received: by 2002:a25:4981:: with SMTP id w123mr5309614yba.123.1613642068668; Thu, 18 Feb 2021 01:54:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613642068; cv=none; d=google.com; s=arc-20160816; b=xvSsvbjMf6K38v26XG1xguD/mNQf6BrGsmI3aFWsCkvLM2mkYgqfe9DJ8kzecwUlpW ibqPMllZaoHEYZzoDY8tMNj4znKi+lgOm77ljuVMXwN7aNoRRZD5jyHVql5zcxh5nwUf H7H7Gd5815YnfyqPD9w1ivOy5yt1HR6CZrwL4CYSXDABRP5TYsyqkDDkSZxnRtktYbI6 CM5bkjNuTzkQ4wV3H0roszADssAVNnsSXBipjPvLayWhlFSy41f7R+eS0NL+ulAZMEUZ rj/ljWXLSQjZZqoj1j+8M9REFH21GnLM5U2caxgFKa/qVJxZM6lKe0N8qNu16mW9MVgD cziw== 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=zkerjIOSR1VBpLEavyIzaruBjnEooIufy3pN/kRsj3g=; b=e0MeqsqLyxH1NrO+2WoIX+gA5+u6tmQQVvslYK36Z4pNbMJNSeWJ5fA/mPEjJa+7HB NKd4NtQ5Qagn3/R0f7IJ2n+NUCy66qefBBYD7ELrI+PwrW6HAu1hjZxq2VQL5dXDrZwb MDrtZeZ1O2cuzOKwtlARLlSEqm4Mj0UqGLDU91kt2qWuPrNphleqo0QJM/UvR9yOsyfH u30kQ2c8oScMNl+MnKuO/t7yjWAg2J9WFQZ8idgAs5vBdSxup9HAT8w9sN7Gedvr1Two udY0vN/HAFou51uDp2I19+bZiubCOuPtDyUMbJTdY01B6d4/+JPntzGnQw94gLhQJ30Y g7Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=gjafs3ON; 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 f23si6290628ybg.397.2021.02.18.01.54.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 01:54:28 -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=gjafs3ON; 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]:46914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCg0y-0005ST-1R for patch@linaro.org; Thu, 18 Feb 2021 04:54:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53382) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfuD-0006zK-PY for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:29 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:41153) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfuB-0007Gu-P8 for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:29 -0500 Received: by mail-wr1-x42f.google.com with SMTP id n6so2177430wrv.8 for ; Thu, 18 Feb 2021 01:47:27 -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=zkerjIOSR1VBpLEavyIzaruBjnEooIufy3pN/kRsj3g=; b=gjafs3ONJf4x+OzJzIMuDlw2tuYuaYQxHbFvsmFoPfLxfrlQPqrqARkoGrL2vCCzI0 Yw/WVKvQ+JeYx8QYwbG/l4BIuOX3YYiZZfMMVX2K2PZ7JE4ZZiIvAopkhq2LoDX2b49F HGKV4u4V/PjioLsoY9SneevvgfRBY63/sveCgcStkC9HgnizrPHXRwHggOLpXKPOxAwR iA5yaJSj+xKBFhIIXoQye83KEgD9+MdZOd+AzYyN/7O40H+agTfEijLv7Zrrd6fIzW5Z ZcGIEREo7tPAVIBY9pY1vBisHWUYasHGE9ijh2EYfCmVZy7vDh0GL7R7amfOHuhqoxOg JqCQ== 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=zkerjIOSR1VBpLEavyIzaruBjnEooIufy3pN/kRsj3g=; b=N4hrS+ZPQeO40junO9AkmFIyGi4gGTOvA3cf5N0URrlNr0PxwUWOe2CZjPrS24S5Av vKo9ztPGqlz9v5y9bBi+WZUgPEvrUEtVDVg+uH1OQ813W6aXVQvJdhS7+3x5XLCdpu7g Wc15kF2RYHo7Yd2aZyOQca3wQCNIGHMuCMuUSqMj4NHo0Q2DCrT1sjROgq8rEk6Hdto3 LWPZ2DH40fUhYBvSy0wHwsC+QdmG62cPd4E6fDKVJSS1U+qdeNGrjy5gaVDgMXKufGsl 7mvygdf9O6gq0xGASNWXYxgoft01bpJy5zMlplN1TvCF9ubHncJ5qr5UGAW6FIGjqIpz mlUw== X-Gm-Message-State: AOAM532GXSuSNtYH1QkMXWQZTkNBgxmD1P+KOMd2W1Ts5gs5N9w2sKeM 9awFmFqyfuwEhOaeBMqEQTGUUQ== X-Received: by 2002:a05:6000:1816:: with SMTP id m22mr3454193wrh.91.1613641646410; Thu, 18 Feb 2021 01:47:26 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id s23sm7062441wmc.29.2021.02.18.01.47.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:47:21 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 6BC841FF9E; Thu, 18 Feb 2021 09:47:08 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 15/23] tests/acceptance: add a new set of tests to exercise plugins Date: Thu, 18 Feb 2021 09:46:58 +0000 Message-Id: <20210218094706.23038-16-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42f.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?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Wainer dos Santos Moschetta , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cleber Rosa , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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 Tested-by: Wainer dos Santos Moschetta Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210213130325.14781-16-alex.bennee@linaro.org> -- 2.20.1 diff --git a/MAINTAINERS b/MAINTAINERS index 68ee271792..1d711e0cb8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2903,6 +2903,7 @@ S: Maintained F: docs/devel/tcg-plugins.rst F: plugins/ F: tests/plugin/ +F: tests/acceptance/tcg_plugins.py F: contrib/plugins/ AArch64 TCG target diff --git a/tests/acceptance/tcg_plugins.py b/tests/acceptance/tcg_plugins.py new file mode 100644 index 0000000000..adec40d3a5 --- /dev/null +++ b/tests/acceptance/tcg_plugins.py @@ -0,0 +1,91 @@ +# 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 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): + + 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: + # TODO: probably fails because plugins not enabled but we + # can't currently probe for the feature. + self.cancel("TCG Plugins not enabled?") + + self.wait_for_console_pattern(console_pattern, vm) + # ensure logs are flushed + vm.shutdown() + + +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')) + + 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" not in m.groupdict(): + self.fail("Failed to find instruction count") From patchwork Thu Feb 18 09:46:59 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: 384376 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3539152jao; Thu, 18 Feb 2021 02:02:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5Z4FMSuO17K7Sev2ZntCdnM6Z2mDkGoHzV37oXbZK5UO0r2oNvP9SHNej6LeQcdse/gHd X-Received: by 2002:a25:3783:: with SMTP id e125mr5193296yba.169.1613642570064; Thu, 18 Feb 2021 02:02:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613642570; cv=none; d=google.com; s=arc-20160816; b=mZDdukax0vcHSw+gS6K7X74i+Qk1F0ELWN32NuTZS+3ahK+qg42XYSDjzsoiMfy4GH +jmTDcUAdu7xX5dOW3M0iCxhOfIzlQU/cNyET8EjfR29sGt7ZgIK9UimcNZce7PTirC4 s5evnxpiLKHPMLFScnq/9gvwdEYG0530Uy9sMfrJ1e0cFV28BFRy5BUg1zTGLDVRS4vI 4PD71U5zp0e1X9s2ED6kYuMqUy9sLW+S7M1Q7BYpXj0zk3Ehoe/ilDafWfioAeW/U13g qIp12V9NKf2NhNGnIlh/erl/tOkxVSOTWA6c8nkLehpGJEtI8Llx4P6fFv3PQzkZWvI9 0Xhw== 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=zs3ZCon26CJzrjGkyi/ru0q40eBX9PJP1e1LsnAKqPY=; b=ofSXXVnai+rxwXZGBGjcS9pNXr4o3WvVM834iS3rcKKIPDJnR1PdWDaUvFsKcrdLm1 ozbiXbRuSrFRjJ6RZ71nm8tIB0xpSlSTl4Q6ww8Xp83XJiNYlyM/0HPMP5QNn3ZCDi88 tulmW2w/H+phDsIWFQV00FYreQZDwrDbjKKWGvCQDxg80Q8wDXFf3MJGIbHFZNqjkew5 qN1gU8rXgzrMABwH9IoeVC9vK9/v0JE9PNeT7DhvMyUHUPu1Q5pxAeNdRA5VE/EDmdJ2 HADQOlNbR1PVvyAa98+FiOY5L9Jfwgi8WnQ/jJIsmIEesAZ4l2/elWgacHacj1SnMOXG I3jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=r14qM+vL; 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 j78si5018715ybj.388.2021.02.18.02.02.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 02:02:50 -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=r14qM+vL; 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]:44878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCg93-00084A-IW for patch@linaro.org; Thu, 18 Feb 2021 05:02:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfuM-00079D-4X for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:38 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:35067) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfuJ-0007J5-Ot for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:37 -0500 Received: by mail-wr1-x430.google.com with SMTP id l12so2208367wry.2 for ; Thu, 18 Feb 2021 01:47:32 -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=zs3ZCon26CJzrjGkyi/ru0q40eBX9PJP1e1LsnAKqPY=; b=r14qM+vLAYuvyO2iiw4GSnpu0KGmCXjsKVYF6yEtaXbGD1/F+gXklOxWWSLiLwUQGu Sq7lrsW7UasnFgcTTRGTSgLbqhHzVRZT1YcCX3NvZVsIiXZwf1CC3hJvCJrXSNYCyqDs byXNCqOkcZQBkEJJNWk8a+vPxC6ZcE3Wy/SLyJXD5zn3c3BvjJSOLwrBluBIkWXFWclE D6+vuTSmhxqNG+H+Sr8zA68sINaLyF/TZvAPVM01G9f3ow1Y6pOefBw6UBgZ74CD4vCy bSKhV4Jk1cl9Vb9Kv0TPFF0wQhJPcoD3TRUIltFKXt4K7lTdeNVxuAw9KqXrPelyVLaQ +o+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=zs3ZCon26CJzrjGkyi/ru0q40eBX9PJP1e1LsnAKqPY=; b=qYSY6YNfMJ+XykbHmRntQCNQ7vfs6hP8tbPs6dZfktsqyu7hOH/NvAEU85NUw93KM7 n2pz+NELTXuXRwdRxWi4AuTNZSTg6rG079WTKVcixQmbvd3VVFd6L9YAGkjUKB5/0Gen +tW5xvuiSSxZCTirbdZhigXOjioyqByBZ1XKlEYjHIRJ6fLodcixfVjcTak4Swt+WLtk h4HLcjhRROJa1MZyj1S5niaB//fC6uRIShQVQ99WNBu2hhtWVUtAw3flWYQja6jTV5Mb 8wBLe/NM5GF1omPd0tKXE+yTuwOYRUtVfd1Pa1fCufS0WfmLLVgnEqOqGG96XnOQI0Me HGNg== X-Gm-Message-State: AOAM530VwMXeWcwW1c1IRQb1rb8zjZxWNg/i8/g7WTfo808SkLQ9WuYR DJY+9TyuoPMOzYHNUxJCxP7VAA== X-Received: by 2002:a5d:4d0b:: with SMTP id z11mr3487950wrt.359.1613641652124; Thu, 18 Feb 2021 01:47:32 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id b15sm7645938wrr.47.2021.02.18.01.47.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:47:23 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 807BF1FF9F; Thu, 18 Feb 2021 09:47:08 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 16/23] accel/tcg: actually cache our partial icount TB Date: Thu, 18 Feb 2021 09:46:59 +0000 Message-Id: <20210218094706.23038-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x430.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 , =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , qemu-devel@nongnu.org, Paolo Bonzini 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 Reviewed-by: Richard Henderson Message-Id: <20210213130325.14781-17-alex.bennee@linaro.org> -- 2.20.1 diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index f2819eec7d..d24c1bdb74 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 Thu Feb 18 09:47:00 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: 384381 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3543256jao; Thu, 18 Feb 2021 02:08:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJzy8iuH/qhIGO+1kCzZcT/RpAyNmrqZklj98AOfm8mgcDe0bMpZMDCeViW01usyKr03UttY X-Received: by 2002:a25:c902:: with SMTP id z2mr5492067ybf.4.1613642907311; Thu, 18 Feb 2021 02:08:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613642907; cv=none; d=google.com; s=arc-20160816; b=JwdpgwBFCJ0XfI/EAm81I86CG5PcCKIDnlpijVatwUhN8JOBKMThXVtq7LOE5KkrTa vfVGcu2pR+pS0jH5m+OesMRTs3GjxL01Aw+rpi7PVzRmVRUeDTXwlQGhsmUzNZE/zylZ 2OOByM3mcBh9187ypAnVwtk2uTytDkG1u1Pd2gQqQBhhTeFcKxnO+GJOuCGMa0gO3HRj de0G/0pfbF9OxI2uJv3zcI/eIhHYe+AWcaanL77DXULQL2OUKuTedk/A+xMvG1/8b+l9 jdmjvQwqzcJAGkrqhKJG7eeKdtn18jMzaJRsV7BzFkEGtBObiD2WgNiGaGuhKmCeyHWo DmDA== 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=J6t14fMjlWmSY/RcG379H0HP4pomUYB2uffBkdEK/6Q=; b=jnw6JwGiHlr7kvzxPGldnsUYi4TOjHBewU6CHEZdenPBu3JPhkzvMiWunxL0SKxgsM 3ZAX/ZxW1u25zmz4/Gc1M9NvZF6WGoNDnqkGTaVBhuS9GLHBlk2q/gVb3nwh1zeRYZoJ c1KoTYikp4Oz8r6v4Fa7M075E8ToGE/RqwIBPhQrX5eWiDgf/GgG//Yr1lO7Vl8rD1hI a9jFsNXbqAOW4FSQSeIbz1rLFn2CTVxzwe3wZNtnEFrqGDqshEX+EzWqoaJ1Lec0zl9Z dn0VbLchjfnJbpXtAP5IlnNlMHwD5XC2p5YiuH3OVKZMmTnaYw3vZT8pYFKf0Vd5m4mk r75Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=izphmsXo; 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 l62si2714469ybl.20.2021.02.18.02.08.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 02:08:27 -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=izphmsXo; 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]:59776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCgEU-0006Lf-Qu for patch@linaro.org; Thu, 18 Feb 2021 05:08:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54336) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfzY-0004ZR-5g for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:53:00 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:33981) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfzV-00010u-Sj for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:52:59 -0500 Received: by mail-wm1-x32a.google.com with SMTP id o10so2467088wmc.1 for ; Thu, 18 Feb 2021 01:52:53 -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=J6t14fMjlWmSY/RcG379H0HP4pomUYB2uffBkdEK/6Q=; b=izphmsXo7OXrSTLSBHORTYyLDWuYsC6pTIsYQ3hvT079fUIzJFwo5Zks5JT+/6KQRo l2wNdqUzgrdP2Kto9GBtcG3Tt45GhkvEyJdNk+30o+vCDh7kWQNFI6juaGPfLmODE6zD 6V+e0wKSF/Bx71ZdK9IQnx2ggR8B1Kz05WG/spKASXOR1eM8PXKNSfkrrDMxZ0lSDbfT jai5rUKcvCgxxKz2nW7Qwc7gdipuZX7qloDlwwNOHXP8LmER4IFSV9vOqzePPeh9a6x3 g1UDO+x/MEp9qujyRYdfww8XUyIM/zHXJFM6oAcK6owjlAIPo03asN7vKZLzHvaLnaje UjiQ== 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=J6t14fMjlWmSY/RcG379H0HP4pomUYB2uffBkdEK/6Q=; b=dBkrWb/h2AgMAvlAfv7fcZrFWJ/mvhngW0JxInnIghiyCsnuMCMQAVGD0VON9NcVjp wq45KuB6G5orercBPOjbuLpZ2cBbesGBp45Tx7mw7NTNqU0ulLvg3LLwDNIstG3ITXii rHvm4YgOHhAmiQCCY4tqV4YYEFt3c9wBE39tXTlHDxRD9vJmx9SdXZI3eIxZjm0WmAvV 0FTOTkpJfKVTzsEIH0ZTVp1rzQZY5MASKRPV7HV7VGcMRhExSVeTmQOpQAZdY7rMOHHS xDs8B0JO2dOW46fTQGRnLAJkkIbS3K6XTwPJkzkoJphpZjrZww63ThWrT6t78mvHFzQo uvaQ== X-Gm-Message-State: AOAM530XHZDrzq7Rmvx/skZhybqzaSa6o+BL8RuHjRXCcqJHD4LRvG15 NRWJEfkkC8bh2QbMtvgE+sD0+w== X-Received: by 2002:a1c:98ce:: with SMTP id a197mr2735622wme.120.1613641972715; Thu, 18 Feb 2021 01:52:52 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id y4sm1837680wrs.66.2021.02.18.01.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:52:46 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 952D41FFA5; Thu, 18 Feb 2021 09:47:08 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 17/23] accel/tcg: cache single instruction TB on pending replay exception Date: Thu, 18 Feb 2021 09:47:00 +0000 Message-Id: <20210218094706.23038-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-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 , =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , qemu-devel@nongnu.org, Paolo Bonzini 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 Reviewed-by: Richard Henderson Message-Id: <20210213130325.14781-18-alex.bennee@linaro.org> -- 2.20.1 diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index d24c1bdb74..16e4fe3ccd 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 Thu Feb 18 09:47:01 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: 384373 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3534738jao; Thu, 18 Feb 2021 01:58:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUo2nWQbGxx9TM+KQEQ3Jkpl0NKDmnCfpIklrpO61tI4rGL9g21V6+KJhNFtJ65mQRJv7B X-Received: by 2002:a25:830e:: with SMTP id s14mr5914526ybk.42.1613642283508; Thu, 18 Feb 2021 01:58:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613642283; cv=none; d=google.com; s=arc-20160816; b=KIaEwUBBx/a2ADluQcBMvGuCWXZ82ckYCZuT2TFn/6DmqMlkJsiAViEue6lna6U9Jj YpfOOLC1deZV2gcI+HhZq8gyk93twLkncn2SwcNWkP8IEeveM+hXMG535ycENzCXPgiy Y5J9Ybnhw3CDHLHi50kAItQfjYDHVh47kRKGNB7dzKdGxgTsEWv33TpWsLzQVPueUPhx 7yGtCOHZRINEZgg+1YY94+2BViPsugpmnAyscf4lzTyOYmhLkSsMUHTJwuoNBF7oEHZx b+4ZEjEzUiD2PaTT3/DjFnWBsWIGINdTg9TnTZEbdD/7akfVHqxQghInNd6Ja39IOAJF mlyQ== 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=cfDw5C6zvUmFdQECRjitQbGFP3IAXxbCAzqXHPWLjR0=; b=GErxInopF5EyTDKb4aZB+lTzlS/Ft7cIOe++kWziljXWZrtBDgQoMVUrW6QLTnNRNz zMmfmwkqHT1z/K57S98drykUZJErJSxivtbx8mkRLlffmWWz0VM4zhep7u5pEY2xnv9d vK2dxU1W4bL6qIAdty2mCN8yAvu176TPPAd0TbPy81g5IfepFcqkhBdJYaR6gXzzrqcN S4R4QLunueHyNdySWE3rsLj6+3PGgOhLYmgobmJpFaXisNfl2DDAggazw4WiZ3g7HQYj REEiIfjeRRWdS0GOm0ZDKonK40+zonZkTbww/Zd06qEdMk0vgflpSHC99N7CBxCph2um 7Xtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=tJNa3xcp; 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 j124si4886438ybj.127.2021.02.18.01.58.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 01:58:03 -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=tJNa3xcp; 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]:58526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCg4Q-0001ue-Uo for patch@linaro.org; Thu, 18 Feb 2021 04:58:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfuK-00075e-F1 for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:36 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:33789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfuF-0007If-Ko for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:36 -0500 Received: by mail-wr1-x42b.google.com with SMTP id 7so2223434wrz.0 for ; Thu, 18 Feb 2021 01:47:31 -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=cfDw5C6zvUmFdQECRjitQbGFP3IAXxbCAzqXHPWLjR0=; b=tJNa3xcpbF/wfS3dZoq1UjDb4tqq4g5CYyFftQJNjLwOSEtKgtp7mDzJAiETHHEdTa WMX/WrK4W+lYikTxtgQzrwsG2Kir9Of3oI2/jW96F8enXr7y2TduwoTE0pmCZJwbpXnr NyMEClPinG+Argfwxtaqxo1rtbY+ce8VZOeTvcQw44796OekiA4XwwXa83SUanDp6J/B C1cqQzMRhhfoO1xxYzKH2mULd2vj+ETmkDIxIrxo3Fd64HgaP3zeQskODgtOfpRBHcAt Kn5pXcN8mfO3pS2JITlasA4fPqehIJZC+zxV+uLsfEjQxXlDBXCAFub4PA0ViH7gtzP4 uB1w== 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=cfDw5C6zvUmFdQECRjitQbGFP3IAXxbCAzqXHPWLjR0=; b=OtpOdsHijf5SpJn4XCde3RmbTqCXQFuohICHW1MQXCt4nkPAJ5tiTgFxBl5D4otjgT pgESiY3w30bhtjv8J5vn92T58NzDRiL4Qu5gGONiw8Mc0XtLf6JcELTkS9K37A+zDIgY qtPlghv7P1tU3ctKL89pwtBCf8GlqT/OAVVnhM7cEqLwejsiLYjh8rjvArsTW34ju2Kv AsAoK3vICagHB2k2ITRciODHLP2ChfNk5paaUdDh6P+tUDJfoW1rdJ62qDSK+O9sL5Tg MTcKB3MFklNGiC7jpNe+tajy1MdSUMnptfCiyVFF/L5m2nBOQvzutNEaI83jaQnFTLCB MCpQ== X-Gm-Message-State: AOAM532imSDD0YTKsgO1Rmro0BwF+BBeV50qzmbh48fKB01sKfWJ7HEq m6Y/E9PZjjLRUstMkvmhg656MA== X-Received: by 2002:a05:6000:1788:: with SMTP id e8mr3471481wrg.171.1613641650314; Thu, 18 Feb 2021 01:47:30 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id m11sm6690599wmi.25.2021.02.18.01.47.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:47:23 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A9CB41FFA6; Thu, 18 Feb 2021 09:47:08 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 18/23] accel/tcg: re-factor non-RAM execution code Date: Thu, 18 Feb 2021 09:47:01 +0000 Message-Id: <20210218094706.23038-19-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42b.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 , =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , qemu-devel@nongnu.org, Paolo Bonzini 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 Reviewed-by: Richard Henderson Message-Id: <20210213130325.14781-19-alex.bennee@linaro.org> -- 2.20.1 Signed-off-by: Alex Bennée diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index c0b98e76b9..72b3c663c5 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1779,7 +1779,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. @@ -1798,17 +1799,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, @@ -1881,9 +1871,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; @@ -2097,6 +2086,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 Thu Feb 18 09:47:02 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: 384374 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3535383jao; Thu, 18 Feb 2021 01:59:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJyDCyNk+bkNKTHjtDNKrTYiiFE83mGBOL9Iwu2TX+cl1C6hywkgA9oyMgY2sD4EP6LciIhc X-Received: by 2002:a5b:98a:: with SMTP id c10mr5492796ybq.406.1613642351545; Thu, 18 Feb 2021 01:59:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613642351; cv=none; d=google.com; s=arc-20160816; b=w2aeO7O57o6UBro6Njk8IV7fWbAMfS73TxCzZb5Bbe672+HaR77NhYhgzQs4hcGu5K Jozm+4dXtEqG1QyK/7D8E5sv7hlfRNjjcYeJp0TdulljyiRKWmVqNqc/9x+iRWTks5OX 8Q1mFPx3W1wnLvnbeaVJ56buYf5bW0wkPqi2viCPj/4gGHx/PUhGRtSGxKmP5Y59/484 UPUFesVWvFvcUQ6zqD3K9nRYZAuJiUPU4LRBAnsjimNXJBSuFU+BJkgJRjWLH57M8GMu Xi4lpdQBxhoQvX3+VPIcktwXVs0NkemHhlhmXGi+11sXuzD4/Ts4ZfPWal5VzgxGw8yz IcYQ== 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=82V7f/olgmCGUJKKkrUSBKvz0iIm47HIR/CWbYHF7lk=; b=Zw6Wn6hWhU4hKyo6V5I7Xo+BmQ3691976h7pkq/T8Ey3s7OEQRo4myGznuxzfVA+hw bMRIWbUSpOiLs3H84G2KgBJxc89Gi8xrnWRFG3v0qnFY/JqH0DVj15tQkmNc9w5DbPwt VJwOKB53gYYtJwaVLh+PwQxIDl8NuKvPtKU+IynLVLTPMgm/Xk+iWjhwOSQr2t8K/Vw2 BY/pdriZ76uSe7BmkJUMNNi8PHjLH1cT3mjcEQSmKgGlFSYgRfch7dym57iggUaJzGYW p2WWH85DO6Vu9hjqlfoy14LxBd0KoRWfQvs7k/F3AjdcBWmvRRyywKj6+9GL/aQFUQid RYLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DSfFJZ4h; 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 e59si5605221ybi.158.2021.02.18.01.59.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 01:59:11 -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=DSfFJZ4h; 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]:36350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCg5W-0004OH-U7 for patch@linaro.org; Thu, 18 Feb 2021 04:59:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfzW-0004UM-2x for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:52:58 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:35154) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfzP-0000zx-9u for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:52:53 -0500 Received: by mail-wm1-x330.google.com with SMTP id n10so2410592wmq.0 for ; Thu, 18 Feb 2021 01:52:50 -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=82V7f/olgmCGUJKKkrUSBKvz0iIm47HIR/CWbYHF7lk=; b=DSfFJZ4hNipRSOrhVCLln5V4QfPs+pjv5ScV5r0D5eoKn1gVf3G5f2d/0ySYjcOlFz 6MziG5tKDAfd4KS0N1kvP78EIqyoy438U+/O/Ds6zkx3aLQR1YD5S9SZ4bIZ5uVlUerk IrgDWDT4fG6BTlODg8+HR+bw5/QSS1QmJeePbFKFKyiGhE23UAXL7x5Swc39K9UD/dL8 1PqiKYUs5WXG5jCQQ7WpjhPEa645A7pUmiCnyg28xGrLFkNroLu8L0WgnB8ih1CrVEhY m3amJS60fDiCT0mtq/GaVovMXt/69c6bQSxy/v76WEL0iep0jDt8TrYpfFukBbFSFZXC gRlw== 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=82V7f/olgmCGUJKKkrUSBKvz0iIm47HIR/CWbYHF7lk=; b=qcCPzMVqmb2uPdMbcS6K1guItEh5nXagYs2YBg9g2jTbHK40soC823SCHE3RLMip6J tEGJvyBgXZWRNh23W4JPojtK+1pakHKH6TOL1j+uBiMVlE5AJT8+hgxSuu27090x/aqe OMTC+W2a9dnMWgBMJB976iK8fHAbMgwtN776aOB4D9tWtWrYcZ8WtDcwaJejJPUnYNWa YbP0RL9qhVC3lmdXv6i4kA7t1ZdCx7U6BQygh9CJx2SoIsIOB7CavVYAn4xop0fBzUCK uSq5kL/hZV53d2qXGOwAvaxCwtZAwGefvUfLHoQU3FxFSBZnvrWHN/6MDbgeCVW74uha cXBQ== X-Gm-Message-State: AOAM5305fOi39qerTLgFx/81iQJdinaWn6erwTk6bNtfIiZRxyD9KScC Cr+dvQENtP/JzJb5XposBFfneA== X-Received: by 2002:a1c:e142:: with SMTP id y63mr2754338wmg.163.1613641969980; Thu, 18 Feb 2021 01:52:49 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id m23sm6669575wmc.31.2021.02.18.01.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:52:46 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C07A41FFA9; Thu, 18 Feb 2021 09:47:08 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 19/23] accel/tcg: remove CF_NOCACHE and special cases Date: Thu, 18 Feb 2021 09:47:02 +0000 Message-Id: <20210218094706.23038-20-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-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 , =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , qemu-devel@nongnu.org, Paolo Bonzini 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: <20210213130325.14781-20-alex.bennee@linaro.org> -- 2.20.1 diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index d30c7a84f6..665fe68607 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 72b3c663c5..464b3c3394 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -410,12 +410,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; } } @@ -1634,8 +1628,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; } @@ -1796,6 +1789,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(); @@ -1815,25 +1810,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) { @@ -1906,7 +1896,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: @@ -2445,16 +2434,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 Thu Feb 18 09:47:03 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: 384382 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3543513jao; Thu, 18 Feb 2021 02:08:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwWqtO/BLYA/DeD1of+jJv+pPSNQzgvh+m8lgJ+oPURBNnkO4TccTabGacjUrrBCFK4sbu7 X-Received: by 2002:a25:8146:: with SMTP id j6mr5316359ybm.380.1613642924094; Thu, 18 Feb 2021 02:08:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613642924; cv=none; d=google.com; s=arc-20160816; b=HJog/is72qZ12djFmFUj0YbLV8OYjX/nxGuL2OgstF90t6lJJISfjbAaJOBNU795bM aMXP8CyABDNhASkikSN7ccUj8Nv38giLAF3SoZrnorwmLrm5NaYWxPoaUjin9HDmUArm UnHtOz5nnDkP9vt412f2oaVtAMhzQKChReq+Che+JM7hxNTRvH5Qa1p8fwc3uO9jeh6z RNDMboqMC1Dbn46taIx8l946aFqtXU7auo91R+xQgHwVWkiLkAySanrpuXrtC51zut+Y WqTOlL5JEFZK4qlerVKFeWNkq/zbKXLS6d+9fnXNwATxNVBCwQcCD/HSnFsurs2kWb79 N4/g== 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=Q/vsJEmuwNpAdWuz4axZuxphvvilNTyUvKWq9feBCKI=; b=r48k7EYQcaTYh3UzbgjwzopAIgbTfCXhuKyDhu/7/yneodDWPL0VLsZeudkTOG8Nfu 4yS1IgfJb3nEu5tYq5XSes5Yv5YMP5SV/402DUCJqLwLMDHTiw+iSb15Bhl070QJzHRC 7t3NyZt3rIspk33qY2nhtaXryxI/J/l5Li8UubX4HpaJ50CY4WXjJCGxHJQoqIBLWD9E WggRR0ADThNTZUnZKISH9219qOzSGhqTVgaOnU6TEFqV8p9kvsX1dAg2LnVdRso6FUlf 7FbiQkX6Toxun6XzCE24pXuweGzACIY+qi1jw0GCvjcFjitPwrzMqfgtIm5BujA/VtLu HbZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=G23nOdsp; 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 f141si5093852yba.286.2021.02.18.02.08.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 02:08:44 -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=G23nOdsp; 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]:59222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCgEl-000670-JF for patch@linaro.org; Thu, 18 Feb 2021 05:08:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfza-0004bH-K0 for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:53:04 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:42658) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfzW-00012Q-Iq for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:53:02 -0500 Received: by mail-wr1-x431.google.com with SMTP id r21so2188852wrr.9 for ; Thu, 18 Feb 2021 01:52:58 -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=Q/vsJEmuwNpAdWuz4axZuxphvvilNTyUvKWq9feBCKI=; b=G23nOdspDLsvRcV3joNwI8SMwWDrP041L/IDLJGgrD+ISbNgIwcz0QQfHQmW91mMeo pXXM0OCeowtr+1M63Erg4v2tw76FrGuUREPqvY4Ku+/xQsJU5ZbqmMuJdzDJVTK8YJ2h GK7RSJkGRAsSofEtUlsKESiVzH95lL7+q8upVAgbFckBkO655dg13s9r998uRiJchQxL 9FOVagg5AvBrM/XMcM59MyxdR+RS/oI373yRBu3y/b+4nw+qeJkie4oWxjuBpOmAB8df 4ZaIotQaWbblJOmC7jcFjN7TRQqygNy4f0JG4V+d6nvx8j2HGy7VXO6FHkpgjPxD8zHj fIeg== 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=Q/vsJEmuwNpAdWuz4axZuxphvvilNTyUvKWq9feBCKI=; b=aiJJXd2AkKwSKs/7r1Fo59kLHmx5pqSUHZxWo7L1ddjhJonCsUuPymr7TIBdY+/AR3 HltiHOZEqZ18PX1wzILd6g1aaKV1FzBPkh7Wr87/iFuZtUJwPL2v9DlrS0irxBTzHdv/ YTsYjwz6cnbrVxnp1og4vOdmHLqJwI852W0wk72ZSaXhsXPjUhvHvvYKL7bC/ZffDZIQ G8uSRAegd+uYIgkAMM+uHKRJHp7+zWWx4b8mBy64tyE3/0GUx7pYPQmpcMmjLW/wn2ph CyZ+LpRFz6OL30R4HHnhUMsW/Zx7RLYTAR2Niav3W+3T21oDrpcUI5RK/akisktGtyhx xGRg== X-Gm-Message-State: AOAM5321GZgkmCiw0Ay3imIhwY7m7CBlFYHOTcDPcNFiOd7rJczZ+Y7K qkpX4poCrv5HGkqH3huuKggB3A== X-Received: by 2002:adf:92c4:: with SMTP id 62mr3444352wrn.245.1613641977079; Thu, 18 Feb 2021 01:52:57 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id m1sm6568167wmq.36.2021.02.18.01.52.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:52:52 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E1F251FFAA; Thu, 18 Feb 2021 09:47:08 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 20/23] accel/tcg: allow plugin instrumentation to be disable via cflags Date: Thu, 18 Feb 2021 09:47:03 +0000 Message-Id: <20210218094706.23038-21-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x431.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 , Aaron Lindsay , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Paolo Bonzini 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_MEMI cflag which only allows memory instrumentation for the next TB (which won't yet have been counted). 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 Tested-by: Aaron Lindsay Reviewed-by: Richard Henderson Message-Id: <20210213130325.14781-21-alex.bennee@linaro.org> -- 2.20.1 diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 665fe68607..b7b3c0ef12 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_MEMI_ONLY 0x00010000 /* Only instrument memory ops */ #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/include/exec/plugin-gen.h b/include/exec/plugin-gen.h index 4834a9e2f4..b1b72b5d90 100644 --- a/include/exec/plugin-gen.h +++ b/include/exec/plugin-gen.h @@ -19,7 +19,7 @@ struct DisasContextBase; #ifdef CONFIG_PLUGIN -bool plugin_gen_tb_start(CPUState *cpu, const TranslationBlock *tb); +bool plugin_gen_tb_start(CPUState *cpu, const TranslationBlock *tb, bool supress); void plugin_gen_tb_end(CPUState *cpu); void plugin_gen_insn_start(CPUState *cpu, const struct DisasContextBase *db); void plugin_gen_insn_end(void); @@ -41,7 +41,7 @@ static inline void plugin_insn_append(const void *from, size_t size) #else /* !CONFIG_PLUGIN */ static inline -bool plugin_gen_tb_start(CPUState *cpu, const TranslationBlock *tb) +bool plugin_gen_tb_start(CPUState *cpu, const TranslationBlock *tb, bool supress) { return false; } diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index 841deed79c..c5a79a89f0 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -92,6 +92,7 @@ struct qemu_plugin_dyn_cb { }; }; +/* Internal context for instrumenting an instruction */ struct qemu_plugin_insn { GByteArray *data; uint64_t vaddr; @@ -99,6 +100,7 @@ struct qemu_plugin_insn { GArray *cbs[PLUGIN_N_CB_TYPES][PLUGIN_N_CB_SUBTYPES]; bool calls_helpers; bool mem_helper; + bool mem_only; }; /* @@ -128,6 +130,7 @@ static inline struct qemu_plugin_insn *qemu_plugin_insn_alloc(void) return insn; } +/* Internal context for this TranslationBlock */ struct qemu_plugin_tb { GPtrArray *insns; size_t n; @@ -135,6 +138,7 @@ struct qemu_plugin_tb { uint64_t vaddr2; void *haddr1; void *haddr2; + bool mem_only; GArray *cbs[PLUGIN_N_CB_SUBTYPES]; }; diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 8a1bb801e0..c3dc3effe7 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -842,7 +842,7 @@ static void plugin_gen_inject(const struct qemu_plugin_tb *plugin_tb) pr_ops(); } -bool plugin_gen_tb_start(CPUState *cpu, const TranslationBlock *tb) +bool plugin_gen_tb_start(CPUState *cpu, const TranslationBlock *tb, bool mem_only) { struct qemu_plugin_tb *ptb = tcg_ctx->plugin_tb; bool ret = false; @@ -855,6 +855,7 @@ bool plugin_gen_tb_start(CPUState *cpu, const TranslationBlock *tb) ptb->vaddr2 = -1; get_page_addr_code_hostp(cpu->env_ptr, tb->pc, &ptb->haddr1); ptb->haddr2 = NULL; + ptb->mem_only = mem_only; plugin_gen_empty_callback(PLUGIN_GEN_FROM_TB); } diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 464b3c3394..bbd919a393 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2400,7 +2400,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. @@ -2431,19 +2432,18 @@ 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 limit instrumentation to memory + * operations only (which execute after completion) so we don't + * double instrument the instruction. + */ + cpu->cflags_next_tb = curr_cflags() | CF_MEMI_ONLY | 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..2dfc27102f 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -58,7 +58,8 @@ 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 = plugin_gen_tb_start(cpu, tb, + tb_cflags(db->tb) & CF_MEMI_ONLY); while (true) { db->num_insns++; @@ -100,6 +101,8 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, gen_io_start(); ops->translate_insn(db, cpu); } else { + /* we should only see CF_MEMI_ONLY for io_recompile */ + tcg_debug_assert(!(tb_cflags(db->tb) & CF_MEMI_ONLY)); ops->translate_insn(db, cpu); } diff --git a/plugins/api.c b/plugins/api.c index 5dc8e6f934..0b04380d57 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -84,15 +84,19 @@ void qemu_plugin_register_vcpu_tb_exec_cb(struct qemu_plugin_tb *tb, enum qemu_plugin_cb_flags flags, void *udata) { - plugin_register_dyn_cb__udata(&tb->cbs[PLUGIN_CB_REGULAR], - cb, flags, udata); + if (!tb->mem_only) { + plugin_register_dyn_cb__udata(&tb->cbs[PLUGIN_CB_REGULAR], + cb, flags, udata); + } } void qemu_plugin_register_vcpu_tb_exec_inline(struct qemu_plugin_tb *tb, enum qemu_plugin_op op, void *ptr, uint64_t imm) { - plugin_register_inline_op(&tb->cbs[PLUGIN_CB_INLINE], 0, op, ptr, imm); + if (!tb->mem_only) { + plugin_register_inline_op(&tb->cbs[PLUGIN_CB_INLINE], 0, op, ptr, imm); + } } void qemu_plugin_register_vcpu_insn_exec_cb(struct qemu_plugin_insn *insn, @@ -100,20 +104,27 @@ void qemu_plugin_register_vcpu_insn_exec_cb(struct qemu_plugin_insn *insn, enum qemu_plugin_cb_flags flags, void *udata) { - plugin_register_dyn_cb__udata(&insn->cbs[PLUGIN_CB_INSN][PLUGIN_CB_REGULAR], - cb, flags, udata); + if (!insn->mem_only) { + plugin_register_dyn_cb__udata(&insn->cbs[PLUGIN_CB_INSN][PLUGIN_CB_REGULAR], + cb, flags, udata); + } } void qemu_plugin_register_vcpu_insn_exec_inline(struct qemu_plugin_insn *insn, enum qemu_plugin_op op, void *ptr, uint64_t imm) { - plugin_register_inline_op(&insn->cbs[PLUGIN_CB_INSN][PLUGIN_CB_INLINE], - 0, op, ptr, imm); + if (!insn->mem_only) { + plugin_register_inline_op(&insn->cbs[PLUGIN_CB_INSN][PLUGIN_CB_INLINE], + 0, op, ptr, imm); + } } - +/* + * We always plant memory instrumentation because they don't finalise until + * after the operation has complete. + */ void qemu_plugin_register_vcpu_mem_cb(struct qemu_plugin_insn *insn, qemu_plugin_vcpu_mem_cb_t cb, enum qemu_plugin_cb_flags flags, @@ -121,7 +132,7 @@ void qemu_plugin_register_vcpu_mem_cb(struct qemu_plugin_insn *insn, void *udata) { plugin_register_vcpu_mem_cb(&insn->cbs[PLUGIN_CB_MEM][PLUGIN_CB_REGULAR], - cb, flags, rw, udata); + cb, flags, rw, udata); } void qemu_plugin_register_vcpu_mem_inline(struct qemu_plugin_insn *insn, @@ -130,7 +141,7 @@ void qemu_plugin_register_vcpu_mem_inline(struct qemu_plugin_insn *insn, uint64_t imm) { plugin_register_inline_op(&insn->cbs[PLUGIN_CB_MEM][PLUGIN_CB_INLINE], - rw, op, ptr, imm); + rw, op, ptr, imm); } void qemu_plugin_register_vcpu_tb_trans_cb(qemu_plugin_id_t id, @@ -181,10 +192,13 @@ uint64_t qemu_plugin_tb_vaddr(const struct qemu_plugin_tb *tb) struct qemu_plugin_insn * qemu_plugin_tb_get_insn(const struct qemu_plugin_tb *tb, size_t idx) { + struct qemu_plugin_insn *insn; if (unlikely(idx >= tb->n)) { return NULL; } - return g_ptr_array_index(tb->insns, idx); + insn = g_ptr_array_index(tb->insns, idx); + insn->mem_only = tb->mem_only; + return insn; } /* From patchwork Thu Feb 18 09:47:04 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: 384371 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3534474jao; Thu, 18 Feb 2021 01:57:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJybLB/Yse8W+vjzAzoAPz5uFv0Jn+IPDRhHPt6MKHMY7QaHR7gD9qFiijkM3Y0cmE+0rpDc X-Received: by 2002:a25:4fc3:: with SMTP id d186mr4869439ybb.343.1613642251501; Thu, 18 Feb 2021 01:57:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613642251; cv=none; d=google.com; s=arc-20160816; b=Esm70UN/kD+xYvHkzKJfESda9g0zY/YWSCaKaPobX1PamDFQzTy0kLVAWUaNE+Wjir r2Ux7PVHvdagzlpRds9Mlo/GaRpulk2wADaOikAdlH6oEvDgvh2Zndy2jFRYbwsF9gJb kJC5YQjRbCcrVgXxC7kwn7zd6YBX1Uo720TWytieZyZxY7tAPP69o+zmQ2i52dd6kYlw a+FtNWwCqE3EM5s9AN5D3toAuj2Q6hGARrJanWoukj3wsiRhxYocVA24kFrSyGNtLizh 38v8R/nmuMX4TN6mKQyPpnOzMaDi6lD7/IOIMGEOKA4RyG+KDPMrNrMxy6czx04vWxTu XBng== 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=5rHH5POPbuYAq0YUi5h3icjOV2z6ayt8RsNYkhPgywI=; b=UTnMFxhw1hfp8UxmLoNSWBW+nmNCckiWFniA+5T3xbyuNN49H0mG9CpGnKNP1dgDAb 4+6/BP9nUTSkYwmOtAR3xf4/16ixndWX5CbmfLTPUozV3CDcqUYj+f/Kd2V+z5Ou72BY 2JnivnK0wUikamBD/+op1uvDiibFHhk19kVX3BbJsHtJX9PvAiZnivWQSvVpgJZWFc6G Y5RGehI2e3IolTOKs3JRDX/yJjxTG1la99MSlOuDPAH0IbA1ETOSs23/ju4l8cpRZFuJ btD5GaRiVHNXN5Zc93qTOTzBzKvzepoc18gKXaB+LHsymySqZZgUgSkYJkCAxp2wYUbu F1PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JRIu0Q8b; 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 w32si5346586ybi.16.2021.02.18.01.57.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 01:57: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=JRIu0Q8b; 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]:55492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCg3u-0000cl-Vn for patch@linaro.org; Thu, 18 Feb 2021 04:57:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfuL-00078Z-UM for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:37 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:40049) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfuE-0007IH-T4 for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:37 -0500 Received: by mail-wr1-x42d.google.com with SMTP id v14so2183321wro.7 for ; Thu, 18 Feb 2021 01:47:30 -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=5rHH5POPbuYAq0YUi5h3icjOV2z6ayt8RsNYkhPgywI=; b=JRIu0Q8b0SW4GfxGiaw6/sHNFqj/lFNVIV+YXe+wewONsWwevOm64mU2pRyeDuul+6 B5DAuphar1fzmIjAvpR3Ks87oS+4YS7PYk5h3lyIiE1nVh9dJTkrFzhl/lLSBEzMZW9E vg5sHvniW2pcTt72wXftNpIzPSg/ASEkaANFdLcZkdBE+8k5RPfhog36EhFdfvZi+r3w UUo13d2OszGto+k4rjE0T6KcjyBpG/Cy4kcjlB8SN7VWbC9hBhyc2qmDxqv14fiq5MQi 7TyEr2HZVZnK1EwfYYCs5mP7Im9sDqUcQ7olyiddzHj2+oLxG4oCc2c8v5mcsDacQUKn pSYQ== 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=5rHH5POPbuYAq0YUi5h3icjOV2z6ayt8RsNYkhPgywI=; b=afWF82FJSfiojwJgqklkm9lGESNQ/t7f6S9U8jcEJjz9FIIfADD227AybzJtS9RMKb NA+O3m97VZc51mo3FAIEevgKZibOv5z2YtPSMIrqxOH15SoSSKRCFHwWHDI0d7PHl8zh O4qZpDEfKGilD/XGAPk9Ty1O8TSZnuEITiIZqbJb0fbLRmfWxasf3BWfhlmBtVSeoKVZ LQvQl94TvfPdcideBjmo4tM3oD81OpmcDelYG+M5m9XOOa530HRIt4lja9ItboG6fnFD SdZikDyVLUfZFsupgcPDPr6wcZfEXj88vfDr8beTcVXP7eXRq3StGbG3CBPnpi/EHZE7 87vw== X-Gm-Message-State: AOAM531azktT/auUDnKqfDQ+bxFuQWwsFO+f8zbbqPzjNRwRa2xQa1x5 3PT8rxt45kuCodnSwFT6SqmPuA== X-Received: by 2002:adf:e5d1:: with SMTP id a17mr3583259wrn.260.1613641649512; Thu, 18 Feb 2021 01:47:29 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id l7sm8319898wrn.11.2021.02.18.01.47.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:47:23 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 031BD1FFAB; Thu, 18 Feb 2021 09:47:09 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 21/23] tests/acceptance: add a new tests to detect counting errors Date: Thu, 18 Feb 2021 09:47:04 +0000 Message-Id: <20210218094706.23038-22-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42d.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?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Wainer dos Santos Moschetta , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cleber Rosa , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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 Tested-by: Wainer dos Santos Moschetta Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210213130325.14781-22-alex.bennee@linaro.org> -- 2.20.1 diff --git a/tests/acceptance/tcg_plugins.py b/tests/acceptance/tcg_plugins.py index adec40d3a5..b1ba10498f 100644 --- a/tests/acceptance/tcg_plugins.py +++ b/tests/acceptance/tcg_plugins.py @@ -89,3 +89,29 @@ def test_aarch64_virt_insn(self): m = re.search(br"insns: (?P\d+)", s) if "count" not in m.groupdict(): self.fail("Failed to find instruction count") + + 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") + + self.run_vm(kernel_path, kernel_command_line, + "tests/plugin/libinsn.so", plugin_log.name, + console_pattern, + args=('-cpu', 'cortex-a53', '-icount', 'shift=1')) + + 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(): + self.fail("detected repeated instructions") From patchwork Thu Feb 18 09:47:05 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: 384367 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3531156jao; Thu, 18 Feb 2021 01:54:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJw4+CIVSNYiLK43lNmUzRGRgm2UXQs5xfH3i7EieyLItUiJeNHEHLfd0v+zYR11gBT+ecyd X-Received: by 2002:a25:67d6:: with SMTP id b205mr4919268ybc.394.1613642064339; Thu, 18 Feb 2021 01:54:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613642064; cv=none; d=google.com; s=arc-20160816; b=SoJmka0NftuacQSlZ+Sa8x/IZzPTzE5/32f59gKx/KOmBmMVSARB/orAmOVGhXgQu6 1zF5cxzIzKvDKP05ykiq3Fgc7kJx6PMYFQc5l+z6gofNHY0FVDKpqh1qAT4VusT7sqoH Gbu8aNDMRMZU1T8lKqNNfC2IbI5xcwrUAxL5tvYeY94ISVdlNqdHs35TQp20OzxYjHAi 1R5PDtUNOovjaLPD7FTfn0rA7CtNq6Nxs7vuGdL/DREakPvrr+hgIG28/cAvjDjaZKhC kCf/iXNbVWuQ52CwYHfH9q76HILBnulNmX4jx7m1X0xmMKweolHY+89qtP3sd5L1wNGw cbPA== 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=NGFgZyHCr3fksW5dEZw0mEN72Dlgf8OF7X/v8VpUACc=; b=IPvZjzm6ZR4tHUW0chi1/KeXX2+7e2m6WITZAhEAfsFXxFB9si2uAQev+HNf9V3LVw ezVR4RzwO88Qkx4CJAWCXtk7clxNw1P5+oWOuZcuHSpD4Il7piXVUYDJNpEmQkGxw+3h OfvYHvgkZA6+KwOoH9WlowCHBspcJ4QP/eS3rqlIfAX7WSXOJL6DYwz7hurTQQ+xMe+F mkdmd3tVvaHZQAaYFL0WW6C0CAXg4mFETZ7vSdSGOxjISVWTaI7TnCkJ0g7BRrjpuxhy zM0GYJZw3PZb3I1UqaFnoNperNykWfZHir6+wYYn81nPcZWMWn4xivCWVzBVNAenypyf 4+Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HQ+RDiMU; 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 v15si952495ybb.119.2021.02.18.01.54.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 01:54:24 -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=HQ+RDiMU; 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]:46468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCg0t-0005Ho-P2 for patch@linaro.org; Thu, 18 Feb 2021 04:54:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfuN-0007Bp-6x for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:39 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:32775) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfuJ-0007JA-P5 for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:47:38 -0500 Received: by mail-wr1-x435.google.com with SMTP id 7so2223659wrz.0 for ; Thu, 18 Feb 2021 01:47:35 -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=NGFgZyHCr3fksW5dEZw0mEN72Dlgf8OF7X/v8VpUACc=; b=HQ+RDiMUEMcu+tAe8zS6ItqdlX0PXgjO9Tr8r6zH/Bvwp2ah57ltg5XECWAr0ww3Hk 5VnpRzV4LFsS+Yr6j782Ht/9+MzgYA28dsAP3gm+VzYpevzsjg/mv2MH9PvKyAjMRoru T93Q+JtqF8n1mdiCgnVf9FmtidsGFLqivOr6XnhkO+xnRq+E85ClB07pHpdy9RdRyyNN AmmMgjBgZ8sifgfVpUTg7OVeBIZAQ7gK3Mac3tDqWrpxlOT/gqI2FgAsWnXD8MoHqYbV 6qYuMdNOLbK30eKaFu0TaneyVpZwc14eUPkg6oOjAZ67L0Zzr8b7fi7vODDcDobnauxS ewbg== 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=NGFgZyHCr3fksW5dEZw0mEN72Dlgf8OF7X/v8VpUACc=; b=VMv22M1t0rwCTyamoZnedkX5J4o12QgItf+twH9wmuYJ+3QGNMgzOlp1FXRAZesmYq p0iJLmK1auUYVuZEMRLE85EBDfd/XD6ZpdPt0d65lEUqm/W4Et+LV3E2G2Euy1z5h1mV QC8mw0sXTMiXIwF7zbcZlt1zqGaSKQ0ET046TUcPjgsNPZXdKk0JJa72bcPLyh0186+w NS8OGyF5KO999z3jrOksKYIGult7XFrTPETKR1lRaLzHzRwBONcHKfyV1scmno3AWD3f r7s2Rwe6HKnz3kS28uEIhamxbItYPnopWZXszhNC26siMpaxIjMEunfRa/inYnzsOuM0 +Ksg== X-Gm-Message-State: AOAM532gkx/IodUeO+Fn1iCZAUrLjtl5X7D5fSYXT009HMkQiBb28PVu C6tkog8wscHaYmEOIKv81eEVcg== X-Received: by 2002:a5d:680e:: with SMTP id w14mr3420339wru.322.1613641654194; Thu, 18 Feb 2021 01:47:34 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id f17sm7893560wru.31.2021.02.18.01.47.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:47:23 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 186861FFAC; Thu, 18 Feb 2021 09:47:09 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 22/23] tests/plugin: allow memory plugin to do both inline and callbacks Date: Thu, 18 Feb 2021 09:47:05 +0000 Message-Id: <20210218094706.23038-23-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x435.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 , =?utf-8?q?Alex_Benn?= =?utf-8?b?w6ll?= , qemu-devel@nongnu.org, =?utf-8?q?Philippe_Ma?= =?utf-8?q?thieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is going to be useful for acceptance tests that check both types are being called the same number of times, especially when icount is enabled. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210213130325.14781-23-alex.bennee@linaro.org> -- 2.20.1 diff --git a/tests/plugin/mem.c b/tests/plugin/mem.c index 4725bd851d..afd1d27e5c 100644 --- a/tests/plugin/mem.c +++ b/tests/plugin/mem.c @@ -16,9 +16,10 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION; -static uint64_t mem_count; +static uint64_t inline_mem_count; +static uint64_t cb_mem_count; static uint64_t io_count; -static bool do_inline; +static bool do_inline, do_callback; static bool do_haddr; static enum qemu_plugin_mem_rw rw = QEMU_PLUGIN_MEM_RW; @@ -26,7 +27,12 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) { g_autoptr(GString) out = g_string_new(""); - g_string_printf(out, "mem accesses: %" PRIu64 "\n", mem_count); + if (do_inline) { + g_string_printf(out, "inline mem accesses: %" PRIu64 "\n", inline_mem_count); + } + if (do_callback) { + g_string_append_printf(out, "callback mem accesses: %" PRIu64 "\n", cb_mem_count); + } if (do_haddr) { g_string_append_printf(out, "io accesses: %" PRIu64 "\n", io_count); } @@ -42,10 +48,10 @@ static void vcpu_mem(unsigned int cpu_index, qemu_plugin_meminfo_t meminfo, if (qemu_plugin_hwaddr_is_io(hwaddr)) { io_count++; } else { - mem_count++; + cb_mem_count++; } } else { - mem_count++; + cb_mem_count++; } } @@ -60,8 +66,9 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) if (do_inline) { qemu_plugin_register_vcpu_mem_inline(insn, rw, QEMU_PLUGIN_INLINE_ADD_U64, - &mem_count, 1); - } else { + &inline_mem_count, 1); + } + if (do_callback) { qemu_plugin_register_vcpu_mem_cb(insn, vcpu_mem, QEMU_PLUGIN_CB_NO_REGS, rw, NULL); @@ -90,6 +97,12 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, } if (!strcmp(argv[0], "inline")) { do_inline = true; + do_callback = false; + } else if (!strcmp(argv[0], "both")) { + do_inline = true; + do_callback = true; + } else { + do_callback = true; } } From patchwork Thu Feb 18 09:47:06 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: 384378 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3541095jao; Thu, 18 Feb 2021 02:05:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJy96+fJVEF+4THfLgiFPafz1umRI2yZLq5wC2me9Uq1WViBn4PcOsRzpsDGlz9YSL5Kmm8A X-Received: by 2002:a25:c506:: with SMTP id v6mr5517524ybe.266.1613642736233; Thu, 18 Feb 2021 02:05:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613642736; cv=none; d=google.com; s=arc-20160816; b=E/EPMdPTOL9FFIMcxfuDajq7a4KYol7euihe8FpoWvUOK3IUGp/3832/tj6txuYEP+ Ye6+DrqqQNc8TB19Gk6drzuRAk+wAbrbiL6CyIWzQGHRchESaXwDg0+3oPq/y2cEbrmU DD9p1nqyBnES/ePOWKUMyhPgblDqpoO2j4oLUtrIjuEIuazfw5tJaUXJynJOVa+sGz5e /M4/x8RugDJ7GqUCft9Uh6mmm9K6/vuMbCcs4j8p7WPU3JvLyn/BjTXOnt0XKLYAPMNL SEJN/xfOAt/AdA9hTtNdP3q1gzLeLzCUtMVS5R9PTlqIGpC9DINx5qRmbpgm/4GxNkqq BYKQ== 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=3UFgwBYMWW+cA/Y1jKLdTryuQ+jpOBq3LyRLsc4984U=; b=wm5ogGIURONahq8QHwPfEWqAXZ6CFFyuG0o2LSjKaeAtKTCsbunecfnGh1f1A39kvg Tvu+MFsocWZtMHvurUYseKK1ldpEDz4yh7vztQXVag0c5BmDTZU3Tz566KZjV1OHcbyD ILvOcxTh0+Oj6Ti9hqBhLMyWWDp/nVudS1/9iV7vYEFZRehl8ALy0Wh1AgzNEq0uvIP1 PGtn/S4toLxlIwv6JCG8gTK/ZcP1umP4NCM6WZFb98BsnDoiFIgIDAbNxnE8dYybaaOw 5tXs1C1gklDiHlDANU2u7xvr75Gou5oQm/l7pJvZeOUYULaSgmxFNa7XnW2ja4Q+Oa3z //lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kBv5Z5er; 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 x6si5368604ybq.233.2021.02.18.02.05.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Feb 2021 02:05:36 -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=kBv5Z5er; 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]:52208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCgBj-00030X-Lt for patch@linaro.org; Thu, 18 Feb 2021 05:05:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54334) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCfzX-0004Yz-Vz for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:53:00 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:45138) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCfzW-00012K-6n for qemu-devel@nongnu.org; Thu, 18 Feb 2021 04:52:59 -0500 Received: by mail-wr1-x42e.google.com with SMTP id f7so1051259wrt.12 for ; Thu, 18 Feb 2021 01:52:55 -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=3UFgwBYMWW+cA/Y1jKLdTryuQ+jpOBq3LyRLsc4984U=; b=kBv5Z5erlb5fnJAVUkisVYukR44IXiXmtMmw4AcoPbVgQ16u6e0W+m//x/+d7ckobe BvJ3YpUsGpGd/J+vekJ0jC8R6yMgSC5LYKU2y0YgPOuq9lzZKQUP4LA6NtYYRGZ1o9Ri mGPx5jTYZaZyHPtkheLJTltRqAaJcuqjEwICaOT0uA5nQVbWWLazDo/plk5m431Mxay5 76RHpXlmgRKZeBZdcQFfbDIKrQ8NQC95XdMv9RGc9l01xhEDmyjZH4YGC9ah7xzyLtIT yPtaiYxY3K7x5Oxz9z0usApkEmUJWdqJXEe0KAHebt4UY+scia5UTWjaCHz2b8WDWnt1 oaAA== 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=3UFgwBYMWW+cA/Y1jKLdTryuQ+jpOBq3LyRLsc4984U=; b=UkUjpeMe581q93iew9qby6lBvJGjORQtqyxtKnXapx8HDaZSL2tY4q70iWMc4iVNqk BETb9p1ZurqD/DpOjitu+8HpMrJPynaHvaia16uxMBXu/UQ0rJGIiPjo3pkdHqPug3Bv 5auato4JAHrtfRlUN3vcp5b/jsx3tqQRcflMX1x17V0648Sonr/V7ESvmqp8E/aaYZ1u 3rydwVQMR5l+erLrlIETRdqzvba92UT4qaypfSMXj7mm3PdDuLATvQNCkuc3ucnimRaL b9lLqhMJXeZri15U19vV7+dREoMp5oEZK647oRdadywCL1Hlrs+ZhobpAPcRE5QFcB+b JUfg== X-Gm-Message-State: AOAM532xwHEdVsIOtBqrQwmJpToeSlgqjkNjeoueydBSvwcWwYlCtpdH f09+n2DkGw8zOfcXMfpM0zLRHQ== X-Received: by 2002:a5d:6d06:: with SMTP id e6mr3517185wrq.425.1613641974578; Thu, 18 Feb 2021 01:52:54 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id v15sm8140158wra.61.2021.02.18.01.52.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 01:52:52 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 2D0F41FFAE; Thu, 18 Feb 2021 09:47:09 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 23/23] tests/acceptance: add a memory callback check Date: Thu, 18 Feb 2021 09:47:06 +0000 Message-Id: <20210218094706.23038-24-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210218094706.23038-1-alex.bennee@linaro.org> References: <20210218094706.23038-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42e.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?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Wainer dos Santos Moschetta , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cleber Rosa , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This test makes sure that the inline and callback based memory checks count the same number of accesses. Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20210213130325.14781-24-alex.bennee@linaro.org> -- 2.20.1 diff --git a/tests/acceptance/tcg_plugins.py b/tests/acceptance/tcg_plugins.py index b1ba10498f..c21bf9e52a 100644 --- a/tests/acceptance/tcg_plugins.py +++ b/tests/acceptance/tcg_plugins.py @@ -115,3 +115,34 @@ def test_aarch64_virt_insn_icount(self): m = re.search(br"detected repeat execution @ (?P0x[0-9A-Fa-f]+)", s) if m is not None and "addr" in m.groupdict(): self.fail("detected repeated instructions") + + def test_aarch64_virt_mem_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") + + self.run_vm(kernel_path, kernel_command_line, + "tests/plugin/libmem.so,arg=both", plugin_log.name, + console_pattern, + args=('-cpu', 'cortex-a53', '-icount', 'shift=1')) + + with plugin_log as lf, \ + mmap.mmap(lf.fileno(), 0, access=mmap.ACCESS_READ) as s: + m = re.findall(br"mem accesses: (?P\d+)", s) + if m is None or len(m) != 2: + self.fail("no memory access counts found") + else: + inline = int(m[0]) + callback = int(m[1]) + if inline != callback: + self.fail("mismatched access counts")