From patchwork Sat Jul 6 19:13:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 810793 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp2095963wru; Sat, 6 Jul 2024 12:15:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVcPFdp9NZKuYNGNqcYWyVr7yj3mh4fiCujmdulctULGmiy65gC7nB/X5Z2y4rlIxOerZwcOu5J9M/QU0KuSvBt X-Google-Smtp-Source: AGHT+IGyJIquzy70ZPHX+x2jmMlMHQkXAfJXlMKpe7E5xfsD5yiuT9OGJ/1l3x5niA8fDL9V8sYX X-Received: by 2002:a05:6214:1bcb:b0:6b5:d97b:7247 with SMTP id 6a1803df08f44-6b5ed0619e7mr98981476d6.52.1720293322020; Sat, 06 Jul 2024 12:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720293322; cv=none; d=google.com; s=arc-20160816; b=lJSRoylWqeF4D5Y0r32mlctSXE+NRsxeubRFjmKzlUsqtx1Emq3Pbbq3xYWUtzDgYM GymPiNWywgy9KXJ30n6ODOzaO6VvQNGBXNRIY44RZ3lU3rBuGJQ6w6QdO2mcFoOuxfXk vAmUmZRXo8KNXjIR9KCo/EXzRBT2vdTZvwMfEdFqGTWbXTCbNm7UjyXLqPLOrIq1u2Do uk66Cwxfvm0c0Z9ZfVGlO2puQWAkrfApBpdZGGCinkWBKZalGaeCNx9en4kzGskApzMI BucFLsLBVXQYd+FV/06egJ9BB9OFR0zFlzs4XeFMt/PMzUSdlByoEUYrCrkkV6ublUmJ I8fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=h1iFjXkNAAiUT1/HXJR1NSUSkejcZSCzgqp885X9UqQ=; fh=LuyLDqXhwowsHipFfT6JgYXgVYpw+0CWJ0UGuA2fScs=; b=GPZtjdDS92xsnxI3pOqB6cbyp4VJCeSPVdWnKBDdJkc4GKb1e7gX5y6cWvlgmV6LoD xoBuswesZN/Z30PfLTC5qa035ypA3SN9f0YOcGiYTm0JaqrQOcMXaYt11EjxSZU8u7Tx ZB7sNGdlR/3gsbDc1D8UScl2CXWEl42E6jLRZqR2Kmq3ShgNX5/ItI3QLCx8vjh+xqcH lg5Jb20iKyZcempacRC9QqxJc0WrMT7cXkE5gqrAvVHdJLaVnXNI93p5w905MZpf0oY6 wg8lGI28h6iHZivCl52tOzDgzc18zleng+qi/fmk84WWM9lNs+U8ltri/UVtt1BqIs2/ N/mg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vReNQLmV; 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=pass (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 d75a77b69052e-44652dda2a5si194033221cf.545.2024.07.06.12.15.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Jul 2024 12:15:22 -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=pass header.i=@linaro.org header.s=google header.b=vReNQLmV; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQAqx-0002Bo-H2; Sat, 06 Jul 2024 15:13:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQAqw-0002BN-DM for qemu-devel@nongnu.org; Sat, 06 Jul 2024 15:13:46 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQAqu-00044N-T7 for qemu-devel@nongnu.org; Sat, 06 Jul 2024 15:13:46 -0400 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-754d2b05db5so1480277a12.0 for ; Sat, 06 Jul 2024 12:13:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720293223; x=1720898023; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=h1iFjXkNAAiUT1/HXJR1NSUSkejcZSCzgqp885X9UqQ=; b=vReNQLmVq05RDzOmAYNbScNBZjQ2SC1zVeoCxOtBLQMqqAvYp5iIjjyOU0k94yXqOp rkvhRcVPtoQYW7RiXWSD6GvSrqMG6nHHdGd7VTQ4Z5yDbYIiwPE/oShD4ZwNp/5SQDTT Av3lqEje+DqydsmtKZJpvRIsPzunbQ+7u4ydBmb6YShQy+s/gZIFtND9aHVp7TM/h4T/ b/B2Qnm68Tk/FNE+xCzBeukyNDo5PxY1tmqqeJtsoXEQxE3ZrYSE42Zp/TUZkOnwp8DD duEjPyDk7UzXR8PntLThSiC1MieAk9EQWONLPcfampwv1pS3ob/hwfiPE6rilyUqj75Y 11Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720293223; x=1720898023; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h1iFjXkNAAiUT1/HXJR1NSUSkejcZSCzgqp885X9UqQ=; b=FVNJ5hobAlC2MXHME31FlAUPJtew87Sru4hFtWnH0Miriwn+dEuOqGWXhLcGxt1rdq wS5iKvb3o26my/v+/MlPiwmKT+Qk8qqO5Ke9upPlh2AdHeBD0FYFR4GGIt6Bb/DsrNC8 1aOLD+urQLvU1QKtix6whZCSs/DfyH8jyIMNO+wbi2U12O1rgQeJrLv2KX/8pPzQHpb2 FIIBtGwk13oqSSjXC4YKrTTpQSc0eT+tMCyqSDG9WWfJDVdoPWdYen8DXAHVVI+6cSM5 A3ic65T4Tt3eCR7hqPp+v8/+fv0rbGbtNodD/4a5qNMNxMqEZdbMFwRQoVQ5/bXCD5Lw E2oQ== X-Gm-Message-State: AOJu0YzOFIwVMTqEj0VhNDH52e4emztja0xGJFiJ1YopH3glWg2bsJu1 Tbuy/eJoKY9Ug7Q3I2HPopuFM39KEDxXDl+Pvwo01vguKvEiraghuPMOxRJx5hX1KkOdG4p0cq9 SYB4= X-Received: by 2002:a17:902:db02:b0:1fb:6a96:fc72 with SMTP id d9443c01a7336-1fb6a970334mr12396215ad.68.1720293223034; Sat, 06 Jul 2024 12:13:43 -0700 (PDT) Received: from linaro.vn.shawcable.net ([2604:3d08:9384:1d00::2193]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fb6153cb3bsm17304305ad.129.2024.07.06.12.13.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 12:13:42 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Richard Henderson , Marcel Apfelbaum , Mahmoud Mandour , Alexandre Iooss , =?utf-8?q?Alex_Benn=C3=A9e?= , Eduardo Habkost , Yanan Wang , Pierrick Bouvier , Xingtao Yao Subject: [PATCH v6 1/7] plugins: fix mem callback array size Date: Sat, 6 Jul 2024 12:13:29 -0700 Message-Id: <20240706191335.878142-2-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240706191335.878142-1-pierrick.bouvier@linaro.org> References: <20240706191335.878142-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pg1-x52c.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org data was correctly copied, but size of array was not set (g_array_sized_new only reserves memory, but does not set size). As a result, callbacks were not called for code path relying on plugin_register_vcpu_mem_cb(). Found when trying to trigger mem access callbacks for atomic instructions. Reviewed-by: Xingtao Yao Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier Reviewed-by: Alex Bennée --- accel/tcg/plugin-gen.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index b6bae32b997..ec89a085b43 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -85,8 +85,7 @@ static void gen_enable_mem_helper(struct qemu_plugin_tb *ptb, len = insn->mem_cbs->len; arr = g_array_sized_new(false, false, sizeof(struct qemu_plugin_dyn_cb), len); - memcpy(arr->data, insn->mem_cbs->data, - len * sizeof(struct qemu_plugin_dyn_cb)); + g_array_append_vals(arr, insn->mem_cbs->data, len); qemu_plugin_add_dyn_cb_arr(arr); tcg_gen_st_ptr(tcg_constant_ptr((intptr_t)arr), tcg_env, From patchwork Sat Jul 6 19:13:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 810788 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp2095779wru; Sat, 6 Jul 2024 12:14:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXASJPeR4PdgC/w2o4MOTHjcGfUSNnf+kL2O9dGmQk5OlSH2uXMnu3dtQPDe2WAt93cwLWHYfwmK8lBC966AzVp X-Google-Smtp-Source: AGHT+IH2V6O6d7rv8tGgEELRyYppVaWJ47QC4XZfmhd0Tis92obVaG5Hv3KN4iuFXWitfdjeID6a X-Received: by 2002:a05:620a:2a01:b0:79f:8be:e3f3 with SMTP id af79cd13be357-79f08bee7ddmr28743985a.50.1720293288339; Sat, 06 Jul 2024 12:14:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720293288; cv=none; d=google.com; s=arc-20160816; b=AfBGfvyKa7zg5P6T4k0/J+donAISj6Dg6/emBdLTrVA1gXthnizNWzpDv/Adg79aqI 6WFB7537E87MiV7hNWMpLXv4RvQk1PPP5Ze1iJMhyVghvCoXBvhRym3woh35nD2cVawc tS9yxDj6tuqMzxI0GHpQ2wXc4JjSW5Rtpwb2nM8b+DBwVa1DP+CY/ICYTDovBMS1cOk8 U7Z8qTv8w0mou1UM0E0o5WtaZZnbGqNSWKoXtjlOMA3a/txGWjB5rR8cKnVcIam80V2M rL7D+YkRYIumJvEwyxolkMsq/o/fTaJr6WvFeJ5bkFpUovPPdW1BF/GUaNqxMJnFXKOd bgKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=oSCkw14FBoeGNGjUHnHe2Vob0BsAYcgrTpSqhp2ESss=; fh=0T+ZUhHg5vB9XgViBy9+A112taCA3LWKEWmDRh7Y4tA=; b=SbxR69KFR77A+mSe+3tfGXEA0XPY6VaxXq2EJqpe94B08+6acJz4P2b9CXa1Z0PBHs H8mSFsOax1EsQnYTNYAd7mjFeexAAtWYQaz+R0l3Fodo+IXaaxtZLhNXw2LRXXpGjNiZ AMQb2t26wwuzKGOgAJbY+/5mDTRQaHA0jPiST5fCcHZ9dcgWl2Cu2Gd011N+twiu0zfz SgtgqF1/5xU3DAHF2r6T4XvGEJZ23/0FoQMmNjRuY6BOL7i0GMtSey1cWB89d1TassGz l/uVgomxzJ4ZIBwdOb7a/UoszlXmd6sk936uf61l6EET3E8KCL+Dp9SgLt4tXDC47A1e relw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Sm6bPoTb; 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=pass (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 af79cd13be357-79f008675cdsi231005385a.761.2024.07.06.12.14.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Jul 2024 12:14: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=pass header.i=@linaro.org header.s=google header.b=Sm6bPoTb; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQAr0-0002CX-L9; Sat, 06 Jul 2024 15:13:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQAqz-0002CD-3x for qemu-devel@nongnu.org; Sat, 06 Jul 2024 15:13:49 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQAqw-00044S-IC for qemu-devel@nongnu.org; Sat, 06 Jul 2024 15:13:48 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1fb222a8eaeso19598135ad.3 for ; Sat, 06 Jul 2024 12:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720293224; x=1720898024; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oSCkw14FBoeGNGjUHnHe2Vob0BsAYcgrTpSqhp2ESss=; b=Sm6bPoTbz8GvIpEh9LfzCiPtJj++aw5ENiwmfKpIEGwZeCBI1Rvn1ZQ38I1nGDwg+j JFzXabeSMx+NA+b5XakqdsgdiVqHIBZXt2goHukq5uGOVhchzxJXiBYmyORCjX80z1fU hIxJHPoE0dJMoVVuCa+AYsxjLqq2xHWtIjyGKr9zG+hfZ9kAejamTUfIXYwKcM5FqHBe 8kYZn7IdRL8l2HpWGU+WIyMD3sHvp/gu6rjIcNVD+tAw4B3gugRNzHH9Z9roOKbz7E99 /BxN07TdgKP5ZRAbBL2RsIl+zXc/C2VdFXkvb/eR3Hfv7FWrBFdnZkgtMiEhcinDitGN wbMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720293224; x=1720898024; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oSCkw14FBoeGNGjUHnHe2Vob0BsAYcgrTpSqhp2ESss=; b=DVw1sW1BXFkgz+6EfCOKjPCw01JlZDV/JX7IDppY5n4K0+nUm88fNZQSB9GO+4GhG8 c9nH0DJIBrSYwYQBdUVG8h4ph64BuXdJzsvIzqiUwD7wD/0hJPuxW5cFPxz0bBAD/QwP 9XbeODfj3+I1Y75NtmrLOzLLXpu+SslzD5tR4AKgMZpWnWn0dus10UjJWlthastCRMN7 TLQ4fpIYZLLYHUsdqvtsEIjMd3gCPupzHp3b+NGscxUdf9vqnjgYcsZ3ecx+l3JAVq/6 BXe2aY6cFnR7vS2v7jLVHgfIk8RApA9QBP1QWX5HIp8nfkiGrjM6PQCOplsyeh/61fWC gCig== X-Gm-Message-State: AOJu0YxP2ug8ZAoSzaoNGqxH8zvyxg7Jnj+0Z+3f5FfBsAFTg9Q/If2M 7k1FpFZiFqRanVfFg95JuURJNHq6eNgVSQGT35FX5QdLRkbKu+WZvtgU4MdNW34Ud26syT36EuX VTe8= X-Received: by 2002:a17:902:e74c:b0:1fb:715d:df83 with SMTP id d9443c01a7336-1fb715de31amr13225355ad.13.1720293224144; Sat, 06 Jul 2024 12:13:44 -0700 (PDT) Received: from linaro.vn.shawcable.net ([2604:3d08:9384:1d00::2193]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fb6153cb3bsm17304305ad.129.2024.07.06.12.13.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 12:13:43 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Richard Henderson , Marcel Apfelbaum , Mahmoud Mandour , Alexandre Iooss , =?utf-8?q?Alex_Benn=C3=A9e?= , Eduardo Habkost , Yanan Wang , Pierrick Bouvier Subject: [PATCH v6 2/7] plugins: save value during memory accesses Date: Sat, 6 Jul 2024 12:13:30 -0700 Message-Id: <20240706191335.878142-3-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240706191335.878142-1-pierrick.bouvier@linaro.org> References: <20240706191335.878142-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x635.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Different code paths handle memory accesses: - tcg generated code - load/store helpers - atomic helpers This value is saved in cpu->neg.plugin_mem_value_{high,low}. Values are written only for accessed word size (upper bits are not set). Atomic operations are doing read/write at the same time, so we generate two memory callbacks instead of one, to allow plugins to access distinct values. For now, we can have access only up to 128 bits, thus split this in two 64 bits words. When QEMU will support wider operations, we'll be able to reconsider this. Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier Reviewed-by: Alex Bennée --- accel/tcg/atomic_template.h | 66 ++++++++++++++++++++++++++++++----- include/hw/core/cpu.h | 4 +++ include/qemu/plugin.h | 4 +++ plugins/core.c | 6 ++++ tcg/tcg-op-ldst.c | 66 +++++++++++++++++++++++++++++++---- accel/tcg/atomic_common.c.inc | 13 ++++++- accel/tcg/ldst_common.c.inc | 38 ++++++++++++-------- 7 files changed, 167 insertions(+), 30 deletions(-) diff --git a/accel/tcg/atomic_template.h b/accel/tcg/atomic_template.h index 1dc2151dafd..89593b2502f 100644 --- a/accel/tcg/atomic_template.h +++ b/accel/tcg/atomic_template.h @@ -53,6 +53,14 @@ # error unsupported data size #endif +#if DATA_SIZE == 16 +# define VALUE_LOW(val) int128_getlo(val) +# define VALUE_HIGH(val) int128_gethi(val) +#else +# define VALUE_LOW(val) val +# define VALUE_HIGH(val) 0 +#endif + #if DATA_SIZE >= 4 # define ABI_TYPE DATA_TYPE #else @@ -83,7 +91,12 @@ ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, abi_ptr addr, ret = qatomic_cmpxchg__nocheck(haddr, cmpv, newv); #endif ATOMIC_MMU_CLEANUP; - atomic_trace_rmw_post(env, addr, oi); + atomic_trace_rmw_post(env, addr, + VALUE_LOW(ret), + VALUE_HIGH(ret), + VALUE_LOW(newv), + VALUE_HIGH(newv), + oi); return ret; } @@ -97,7 +110,12 @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, abi_ptr addr, ABI_TYPE val, ret = qatomic_xchg__nocheck(haddr, val); ATOMIC_MMU_CLEANUP; - atomic_trace_rmw_post(env, addr, oi); + atomic_trace_rmw_post(env, addr, + VALUE_LOW(ret), + VALUE_HIGH(ret), + VALUE_LOW(val), + VALUE_HIGH(val), + oi); return ret; } @@ -109,7 +127,12 @@ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, abi_ptr addr, \ haddr = atomic_mmu_lookup(env_cpu(env), addr, oi, DATA_SIZE, retaddr); \ ret = qatomic_##X(haddr, val); \ ATOMIC_MMU_CLEANUP; \ - atomic_trace_rmw_post(env, addr, oi); \ + atomic_trace_rmw_post(env, addr, \ + VALUE_LOW(ret), \ + VALUE_HIGH(ret), \ + VALUE_LOW(val), \ + VALUE_HIGH(val), \ + oi); \ return ret; \ } @@ -145,7 +168,12 @@ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, abi_ptr addr, \ cmp = qatomic_cmpxchg__nocheck(haddr, old, new); \ } while (cmp != old); \ ATOMIC_MMU_CLEANUP; \ - atomic_trace_rmw_post(env, addr, oi); \ + atomic_trace_rmw_post(env, addr, \ + VALUE_LOW(old), \ + VALUE_HIGH(old), \ + VALUE_LOW(xval), \ + VALUE_HIGH(xval), \ + oi); \ return RET; \ } @@ -188,7 +216,12 @@ ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, abi_ptr addr, ret = qatomic_cmpxchg__nocheck(haddr, BSWAP(cmpv), BSWAP(newv)); #endif ATOMIC_MMU_CLEANUP; - atomic_trace_rmw_post(env, addr, oi); + atomic_trace_rmw_post(env, addr, + VALUE_LOW(ret), + VALUE_HIGH(ret), + VALUE_LOW(newv), + VALUE_HIGH(newv), + oi); return BSWAP(ret); } @@ -202,7 +235,12 @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, abi_ptr addr, ABI_TYPE val, ret = qatomic_xchg__nocheck(haddr, BSWAP(val)); ATOMIC_MMU_CLEANUP; - atomic_trace_rmw_post(env, addr, oi); + atomic_trace_rmw_post(env, addr, + VALUE_LOW(ret), + VALUE_HIGH(ret), + VALUE_LOW(val), + VALUE_HIGH(val), + oi); return BSWAP(ret); } @@ -214,7 +252,12 @@ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, abi_ptr addr, \ haddr = atomic_mmu_lookup(env_cpu(env), addr, oi, DATA_SIZE, retaddr); \ ret = qatomic_##X(haddr, BSWAP(val)); \ ATOMIC_MMU_CLEANUP; \ - atomic_trace_rmw_post(env, addr, oi); \ + atomic_trace_rmw_post(env, addr, \ + VALUE_LOW(ret), \ + VALUE_HIGH(ret), \ + VALUE_LOW(val), \ + VALUE_HIGH(val), \ + oi); \ return BSWAP(ret); \ } @@ -247,7 +290,12 @@ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, abi_ptr addr, \ ldn = qatomic_cmpxchg__nocheck(haddr, ldo, BSWAP(new)); \ } while (ldo != ldn); \ ATOMIC_MMU_CLEANUP; \ - atomic_trace_rmw_post(env, addr, oi); \ + atomic_trace_rmw_post(env, addr, \ + VALUE_LOW(old), \ + VALUE_HIGH(old), \ + VALUE_LOW(xval), \ + VALUE_HIGH(xval), \ + oi); \ return RET; \ } @@ -281,3 +329,5 @@ GEN_ATOMIC_HELPER_FN(add_fetch, ADD, DATA_TYPE, new) #undef SUFFIX #undef DATA_SIZE #undef SHIFT +#undef VALUE_LOW +#undef VALUE_HIGH diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index a2c8536943f..e92cba049fd 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -350,6 +350,8 @@ typedef union IcountDecr { * from CPUArchState, via small negative offsets. * @can_do_io: True if memory-mapped IO is allowed. * @plugin_mem_cbs: active plugin memory callbacks + * @plugin_mem_value_low: 64 lower bits of latest accessed mem value. + * @plugin_mem_value_high: 64 higher bits of latest accessed mem value. */ typedef struct CPUNegativeOffsetState { CPUTLB tlb; @@ -358,6 +360,8 @@ typedef struct CPUNegativeOffsetState { * The callback pointer are accessed via TCG (see gen_empty_mem_helper). */ GArray *plugin_mem_cbs; + uint64_t plugin_mem_value_low; + uint64_t plugin_mem_value_high; #endif IcountDecr icount_decr; bool can_do_io; diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index af5f9db4692..9726a9ebf36 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -167,6 +167,8 @@ qemu_plugin_vcpu_syscall(CPUState *cpu, int64_t num, uint64_t a1, void qemu_plugin_vcpu_syscall_ret(CPUState *cpu, int64_t num, int64_t ret); void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr, + uint64_t value_low, + uint64_t value_high, MemOpIdx oi, enum qemu_plugin_mem_rw rw); void qemu_plugin_flush_cb(void); @@ -251,6 +253,8 @@ void qemu_plugin_vcpu_syscall_ret(CPUState *cpu, int64_t num, int64_t ret) { } static inline void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr, + uint64_t value_low, + uint64_t value_high, MemOpIdx oi, enum qemu_plugin_mem_rw rw) { } diff --git a/plugins/core.c b/plugins/core.c index 12c67b4b4eb..d353d38b8da 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -583,6 +583,8 @@ void exec_inline_op(enum plugin_dyn_cb_type type, } void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr, + uint64_t value_low, + uint64_t value_high, MemOpIdx oi, enum qemu_plugin_mem_rw rw) { GArray *arr = cpu->neg.plugin_mem_cbs; @@ -591,6 +593,10 @@ void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr, if (arr == NULL) { return; } + + cpu->neg.plugin_mem_value_low = value_low; + cpu->neg.plugin_mem_value_high = value_high; + for (i = 0; i < arr->len; i++) { struct qemu_plugin_dyn_cb *cb = &g_array_index(arr, struct qemu_plugin_dyn_cb, i); diff --git a/tcg/tcg-op-ldst.c b/tcg/tcg-op-ldst.c index 85101602581..23dc807f119 100644 --- a/tcg/tcg-op-ldst.c +++ b/tcg/tcg-op-ldst.c @@ -148,11 +148,11 @@ static TCGv_i64 plugin_maybe_preserve_addr(TCGTemp *addr) return NULL; } +#ifdef CONFIG_PLUGIN static void plugin_gen_mem_callbacks(TCGv_i64 copy_addr, TCGTemp *orig_addr, MemOpIdx oi, enum qemu_plugin_mem_rw rw) { -#ifdef CONFIG_PLUGIN if (tcg_ctx->plugin_insn != NULL) { qemu_plugin_meminfo_t info = make_plugin_meminfo(oi, rw); @@ -172,6 +172,54 @@ plugin_gen_mem_callbacks(TCGv_i64 copy_addr, TCGTemp *orig_addr, MemOpIdx oi, } } } +} +#endif + +static void +plugin_gen_mem_callbacks_i32(TCGv_i32 val, + TCGv_i64 copy_addr, TCGTemp *orig_addr, + MemOpIdx oi, enum qemu_plugin_mem_rw rw) +{ +#ifdef CONFIG_PLUGIN + if (tcg_ctx->plugin_insn != NULL) { + tcg_gen_st_i32(val, tcg_env, + offsetof(CPUState, neg.plugin_mem_value_low) - + sizeof(CPUState) + (HOST_BIG_ENDIAN * 4)); + plugin_gen_mem_callbacks(copy_addr, orig_addr, oi, rw); + } +#endif +} + +static void +plugin_gen_mem_callbacks_i64(TCGv_i64 val, + TCGv_i64 copy_addr, TCGTemp *orig_addr, + MemOpIdx oi, enum qemu_plugin_mem_rw rw) +{ +#ifdef CONFIG_PLUGIN + if (tcg_ctx->plugin_insn != NULL) { + tcg_gen_st_i64(val, tcg_env, + offsetof(CPUState, neg.plugin_mem_value_low) - + sizeof(CPUState)); + plugin_gen_mem_callbacks(copy_addr, orig_addr, oi, rw); + } +#endif +} + +static void +plugin_gen_mem_callbacks_i128(TCGv_i128 val, + TCGv_i64 copy_addr, TCGTemp *orig_addr, + MemOpIdx oi, enum qemu_plugin_mem_rw rw) +{ +#ifdef CONFIG_PLUGIN + if (tcg_ctx->plugin_insn != NULL) { + tcg_gen_st_i64(TCGV128_LOW(val), tcg_env, + offsetof(CPUState, neg.plugin_mem_value_low) - + sizeof(CPUState)); + tcg_gen_st_i64(TCGV128_HIGH(val), tcg_env, + offsetof(CPUState, neg.plugin_mem_value_high) - + sizeof(CPUState)); + plugin_gen_mem_callbacks(copy_addr, orig_addr, oi, rw); + } #endif } @@ -203,7 +251,8 @@ static void tcg_gen_qemu_ld_i32_int(TCGv_i32 val, TCGTemp *addr, opc = INDEX_op_qemu_ld_a64_i32; } gen_ldst(opc, tcgv_i32_temp(val), NULL, addr, oi); - plugin_gen_mem_callbacks(copy_addr, addr, orig_oi, QEMU_PLUGIN_MEM_R); + plugin_gen_mem_callbacks_i32(val, copy_addr, addr, orig_oi, + QEMU_PLUGIN_MEM_R); if ((orig_memop ^ memop) & MO_BSWAP) { switch (orig_memop & MO_SIZE) { @@ -271,7 +320,7 @@ static void tcg_gen_qemu_st_i32_int(TCGv_i32 val, TCGTemp *addr, } } gen_ldst(opc, tcgv_i32_temp(val), NULL, addr, oi); - plugin_gen_mem_callbacks(NULL, addr, orig_oi, QEMU_PLUGIN_MEM_W); + plugin_gen_mem_callbacks_i32(val, NULL, addr, orig_oi, QEMU_PLUGIN_MEM_W); if (swap) { tcg_temp_free_i32(swap); @@ -324,7 +373,8 @@ static void tcg_gen_qemu_ld_i64_int(TCGv_i64 val, TCGTemp *addr, opc = INDEX_op_qemu_ld_a64_i64; } gen_ldst_i64(opc, val, addr, oi); - plugin_gen_mem_callbacks(copy_addr, addr, orig_oi, QEMU_PLUGIN_MEM_R); + plugin_gen_mem_callbacks_i64(val, copy_addr, addr, orig_oi, + QEMU_PLUGIN_MEM_R); if ((orig_memop ^ memop) & MO_BSWAP) { int flags = (orig_memop & MO_SIGN @@ -396,7 +446,7 @@ static void tcg_gen_qemu_st_i64_int(TCGv_i64 val, TCGTemp *addr, opc = INDEX_op_qemu_st_a64_i64; } gen_ldst_i64(opc, val, addr, oi); - plugin_gen_mem_callbacks(NULL, addr, orig_oi, QEMU_PLUGIN_MEM_W); + plugin_gen_mem_callbacks_i64(val, NULL, addr, orig_oi, QEMU_PLUGIN_MEM_W); if (swap) { tcg_temp_free_i64(swap); @@ -606,7 +656,8 @@ static void tcg_gen_qemu_ld_i128_int(TCGv_i128 val, TCGTemp *addr, tcg_constant_i32(orig_oi)); } - plugin_gen_mem_callbacks(ext_addr, addr, orig_oi, QEMU_PLUGIN_MEM_R); + plugin_gen_mem_callbacks_i128(val, ext_addr, addr, orig_oi, + QEMU_PLUGIN_MEM_R); } void tcg_gen_qemu_ld_i128_chk(TCGv_i128 val, TCGTemp *addr, TCGArg idx, @@ -722,7 +773,8 @@ static void tcg_gen_qemu_st_i128_int(TCGv_i128 val, TCGTemp *addr, tcg_constant_i32(orig_oi)); } - plugin_gen_mem_callbacks(ext_addr, addr, orig_oi, QEMU_PLUGIN_MEM_W); + plugin_gen_mem_callbacks_i128(val, ext_addr, addr, orig_oi, + QEMU_PLUGIN_MEM_W); } void tcg_gen_qemu_st_i128_chk(TCGv_i128 val, TCGTemp *addr, TCGArg idx, diff --git a/accel/tcg/atomic_common.c.inc b/accel/tcg/atomic_common.c.inc index 95a5c5ff12d..6056598c23d 100644 --- a/accel/tcg/atomic_common.c.inc +++ b/accel/tcg/atomic_common.c.inc @@ -14,9 +14,20 @@ */ static void atomic_trace_rmw_post(CPUArchState *env, uint64_t addr, + uint64_t read_value_low, + uint64_t read_value_high, + uint64_t write_value_low, + uint64_t write_value_high, MemOpIdx oi) { - qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, oi, QEMU_PLUGIN_MEM_RW); + if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) { + qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, + read_value_low, read_value_high, + oi, QEMU_PLUGIN_MEM_R); + qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, + write_value_low, write_value_high, + oi, QEMU_PLUGIN_MEM_W); + } } /* diff --git a/accel/tcg/ldst_common.c.inc b/accel/tcg/ldst_common.c.inc index 87ceb954873..ebbf380d767 100644 --- a/accel/tcg/ldst_common.c.inc +++ b/accel/tcg/ldst_common.c.inc @@ -123,10 +123,15 @@ void helper_st_i128(CPUArchState *env, uint64_t addr, Int128 val, MemOpIdx oi) * Load helpers for cpu_ldst.h */ -static void plugin_load_cb(CPUArchState *env, abi_ptr addr, MemOpIdx oi) +static void plugin_load_cb(CPUArchState *env, abi_ptr addr, + uint64_t value_low, + uint64_t value_high, + MemOpIdx oi) { if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) { - qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, oi, QEMU_PLUGIN_MEM_R); + qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, + value_low, value_high, + oi, QEMU_PLUGIN_MEM_R); } } @@ -136,7 +141,7 @@ uint8_t cpu_ldb_mmu(CPUArchState *env, abi_ptr addr, MemOpIdx oi, uintptr_t ra) tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_UB); ret = do_ld1_mmu(env_cpu(env), addr, oi, ra, MMU_DATA_LOAD); - plugin_load_cb(env, addr, oi); + plugin_load_cb(env, addr, ret, 0, oi); return ret; } @@ -147,7 +152,7 @@ uint16_t cpu_ldw_mmu(CPUArchState *env, abi_ptr addr, tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_16); ret = do_ld2_mmu(env_cpu(env), addr, oi, ra, MMU_DATA_LOAD); - plugin_load_cb(env, addr, oi); + plugin_load_cb(env, addr, ret, 0, oi); return ret; } @@ -158,7 +163,7 @@ uint32_t cpu_ldl_mmu(CPUArchState *env, abi_ptr addr, tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_32); ret = do_ld4_mmu(env_cpu(env), addr, oi, ra, MMU_DATA_LOAD); - plugin_load_cb(env, addr, oi); + plugin_load_cb(env, addr, ret, 0, oi); return ret; } @@ -169,7 +174,7 @@ uint64_t cpu_ldq_mmu(CPUArchState *env, abi_ptr addr, tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_64); ret = do_ld8_mmu(env_cpu(env), addr, oi, ra, MMU_DATA_LOAD); - plugin_load_cb(env, addr, oi); + plugin_load_cb(env, addr, ret, 0, oi); return ret; } @@ -180,7 +185,7 @@ Int128 cpu_ld16_mmu(CPUArchState *env, abi_ptr addr, tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_128); ret = do_ld16_mmu(env_cpu(env), addr, oi, ra); - plugin_load_cb(env, addr, oi); + plugin_load_cb(env, addr, int128_getlo(ret), int128_gethi(ret), oi); return ret; } @@ -188,10 +193,15 @@ Int128 cpu_ld16_mmu(CPUArchState *env, abi_ptr addr, * Store helpers for cpu_ldst.h */ -static void plugin_store_cb(CPUArchState *env, abi_ptr addr, MemOpIdx oi) +static void plugin_store_cb(CPUArchState *env, abi_ptr addr, + uint64_t value_low, + uint64_t value_high, + MemOpIdx oi) { if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) { - qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, oi, QEMU_PLUGIN_MEM_W); + qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, + value_low, value_high, + oi, QEMU_PLUGIN_MEM_W); } } @@ -199,7 +209,7 @@ void cpu_stb_mmu(CPUArchState *env, abi_ptr addr, uint8_t val, MemOpIdx oi, uintptr_t retaddr) { helper_stb_mmu(env, addr, val, oi, retaddr); - plugin_store_cb(env, addr, oi); + plugin_store_cb(env, addr, val, 0, oi); } void cpu_stw_mmu(CPUArchState *env, abi_ptr addr, uint16_t val, @@ -207,7 +217,7 @@ void cpu_stw_mmu(CPUArchState *env, abi_ptr addr, uint16_t val, { tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_16); do_st2_mmu(env_cpu(env), addr, val, oi, retaddr); - plugin_store_cb(env, addr, oi); + plugin_store_cb(env, addr, val, 0, oi); } void cpu_stl_mmu(CPUArchState *env, abi_ptr addr, uint32_t val, @@ -215,7 +225,7 @@ void cpu_stl_mmu(CPUArchState *env, abi_ptr addr, uint32_t val, { tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_32); do_st4_mmu(env_cpu(env), addr, val, oi, retaddr); - plugin_store_cb(env, addr, oi); + plugin_store_cb(env, addr, val, 0, oi); } void cpu_stq_mmu(CPUArchState *env, abi_ptr addr, uint64_t val, @@ -223,7 +233,7 @@ void cpu_stq_mmu(CPUArchState *env, abi_ptr addr, uint64_t val, { tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_64); do_st8_mmu(env_cpu(env), addr, val, oi, retaddr); - plugin_store_cb(env, addr, oi); + plugin_store_cb(env, addr, val, 0, oi); } void cpu_st16_mmu(CPUArchState *env, abi_ptr addr, Int128 val, @@ -231,7 +241,7 @@ void cpu_st16_mmu(CPUArchState *env, abi_ptr addr, Int128 val, { tcg_debug_assert((get_memop(oi) & MO_SIZE) == MO_128); do_st16_mmu(env_cpu(env), addr, val, oi, retaddr); - plugin_store_cb(env, addr, oi); + plugin_store_cb(env, addr, int128_getlo(val), int128_gethi(val), oi); } /* From patchwork Sat Jul 6 19:13:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 810789 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp2095846wru; Sat, 6 Jul 2024 12:14:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU7NdfTSMkP18xU6A6lgo90FWYEsZBykKAEjstBVbyXry48NeoBu4A4L0SFclWSTXnIJgccy9xCJWZ0oeejumWH X-Google-Smtp-Source: AGHT+IHvUh52bj1Y+XdqXpdAPdEZgF7OyFjamUoiHJlfjyvTWS+qnqgJ977R2GCtAbuHoXWZ89S1 X-Received: by 2002:a05:622a:1a8a:b0:446:5e11:2888 with SMTP id d75a77b69052e-447cbf8cd80mr77756441cf.61.1720293299691; Sat, 06 Jul 2024 12:14:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720293299; cv=none; d=google.com; s=arc-20160816; b=sgwRoGcZhWLUO8RgDgyOdCpTdPLVHRDbq6C6jZZGkZEHJOR23QX9bhSnqZXUJqLf2t JDUuqg6sm5OyMTpn8gki99fILxNU2A9lY/q5+SWJOfvn8/ts/wGgErC/wzqhOnmcOrpM S1JvWvs0UFeJilT+46IowVMG/eZGRIvkQdeqWBp8Tv1KQMzpWfW+rIMQWlvrQWtGSDoo UaQzqEBcEqHbzro/qshMBFaDurhewwid1sF7kprSZIJJbCTww0R0bx/w+3gvsiDH6+r3 VMjjs40ZC0p4RkIJdNWqq46Ta0dXeKmcM+hTGDSWTXwlpyvdIAhMz0+cPaVLI4gmueIc qLSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=29AmjN08v39I61gQ3jvm15T5PbVM6dvTT6GDpWQa9nI=; fh=LuyLDqXhwowsHipFfT6JgYXgVYpw+0CWJ0UGuA2fScs=; b=NT9TEEdttNkCWgA8QHn4xpou+KVmY4QCDXhzzzEw3jvlDkFGtp2aOZuX9ucs110ixX BRuNK/SEhJAk33hiEFf82vOkgINtnSge3Ydc1NpNkNWsLilCsTXwebncMbrg9KhdqbOf FeZhNsMMqd0IMq5WxQ5aCkPgxvDbNRKLQLskwlSKBgEtcUNByFtABy4p4pfEb86L3vD8 tgAMDQtlNFF/9qfyRpOdpq+oqfD8oBIfDKx3jL3829HiUwUpjJ5UftVuuskpioW1MRxr 9KvpsWK4+f1Xh1tGRSgqTZ2iCxsV1odrs55wyUarBjNsI4pJhjbRkzE1i/4hP80ASWJ6 uT/Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SEHTXWSO; 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=pass (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 d75a77b69052e-4466dda217csi163923761cf.102.2024.07.06.12.14.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Jul 2024 12:14:59 -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=pass header.i=@linaro.org header.s=google header.b=SEHTXWSO; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQAr2-0002Cj-35; Sat, 06 Jul 2024 15:13:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQAqz-0002CN-V5 for qemu-devel@nongnu.org; Sat, 06 Jul 2024 15:13:49 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQAqy-00044k-5c for qemu-devel@nongnu.org; Sat, 06 Jul 2024 15:13:49 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1fb05b0be01so15520275ad.2 for ; Sat, 06 Jul 2024 12:13:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720293226; x=1720898026; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=29AmjN08v39I61gQ3jvm15T5PbVM6dvTT6GDpWQa9nI=; b=SEHTXWSOEF9Ti4uIt8c8ENpHY9ryQ4U01opzwmPHBGMhbWyQe8nm4jMsRyrXUY9Mm4 IL0UGfCaJh/kyHg3zrnsYyVwPWONBeIWLsnpE9cE2Qormqr8T8JVnSwHvsmIxOXb7y29 ixh4Re+IPK03o4kbBp4OvCg86UmPfGzdRoiCcntLhOl7Y/9DtZRE0nfsqlysR9faUk1K M3bUinXMmFoBiRraVKYWv8Dos8uSkFdJOYSfJMKzHlhs16sAJtjyeN85pNmPDnSVq5pu lFMMD5NnYfX2d+YobUleetHde4x+K9nq9cdtstEYm/79n1cPuxaZNV5Wp/mSL+5aBaS6 C6yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720293226; x=1720898026; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=29AmjN08v39I61gQ3jvm15T5PbVM6dvTT6GDpWQa9nI=; b=IDti/UylwYuHakytQj9cDp9h3UUX5+Dhagoln6teW8RWZTxWl9+/bq+jS8pbVFJMi6 IO+CT6PawVWG5olTEWRdbw+iQyNnOk9E6sXQksWhXjgqGhkgqpzrNEqVKQxWnh8DJr6f ydlPEdkKdmSXq/OfoWWAbu6y/LJW3k2pvBPm3lBQhjDNuri68uNKXf8rwNxUkIR0nhFP SytJ3gweL5OxlT4bojgenKwMCVxh2Pcj6QEHwK7Vj3naA8W7dRBhTlqKStreRcZACVwm OrmgiONOR2+fsHg8ATxRcaj0gShipc/rcF1FLepNK/dOXgrcquq+IpjPJdibahytUu2+ QRCA== X-Gm-Message-State: AOJu0YxZUrUy1LnaH6rlWoHo0K0RGTulDxtPHQmQUGKALlIc2JPG45un cmDAsfls5Lv16jBdV20ufB6iVJyAfZ4r2VrzgfUZN7bGDCJujEzpAoiEFUy+ZSTt5zjkr3S4Urv NyjA= X-Received: by 2002:a17:902:ec8c:b0:1fb:1fd6:5e48 with SMTP id d9443c01a7336-1fb33e055bbmr68609115ad.7.1720293225842; Sat, 06 Jul 2024 12:13:45 -0700 (PDT) Received: from linaro.vn.shawcable.net ([2604:3d08:9384:1d00::2193]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fb6153cb3bsm17304305ad.129.2024.07.06.12.13.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 12:13:44 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Richard Henderson , Marcel Apfelbaum , Mahmoud Mandour , Alexandre Iooss , =?utf-8?q?Alex_Benn=C3=A9e?= , Eduardo Habkost , Yanan Wang , Pierrick Bouvier , Xingtao Yao Subject: [PATCH v6 3/7] plugins: extend API to get latest memory value accessed Date: Sat, 6 Jul 2024 12:13:31 -0700 Message-Id: <20240706191335.878142-4-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240706191335.878142-1-pierrick.bouvier@linaro.org> References: <20240706191335.878142-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x630.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This value can be accessed only during a memory callback, using new qemu_plugin_mem_get_value function. Returned value can be extended when QEMU will support accesses wider than 128 bits. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1719 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2152 Reviewed-by: Richard Henderson Reviewed-by: Xingtao Yao Signed-off-by: Pierrick Bouvier Reviewed-by: Alex Bennée --- include/qemu/qemu-plugin.h | 32 ++++++++++++++++++++++++++++++++ plugins/api.c | 33 +++++++++++++++++++++++++++++++++ plugins/qemu-plugins.symbols | 1 + 3 files changed, 66 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index c71c705b699..649ce89815f 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -262,6 +262,29 @@ enum qemu_plugin_mem_rw { QEMU_PLUGIN_MEM_RW, }; +enum qemu_plugin_mem_value_type { + QEMU_PLUGIN_MEM_VALUE_U8, + QEMU_PLUGIN_MEM_VALUE_U16, + QEMU_PLUGIN_MEM_VALUE_U32, + QEMU_PLUGIN_MEM_VALUE_U64, + QEMU_PLUGIN_MEM_VALUE_U128, +}; + +/* typedef qemu_plugin_mem_value - value accessed during a load/store */ +typedef struct { + enum qemu_plugin_mem_value_type type; + union { + uint8_t u8; + uint16_t u16; + uint32_t u32; + uint64_t u64; + struct { + uint64_t low; + uint64_t high; + } u128; + } data; +} qemu_plugin_mem_value; + /** * enum qemu_plugin_cond - condition to enable callback * @@ -551,6 +574,15 @@ bool qemu_plugin_mem_is_big_endian(qemu_plugin_meminfo_t info); QEMU_PLUGIN_API bool qemu_plugin_mem_is_store(qemu_plugin_meminfo_t info); +/** + * qemu_plugin_mem_get_mem_value() - return last value loaded/stored + * @info: opaque memory transaction handle + * + * Returns: memory value + */ +QEMU_PLUGIN_API +qemu_plugin_mem_value qemu_plugin_mem_get_value(qemu_plugin_meminfo_t info); + /** * qemu_plugin_get_hwaddr() - return handle for memory operation * @info: opaque memory info structure diff --git a/plugins/api.c b/plugins/api.c index 2ff13d09de6..3316d4a04d4 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -351,6 +351,39 @@ bool qemu_plugin_mem_is_store(qemu_plugin_meminfo_t info) return get_plugin_meminfo_rw(info) & QEMU_PLUGIN_MEM_W; } +qemu_plugin_mem_value qemu_plugin_mem_get_value(qemu_plugin_meminfo_t info) +{ + uint64_t low = current_cpu->neg.plugin_mem_value_low; + qemu_plugin_mem_value value; + + switch (qemu_plugin_mem_size_shift(info)) { + case 0: + value.type = QEMU_PLUGIN_MEM_VALUE_U8; + value.data.u8 = (uint8_t)low; + break; + case 1: + value.type = QEMU_PLUGIN_MEM_VALUE_U16; + value.data.u16 = (uint16_t)low; + break; + case 2: + value.type = QEMU_PLUGIN_MEM_VALUE_U32; + value.data.u32 = (uint32_t)low; + break; + case 3: + value.type = QEMU_PLUGIN_MEM_VALUE_U64; + value.data.u64 = low; + break; + case 4: + value.type = QEMU_PLUGIN_MEM_VALUE_U128; + value.data.u128.low = low; + value.data.u128.high = current_cpu->neg.plugin_mem_value_high; + break; + default: + g_assert_not_reached(); + } + return value; +} + /* * Virtual Memory queries */ diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols index ca773d8d9fe..eed9d8abd90 100644 --- a/plugins/qemu-plugins.symbols +++ b/plugins/qemu-plugins.symbols @@ -13,6 +13,7 @@ qemu_plugin_insn_size; qemu_plugin_insn_symbol; qemu_plugin_insn_vaddr; + qemu_plugin_mem_get_value; qemu_plugin_mem_is_big_endian; qemu_plugin_mem_is_sign_extended; qemu_plugin_mem_is_store; From patchwork Sat Jul 6 19:13:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 810790 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp2095876wru; Sat, 6 Jul 2024 12:15:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU0kawtXciQV3ecpkkFROfKKnHklTC76gMnZF5yhRnBwKWHD6sPu96obc3261EzH6sCpXrhYvI6CCjRXfZ6SFLG X-Google-Smtp-Source: AGHT+IEUITSK1b+83EYgFegcU99ltcnxI5LaxG7TJtnQ/ej8x9UjyfHFzYNbDL/iVs5V3Rz5BjU7 X-Received: by 2002:a05:622a:110:b0:446:5984:9cf0 with SMTP id d75a77b69052e-447cbeabd02mr113077761cf.1.1720293303709; Sat, 06 Jul 2024 12:15:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720293303; cv=none; d=google.com; s=arc-20160816; b=anLuMz21gYbaaRl+YYXxBDmGKrLyd8Xq6o3OyWD+5n31nBQZT6sSoGNGN955R1ugpQ MxutHpRC2bmH43nFi//FTWjTaHiF35VvcLk5q+zqm5nyOI7Cd4bh9BProtB8vU+Gh8HA CizzbCnpXmoGuppcGuFilKPAiRtA+BqpOIifdAITfg1+HpKr+kMbSCtO/8/PzqOYa9x5 YKLjUoca0QVS5uGj0leKyGIuqAnC7xFlDe0pqaYph9CnAAyiIoN1Fi8Lb+y50rdsI8wT /Bdax4SgWahcGkeri3mHRfzVdDYfhg39DoLOz2eU+XKqj7Gfjgd/jRpQEFnXSxw+93n8 9Vfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=EOVQG8CjYwbYZDeC+WrM19zb25ZnXpMuyBziO7HazqU=; fh=LuyLDqXhwowsHipFfT6JgYXgVYpw+0CWJ0UGuA2fScs=; b=No4AyRvlDkm6YQuU4x7AuKcxKmV1b8WtJ/KhbFDn11goq4Ap1pdTx16XG6I8yNv9Nu +qPesIQLSttnP/cDvPtvvHa7H2jbvKOmB8txYRsCve4wbbQTz8CH9gD7+RnVovxvIJC/ rqJRYqMdhBrwd1iYXgsvqt5SPd5sYSX5hpczInlh3g0OOCyzq3LseSr3UtDuVH6cjz76 c9E7fBb3XsueBcL2pQRT4qroUIOq8aU8J3yV/OQI49FBXCtojtn4yASM7eakE51UujT7 BjeNBG9ttJmkxoV+OtvHiRnjCW85K7o/ZCLxQYvthQYry49rNGU+J73CqVJskUzBWRWa sW2A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="wJY6/rIq"; 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=pass (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 d75a77b69052e-447e62e500csi7824621cf.172.2024.07.06.12.15.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Jul 2024 12:15:03 -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=pass header.i=@linaro.org header.s=google header.b="wJY6/rIq"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQArH-0002Fg-FC; Sat, 06 Jul 2024 15:14:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQArF-0002F2-Fm for qemu-devel@nongnu.org; Sat, 06 Jul 2024 15:14:05 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQAr0-000455-Py for qemu-devel@nongnu.org; Sat, 06 Jul 2024 15:14:05 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1f9fb3ca81bso15809695ad.3 for ; Sat, 06 Jul 2024 12:13:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720293227; x=1720898027; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EOVQG8CjYwbYZDeC+WrM19zb25ZnXpMuyBziO7HazqU=; b=wJY6/rIqDV0scUNDMzOu7Gra417DP008PHaTn9xTmlyPB773p+z0WG1lpe5hkjCkdX B204JiAxxinyc9XFezfH/PNPVRqjkv0F6oVBkJjpZr+GKYwo/GuneaqsCzpZhaTslQCn Z30b5uvYQY1BxKOBKLF+DNhXvQx1Yg2YEJ3iyhp+IWHUjUUsT3lncLbPRPfS8bmS7PA5 R6C1pvUfNLcpIFXszroZE6OCLjFTQyTFKy3HEJjwiOsaNMA2/4OmyEwEuYM9tXgetYRo tXAoGeo2P+s9JMnvpYaZczWFTUtRgiijGik6fhSDZDtrH6juydoEG6cEToK2mcGL+Ocv 5/GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720293227; x=1720898027; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EOVQG8CjYwbYZDeC+WrM19zb25ZnXpMuyBziO7HazqU=; b=uhSMUl7+eGTel4r2ztXHIiENYze3Avefvz1vtk4iFKo99jq0Wo8itHvlswzM5mU+YF GfX7GaFBfGdDn8XqXgakyB/qfg2HBbg1BH5gBjR7Cx3VVYmVrxeHCC0YCCEghVNYZoik O/htYoM2SirMkgKwWX2R/29QfEtrunHpELFmhLk0iMQqBjOGoVUeu2vqx1Sns3zLZgha iz7ZEyMoHGM6Az4hYz54i+TKgfj38VtrQYqjKt7Pb70kC5xSDpOzrh1oXVXtIBAkK6yS ZKyhRBPLnf45OX3NSMbr576cHVbbLcH0vQR8w/4tM25GFMWP4Nrbdde/Asmv9UH/pCmW H87w== X-Gm-Message-State: AOJu0YwLADH9lBP4kRf0HzimrjowpsseLoFblFzKshT9eRrs8o3LuxEJ gifqu+CzbKFcW03d5mpONr4FLC9mW4Pvhgufa+judFsvMKqjTc85ATS54N+h51XP4iwCOmTRP5f pPOU= X-Received: by 2002:a17:903:41c7:b0:1fb:6616:9cd4 with SMTP id d9443c01a7336-1fb66169f60mr14796955ad.38.1720293227456; Sat, 06 Jul 2024 12:13:47 -0700 (PDT) Received: from linaro.vn.shawcable.net ([2604:3d08:9384:1d00::2193]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fb6153cb3bsm17304305ad.129.2024.07.06.12.13.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 12:13:46 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Richard Henderson , Marcel Apfelbaum , Mahmoud Mandour , Alexandre Iooss , =?utf-8?q?Alex_Benn=C3=A9e?= , Eduardo Habkost , Yanan Wang , Pierrick Bouvier , Xingtao Yao Subject: [PATCH v6 4/7] tests/tcg: add mechanism to run specific tests with plugins Date: Sat, 6 Jul 2024 12:13:32 -0700 Message-Id: <20240706191335.878142-5-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240706191335.878142-1-pierrick.bouvier@linaro.org> References: <20240706191335.878142-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Only multiarch tests are run with plugins, and we want to be able to run per-arch test with plugins too. Tested-by: Xingtao Yao Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier --- tests/tcg/Makefile.target | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index cb8cfeb6dac..52616544d52 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -152,10 +152,11 @@ PLUGINS=$(patsubst %.c, lib%.so, $(notdir $(wildcard $(PLUGIN_SRC)/*.c))) # only expand MULTIARCH_TESTS which are common on most of our targets # to avoid an exponential explosion as new tests are added. We also # add some special helpers the run-plugin- rules can use below. +# In more, extra tests can be added using PLUGINS_TESTS variable. ifneq ($(MULTIARCH_TESTS),) $(foreach p,$(PLUGINS), \ - $(foreach t,$(MULTIARCH_TESTS),\ + $(foreach t,$(MULTIARCH_TESTS) $(PLUGINS_TESTS),\ $(eval run-plugin-$(t)-with-$(p): $t $p) \ $(eval RUN_TESTS+=run-plugin-$(t)-with-$(p)))) endif # MULTIARCH_TESTS From patchwork Sat Jul 6 19:13:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 810787 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp2095774wru; Sat, 6 Jul 2024 12:14:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW/6+kAMXGhjUk+1ddlUmNDJo9ZgrESK31faAP/HJQ7frCLk4+tFLrrj51Ky0nwQtzdyPni0ShQ7vOF0Gr2tV4j X-Google-Smtp-Source: AGHT+IFHG36GLytn/Vnseb/IlEyDeO/FPWUHun5DcXBoLanCuCgE5CcE1l2NPugO3YiAOQBAeS4m X-Received: by 2002:ad4:5bc3:0:b0:6b5:a853:da25 with SMTP id 6a1803df08f44-6b5ed094df2mr97738226d6.61.1720293287836; Sat, 06 Jul 2024 12:14:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720293287; cv=none; d=google.com; s=arc-20160816; b=Wg3rDLPZKacurPsFroUyY4ZiSZ5qZsxWwX4fTXWGTfJQ8nIIUKKYZxBJlq03g70+Ft SnQNp9Qn0FUxYx1RSUyPQjkDKR3t/paEnKU3wylFVfGOzIv56T1e60F5pQRVmtxgGQYj IoUDubYTdensKb+JvRROTLH8gczCjcPEx1k0qAcGr+qCtBrMki8tLzJWub1NupSK262N 9ct8SNOi0qJbnRJgLgdPgV+5NL9sXOCm+xfLOSVJ7f4D26WjNITEaEW1397mSo2SRfJF wftk0rv2QODXVOKQkHgKerUOniXt6n4TXyhRzJ2qIuKWGJK4JLCcgl/885mGq5l8Xz6A 9w7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=t4bNu6CI6omvOt9CPXqjom5ah5T2zFduQZDfzw7pbQM=; fh=LuyLDqXhwowsHipFfT6JgYXgVYpw+0CWJ0UGuA2fScs=; b=JA9DFtsfn4ARdqlosMn2EaVmITV64/0m7H4qAdT60tbCxbeQfS2ULUqMnDndllyze3 rQRqN6dG0fJz5NVA+jR4BiHxru7nxwxy9czh74aLnsdMj7tUAWr627pJg2XL+cR2p87t vGmcj7OqIorsubcrfx2DCtvav4MzzIY9SjJOmofxHfyeSS2JoNcsZSJ/PbvKosrwzZ9C F/ExX/3q4Sq8XuMWs28slO7hfBCsxD6nbK06WKKSDNoBtglwsIaWd/na+sShunl6AGe6 VV1y38vWT7wxW3RDeT+EOhAfItLSECye01h3DCweU71543+OpqK3MKWFiMpeA+qRZq9W 6f3A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JEinJQda; 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=pass (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 6a1803df08f44-6b60b0b2e7esi484356d6.346.2024.07.06.12.14.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Jul 2024 12:14:47 -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=pass header.i=@linaro.org header.s=google header.b=JEinJQda; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQAr4-0002Da-LX; Sat, 06 Jul 2024 15:13:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQAr3-0002DC-1K for qemu-devel@nongnu.org; Sat, 06 Jul 2024 15:13:53 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQAr1-00045K-GB for qemu-devel@nongnu.org; Sat, 06 Jul 2024 15:13:52 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1fb70169c23so1703325ad.1 for ; Sat, 06 Jul 2024 12:13:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720293229; x=1720898029; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=t4bNu6CI6omvOt9CPXqjom5ah5T2zFduQZDfzw7pbQM=; b=JEinJQdaGKvBpFxnYUO3y66s4dl2SiY7N/3ShcSEh3qU/+Zw2vkoM6JO/Js2Qlv5DX arGbN6hu739fmrblTMJpdfGLQE0AyVZUoU4tthpMyZNZ/eSdH/2kFxqzMoB2mhBPqdmB wIO+TP9LP4Y9dM2CFkdIawTBik0EnFIwYYTwPgut10e1Kyj8FgOdJaMqvWD9pz7OtCXe VpWg4X0MXrGoBZJxwhiFqeaMBV6ZpXkk8b2DzzYkpv0yG/c001ZKhPiR/ugRLYHexLdC Tppn4KrHndGwZ2uHxV54PWRmCyYafikorsyiuU/uOO5myqChUK/VattBGoH+WUHIcffC Ntkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720293229; x=1720898029; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t4bNu6CI6omvOt9CPXqjom5ah5T2zFduQZDfzw7pbQM=; b=Fu8zDZROxl4krvLAwrRdL7eYjfqeuLQbnr0EcxfbidrsxkQjdnwnvXlrfLMl4aDBD2 vgYIJvvAmpnq/ksph2FwEqWaL8mY0Nj8i/PTO+qg2lhwU2OOQlLYoszxBw9c33ljugUM OyvHhDuAsmmRLDvDzW+RKfzB4dcU2C7TVqdOFsMOXdYQJEMB0h+5Rv74gegwfgaGhXPU 71YxCaim/GY3H4d2AHPWoU9WLEcgEw/E6/LjNT6iAitQ2a6qVRwOKRGCdOmoSayZFMKw cBVQSUPJ57ntXg1YROSxogblYzJU1CcE08H0lsMn1vieJaLjDIBREjF6rGzjHXRibKNy ilcQ== X-Gm-Message-State: AOJu0YwB7KDtE/OVszj+vLllan2sDNwd57fXLEbXYV22Vvll3+zxj3El 2Si6f+imhI7eIvCHD8xJpgJV9DTZ+FM41NMDj4atuG7Za4aOK4sOk9WrcE1JkNGZs+ne9jwYivM 4pMA= X-Received: by 2002:a17:902:e9c6:b0:1f6:89b1:a419 with SMTP id d9443c01a7336-1fb33e15326mr45465225ad.17.1720293229102; Sat, 06 Jul 2024 12:13:49 -0700 (PDT) Received: from linaro.vn.shawcable.net ([2604:3d08:9384:1d00::2193]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fb6153cb3bsm17304305ad.129.2024.07.06.12.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 12:13:48 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Richard Henderson , Marcel Apfelbaum , Mahmoud Mandour , Alexandre Iooss , =?utf-8?q?Alex_Benn=C3=A9e?= , Eduardo Habkost , Yanan Wang , Pierrick Bouvier , Xingtao Yao Subject: [PATCH v6 5/7] tests/tcg: allow to check output of plugins Date: Sat, 6 Jul 2024 12:13:33 -0700 Message-Id: <20240706191335.878142-6-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240706191335.878142-1-pierrick.bouvier@linaro.org> References: <20240706191335.878142-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x62a.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org A specific plugin test can now read and check a plugin output, to ensure it contains expected values. Tested-by: Xingtao Yao Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier --- tests/tcg/Makefile.target | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index 52616544d52..6f50b0176ea 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -90,6 +90,7 @@ CFLAGS= LDFLAGS= QEMU_OPTS= +CHECK_PLUGIN_OUTPUT_COMMAND=true # If TCG debugging, or TCI is enabled things are a lot slower @@ -180,6 +181,9 @@ run-plugin-%: -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@)$(PLUGIN_ARGS) \ -d plugin -D $*.pout \ $(call strip-plugin,$<)) + $(call quiet-command, $(CHECK_PLUGIN_OUTPUT_COMMAND) $*.pout, \ + TEST, check plugin $(call extract-plugin,$@) output \ + with $(call strip-plugin,$<)) else run-%: % $(call run-test, $<, \ @@ -194,6 +198,9 @@ run-plugin-%: -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@)$(PLUGIN_ARGS) \ -d plugin -D $*.pout \ $(QEMU_OPTS) $(call strip-plugin,$<)) + $(call quiet-command, $(CHECK_PLUGIN_OUTPUT_COMMAND) $*.pout, \ + TEST, check plugin $(call extract-plugin,$@) output \ + with $(call strip-plugin,$<)) endif gdb-%: % From patchwork Sat Jul 6 19:13:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 810792 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp2095943wru; Sat, 6 Jul 2024 12:15:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUpcKkyhqeTsVOIi1B1itXcpPB1V9rBQ+vkCduf8UDnGwJJefVi+yPELVDv93bt9Fzuwm9IWv8rqV00ZZTRLXl5 X-Google-Smtp-Source: AGHT+IH1JyS9U08Ykt1AgVHy7ccsV345h2RZIBXxdl85J44DoyQu0nYqLGz4yoMAG5HT7m3kBzr4 X-Received: by 2002:a05:620a:2103:b0:79e:f6c3:f23f with SMTP id af79cd13be357-79ef6c4027emr475463485a.59.1720293317897; Sat, 06 Jul 2024 12:15:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720293317; cv=none; d=google.com; s=arc-20160816; b=tWxPIwV9L8AiE3ryVRzcsUhJiG+5JEsiQlYrRm8S86a5cF+ePyZjDDSLURMmv7obGM LTEm/Ir7QV1CwLK/umMBKRf8SfZZlY0Ath76XN2HxxxuTyxLwT3DWTrq07Igxhd+DTTF TKCYMD/uSryx70r9nZFwPCfsOL3je4lJL3CLxU2DGoC4ORGz6xz5RdqXLJZCp7QhwUHD QWwZTLz8aEeMu/wdxjKrSjG7sDGwcahg6RmegFPqlbeqwxCI6x51F0WMI7ulATsuLPIT YXmVQr1lK4BJxPNEhCia2905qjdeItgGSE/J827j1K58coya/skiAmd6GyiXjnXao0/1 BCMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=Q3v41GFzb0/piPBsIvskwb3RVBKxsZFvBfDW4N/dtnI=; fh=LuyLDqXhwowsHipFfT6JgYXgVYpw+0CWJ0UGuA2fScs=; b=eOand1Ai0LnsXxAkc/XoJLiLhMwJGe+14JOBIrgqqVEAHwVg9Dbm42RVpTny7+N2D1 uz3uJkYWQwuIrCFtN9XF6cAyKNwwKu08bX0NbO6otyueLtx1oT37tPUmtPsfUJt+wbMz MC6RWbOT6NdMBa3kW2fmyLpFJ8VXBeOfyViWwmgpWbiA1V+lkyXP2iikvymDZ/bjyiGt k84JxhbRvSI23M/qHzCXlrYWxFNe0LKiSyBM4bVlMy5KAxJarN1SYM9zo8Bm563T1H6I zp5L1JY+pG7pq8KMbnqc988+1hGpua3ohsYt0O3cd79FAH4biZOvDqItpNGkTcgYeXCV vFGw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Gyb52TU+; 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=pass (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 af79cd13be357-79efc1e22a6si315411785a.64.2024.07.06.12.15.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Jul 2024 12:15:17 -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=pass header.i=@linaro.org header.s=google header.b=Gyb52TU+; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQAr6-0002Dt-6z; Sat, 06 Jul 2024 15:13:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQAr4-0002De-N7 for qemu-devel@nongnu.org; Sat, 06 Jul 2024 15:13:54 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQAr2-00045V-VK for qemu-devel@nongnu.org; Sat, 06 Jul 2024 15:13:54 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-70b09c2ade6so1272512b3a.3 for ; Sat, 06 Jul 2024 12:13:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720293230; x=1720898030; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Q3v41GFzb0/piPBsIvskwb3RVBKxsZFvBfDW4N/dtnI=; b=Gyb52TU+XeUqFj8bI07cQmSlLXhMeL2l1kRnwAIE/KdPVuJB3T78bwVoXnypNVLZ4W jTzwHzUlfUM8DMBNYoroFp3S1PKpV0Je0ce5ZetwuHJN8HTc/vAB+FPjTU7hj/QjWjHM YA88XSCdT0fbSq0jQY/w+FyztOWEhRwyTb0mLxUZ/I6QCXS2lzW1W3Enyl5/WIGi0AxK 86XeKey6I7xwQ90zaimsWAwcuvUfI9XhFjc27BizgCzqpMzszGGmDPRrY+RISWTsuLDb BeaL1ISMWhVnWJa+VMMfN8SvexR6Czwk2QVKBTtYSj68MSa/pgELTao3TmPE9BYIfLcz 8pHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720293230; x=1720898030; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q3v41GFzb0/piPBsIvskwb3RVBKxsZFvBfDW4N/dtnI=; b=uOY2HZT4UmBBarQBH2uYg4Yn4IiTuhplXjK+JunZV1orKMK6ZNVYss32uaUg6Hgwow UyvrphaWqqF02GZGuIG1qGYD43EgVJo/7CisQyZOCyzP7zb9505tpozFY6I7es+r1JPX ORtdoPrh2BJl/rOQ+GGcK6mhHr38worITiKiwHnyQpZ3XwqQmQQXobVyAlXBcW4fOQJA 2iKzEqUyJqv2KKhnBY+9y9kHNzrH+j22i3OnEc2znF/IQmqxJ/zSHg03qXwdGqIxW/le W/1bsmMGrvviDkrkGkQ2HMWLIJJfAJ+Vmfriz/uEg4YwGn2gDKQ0lhS31KBYZR0Uhh1S Ww7A== X-Gm-Message-State: AOJu0Yy/uZ0lx/4xvM49ikLnCQ/XQEsR4YcLA8ycipmb4DF8W4OgDA6M kbTN/Dd0ZVsIhbu9pYUNaaSV8CZbQA7FyBwvbmc+m4N4YU/F0aCdz+Jjh9GFv7mh9AeBi8aX31g YmYA= X-Received: by 2002:a05:6a20:9186:b0:1c0:ef24:4125 with SMTP id adf61e73a8af0-1c0ef24b42amr341721637.26.1720293230225; Sat, 06 Jul 2024 12:13:50 -0700 (PDT) Received: from linaro.vn.shawcable.net ([2604:3d08:9384:1d00::2193]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fb6153cb3bsm17304305ad.129.2024.07.06.12.13.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 12:13:49 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Richard Henderson , Marcel Apfelbaum , Mahmoud Mandour , Alexandre Iooss , =?utf-8?q?Alex_Benn=C3=A9e?= , Eduardo Habkost , Yanan Wang , Pierrick Bouvier , Xingtao Yao Subject: [PATCH v6 6/7] tests/plugin/mem: add option to print memory accesses Date: Sat, 6 Jul 2024 12:13:34 -0700 Message-Id: <20240706191335.878142-7-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240706191335.878142-1-pierrick.bouvier@linaro.org> References: <20240706191335.878142-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pf1-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org By using "print-accesses=true" option, mem plugin will now print every value accessed, with associated size, type (store vs load), symbol, instruction address and phys/virt address accessed. Reviewed-by: Richard Henderson Reviewed-by: Xingtao Yao Signed-off-by: Pierrick Bouvier --- tests/plugin/mem.c | 69 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/tests/plugin/mem.c b/tests/plugin/mem.c index b650dddcce1..086e6f5bdfc 100644 --- a/tests/plugin/mem.c +++ b/tests/plugin/mem.c @@ -21,10 +21,15 @@ typedef struct { uint64_t io_count; } CPUCount; +typedef struct { + uint64_t vaddr; + const char *sym; +} InsnInfo; + static struct qemu_plugin_scoreboard *counts; static qemu_plugin_u64 mem_count; static qemu_plugin_u64 io_count; -static bool do_inline, do_callback; +static bool do_inline, do_callback, do_print_accesses; static bool do_haddr; static enum qemu_plugin_mem_rw rw = QEMU_PLUGIN_MEM_RW; @@ -60,6 +65,44 @@ static void vcpu_mem(unsigned int cpu_index, qemu_plugin_meminfo_t meminfo, } } +static void print_access(unsigned int cpu_index, qemu_plugin_meminfo_t meminfo, + uint64_t vaddr, void *udata) +{ + InsnInfo *insn_info = udata; + unsigned size = 8 << qemu_plugin_mem_size_shift(meminfo); + const char *type = qemu_plugin_mem_is_store(meminfo) ? "store" : "load"; + qemu_plugin_mem_value value = qemu_plugin_mem_get_value(meminfo); + uint64_t hwaddr = + qemu_plugin_hwaddr_phys_addr(qemu_plugin_get_hwaddr(meminfo, vaddr)); + g_autoptr(GString) out = g_string_new(""); + g_string_printf(out, + "0x%"PRIx64",%s,0x%"PRIx64",0x%"PRIx64",%d,%s,", + insn_info->vaddr, insn_info->sym, + vaddr, hwaddr, size, type); + switch (value.type) { + case QEMU_PLUGIN_MEM_VALUE_U8: + g_string_append_printf(out, "0x%02"PRIx8, value.data.u8); + break; + case QEMU_PLUGIN_MEM_VALUE_U16: + g_string_append_printf(out, "0x%04"PRIx16, value.data.u16); + break; + case QEMU_PLUGIN_MEM_VALUE_U32: + g_string_append_printf(out, "0x%08"PRIx32, value.data.u32); + break; + case QEMU_PLUGIN_MEM_VALUE_U64: + g_string_append_printf(out, "0x%016"PRIx64, value.data.u64); + break; + case QEMU_PLUGIN_MEM_VALUE_U128: + g_string_append_printf(out, "0x%016"PRIx64"%016"PRIx64, + value.data.u128.high, value.data.u128.low); + break; + default: + g_assert_not_reached(); + } + g_string_append_printf(out, "\n"); + qemu_plugin_outs(out->str); +} + static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) { size_t n = qemu_plugin_tb_n_insns(tb); @@ -79,6 +122,16 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) QEMU_PLUGIN_CB_NO_REGS, rw, NULL); } + if (do_print_accesses) { + /* we leak this pointer, to avoid locking to keep track of it */ + InsnInfo *insn_info = g_malloc(sizeof(InsnInfo)); + const char *sym = qemu_plugin_insn_symbol(insn); + insn_info->sym = sym ? sym : ""; + insn_info->vaddr = qemu_plugin_insn_vaddr(insn); + qemu_plugin_register_vcpu_mem_cb(insn, print_access, + QEMU_PLUGIN_CB_NO_REGS, + rw, (void *) insn_info); + } } } @@ -117,6 +170,12 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, fprintf(stderr, "boolean argument parsing failed: %s\n", opt); return -1; } + } else if (g_strcmp0(tokens[0], "print-accesses") == 0) { + if (!qemu_plugin_bool_parse(tokens[0], tokens[1], + &do_print_accesses)) { + fprintf(stderr, "boolean argument parsing failed: %s\n", opt); + return -1; + } } else { fprintf(stderr, "option parsing failed: %s\n", opt); return -1; @@ -129,6 +188,14 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, return -1; } + if (do_print_accesses) { + g_autoptr(GString) out = g_string_new(""); + g_string_printf(out, + "insn_vaddr,insn_symbol,mem_vaddr,mem_hwaddr," + "access_size,access_type,mem_value\n"); + qemu_plugin_outs(out->str); + } + counts = qemu_plugin_scoreboard_new(sizeof(CPUCount)); mem_count = qemu_plugin_scoreboard_u64_in_struct( counts, CPUCount, mem_count); From patchwork Sat Jul 6 19:13:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 810791 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp2095879wru; Sat, 6 Jul 2024 12:15:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXKOdj9iVXvaRpIZ0jrZ7X2GfDP7cqNoZx2CETjRaUPng+0DGPMUd9JbKUR5oWqjzTuFoTRAbuujwVijTQinQg3 X-Google-Smtp-Source: AGHT+IGsP+3tPbWvpECeuEfXkQ9iBqsPK94K1NXbwTebMHf6bJJzPzOlrch0dn9ULFqdYdiLnnb3 X-Received: by 2002:a05:6808:189e:b0:3d6:2f1c:e771 with SMTP id 5614622812f47-3d914c54e5dmr9271702b6e.18.1720293304548; Sat, 06 Jul 2024 12:15:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720293304; cv=none; d=google.com; s=arc-20160816; b=VbC+LVnoKMypLHuXw/lkN8KLdPnzNsNeU1JSkUgwZW8XtNq16HmT8Pusjd4sruiCgV lDTekoV1HMUJmt9R3HBQwucd1IFHaZZu9cYbsDAOWu2DbrWGmIwxrQ4FfZsK9UtBCF+I jEycAcIc/v78kJrz4oM2OB97SJ8G709aFups6glC+J9RUO8NereWNBS5KsHvQ8HVT2oQ m3Czq+g3mry/euuW6tAa9gIj6LXCbVm68GIW/uzJ/LSMqFsB9fCJbQuNaSEKYNNkqQIM aDRGtVNCDgrb7vTScf0tBg3LG0fBF56ohrQUzDSVGjZH2z6LqjlCcSWo/ESXsqa1kLqK c8dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=jSYKX7tgmPWgH1eoungM9Ek83i1kIQO2hxPk9JjJ0jw=; fh=LuyLDqXhwowsHipFfT6JgYXgVYpw+0CWJ0UGuA2fScs=; b=u6bViN6lKWQpO7kWN1xECbiaJD5bP1z7eDOuwK18I5//tmZB9un5FfLzE6vzP0FyKI Ulscqka3+gueVT2aneGlpw0e6bF1BImzH9Y/7MAXUQRzUdEYInkDP7MvQiERjh0PXann WYxbRuc84mRT4+oOhxQ/oi5KQfGMIQ2PLiTIHaIZ5VAi28nGsiHn2mIIbA1Ble+EgXqt cz1BpM8bn83WLw/kmaf5SROfWl6R2bsAn8Vu6zaLc0HEuv9NaUjuv3pK9Oc72dKXPmqJ T4aZT1T1muICdR7Ef5tRoC8YyHDTozMVIEeptKbOtHYJ5m55r471vlbv0skwa4PqN1w4 MIxQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qqwdRoxF; 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=pass (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 af79cd13be357-79f001c45c7si232789085a.278.2024.07.06.12.15.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 06 Jul 2024 12:15:04 -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=pass header.i=@linaro.org header.s=google header.b=qqwdRoxF; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQAr7-0002EJ-9l; Sat, 06 Jul 2024 15:13:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQAr6-0002Du-6D for qemu-devel@nongnu.org; Sat, 06 Jul 2024 15:13:56 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQAr3-00045g-Ps for qemu-devel@nongnu.org; Sat, 06 Jul 2024 15:13:55 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1f65a3abd01so18387685ad.3 for ; Sat, 06 Jul 2024 12:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720293231; x=1720898031; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jSYKX7tgmPWgH1eoungM9Ek83i1kIQO2hxPk9JjJ0jw=; b=qqwdRoxFtouSAaXWvRQZS+ftVI+mpnYfjpyXEb6Zvxnwr6aX8ISMm/xs3b7maAT1nX Kt7/fMH2t3pPU7P/2VP0E1ydrNInkGwFVZV8ttQUQBUL1Hhrj4WU88VRxsgzDEZjlQxp FhvEQBoI69g8/nR3xfQOl2LQuWlDjUwD5RHcH2iCpwog9b/kvXhkWphxOGpe4f3VFyw2 qhzYn5jEEuEX/1crqlZoeQPbk8az1AV1ztWfdN6bEmqucmZ/Mkgp/Veyr2u0QbXLu67g zhpxTypUE+FRTZNVkwhyrevMKqSf3Jxe4p3Ipc1VNiKwAC5Kw3BW4pjv/8UH9tDux8wK nRgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720293231; x=1720898031; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jSYKX7tgmPWgH1eoungM9Ek83i1kIQO2hxPk9JjJ0jw=; b=oxH4S2zu8iybl20twEuKeFo3Fr2DKIUS7BUOvVMbTyrEwVt36pUitlWvMZjROLbn+i 4UZnDoLwIXV/H9vA5G0+/pzTFAdfEFRmN4AJB6pmXhEXp57fzlwwIR32fXFrRD5rfl05 NRZ0C0yv/GqFgKxfebHTLsqdb4738VZVfHMwaPcZCFkugrNl3/wG0m0eEMX91jezpxP8 ygym7Wmnur6Q/b3bLS1yxz8WerAFFO2kRXiwf9MAQTQPy23HvTIg7SFGOPq5mFjMNKlU BiiMW1n0j79UuE1QY79wOmh8C+S3gWXLc1sRm71JsAOV2tr1n3L2QtBXB8jv2PVtOuvV QOZw== X-Gm-Message-State: AOJu0YzX7zyJoW6VrFvqqH42rzt8yk8bIG2mxvWA+TrRb7SYXingTqnX c6noyEMrywqKLsRjKiKeA2x2i7lFYnQ+Akmbd62LhKlPcuYtlxA/ipaxEu+C1xZhRaaclluj5jn r2x8= X-Received: by 2002:a17:902:654a:b0:1fb:18a8:1939 with SMTP id d9443c01a7336-1fb33e1965dmr52716065ad.20.1720293231364; Sat, 06 Jul 2024 12:13:51 -0700 (PDT) Received: from linaro.vn.shawcable.net ([2604:3d08:9384:1d00::2193]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fb6153cb3bsm17304305ad.129.2024.07.06.12.13.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 12:13:50 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Richard Henderson , Marcel Apfelbaum , Mahmoud Mandour , Alexandre Iooss , =?utf-8?q?Alex_Benn=C3=A9e?= , Eduardo Habkost , Yanan Wang , Pierrick Bouvier , Xingtao Yao Subject: [PATCH v6 7/7] tests/tcg/x86_64: add test for plugin memory access Date: Sat, 6 Jul 2024 12:13:35 -0700 Message-Id: <20240706191335.878142-8-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240706191335.878142-1-pierrick.bouvier@linaro.org> References: <20240706191335.878142-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x62c.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Add an explicit test to check expected memory values are read/written. For sizes 8, 16, 32, 64 and 128, we generate a load/store operation. For size 8 -> 64, we generate an atomic __sync_val_compare_and_swap too. For 128bits memory access, we rely on SSE2 instructions. By default, atomic accesses are non atomic if a single cpu is running, so we force creation of a second one by creating a new thread first. load/store helpers code path can't be triggered easily in user mode (no softmmu), so we can't test it here. Can be run with: make -C build/tests/tcg/x86_64-linux-user run-plugin-test-plugin-mem-access-with-libmem.so Tested-by: Xingtao Yao Signed-off-by: Pierrick Bouvier --- tests/tcg/x86_64/test-plugin-mem-access.c | 89 +++++++++++++++++++++ tests/tcg/x86_64/Makefile.target | 7 ++ tests/tcg/x86_64/check-plugin-mem-access.sh | 48 +++++++++++ 3 files changed, 144 insertions(+) create mode 100644 tests/tcg/x86_64/test-plugin-mem-access.c create mode 100755 tests/tcg/x86_64/check-plugin-mem-access.sh diff --git a/tests/tcg/x86_64/test-plugin-mem-access.c b/tests/tcg/x86_64/test-plugin-mem-access.c new file mode 100644 index 00000000000..7fdd6a55829 --- /dev/null +++ b/tests/tcg/x86_64/test-plugin-mem-access.c @@ -0,0 +1,89 @@ +#include +#include +#include +#include + +static void *data; + +#define DEFINE_STORE(name, type, value) \ +static void store_##name(void) \ +{ \ + *((type *)data) = value; \ +} + +#define DEFINE_ATOMIC_OP(name, type, value) \ +static void atomic_op_##name(void) \ +{ \ + *((type *)data) = 0x42; \ + __sync_val_compare_and_swap((type *)data, 0x42, value); \ +} + +#define DEFINE_LOAD(name, type) \ +static void load_##name(void) \ +{ \ + register type var asm("eax") = *((type *) data); \ + (void)var; \ +} + +DEFINE_STORE(u8, uint8_t, 0xf1) +DEFINE_ATOMIC_OP(u8, uint8_t, 0xf1) +DEFINE_LOAD(u8, uint8_t) +DEFINE_STORE(u16, uint16_t, 0xf123) +DEFINE_ATOMIC_OP(u16, uint16_t, 0xf123) +DEFINE_LOAD(u16, uint16_t) +DEFINE_STORE(u32, uint32_t, 0xff112233) +DEFINE_ATOMIC_OP(u32, uint32_t, 0xff112233) +DEFINE_LOAD(u32, uint32_t) +DEFINE_STORE(u64, uint64_t, 0xf123456789abcdef) +DEFINE_ATOMIC_OP(u64, uint64_t, 0xf123456789abcdef) +DEFINE_LOAD(u64, uint64_t) + +static void store_u128(void) +{ + _mm_store_si128(data, _mm_set_epi32(0xf1223344, 0x55667788, + 0xf1234567, 0x89abcdef)); +} + +static void load_u128(void) +{ + __m128i var = _mm_load_si128(data); + (void)var; +} + +static void *f(void *p) +{ + return NULL; +} + +int main(void) +{ + /* + * We force creation of a second thread to enable cpu flag CF_PARALLEL. + * This will generate atomic operations when needed. + */ + pthread_t thread; + pthread_create(&thread, NULL, &f, NULL); + pthread_join(thread, NULL); + + data = malloc(sizeof(__m128i)); + atomic_op_u8(); + store_u8(); + load_u8(); + + atomic_op_u16(); + store_u16(); + load_u16(); + + atomic_op_u32(); + store_u32(); + load_u32(); + + atomic_op_u64(); + store_u64(); + load_u64(); + + store_u128(); + load_u128(); + + free(data); +} diff --git a/tests/tcg/x86_64/Makefile.target b/tests/tcg/x86_64/Makefile.target index eda9bd7396c..3edc29b924d 100644 --- a/tests/tcg/x86_64/Makefile.target +++ b/tests/tcg/x86_64/Makefile.target @@ -16,6 +16,7 @@ X86_64_TESTS += noexec X86_64_TESTS += cmpxchg X86_64_TESTS += adox X86_64_TESTS += test-1648 +PLUGINS_TESTS += test-plugin-mem-access TESTS=$(MULTIARCH_TESTS) $(X86_64_TESTS) test-x86_64 else TESTS=$(MULTIARCH_TESTS) @@ -26,6 +27,12 @@ adox: CFLAGS=-O2 run-test-i386-ssse3: QEMU_OPTS += -cpu max run-plugin-test-i386-ssse3-%: QEMU_OPTS += -cpu max +run-plugin-test-plugin-mem-access-with-libmem.so: \ + PLUGIN_ARGS=$(COMMA)print-accesses=true +run-plugin-test-plugin-mem-access-with-libmem.so: \ + CHECK_PLUGIN_OUTPUT_COMMAND= \ + $(SRC_PATH)/tests/tcg/x86_64/check-plugin-mem-access.sh + test-x86_64: LDFLAGS+=-lm -lc test-x86_64: test-i386.c test-i386.h test-i386-shift.h test-i386-muldiv.h $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) diff --git a/tests/tcg/x86_64/check-plugin-mem-access.sh b/tests/tcg/x86_64/check-plugin-mem-access.sh new file mode 100755 index 00000000000..163f1cfad34 --- /dev/null +++ b/tests/tcg/x86_64/check-plugin-mem-access.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +set -euo pipefail + +die() +{ + echo "$@" 1>&2 + exit 1 +} + +check() +{ + file=$1 + pattern=$2 + grep "$pattern" "$file" > /dev/null || die "\"$pattern\" not found in $file" +} + +[ $# -eq 1 ] || die "usage: plugin_out_file" + +plugin_out=$1 + +expected() +{ + cat << EOF +,store_u8,.*,8,store,0xf1 +,atomic_op_u8,.*,8,load,0x42 +,atomic_op_u8,.*,8,store,0xf1 +,load_u8,.*,8,load,0xf1 +,store_u16,.*,16,store,0xf123 +,atomic_op_u16,.*,16,load,0x0042 +,atomic_op_u16,.*,16,store,0xf123 +,load_u16,.*,16,load,0xf123 +,store_u32,.*,32,store,0xff112233 +,atomic_op_u32,.*,32,load,0x00000042 +,atomic_op_u32,.*,32,store,0xff112233 +,load_u32,.*,32,load,0xff112233 +,store_u64,.*,64,store,0xf123456789abcdef +,atomic_op_u64,.*,64,load,0x0000000000000042 +,atomic_op_u64,.*,64,store,0xf123456789abcdef +,load_u64,.*,64,load,0xf123456789abcdef +,store_u128,.*,128,store,0xf122334455667788f123456789abcdef +,load_u128,.*,128,load,0xf122334455667788f123456789abcdef +EOF +} + +expected | while read line; do + check "$plugin_out" "$line" +done