Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp645393lqb; Wed, 17 Apr 2024 07:06:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCULRz0U70rI0Bbk2DNyYvEEhBslK+L9GNt/qJ4uUvM7hrqBTl4zhogt3IwUZ/lYrqcnCv65AxY7eBXs4KSp2EyAU/lg0GDe14tKQyuY9g== X-Google-Smtp-Source: AGHT+IE02eWVHMD7WPIAgIN0vsAtubBO7uC97fZplIXo0qKfUT6dY3+pCCJLuQ++lTSD25Wgo+Lq X-Received: by 2002:a17:90b:1583:b0:2a3:8a4:dce3 with SMTP id lc3-20020a17090b158300b002a308a4dce3mr13554863pjb.25.1713362819570; Wed, 17 Apr 2024 07:06:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713362819; cv=pass; d=google.com; s=arc-20160816; b=Ca8kCw2rQMj4jRLm9i3Dfo3dCR0DVADfFKChkkZJ98WOfMsldSrsvk2MU/ywKD7S4D M3ZvBauo0ruMngLLJ14NHNQjU5Tdl766Cp95vaNPQdRhXTgXlMhwPiwMgErUeWZW49eC 44nGsV2SaiE0Hqp3OvEgmBZ6YyEg7uFvyMWZ/njGnMsEFcwH0n7m3cUYOemLcGrmxqNt MBjja7HJ1Ggey8JwTWtxq+5tVQ7b2jJlrKOk0CS0kh/CXOyf/9tZhLS56HicVnb7zqfx l2ckkH9XbkBn4ZHA+i6ihNtxB5r81SqlnEs2guPEhxE0LhanGxglAD01tXZ3T0sl2FYo wwJA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=A23hE/jrm3+jetnsib4dmDsoa55FGtt2CZmHhByek9I=; fh=KWMbHrq1ycDxfGpVXc6zIcCBGNuvmVwkpG0JCwCv6m4=; b=Bz15V4LbjkWn7StAk7En+gVPZZr8z7LCEgJBRYkj7XAIXFfyudyyWMldoXzw4bc5Aj Na0I29ZNvs7feVEgjFgw/vbP99DQQGaX4dfeiCdvd8ab9rKBKRguOgynk43OXwx0lKIH 5sRLc/QbC1EfviZuLhKGvQL0UUjlTaq+35HLWIPKI1eNt2gvNyjZzC7+rA8hcg2om5XK 77GhmGJ/4KzrdRTGR1PvuGhNd7nFGKWCymo5fX68n25ePTiCGTnD88hsC7o9NLThLoR4 ybrOb2UNmg3lhc/DOy179cxOqjmaQduBYD58aKDGlO+397g7EtsrLCaoDQGLS7Xtzi67 iR7Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G3frWAbK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-148606-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148606-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i6-20020a17090ad34600b002a2a70f148bsi1323526pjx.69.2024.04.17.07.06.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 07:06:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148606-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G3frWAbK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-148606-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148606-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1B4D2B23730 for ; Wed, 17 Apr 2024 13:41:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A916E1420B6; Wed, 17 Apr 2024 13:40:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="G3frWAbK" 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 BB4C813F449; Wed, 17 Apr 2024 13:40:00 +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=1713361200; cv=none; b=Hcjv1zD3ApCLoLdrv96O+58JiLmAr0235OeEvlaoiuuydVOD/4Tp5lPaTI4qAyHRclL3nypflSFg3YX+ekyAkbfgGC0HbOW9BV87PU2yJBAU9OL3CaVj1AS918fd7Smnm/BSiCHoff0Q3luW6uU6kGJrwqRsh2DUphTpsBFbReQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713361200; c=relaxed/simple; bh=b/sDQSq5JjwUA6lrjG6U3vqq2NaTsKZLOqjslzcjaPQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cQibolCKgpF3dtCvNU1NPfn8B5guDxKRFP5oL1kceOgOmpoIoqQupt0ksKv8aSAjHEEbpst5LRhH1ex+I5reL12mbycw+fKXgngIgYlNLwrLMHPpqWSxLE0ZZlwHURYRWfw8k0NNej2QZaCBAos0gdbIQQ0mAldGsaHebu8wBIA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=G3frWAbK; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE70DC072AA; Wed, 17 Apr 2024 13:39:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713361200; bh=b/sDQSq5JjwUA6lrjG6U3vqq2NaTsKZLOqjslzcjaPQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=G3frWAbKid/PFYHRRbptixtGcA2rMU0xjx0kj6bXI+3GdbUHAYfUO9WURlMmxkr+4 EWl0ebX7frfwTRdfEC/HXAB/ldZIORDKJ/v5Bhw9QJI/mo5TZP0qkLbFQgPPaib+jb fCNud3ASO8Lywj+Idh5ZHXx3Ze1Hpl0pHCP1SP+kjmfaqluWM/eAQWoHX4BMZ+8A1G J2nAZoYzItEe6qqMwaeO2uaeb35ORQq3P6+w+t79IwBP9VvwRHQxkMMWRlf3z7EhK5 HEwrXkZl4hJVwOgnersh85w8K/xnDFXU7KfmwNlSk3nOhdZ+hSsQNSf8zJOtiHvhpk vmHVResSMaxpw== Date: Wed, 17 Apr 2024 10:39:56 -0300 From: Arnaldo Carvalho de Melo To: James Clark Cc: Alexey Dobriyan , Chaitanya S Prakash , Ian Rogers , linux-perf-users@vger.kernel.org, anshuman.khandual@arm.com, Josh Poimboeuf , Peter Zijlstra , Suzuki K Poulose , Mike Leach , John Garry , Will Deacon , Leo Yan , Ingo Molnar , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Chenyuan Mi , Masami Hiramatsu , Ravi Bangoria , Ahelenia =?utf-8?Q?Ziemia=C5=84ska?= , Colin Ian King , Changbin Du , Kan Liang , Athira Rajeev , Tiezhu Yang , Georg =?iso-8859-1?Q?M=FCller?= , Liam Howlett , bpf@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2 0/8] perf tools: Fix test "perf probe of function from different CU" Message-ID: References: <20240408062230.1949882-1-ChaitanyaS.Prakash@arm.com> <2d7a896b-bbee-4285-9b2b-3edfab6797d3@p183> <1b52699d-8f92-4a79-89aa-c4df1594e8b1@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@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: <1b52699d-8f92-4a79-89aa-c4df1594e8b1@arm.com> On Wed, Apr 17, 2024 at 02:24:33PM +0100, James Clark wrote: > On 14/04/2024 12:41, Alexey Dobriyan wrote: > > On Thu, Apr 11, 2024 at 05:40:04PM +0530, Chaitanya S Prakash wrote: > >> On 4/9/24 11:02, Alexey Dobriyan wrote: > >>> On Mon, Apr 08, 2024 at 11:52:22AM +0530, Chaitanya S Prakash wrote: > >>>> - Add str_has_suffix() and str_has_prefix() to tools/lib/string.c > >>>> - Delete ends_with() and replace its usage with str_has_suffix() > >>>> - Delete strstarts() from tools/include/linux/string.h and replace its > >>>> usage with str_has_prefix() > >>> It should be the other way: starts_with is normal in userspace. > >>> C++, Python, Java, C# all have it. JavaScript too! > >> > >> This is done in accordance with Ian's comments on V1 of this patch > >> series. Please find the link to the same below. > > > > Yes, but str_has_suffix() doesn't make sense in the wider context. > > > >> https://lore.kernel.org/all/CAP-5=fUFmeoTjLuZTgcaV23iGQU1AdddG+7Rw=d6buMU007+1Q@mail.gmail.com/ > > > > The naming ends_with makes sense but there is also strstarts and > > str_has_prefix, perhaps str_has_suffix would be the most consistent > > and intention revealing name? > From a brief check it looks like str_has_prefix() is already quite > common with 94 uses. So the path of least resistance is to make > everything self consistent and add str_has_suffix(). > I agree it's a bit of a mouthful and not so common in other languages. > Once this more complicated set gets through we could always do a simple > search and replace change it to anything we like. But it would touch > _lots_ of different drivers and trees, so it would be hard to justify. Right, we try to follow the kernel APIs to make tools/perf more familiar to kernel developers, this return strlen() thing on str_has_prefix() looked too clever for me at first, but since we need to do it anyway, and return !0 to indicate it has the prefix and there are usecase... The bpftool people agreed as well, so in tools/ it seems we're in general agreement about using str_has_{prefix,suffix}(). - Arnaldo