From patchwork Tue Dec 17 22:42:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 851468 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp616801wrq; Tue, 17 Dec 2024 14:45:00 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXXfFnMOhNIBLHMgay4tdCxNx+9ytDaHzs2qCZUf+pJSLnpikVxa64CKmB9xM751tZb5cGZ4w==@linaro.org X-Google-Smtp-Source: AGHT+IGl1+uOh6ewXzNT5rG9ZS2eoG3BKIV0e89zz7Pr/Eu4GKjfjzHX6pzyPtd/dpGnIQiAo5YL X-Received: by 2002:ac8:5fc4:0:b0:466:9197:b4fb with SMTP id d75a77b69052e-46908ed0d02mr8887451cf.47.1734475500446; Tue, 17 Dec 2024 14:45:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734475500; cv=none; d=google.com; s=arc-20240605; b=kPLGcl4WUeS04EoDw66Z96Gbpurfm+MFexUbnGcRebP5GdFMDbKIOVLGjBzJPDx6OZ YUmY2TXVsQY9inJlotM94+qqV6CxfU8O71DCohIqzPmuyzOoa+WCkQ3lkCHoscgyXAqo lLp/px6CPKsBKd39A7WrIXZ4CKfSqZOCeBAPoDly7K3YF/u6h3cdabOHK8U46AFntE11 Qf4hUK/8dlSu4TfIuW/sp2IHDdmuDDcgCeIzFpyk7qzJ/Zvcr6sL0P3nsOOMjHYweMvF RDm76x+uuBJntZ6tS2y6jateOgBUj+HqNJmVsyrN3M/Ia7nFvITHxqQtSdkWfrer4Dkg uKnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=NOzYfBh0zmSLp+iKqt+C5cDNqScuCpesF/tusP6QFbo=; fh=e32mLanPjfs41dQwy8Wt4zFa68BQ2A3naWRPcWqt/Vw=; b=L4BqVCyYHXxreExB8aW+xva2vjrsWvErwcnl4FHcednV7OkRbdGHkqdwn30PueL7FR bw3fC7BrdffGotDAB+RRu8nXAizt51dfJ8SQvIsZSyTHoxFvA7ERl15m6USY2pC6Izhd qpwrN/J6lFYJIf5eGuw6rcOHNDHts8wbhl2GKcclMHIwQ3jC7mxT2Csm+2E3PBp4wluc KpNitOumZIsCb+mSQxMpdeEOXupmuRrfxDOGODi4FSqL1tbdBKdK6MDmnzF13VOus5tB 5/T79XDb1c7TKMU5owvMpdAswBcy53LPprFpIIV+atC6f5UgLsNes49S5HmdlyKcccjm zRNQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rEWGNR36; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b7048bf5aasi1064594685a.277.2024.12.17.14.45.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Dec 2024 14:45:00 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rEWGNR36; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tNgHj-0004LJ-18; Tue, 17 Dec 2024 17:43:23 -0500 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 1tNgHf-0004JG-8K for qemu-devel@nongnu.org; Tue, 17 Dec 2024 17:43:19 -0500 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNgHa-00018u-De for qemu-devel@nongnu.org; Tue, 17 Dec 2024 17:43:19 -0500 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-725ef0397aeso5228161b3a.2 for ; Tue, 17 Dec 2024 14:43:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734475392; x=1735080192; 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=NOzYfBh0zmSLp+iKqt+C5cDNqScuCpesF/tusP6QFbo=; b=rEWGNR369wdoc06ayRxkHSUnPdDE9NKxzf5Kivzx16yYZPMZSaStqaMJTKNMeVeZGZ jfDawKWGULon7JIXsAzEevh0LKshkStIbusreQ5ANzduQtp7LjBQlUlJ5+mPd+7sGkJV L/L1RGJfPiyj3FFWvDFePVTCyzNxKLfFV15XjTsJJqW/bkKNz1rmCG61zmvChtSmFgVn c/ZM32y3GyTB/08AAC2Z56GcQrQRHeQhhaeLXPNA5gMrApzQv1ZAGqjHelT8BwHLIEOg LSGOYWNrvzR4gW0eSw9P2etLExL8qa2X3keST39vey9GjEYbraRUC2aiPcgRSTF0N3uT UejQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734475392; x=1735080192; 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=NOzYfBh0zmSLp+iKqt+C5cDNqScuCpesF/tusP6QFbo=; b=hp91nQqv+pP2Zx59YmmyvRZfyaCG5RL4rlmkugwQ2L0a81ZQFVg72OhSBG5npg9Fj4 jvRurS1OZjo4I5TKfGAOd6Unzwn+CHyzir8yQUKJe2aqH0drLmIEDGv0WZj56ZoxCnjg b+Dw9gqMLYQEda9P2FTeez7zwDfdAuOLemfHZVRixiIBGTUfsuit9kJZDwDlxhgquokq J6BLQTOcth2XpF4V/xbkd+rwjCVX3CUbGHDSvYh6ObiM0eRt5QwTu1b5/XxZtX78gzKK f+ob4rVJFHKUa74FIjzUiKV8KBaMkDIsYPO5C4YLQi1wXfn0Um4VBT0VSLa4a4wIQitu M8zg== X-Gm-Message-State: AOJu0YxTC/V/h2+UrxrieZqfnSCytU9jJOfqUe0Rky5vcKqs/wpPT6Rv pujUCQEfGogzI8er0GYOsSr2+9yBQX+CAB7C8mn/E7xrDQYF9bBjoUTgb9Dp477gUbus+n7lkx8 j/2M= X-Gm-Gg: ASbGncsvZbz2mnwS1jNYTRkFgiG8mKpDwqCCMtsasIWzqx7FoZ9be3pwpHUxymumsqw CK+y8NWMGxZSJhXGIEebnOd7pxvb2c8+3kHpmfCG/aHjLMdIRzGREQW7BqFSJ2nVUYVR1MUqxQp Bai/sB9+CPhUMvcw7Udtq7gm02fahZ6TqyzRz1Nmbdwxq8gVxPWxUY+Zc5K/+0yYws64b3gUkN2 fHxqkDH5s4g07GtleXonesZ6Z9WMSnl5yiQRE22Tf96IdLIppzaUF35 X-Received: by 2002:a05:6a00:21c6:b0:728:eb32:356c with SMTP id d2e1a72fcca58-72a8d2611f2mr991827b3a.11.1734475392496; Tue, 17 Dec 2024 14:43:12 -0800 (PST) Received: from pc.. ([38.39.164.180]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72918ac53f3sm7463214b3a.27.2024.12.17.14.43.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 14:43:12 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= , richard.henderson@linaro.org, philmd@linaro.org, Alexandre Iooss , Mahmoud Mandour , Thomas Huth , Paolo Bonzini Subject: [PATCH v3 02/11] contrib/plugins/howvec: ensure we don't regress if this plugin is extended Date: Tue, 17 Dec 2024 14:42:57 -0800 Message-Id: <20241217224306.2900490-3-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241217224306.2900490-1-pierrick.bouvier@linaro.org> References: <20241217224306.2900490-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pf1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_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 Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier --- contrib/plugins/howvec.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/plugins/howvec.c b/contrib/plugins/howvec.c index 9be67f74534..2aa9029c3f0 100644 --- a/contrib/plugins/howvec.c +++ b/contrib/plugins/howvec.c @@ -253,6 +253,8 @@ static struct qemu_plugin_scoreboard *find_counter( int i; uint64_t *cnt = NULL; uint32_t opcode = 0; + /* if opcode is greater than 32 bits, we should refactor insn hash table. */ + G_STATIC_ASSERT(sizeof(opcode) == sizeof(uint32_t)); InsnClassExecCount *class = NULL; /* @@ -284,7 +286,7 @@ static struct qemu_plugin_scoreboard *find_counter( g_mutex_lock(&lock); icount = (InsnExecCount *) g_hash_table_lookup(insns, - GUINT_TO_POINTER(opcode)); + (gpointer)(intptr_t) opcode); if (!icount) { icount = g_new0(InsnExecCount, 1); @@ -295,8 +297,7 @@ static struct qemu_plugin_scoreboard *find_counter( qemu_plugin_scoreboard_new(sizeof(uint64_t)); icount->count = qemu_plugin_scoreboard_u64(score); - g_hash_table_insert(insns, GUINT_TO_POINTER(opcode), - (gpointer) icount); + g_hash_table_insert(insns, (gpointer)(intptr_t) opcode, icount); } g_mutex_unlock(&lock);