Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2319665rdb; Tue, 3 Oct 2023 18:38:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEwkDiDIXrZakwySsNJhWCcIRR4DSb9lGFtZjV5ed8cyZ1LtnqsfwEZiXhNMCNH36lksuWp X-Received: by 2002:a05:6870:e98e:b0:1d1:40a6:e83d with SMTP id r14-20020a056870e98e00b001d140a6e83dmr1492347oao.50.1696383483698; Tue, 03 Oct 2023 18:38:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696383483; cv=none; d=google.com; s=arc-20160816; b=w+CGtacEaNdmqAAK85HSyShnnjKXFqjf9P8ueXvTrvahpahcSFDc/TRWvQyTkuiIdp tEo7BokP1wBNuuaOVvz/33SKM59Td8Nuu6XTm5CJMktS+iOURrj7kP/xIOiNj2JZIF1m Td17dfvMJBe6VCqKg+LsmAYDn2auS/0hLCZeoAty0MieUfQVTh3GEMd+tfoRQjDcnAoD OkQwbfVDxzE6TTSc1N/tS1pj+VBoXiRktWOejvGq/n60iXYj6nIBywqAPvecso1hhurL fGQ485OqGvELzg5BqkFpL57LdXf3bFefUZi7gX8TZXoPa8jQJwgbEsumDBDCp6OBywze jqLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Ut7xWoIyAkKaAS+UBG8acxM2uYnbNKB4bITE7OuyUn8=; fh=wT9Q6l4w0nN9BZc2VSxa7kC4ae7opG8tVDMNxCIfbBM=; b=RFvMmoqSa26y7qHPxPrEe4/hOlzrtr/fLn9nP2+HAFOaETCRlZOegAZ84fzYghrUbP rTdCVrX8Vt9Ru6XdJuNHJOI9WgAPpiyh1M48bIJbwWPPGfJlKaQi4iE6OhTEkxsCWa9p efCj7wVDO3CgHAmmu3Q/zS8GOM85nCCNQDZM3wIBKV/c3t/CrgW7V9X/wcJSGHc94eAo GoJvbS3IhgyTmaRcWq5+RXVnjygdHDBVgZwfhFO6Fip3MggvHrpQcNz4CmEvEdvnedZ4 sN/fpwr80RsNgVLctWtYgFgI/QR0FUrdiaTtYBktTYu/hAUbLolJHCNvot4c8jZ3PEBC NkAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="F/5RRAKL"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id t23-20020a62d157000000b00690de92ffe3si2475991pfl.309.2023.10.03.18.38.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 18:38:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="F/5RRAKL"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 6F4AB8320DC9; Tue, 3 Oct 2023 18:38:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239903AbjJDBiC (ORCPT + 99 others); Tue, 3 Oct 2023 21:38:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239803AbjJDBiB (ORCPT ); Tue, 3 Oct 2023 21:38:01 -0400 Received: from mail-vk1-xa29.google.com (mail-vk1-xa29.google.com [IPv6:2607:f8b0:4864:20::a29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2165B7 for ; Tue, 3 Oct 2023 18:37:57 -0700 (PDT) Received: by mail-vk1-xa29.google.com with SMTP id 71dfb90a1353d-495eb6e2b80so687993e0c.1 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=vger.kernel.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=F/5RRAKLmW2qRiZrC1rpshlSbTD/0EguwBg3QhSqyHK3S7rS4z+jFPUl32SZZd0JSQ YSMpuNwRMvuC386MRS+soH/aGfbDo7fFPwIIf03C8MLZtOVcStBoZ3hHOasTm/hLPdZu m4ldVUtwAWESkbgP5UEs7uMb3/K4uVT6L5Tuac4MtefSLpN/UnGFi6VX2QrDhFUxbtWf eQz2iCMcIEKJAbt5gfSPv8vUaC3fyMVmtcWu+ra1RtKI6Cws4fvUcagZjQrBAUa1Awn8 OBFZf4sAsI4RXfyGB+svmpcX+lZpilreigTH1A5wj1jMRXX1x8/uuQMwO3/XZPF8zDzD 4/og== 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=ZkAtTTK4qhDAf1hkIQnB1J+PU6VeBix26UchdgspvalacGxkmPm5UxKiQCIG4u7XNg hlJaoVNdieH9YeAeZMTJJaFX/rnCR23LpKMeSOGBuJqtmdQNLUJ4/H5SwlEjP0FdePCK 6IgEnea8j0gX5kNhQ8hvT8jQ/jaKz/lzPoiPTXl23ZZVFV+Qv54Z6NhrV0f+11xlYxgd +zHB/uBU1vGFjqZdp39EMZ4FXqAT33G+i80bSvrdu5nJocov5poXOS3cet/WGi54q6y2 +psidF3NxetG4BHCNFjUEYCvZVf90szfUc4jlUHMgBrjv6QcZpiaIFs5ZIL9GxzfiITT R40Q== X-Gm-Message-State: AOJu0YxmrzxecPplUI2pg7Y6X2IyuZPupLAHr/5zzM47JNnpXQ8g6Rmx K1BQNiPIAHO/+aQVSQdM6r1zGA== 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 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ud/ll0XBucuOa13p" Content-Disposition: inline In-Reply-To: <20230922143920.3144249-2-fabrice.gasnier@foss.st.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 03 Oct 2023 18:38:02 -0700 (PDT) --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--