From patchwork Mon Mar 28 15:26:13 2022 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: 554816 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1248:0:0:0:0 with SMTP id z8csp8649585mag; Mon, 28 Mar 2022 08:27:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyy8wndE6l3ofcbbzye6vcRKPn40B33lW3+yd6bSxR+lc0vsjjK0iI63pJI25E9lUNGfNo X-Received: by 2002:a25:508b:0:b0:633:8827:602e with SMTP id e133-20020a25508b000000b006338827602emr23736828ybb.524.1648481268382; Mon, 28 Mar 2022 08:27:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648481268; cv=none; d=google.com; s=arc-20160816; b=Dm1FcedVrU45iDgUuKvTzFzhBYl6KI36fCdeaYYOFHGZb3ejhYiNYr0bcMMClSu/D7 W2u8XecTATizKdRlqMxiJbEB5Z9gb2ttUJeHBNI77bYivbWd3iILLliC9m5cCjzxs1MT JfsEuOb05pcsxLS9dijsdj830FXklwv+tZtsjMH9nLCNPLJUvsnmbZXcqZx/wxq8EY2N WwcQLmgQ853bvo6nzwAQEFZvLxt4WFTMraj+8j+UH+booRTNT8sWc2NNjuR1vhaXZxtt MX2xH0NH8dNcqdm78oPXI4SHsDQriaXZmJvbMqqWIgEPlOu8Dl/PIo9WCmp8YkVE7dga RUQQ== 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=Gs6DhXXH3OheiODrWMr7bw7KN+vJ8pkDZF2hBYggHlU=; b=aSfpvtjPkKVU372IyH3PHuqu1AzrFaRA5TYrEPJX8Am7zTAafzFnhj0McQLeFXSlzC n5r30zzOeCrIOXSQTbK6qNeWT86H7bt5hhGFbBl37WMeGPdyXIVOTvizTGcl3vOQY1Vh 6SXCWoxa9j/iAGXni3JXVhCjDLvJ1hfl7q3sIbsrpphdGj+TfDt7UfUXrQi79tIqbgmV 4DaB+J33LMsqGJI2sh/LOiPBi+rqeibyQQUXiRZq1UHQc77O0ZKCiEu5m8v5R+M7w6Fn /+1eMO5Hi70cQ+WtDfAdGPYj8AaoZPXzJ58L10GA8BOG11+STL6L6Vh9Njp8GSGgcFAA 8pZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hzILFza1; 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 a4-20020a816604000000b002e5bb9dcaccsi12583423ywc.341.2022.03.28.08.27.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Mar 2022 08:27:48 -0700 (PDT) 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=hzILFza1; 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]:46916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nYrHX-0001H8-Tj for patch@linaro.org; Mon, 28 Mar 2022 11:27:47 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nYrGC-0001Bh-Gr for qemu-devel@nongnu.org; Mon, 28 Mar 2022 11:26:24 -0400 Received: from [2a00:1450:4864:20::430] (port=46658 helo=mail-wr1-x430.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nYrG9-0001Zj-74 for qemu-devel@nongnu.org; Mon, 28 Mar 2022 11:26:23 -0400 Received: by mail-wr1-x430.google.com with SMTP id h4so20897142wrc.13 for ; Mon, 28 Mar 2022 08:26:20 -0700 (PDT) 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=Gs6DhXXH3OheiODrWMr7bw7KN+vJ8pkDZF2hBYggHlU=; b=hzILFza1vrZqmYLvxSUj9kpCO9FV0eSlPYzEsioEDGpcPFDZL5RGB6zjYhEtyywUXx kCMYT1a525TzI1E1pqKGW5un6YzKfKrPEGfTew2+UzIJQk49Gf+rzX8x2s9KpA3qDvgC mgzVryKPf/J+fE9xrM4Oah34IOXoZpgRIDPoFaxAx3FdVqOcsi5AX6U5ODhyz45fs1Rn mpw+sXfttM9Nnlk9zglvDRNPDW8mfruym7FsCEv9XIHGuDXEPvved680MCjB9u2K2h8m br2BCnjzYmDXC97U3jx8KI+dyU3uGriWsY/ZDHL5uY+gwXlETibsLLfLpEgizA8FQyqh TfXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gs6DhXXH3OheiODrWMr7bw7KN+vJ8pkDZF2hBYggHlU=; b=ImGutVyqGr5/1vnji7VsUi4BWEbLx0MzP2lmCpSh60By1IQPoc8uGOlQOURekDQofb bA3+6pGPumAid1OZdPkk8etDZWvfasywPH/7+bCZnnygCADYXdzRllCEHWfXaKbwffX/ +e4FkZEvY+urKr79WAdhOIdpSLUESCv1JSWF3vXdpn2Iu0ISugn/HYmq6FRfpAhxoyS7 jlMGqWWhUvtdtsXoX90jdhLeRgPzXlCdq4y9jS6EH3gP3Zz2hIpSyGlT9cKMDn1qvcWP 8oSM9WG0y7OdVxK4uLpHtg6ZOVXfsvmyWDIKUbiZ/3ARGKkFWf3WHNxhHscGhBNIbYz/ gy3g== X-Gm-Message-State: AOAM532hd5TaEblDLT8sWA6Dr8iEHPSiWEyq88zPzSxhSBFGwhFTw66F 0U62kzY5rwsK9QoJNPwOfocZxw== X-Received: by 2002:a5d:460c:0:b0:204:62a:210c with SMTP id t12-20020a5d460c000000b00204062a210cmr24131056wrq.460.1648481178845; Mon, 28 Mar 2022 08:26:18 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id i1-20020a05600c354100b0038cceb205besm12097704wmq.7.2022.03.28.08.26.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 08:26:15 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 95E831FFB8; Mon, 28 Mar 2022 16:26:14 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 1/2] tests/tcg: add memory-sve test for aarch64 Date: Mon, 28 Mar 2022 16:26:13 +0100 Message-Id: <20220328152614.2452259-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220328152614.2452259-1-alex.bennee@linaro.org> References: <20220328152614.2452259-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::430 (failed) 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: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , aaron@os.amperecomputing.com, robhenry@microsoft.com, mahmoudabdalghany@outlook.com, minyihh@uci.edu, cota@braap.org, Luke.Craig@ll.mit.edu, kuhn.chenqun@huawei.com, ma.mandourr@gmail.com, =?utf-8?q?Alex_Benn=C3=A9e?= , "open list:ARM TCG CPUs" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This will be helpful in debugging problems with tracking SVE memory accesses via the TCG plugins system. Signed-off-by: Alex Bennée Cc: Robert Henry Cc: Aaron Lindsay --- tests/tcg/aarch64/Makefile.softmmu-target | 7 +++++++ tests/tcg/aarch64/system/boot.S | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/tcg/aarch64/Makefile.softmmu-target b/tests/tcg/aarch64/Makefile.softmmu-target index a7286ac295..cc02814065 100644 --- a/tests/tcg/aarch64/Makefile.softmmu-target +++ b/tests/tcg/aarch64/Makefile.softmmu-target @@ -31,6 +31,13 @@ LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc memory: CFLAGS+=-DCHECK_UNALIGNED=1 +memory-sve: memory.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) + +memory-sve: CFLAGS+=-DCHECK_UNALIGNED=1 -march=armv8.1-a+sve -O3 -fno-tree-loop-distribute-patterns + +TESTS+=memory-sve + # Running QEMU_BASE_MACHINE=-M virt -cpu max -display none QEMU_OPTS+=$(QEMU_BASE_MACHINE) -semihosting-config enable=on,target=native,chardev=output -kernel diff --git a/tests/tcg/aarch64/system/boot.S b/tests/tcg/aarch64/system/boot.S index e190b1efa6..f136363d2a 100644 --- a/tests/tcg/aarch64/system/boot.S +++ b/tests/tcg/aarch64/system/boot.S @@ -179,12 +179,13 @@ __start: isb /* - * Enable FP registers. The standard C pre-amble will be + * Enable FP/SVE registers. The standard C pre-amble will be * saving these and A-profile compilers will use AdvSIMD * registers unless we tell it not to. */ mrs x0, cpacr_el1 orr x0, x0, #(3 << 20) + orr x0, x0, #(3 << 16) msr cpacr_el1, x0 /* Setup some stack space and enter the test code. From patchwork Mon Mar 28 15:26:14 2022 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: 554815 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1248:0:0:0:0 with SMTP id z8csp8649471mag; Mon, 28 Mar 2022 08:27:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcWJcT1/zopsXCFHEXWcHt26/p08PqM3bcxv7wJ1C0uuIs9YHBaQj+gtI9Gisghi8JYdPz X-Received: by 2002:a81:1dd1:0:b0:2ea:c38b:65a8 with SMTP id d200-20020a811dd1000000b002eac38b65a8mr25548ywd.135.1648481262584; Mon, 28 Mar 2022 08:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648481262; cv=none; d=google.com; s=arc-20160816; b=kaTofhUQvih2+iOFcpxYICt62mtO4H2S8skuRABltgEn2PkoABln7KZd5k7UTr25JA lqby+WT1QUTM+3AIw0AceVLim6F93lngEFLRPqi78YhU3kJohmPt0cdxrmr6rxzoBBjE WjWpmdKGIl2a+M7g3omEJ0GckvfTR4vKv2GqfNJ/M5r3t2rreTAv2TUftMG+EBTfCjJF UMRaDxR5QzQ1VYpOeVAnxQbfyl8qdDK6UMNHMQwL48dfXbZygy7GkYkAnYBacGQfxyzj RftAdxZ+XWIbRU28IpNlU6SO7D6LxtujrmRmon0Sam4W52BgwqWlS5e3SLt+mZLbHCJs 76Lg== 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=pBymOyMO/SSZAGGx1Pb+hhWQVZJ3zv96epfxxyIA1f8=; b=adkFiXO7xC39+/lEEZMmezBMVxtDGhtQy14WtHj6vyJ1JReFygbI1siKIcIggYjCk6 iZYPNdfpnlp6+8ZkWa7QabE1BZYZJmLJNSbr2pLySCXVHnsygoW9eBw3kufn9o+ZTfUT XQwQlVJe+wGvPRvQHMoLJlZW5rnMNUaVNsgH3YUX3Tdxb1LqjRVKoBtfN2qxist7LzkM BPM++pqK62xO+niK7v5j1aff8duV6dH+JH7KRu7qyw6UDEAGTG1913rH6g3XzBnWj/j0 X4x6XqEcQwgLgz8MO9Ep9CxgRQqtRKe1gZtgANXIXoVyiYlObUnEwRXBQuQwS9BKk/J8 R9sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PIKcJefz; 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 z130-20020a256588000000b0063399404433si14997487ybb.157.2022.03.28.08.27.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Mar 2022 08:27:42 -0700 (PDT) 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=PIKcJefz; 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]:46874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nYrHS-0001Cj-4y for patch@linaro.org; Mon, 28 Mar 2022 11:27:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nYrGB-0001AZ-30 for qemu-devel@nongnu.org; Mon, 28 Mar 2022 11:26:23 -0400 Received: from [2a00:1450:4864:20::42e] (port=36421 helo=mail-wr1-x42e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nYrG9-0001Zh-6e for qemu-devel@nongnu.org; Mon, 28 Mar 2022 11:26:22 -0400 Received: by mail-wr1-x42e.google.com with SMTP id u3so20956795wrg.3 for ; Mon, 28 Mar 2022 08:26:20 -0700 (PDT) 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=pBymOyMO/SSZAGGx1Pb+hhWQVZJ3zv96epfxxyIA1f8=; b=PIKcJefzj3XBteOn+U+RFOhN5tOac/ABahktH9M3nd+prY3I7NraKALPpXDQYqDAXL n3z83rUMUg3GgiO9Q6nFyn4hlwE49YuT+uTm5qDuJ1gkM8bvW+2t8BCNonG/6peba7rl 9KCUBzBtkzWcNIoVlnbzDHbSWA9pb2buA7sZ4aawes1IsWocBGCd611U83WpybUXu/jB zaxlJhu8dHPwVJE5/O39+7klXD2u5XnOsR8uaKTjxHx8fXp8VDDdDcbNsn5Hw5Edd56F Qfo+PwmtFb+VasuQTyqEYA3PLOpu1VkX2xgdAYsTXMRVI4koUT1gNjjzq8hOjYmzmOiX SWag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pBymOyMO/SSZAGGx1Pb+hhWQVZJ3zv96epfxxyIA1f8=; b=WD87QjIpl9C8zRjVh1osYQ3zTymrUIcphgcSBVYd1gqOf7UJ7c1YJ2Fa2gdrjGqIh5 AheK7w0KSO9SRTNCnLijr6Ev8B5N/SPS0FVsi5DzEjm5TZ+7wjdUb5+h8tWqNvR3qEUb qs4LEgU90RZS1mmLsiIsifoUuaQJ3rO2BsyMV5Z/ivKePdJlVEZWRBIhEYr/HzTKh4h4 Ch10tLTyTXBWgISYPxUPEwBTh3gA27umZZ3uhqWZUJI+455PHplZBVS5Ieh5H5uRmdMB caGGMuPPSkhcbmn3jBJ1rfbxvIbKqNVb5xceMO2sMI8Wt+aGCaWMXq2831SS0gDSU5vZ Dacg== X-Gm-Message-State: AOAM533LDj6tfQ8aBxxu7JhThlmS0U9udFUNsGWdYMmXQ6lqXyvpI8gv r7ZEAFZXqky5dyEnJVvvSN0RbQ== X-Received: by 2002:a5d:4812:0:b0:205:c541:3e92 with SMTP id l18-20020a5d4812000000b00205c5413e92mr5278127wrq.485.1648481177569; Mon, 28 Mar 2022 08:26:17 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id n8-20020a5d5988000000b00203d5f1f3e4sm13722573wri.105.2022.03.28.08.26.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 08:26:15 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id AF6321FFBA; Mon, 28 Mar 2022 16:26:14 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 2/2] plugins: extend execlog to filter matches Date: Mon, 28 Mar 2022 16:26:14 +0100 Message-Id: <20220328152614.2452259-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220328152614.2452259-1-alex.bennee@linaro.org> References: <20220328152614.2452259-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42e (failed) 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: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aaron@os.amperecomputing.com, robhenry@microsoft.com, mahmoudabdalghany@outlook.com, minyihh@uci.edu, cota@braap.org, Luke.Craig@ll.mit.edu, Alexandre Iooss , kuhn.chenqun@huawei.com, ma.mandourr@gmail.com, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Sometimes the whole execlog is just two much so add the ability to filter by instruction opcode or address. [AJB: this shows for example .qemu-system-aarch64 -display none -serial mon:stdio \ -M virt -cpu max \ -semihosting-config enable=on \ -kernel ./tests/tcg/aarch64-softmmu/memory-sve \ -plugin ./contrib/plugins/libexeclog.so,ifilter=st1w,afilter=0x40001808 -d plugin -D plugin.out the st1w SVE instruction is not instrumenting its stores.] Signed-off-by: Alex Bennée Cc: Robert Henry Cc: Aaron Lindsay Reviewed-by: Alexandre Iooss --- docs/devel/tcg-plugins.rst | 9 +++- contrib/plugins/execlog.c | 96 ++++++++++++++++++++++++++++++++------ 2 files changed, 90 insertions(+), 15 deletions(-) diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst index a7cc44aa20..a503d44cee 100644 --- a/docs/devel/tcg-plugins.rst +++ b/docs/devel/tcg-plugins.rst @@ -346,7 +346,7 @@ The execlog tool traces executed instructions with memory access. It can be used for debugging and security analysis purposes. Please be aware that this will generate a lot of output. -The plugin takes no argument:: +The plugin needs default argument:: qemu-system-arm $(QEMU_ARGS) \ -plugin ./contrib/plugins/libexeclog.so -d plugin @@ -364,6 +364,13 @@ which will output an execution trace following this structure:: 0, 0xd34, 0xf9c8f000, "bl #0x10c8" 0, 0x10c8, 0xfff96c43, "ldr r3, [r0, #0x44]", load, 0x200000e4, RAM +the output can be filtered to only track certain instructions or +addresses using the `ifilter` or `afilter` options. You can stack the +arguments if required:: + + qemu-system-arm $(QEMU_ARGS) \ + -plugin ./contrib/plugins/libexeclog.so,ifilter=st1w,afilter=0x40001808 -d plugin + - contrib/plugins/cache.c Cache modelling plugin that measures the performance of a given L1 cache diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c index a5275dcc15..e659ac9cbb 100644 --- a/contrib/plugins/execlog.c +++ b/contrib/plugins/execlog.c @@ -20,6 +20,9 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION; /* Store last executed instruction on each vCPU as a GString */ GArray *last_exec; +static GPtrArray *imatches; +static GArray *amatches; + /** * Add memory read or write information to current instruction log */ @@ -85,12 +88,13 @@ static void vcpu_insn_exec(unsigned int cpu_index, void *udata) static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) { struct qemu_plugin_insn *insn; - uint64_t insn_vaddr; - uint32_t insn_opcode; - char *insn_disas; + bool skip = (imatches || amatches) ? true : false; size_t n = qemu_plugin_tb_n_insns(tb); for (size_t i = 0; i < n; i++) { + char *insn_disas; + uint64_t insn_vaddr; + /* * `insn` is shared between translations in QEMU, copy needed data here. * `output` is never freed as it might be used multiple times during @@ -99,20 +103,52 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) * a limitation for CISC architectures. */ insn = qemu_plugin_tb_get_insn(tb, i); - insn_vaddr = qemu_plugin_insn_vaddr(insn); - insn_opcode = *((uint32_t *)qemu_plugin_insn_data(insn)); insn_disas = qemu_plugin_insn_disas(insn); - char *output = g_strdup_printf("0x%"PRIx64", 0x%"PRIx32", \"%s\"", - insn_vaddr, insn_opcode, insn_disas); + insn_vaddr = qemu_plugin_insn_vaddr(insn); + + /* + * If we are filtering we better check out if we have any + * hits. The skip "latches" so we can track memory accesses + * after the instruction we care about. + */ + if (skip && imatches) { + int j; + for (j = 0; j < imatches->len && skip; j++) { + char *m = g_ptr_array_index(imatches, j); + if (g_str_has_prefix(insn_disas, m)) { + skip = false; + } + } + } + + if (skip && amatches) { + int j; + for (j = 0; j < amatches->len && skip; j++) { + uint64_t v = g_array_index(amatches, uint64_t, j); + if (v == insn_vaddr) { + skip = false; + } + } + } - /* Register callback on memory read or write */ - qemu_plugin_register_vcpu_mem_cb(insn, vcpu_mem, - QEMU_PLUGIN_CB_NO_REGS, - QEMU_PLUGIN_MEM_RW, NULL); + if (skip) { + g_free(insn_disas); + } else { + uint32_t insn_opcode; + insn_opcode = *((uint32_t *)qemu_plugin_insn_data(insn)); + char *output = g_strdup_printf("0x%"PRIx64", 0x%"PRIx32", \"%s\"", + insn_vaddr, insn_opcode, insn_disas); + + /* Register callback on memory read or write */ + qemu_plugin_register_vcpu_mem_cb(insn, vcpu_mem, + QEMU_PLUGIN_CB_NO_REGS, + QEMU_PLUGIN_MEM_RW, NULL); + + /* Register callback on instruction */ + qemu_plugin_register_vcpu_insn_exec_cb(insn, vcpu_insn_exec, + QEMU_PLUGIN_CB_NO_REGS, output); + } - /* Register callback on instruction */ - qemu_plugin_register_vcpu_insn_exec_cb(insn, vcpu_insn_exec, - QEMU_PLUGIN_CB_NO_REGS, output); } } @@ -132,6 +168,25 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) } } +/* Add a match to the array of matches */ +static void parse_insn_match(char *match) +{ + if (!imatches) { + imatches = g_ptr_array_new(); + } + g_ptr_array_add(imatches, match); +} + +static void parse_vaddr_match(char *match) +{ + uint64_t v = g_ascii_strtoull(match, NULL, 16); + + if (!amatches) { + amatches = g_array_new(false, true, sizeof(uint64_t)); + } + g_array_append_val(amatches, v); +} + /** * Install the plugin */ @@ -145,6 +200,19 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, */ last_exec = g_array_new(FALSE, FALSE, sizeof(GString *)); + for (int i = 0; i < argc; i++) { + char *opt = argv[i]; + g_autofree char **tokens = g_strsplit(opt, "=", 2); + if (g_strcmp0(tokens[0], "ifilter") == 0) { + parse_insn_match(tokens[1]); + } else if (g_strcmp0(tokens[0], "afilter") == 0) { + parse_vaddr_match(tokens[1]); + } else { + fprintf(stderr, "option parsing failed: %s\n", opt); + return -1; + } + } + /* Register translation block and exit callbacks */ qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans); qemu_plugin_register_atexit_cb(id, plugin_exit, NULL);