From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D61B3E8FDC4 for ; Wed, 4 Oct 2023 01:38:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=v3wgrDCStQ5aPManShxQIwWH6kFabf/AN9OgeANE+k4=; b=anZKXUGXLmyFNCgyqX94aPaJK9 cRoH3/zrINe4U/09QuHaRCvncDG96UzDTXCyXLgqBDG/OVvrSB5KyCek+W30wpPTLCv+U9C9QK8/D HBFfb/hoTyE8T6SDDhI/5pihsURcfGXF64bZ5Rn53VAiq2O6rqz7SwHeQG6YmaPYTfT/2mqsz2JE5 L9BeYf0zhVtH4HcEc4t4zP0FqPnKYN7gquk3SGvWOd6I/VWc11JlPfudJfdofFq+OhF/E5XRzPFn+ yqNiohp6fW/FTu/L7NZT3M7LBs3uVUv5ZifWaIaeceSu4tXBKqt11/aTMcSM8EfhC4ASHyjMbyUKC ihffjLzA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qnqpx-00Fjb0-26; Wed, 04 Oct 2023 01:38:05 +0000 Received: from mail-vk1-xa29.google.com ([2607:f8b0:4864:20::a29]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qnqpt-00FjaG-2A for linux-arm-kernel@lists.infradead.org; Wed, 04 Oct 2023 01:38:04 +0000 Received: by mail-vk1-xa29.google.com with SMTP id 71dfb90a1353d-49040dc5cedso681474e0c.3 for ; Tue, 03 Oct 2023 18:37:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696383477; x=1696988277; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Ut7xWoIyAkKaAS+UBG8acxM2uYnbNKB4bITE7OuyUn8=; b=NIeabgARqyzdN/skbu6/H9e2z9OMu6efyJRigVWiGE+vFNr1mmNYApkkZnMftYOOEz CF0Roj/1/YcXBKk2Y1R3We9l5giVK2D9bp8tTP8BCXxJV4DDiH7WjUqJkg6wbZbZN7FC WkjSER6/4a32BQDigKnyGwno4NHVaKoxzRtfJJklRCIbjNQV5oRvAPl4etJj4UyDFcwN dkVGHbbbZTnLvvGWIpDkWaZxFbIOb1dLm7kXUKXLK1+92y6x5PDZWOanxJxow3g+h2XB bnsdTodphYeuY8WUkznJW4V+8m3zPMuqqrYXSru8NmodqI/v7DEe095KQGyIsh54lTpQ 8ROg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696383477; x=1696988277; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Ut7xWoIyAkKaAS+UBG8acxM2uYnbNKB4bITE7OuyUn8=; b=r1khUHL635m4PsXDYLg4Y4fs9GFz5C7q5RFE+wToBaQTt9Qqz0L1mEXPEEVHvY8uJ1 m9S0cRhCkuyELcMU+bSq5cxLycghCGmEw1a5hD1TKYOeOndVcW+B5dgINDzAhBSyeABb DuXu5ASLY1Lm3zIOWA/thrVAqqmdkBmaaS888Hfopo6zWdHxNBak5TuuAfC8Ke5u8LLS 49WvD0hrGBl+6nZU/EtS+XvqZ8MQb6jQpclo3qO8LAKi7zVyfTj9SzJa7RALthRf9T0W lGHl9GXEbW0kHooqJMVGL07nSkFOwZtkDBGs3yWi7VMIZyvFXdCSZvqm6Z8yK0qvmU6y NP2g== X-Gm-Message-State: AOJu0Yzk9aA/bAqh8zU5Pd4XXWVfPYqWpG/QhHc4cp1ksTB6fVkd0By4 yg3V+UylIMnbqWsfK+VpVWJWxAO9SKblk4vJvso= X-Google-Smtp-Source: AGHT+IFe9WGtyUnwFgSpm2oOiz9vnIspKZLXWvuP1DOW+PgtsVRIlTTNJUn1eT68WXpwzGTuIifS6Q== X-Received: by 2002:a05:6122:2208:b0:48f:cd3a:108 with SMTP id bb8-20020a056122220800b0048fcd3a0108mr1039736vkb.12.1696383476933; Tue, 03 Oct 2023 18:37:56 -0700 (PDT) Received: from fedora (072-189-067-006.res.spectrum.com. [72.189.67.6]) by smtp.gmail.com with ESMTPSA id c9-20020ac5c769000000b0049ab44fce7esm333804vkn.50.2023.10.03.18.37.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 18:37:56 -0700 (PDT) Date: Tue, 3 Oct 2023 21:37:53 -0400 From: William Breathitt Gray To: Fabrice Gasnier Cc: lee@kernel.org, alexandre.torgue@foss.st.com, linux-iio@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/6] tools/counter: add a flexible watch events tool Message-ID: References: <20230922143920.3144249-1-fabrice.gasnier@foss.st.com> <20230922143920.3144249-2-fabrice.gasnier@foss.st.com> MIME-Version: 1.0 In-Reply-To: <20230922143920.3144249-2-fabrice.gasnier@foss.st.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231003_183801_804419_18014787 X-CRM114-Status: GOOD ( 29.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============7228211590261815642==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============7228211590261815642== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ud/ll0XBucuOa13p" Content-Disposition: inline --ud/ll0XBucuOa13p Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 22, 2023 at 04:39:15PM +0200, Fabrice Gasnier wrote: > This adds a new counter tool to be able to test various watch events. > A flexible watch array can be populated from command line, each field > may be tuned with a dedicated command line sub-option in "--watch" string. > Several watch events can be defined, each can have specific watch options, > by using "--watch --watch ". > Watch options is a comma separated list. >=20 > It also comes with a simple default watch (to monitor overflow/underflow > events), used when no watch parameters are provided. It's equivalent to: > counter_watch_events -w comp_count,scope_count,evt_ovf_udf >=20 > The print_usage() routine proposes another example, from the command line, > which generates a 2 elements watch array, to monitor: > - overflow underflow events > - capture events, on channel 3, that reads read captured data by > specifying the component id (capture3_component_id being 7 here). >=20 > Signed-off-by: Fabrice Gasnier Hi Fabrice, This tool is independent from the rest of the patches in this patchset, so I suggest separating and submitting the next revision of this patch independently. > --- > Changes in v2: > Review comments from William: > - revisit watch options to be less error prone: add --watch with > sub-options to properly define each watch one by one, as a comma > separated list > - by the way, drop string/array parsing routines, replaced by getsubopt() > - Improve command-line interface descriptions, e.g. like "-h, --help" > - Makefile: adopt ARRAY_SIZE from tools/include/linux.kernel.h (via CFLAG) > - remove reference to counter_example > - clarify commit message, code comment: Index/overflow/underflow event > - check calloc return value > - Makefile: sort count_watch_events in alphabetic order > - Makefile: add a clean rule to delete .*.o.cmd files It looks like you implemented all the changes I requested in the first review so I don't have much to comment inline for this revision. It looks like the memory allocated (via calloc()) for the watches array is never freed, so fix that in the next revision. Also, add a MAINTAINERS entry with at least you as the point of contact or someone else (an ST engineer?) who is willing to respond to any bug reports the mailing list could get for this utility. Regarding watch options, I looked up how a few other utilities handle similar situations. Some utilities like the nftables nft command line utility takes in a configuration file where you can specify the verbose rule-sets, while others such as bfptrace allows entire programs to be specified via one-liner constructs passed in a single option ("-e"). Although powerful, I found those approaches to be far too complex for our simple test utility here. Instead, uilities with a simpler interface take an approach similar to yours by providing several well-defined sub-options; for example, to filter tcpdump packets users can provide the particular sub-options they desire ("-i eth0 port 22"). The watch option solution here with sub-options is simple and clear, so for now let's go with it as you have it. If the need arises in the future for a more complex option interface, we'll tackle it as it comes. Thanks, William Breathitt Gray --ud/ll0XBucuOa13p Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQSNN83d4NIlKPjon7a1SFbKvhIjKwUCZRzB8QAKCRC1SFbKvhIj K8MOAP40On/mofJvCleupa6Ta0fCuH3zADKugk7CCkCLpyljWwD/TAi5GM0LSIWa mlOzR+0lN8QEY6op3Qh1ojgvHuugqgQ= =cxjL -----END PGP SIGNATURE----- --ud/ll0XBucuOa13p-- --===============7228211590261815642== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============7228211590261815642==--