From patchwork Tue Dec 17 22:38:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 851451 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp614866wrq; Tue, 17 Dec 2024 14:39:26 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUQByG+TfbFOPhw4+UR1z5j5eonRFbEtJMNvrmtilvLjFbtFV2hbWzfAL6jvxZffDiKkALPzQ==@linaro.org X-Google-Smtp-Source: AGHT+IGR+hXHKfEzzNzu8qC3yS6NTE9KfdbNIja5GgS4fDh9162Em4gBTLBFmIgU0ByAflscHw2R X-Received: by 2002:ac8:7f4e:0:b0:466:b29a:816d with SMTP id d75a77b69052e-46908db2144mr10134851cf.3.1734475165688; Tue, 17 Dec 2024 14:39:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734475165; cv=none; d=google.com; s=arc-20240605; b=UGLISlV0n+6N3OVDwuAcUPH1zUvcUUJN516Cdw5k3FRAzDxbcYwGEg6gi6k5xHcho/ 0Ar1akYPAycQlgmkl+tj00f213pukRuJ6lEK0dcJJct3F12T1F9e+CtMjLSa3dSFdbMJ Pxbs/bre28BriZBOcbTm4M9EpP2ClEJr/tPaonGkeBxY9OzXqkmHhP5UOFboveJib9HC ZKFZ8PbxTlyHZGk33/EygKT5P/nw2QAuFHhBeyknKcKlkxGq1QFgYPTvdjgeElVVwSSj ur0WTQS+t/9Qaln4Ot2er/r1/WY6ZIndQs7UI83JBfTaMwFE0BDwmFccyCqL8mpj6eu3 s7cw== 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=kntzVB1MiyL7bevKjAuLTyrUWmHMkhYgMIBRD8JjWYI=; fh=+NflhOdr9R5O8MPEqbGfWeoDmt6zsMvcpjNabm4DZ9U=; b=NYLT5AWN+fJVR6P33VoAd6XDo2huzWGKgKGKL9N642AMUT6VUlCcGNw3fSxozXyHST U5TmdtCdpxUvOXBfI8jQE+eAHZ2oNzHWgQU6iDbjXorgoJsXbFWwbQDGoc6v0j775ijt 13+SVGn5GVtTgJKS6/Lcn0Y6WHSZo5zgm17i9YZUSUAnz+gcYzdD9EoIdz6rMB+AxUtl PzllCuKDxmXHM6CogM28Onz/XJisZho2N+jr0f1NoO7Hm2sZaShH279p4ik9Bi+toPFH RHBlAEdmj2zpL5VUe8y++tNDw3SG2+8RnpASivanV0tbm7UzAb25AewMl4QAEC68BVdr L/Pw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jka0e2/r"; 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 d75a77b69052e-467b2ecf225si105750071cf.372.2024.12.17.14.39.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Dec 2024 14:39:25 -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="jka0e2/r"; 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 1tNgD9-0005Ly-Ma; Tue, 17 Dec 2024 17:38:39 -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 1tNgD7-0005LF-Ja for qemu-devel@nongnu.org; Tue, 17 Dec 2024 17:38:37 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tNgD3-0008Q9-Rj for qemu-devel@nongnu.org; Tue, 17 Dec 2024 17:38:37 -0500 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-2166f1e589cso60826695ad.3 for ; Tue, 17 Dec 2024 14:38:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734475112; x=1735079912; 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=kntzVB1MiyL7bevKjAuLTyrUWmHMkhYgMIBRD8JjWYI=; b=jka0e2/rf1fDc5ExS59m06zL3kXhOAxCTG5Hz+s8CplkqIHkVPmFGGxGwhKOlrEElj c3MwdfqjiO1kCZdYkYwLUlHRFCRiER89tg6Gg2gIncm/44O7ZNbY/1HziSUdTDuEisWw 3S8Vrkcdmap0n92u/YDL57XHtrE1KzceKcSQdXEvn0Bn6QC3gUvhOMFy7HIyfeIpJD98 UVruR/+dDSIWHXEfI/dKzRbBRjauQ0oGs4o/pkL/djaZKt4nzlE1ZSfqMLY47VL/wIIP EOu/fQB9iZdswXjc2R2HlSolElQCksUswt/Kns1uVWC6mmbtYPrPwBV89mWBZmbxuq5q p6og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734475112; x=1735079912; 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=kntzVB1MiyL7bevKjAuLTyrUWmHMkhYgMIBRD8JjWYI=; b=e4RSpQsQbJh47hgAOGryD2lFXN85vJ85OzSk+0P36YPOziv9JvzL2yKsuql2Zn6+Vk mCiilNmwPQmbryNlVRMoMLXkckMYYVjZQlRGc/+3LEjLSen8xa6CYggxwnrN3bUbfw+5 FQnwDyvUYd0lvuzSPgZ+8fQ+r6zV2IhTWQnYMHdlbR8c+3zEX+RNoT6CVmI9Mdt5tf1m WgKv8piCwl8Mx76GKPT5lpWm8oS3DNjuSGW0w19jU8JsYDTy1WmiY9sykmNUoJWr3R7g MhmSAdtECZLP5JnUmk4bx+gCMp85iI5T2vI0WQVfHvq+bzE62u/wQCMrnWLkgAlBGBfZ pPiw== X-Gm-Message-State: AOJu0YwoFKxeSG5YK0eU+ie+nWyiRfOqJpxW3Rv6pkro/yOxQ8Jo78zz +3xbQQ2aGGEg03mjBTC/2rmZNdIDUTrVHuY6V5su+e2nTQvDC0O9eD2O8R7rC+ypwRFH6u6a31G zCiA= X-Gm-Gg: ASbGncu4FpBY4Q2LYMd2DxES+TUGk9XxY/MF7kJU1pB2ofC/WQi4dRNOhCiMtuoCZqi oJnDhuJLK1gQg4ckKYcyLOclvJDtvwIkY81T60GDTtkVqcDSazFVIWYI+r4nm99t2MH8mVVtwiR EP39oFfDR6c+R5nAxF28JEus+hRuK5Zoxpt5JMolJ91IDjUj2W96mnfIblciUv4pRo6sy4eY4Yg 0zOVbzkgwWa41ssUi8ayyiEtPK9ZHxkh+hW1gMDdAW/teUU68Rt5qPP X-Received: by 2002:a17:902:c94f:b0:216:281f:820d with SMTP id d9443c01a7336-218d6fd4bdamr6186205ad.11.1734475112348; Tue, 17 Dec 2024 14:38:32 -0800 (PST) Received: from pc.. ([38.39.164.180]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-218a1dccb03sm64869465ad.98.2024.12.17.14.38.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 14:38:31 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Paolo Bonzini , philmd@linaro.org, Mahmoud Mandour , richard.henderson@linaro.org, Pierrick Bouvier , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Alexandre Iooss Subject: [PATCH v2 02/11] contrib/plugins/howvec: ensure we don't regress if this plugin is extended Date: Tue, 17 Dec 2024 14:38:16 -0800 Message-Id: <20241217223825.2895749-3-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241217223825.2895749-1-pierrick.bouvier@linaro.org> References: <20241217223825.2895749-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x634.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 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);