Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4166929ybv; Tue, 25 Feb 2020 14:35:08 -0800 (PST) X-Google-Smtp-Source: APXvYqxtU5bSmyqPcMpx/WsqGNd+Ysxdtb79zid/ei7lrfAt2hNBunhPpTHpHfvTbHS7MXubycU6 X-Received: by 2002:aca:5f85:: with SMTP id t127mr914926oib.1.1582670107902; Tue, 25 Feb 2020 14:35:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582670107; cv=none; d=google.com; s=arc-20160816; b=WC/iZjJVmvdaxkQQLt3RIBK9FxOaqL+pdxk7P2TTz1Ua7BIc+LL4c9yzAJtBoNrph2 r92E9QV16FalEhCWy8zESp7mIuTMKh6ViHEH4/0Vae9QOZjZUcZw9ygXkBWY8sdPa0Oe D3grQFI+7iAUTPMgyxbummXkBqG7f5mC3AxBn20P7c4ICLu+ceqk2ShVLtBpllop24bQ oGXBv0qn02XSgoywXLeWS6FyK82YNRaMws7inhs0ACBUNJbRlzb2leQ6VE1zurC2kqIU kjjoZkUgFj5+p3mtYOhuk6/FnbnGNda9b9h66pDY3vNNtHKJUEODwskDuJvxU7NanAr0 coIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=FY1HKZ2XjDi88PtrPzdU2dlAfIMOeNT0m95NB0WcJ5o=; b=cOptI6R+9HddF/iYHBx21t81plCT0w9y5ccdA5bSxbCXj17nkSItGQVMpo8AJS4rov ZSA6ub4MiCQpfnNStIz4+yTHTBpi4nn165zvbGQvLG7IvuNzoeYQZRCacbk8s73fmD5u bFfCP8RZXyshvWVUvvgovohXPDKNlJPuKeOXFqK/D4ZiTzJuQACvl1w4yGKjoFr3l6cz SDjMCBFjAFY2ZTduDXoO+dZ4K3qMBj140HYIoonhkqwrDXI6JoqB/eytDrpRCEh9s2Aq 2x62xfyZ+hMYCi87tctPbRQgnk0emE/sGIZfc/QnZBUK2R7HyzpRbGs4PtWk6It36hZg Q6Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fRGgdYGa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k10si111038otn.323.2020.02.25.14.34.55; Tue, 25 Feb 2020 14:35:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fRGgdYGa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728770AbgBYWet (ORCPT + 99 others); Tue, 25 Feb 2020 17:34:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:43446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726421AbgBYWet (ORCPT ); Tue, 25 Feb 2020 17:34:49 -0500 Received: from devnote2 (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3D9942176D; Tue, 25 Feb 2020 22:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582670088; bh=UOlSQxvVm/kBdia7kbMThkXl+l65D3+ArFpNE9ORreA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=fRGgdYGazBdAqAHUDhZdY2pErIwVIT2lcMZdSLXkV+kWU7qtT2as8YYmgDsGJ4OFD 0Wzjwpux/cGv8aMKNAAjtVooLiPsoFlaSX+zrbp0cWbf4g7hgaNT0zRiNh7BNxp2SR Xui5tmBAVCC4hLSdahbgBabO7mu4U1JsLZDlg/Fs= Date: Wed, 26 Feb 2020 07:34:43 +0900 From: Masami Hiramatsu To: Cc: , , , , , , , , , Subject: Re: [PATCH 1/2] perf: Fix checking of duplicate probe to give proper hint Message-Id: <20200226073443.3f6b44422104873dc0397d0e@kernel.org> In-Reply-To: <1582641703-233485-1-git-send-email-zhe.he@windriver.com> References: <1582641703-233485-1-git-send-email-zhe.he@windriver.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Thanks for reporting. This bug has been reported and I should fixed last year... https://lkml.org/lkml/2019/12/3/136 Arnaldo, haven't you picked it yet? Thank you, On Tue, 25 Feb 2020 22:41:42 +0800 wrote: > From: He Zhe > > Since commit 72363540c009 ("perf probe: Support multiprobe event") and its > series, if there are multiple probes for one event, > __probe_file__get_namelist would return -EEXIST and cause the following > failure without proper hint, due to adding existing entry to output list. > > root@qemuarm64:~# perf probe -x /lib64/libc.so.6 free > Added new events: > probe_libc:free (on free in /lib64/libc-2.31.so) > probe_libc:free (on free in /lib64/libc-2.31.so) > > You can now use it in all perf tools, such as: > > perf record -e probe_libc:free -aR sleep 1 > > root@qemuarm64:~# perf probe -l > probe_libc:free (on free@plt in /lib64/libc-2.31.so) > probe_libc:free (on cfree in /lib64/libc-2.31.so) > root@qemuarm64:~# perf probe -x /lib64/libc.so.6 free > Error: Failed to add events. > > As we just want to check if there is any probe with the same name, -EEXIST > can be ignored, so we can have the right hint as before. > > root@qemuarm64:~# perf probe -x /lib64/libc.so.6 free > Error: event "free" already exists. > Hint: Remove existing event by 'perf probe -d' > or force duplicates by 'perf probe -f' > or set 'force=yes' in BPF source. > Error: Failed to add events. > > Signed-off-by: He Zhe > --- > tools/perf/util/probe-file.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c > index 5003ba403345..cf44c05f89c1 100644 > --- a/tools/perf/util/probe-file.c > +++ b/tools/perf/util/probe-file.c > @@ -201,10 +201,16 @@ static struct strlist *__probe_file__get_namelist(int fd, bool include_group) > if (include_group) { > ret = e_snprintf(buf, 128, "%s:%s", tev.group, > tev.event); > - if (ret >= 0) > + if (ret >= 0) { > ret = strlist__add(sl, buf); > - } else > + if (ret == -EEXIST) > + ret = 0; > + } > + } else { > ret = strlist__add(sl, tev.event); > + if (ret == -EEXIST) > + ret = 0; > + } > clear_probe_trace_event(&tev); > if (ret < 0) > break; > -- > 2.24.1 > -- Masami Hiramatsu