From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A600145A03; Thu, 21 Nov 2024 21:08:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732223298; cv=none; b=GJk9MmUla4dZidA3NqT76vCniDdkBVqNf91u4oaBIclER8wBdjGGrqyPaw7Lyq2c7x0TH5cSQTeaFWZS8dT2HfYkiNc5Ws46JFpLLfw51Xrl+pQkgGYIcRCvcGBl/sQIfQQ1L6ie9YTFlOXjlcAYyxXfdil4BxzaxZExbWOF/7M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732223298; c=relaxed/simple; bh=fXt8OxKD9XX5qaiVShNhnVnQCT5t1Ne8v6HujS5jMVQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=l9hT18y307WDV6BTTNnYfYY/9vHAAdQaU3fajQmyydR8BQ+tq2Wi2Fab1HRL5x/nA9yLjKvZ3EEaxvJcUgD+FKwBt1h6LdzCmu1cTEg851T7HMqX7jci+1P1q+ND0CBjwghF9hhKSuyGvpUAgbEFjXomt1iVykAlNfbH5ATLysc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qz+C2QVT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qz+C2QVT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 284D3C4CECC; Thu, 21 Nov 2024 21:08:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1732223297; bh=fXt8OxKD9XX5qaiVShNhnVnQCT5t1Ne8v6HujS5jMVQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qz+C2QVTzAuv07xeo7NfDGTUpe22VVE87opo3nmV7QIeSMhgz0WnzCYAuMVQfME2Y Z+X+L8SzHZgtzL0SHtIlaHZRi2DfX7o8RVM/aRHx4loPcZyFgInRHs48dL2r8QZdT+ Oj/bnwqDxuMN5i+uRYIyrtoJLxJW9jVAvYowsmrdsVqa35A8vZaHWmXIj5DGHnJ57e lwXu0Ltb39W3f8Qy0PbjZ4he+7IO5glzXYg9ObW83CKAvsfORjeENkjmdF4AsJ4i8s DIZSA4Y7AEz6LU4S0IuetnBmTzF/0Skw2snVMy1lp4xHQRYd9pptSkob6FU62ifIsh 6fwtQskaAl1jg== Date: Thu, 21 Nov 2024 18:08:14 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] perf tests: Fix hwmon parsing with PMU name test Message-ID: References: <20241121000955.536930-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Nov 21, 2024 at 05:58:09PM -0300, Arnaldo Carvalho de Melo wrote: > root@number:~# perf probe -x ~/bin/perf -L hwmon_pmu__have_event > > 0 bool hwmon_pmu__have_event(struct perf_pmu *pmu, const char *name) > 1 { > 2 struct hwmon_pmu *hwm = container_of(pmu, struct hwmon_pmu, pmu); > enum hwmon_type type; > int number; > 5 union hwmon_pmu_event_key key = { .type_and_num = 0 }; > struct hashmap_entry *cur; > size_t bkt; > > 9 if (!parse_hwmon_filename(name, &type, &number, /*item=*/NULL, /*is_alarm=*/NULL)) > 10 return false; > > 12 if (hwmon_pmu__read_events(hwm)) > 13 return false; > > 15 key.type = type; > 16 key.num = number; > 17 if (hashmap_find(&hwm->events, key.type_and_num, /*value=*/NULL)) > 18 return true; > 19 if (key.num != -1) > 20 return false; > /* Item is of form _ which means we should match _