Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7419970rwb; Wed, 23 Nov 2022 06:22:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf5sOxU5lG7eY67DZ3WENzW8wdWB4gOqV2ux/z6Lbi3Pc/OA9rx86Ixhs48UOYGSmCZ4GkzV X-Received: by 2002:a17:90a:9205:b0:218:adea:6e17 with SMTP id m5-20020a17090a920500b00218adea6e17mr15777623pjo.243.1669213339616; Wed, 23 Nov 2022 06:22:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669213339; cv=none; d=google.com; s=arc-20160816; b=Ggti/N/VYlSfOEIR8/AFWQoKwmrjiQJjHgzEjtKqUOGH0N0RC3KxHKBV5uAdFltMbF 1tts+TVPKUqOENClJE52IynXKu5R7sj8YOsVeUF36+qLIgpLYoaT+Wp5Qs+8gL8qRx4K qRd1pFRnTOOj5KSw2Bb5zkDktdceC4HftvE+wVzB6vfxDbgpDYTzRNDm1gRBEx+Jtfzc CnwSiv2GVDbemihtVgrY3fd0evaQWnfgDIRw0r+diC2Xe+R7LqrFUKdzKOrTl8lGWr6R rNJ3KfEziqIAlDe0RY48yZpTECd9Y6kH7QyYfrwG7l4Mhyz5/C1/LDWn+x5wbBfWHZa1 Zkmw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=vodG8Z9N/8yodTREPuY4hCnnMdcuDF/kfOq+3KJf8EE=; b=sqpT8MkAkoLMD4GI4RBx82pVMsSz7pAuKqdsVUAftXqH5kGeYV+bPdZKftyLPosgMG qj/eBDkdeZDTGUY15XEzjxUvzr/TJ+v292h1HnSPw/0Z5Fdb2dW0kGMjXiusCOhJsYcz xOKLZhC/KsYEVUr5WhwI/0zJ6+PzpB0EVToWVBKD+/dhDsiSvZ+UUQI8TOlf3Ac48R0h rsLCwWUJq0EU7JdCTNa7Hhd3DgT03ziUrinqHmkZl/irTeU8W7YEew8PG4Kf2KKqqMF3 kp+uSloMPrk94wavymse9hIJXMSk6D2cSCSYNQO7pOhFaZH6nB3bPGoFDWHzsxYr093e h6+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LOl7Q4n4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g18-20020a056a001a1200b0052c56cea553si540098pfv.352.2022.11.23.06.22.08; Wed, 23 Nov 2022 06:22:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LOl7Q4n4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S237990AbiKWNpZ (ORCPT + 89 others); Wed, 23 Nov 2022 08:45:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237948AbiKWNpG (ORCPT ); Wed, 23 Nov 2022 08:45:06 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CED6DD5396; Wed, 23 Nov 2022 05:33:47 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5A9EB61CC9; Wed, 23 Nov 2022 13:33:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BB36C433D6; Wed, 23 Nov 2022 13:33:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669210409; bh=o5a/1D++1Mz35bMC46Wx3lUgNniBZ5e14zrk6/8nSLA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LOl7Q4n4cEl48OuaUSA+Bgl0IZTxdonu6mUt/hJRzmYjzYC5vh9Aa2N3ZXMxrUR/6 48m+AKkRf2fO3muoslzGBzQUQBe2NxHZTgy+eHvpR+Au3yxQ2og13EtKoKPsTf8Wyg nwUHbaUgC/sR+weWCCWEzz0ML39ZkwLmTORo98UEeKQs4s5cDDnvO08asxGGog6Ydz eBDgNoiqpV5wqgiRgNG0A/FUmd9zgySBEdzk5Ud2AYI+S2ARX0UaCBcxxK1s3revGZ GA8gUTbE00d7ixoql1pdSKm1bZNED2WAN8pFIiz5zQiXrapqcLWoVFoJCyl8cfqdRy 8bN3OuFhi7ziQ== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id E73C84034E; Wed, 23 Nov 2022 10:33:26 -0300 (-03) Date: Wed, 23 Nov 2022 10:33:26 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Christophe Leroy , "Naveen N. Rao" , Ravi Bangoria , "linux-perf-users@vger.kernel.org" , Disha Goel , "linuxppc-dev@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] perf test: Skip watchpoint tests if no watchpoints available Message-ID: References: <20221121102747.208289-1-naveen.n.rao@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Em Tue, Nov 22, 2022 at 12:57:05PM -0800, Ian Rogers escreveu: > On Tue, Nov 22, 2022 at 11:19 AM Christophe Leroy > wrote: > > > > > > > > Le 21/11/2022 ? 11:27, Naveen N. Rao a ?crit : > > > On IBM Power9, perf watchpoint tests fail since no hardware breakpoints > > > are available. Detect this by checking the error returned by > > > perf_event_open() and skip the tests in that case. > > > > > > Reported-by: Disha Goel > > > Signed-off-by: Naveen N. Rao > > > --- > > > tools/perf/tests/wp.c | 12 +++++++----- > > > 1 file changed, 7 insertions(+), 5 deletions(-) > > > > > > diff --git a/tools/perf/tests/wp.c b/tools/perf/tests/wp.c > > > index 56455da30341b4..cc8719609b19ea 100644 > > > --- a/tools/perf/tests/wp.c > > > +++ b/tools/perf/tests/wp.c > > > @@ -59,8 +59,10 @@ static int __event(int wp_type, void *wp_addr, unsigned long wp_len) > > > get__perf_event_attr(&attr, wp_type, wp_addr, wp_len); > > > fd = sys_perf_event_open(&attr, 0, -1, -1, > > > perf_event_open_cloexec_flag()); > > > - if (fd < 0) > > > + if (fd < 0) { > > > + fd = -errno; > > > pr_debug("failed opening event %x\n", attr.bp_type); > > > + } > > > > Do you really need that ? > > > > Can't you directly check errno in the caller ? > > errno is very easily clobbered and not clearly set on success - ie, > it'd be better not to do that. > > Acked-by: Ian Rogers Thanks, applied. - Arnaldo