From patchwork Tue Oct 18 09:41:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 4056 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1865328wrs; Tue, 18 Oct 2022 02:52:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66xHuBBNsKAm3qTWKse9+uOoI7x1WzAvmde09Cf3yLrUUx3XicQqyQEQDAgATWM+W/GwLk X-Received: by 2002:a17:903:228c:b0:185:3ea8:37b4 with SMTP id b12-20020a170903228c00b001853ea837b4mr2315730plh.48.1666086751397; Tue, 18 Oct 2022 02:52:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666086751; cv=none; d=google.com; s=arc-20160816; b=XlXxEsUBFpufP7safHIx3MzZLkjuE7SbwPI1PHfI9Lmx1Ssm33Tcb9h7Jk3cd84sLI SH1Wyd32vQYRRgWqQb5clwgm0+aJdAtRBYjS+W4c/kg6DLJV9QMOaLEcUPR3jaOdbUFO /xUqoJZDR/l9CZNzwhmBS/8ak2dpnetYDDD/QAYDx0IYNTfu0eMO9/TdIO4H4fEJoP24 nH5X6NdUahCXZiiVSDUXNm6j8gIRgjtIFM722pJ1oUuuuSuoP0HzaIq3pE85Tnw1qKJf zpAQi/fYOwTfI0aKaz+EBbBEJEfw7PcSMjCWiVaC0rCcDctfSInT9zUNx0XvIWAHGyRZ 4Iuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=+y2ASQZjOgaELSOfQRfP1zgkJo9RYgIV3kX8jTIF4no=; b=c+GtZj1TYdI630pr8achggz4jpUhVzILD+s3Rf01TgiucZTlKGE+rb7lVp0lrkR2GV F/xcrXeko8f/2zqreZb6Nl9nPUVmjJ7G4DfV1Quw4t/EzvnjY3yyPckI/DCl2WVmMIwT cQwx6gG8me/hz7Sw2Xqdg+7/0vuuBiHOrE4q14VuToWswLGCenNsNdQeIP90Yf4DOPwL wEflIUUQ+di8E7BYAE2+SJkgrVyH19lV0A7UE2cRg8SChomQOAB5o8xwJljgHAeJHzgg Qg3+BmOaSuCSCmMlPQeOK3zLvr4R0OtD/CeD4U0mn479kRVwEpqyMYFkByVzKXyPhdIq 0qaA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nl15-20020a17090b384f00b001f52b9da815si15119853pjb.167.2022.10.18.02.52.18; Tue, 18 Oct 2022 02:52:31 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230109AbiJRJmA (ORCPT + 99 others); Tue, 18 Oct 2022 05:42:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229736AbiJRJl5 (ORCPT ); Tue, 18 Oct 2022 05:41:57 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5063B9AFC2; Tue, 18 Oct 2022 02:41:56 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 06CC9175D; Tue, 18 Oct 2022 02:42:02 -0700 (PDT) Received: from e121896.Emea.Arm.com (e121896.Emea.Arm.com [10.32.36.24]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E85EA3F7D8; Tue, 18 Oct 2022 02:41:52 -0700 (PDT) From: James Clark To: linux-perf-users@vger.kernel.org, acme@kernel.org, namhyung@kernel.org Cc: linux-kernel@vger.kernel.org, James Clark , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter Subject: [PATCH v2 1/2] perf: Fix "kernel lock contention analysis" test by not printing warnings in quiet mode Date: Tue, 18 Oct 2022 10:41:35 +0100 Message-Id: <20221018094137.783081-2-james.clark@arm.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20221018094137.783081-1-james.clark@arm.com> References: <20221018094137.783081-1-james.clark@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747018581739349915?= X-GMAIL-MSGID: =?utf-8?q?1747018581739349915?= Especially when CONFIG_LOCKDEP and other debug configs are enabled, Perf can print the following warning when running the "kernel lock contention analysis" test: Warning: Processed 1378918 events and lost 4 chunks! Check IO/CPU overload! Warning: Processed 4593325 samples and lost 70.00%! The test already supplies -q to run in quiet mode, so extend quiet mode to perf_stdio__warning() and also ui__warning() for consistency. This fixes the following failure due to the extra lines counted: perf test "lock cont" -vvv 82: kernel lock contention analysis test : --- start --- test child forked, pid 3125 Testing perf lock record and perf lock contention [Fail] Recorded result count is not 1: 9 test child finished with -1 ---- end ---- kernel lock contention analysis test: FAILED! Fixes: ec685de25b67 ("perf test: Add kernel lock contention test") Cc: Namhyung Kim Cc: Arnaldo Carvalho de Melo Signed-off-by: James Clark --- tools/perf/ui/util.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/perf/ui/util.c b/tools/perf/ui/util.c index 689b27c34246..1d38ddf01b60 100644 --- a/tools/perf/ui/util.c +++ b/tools/perf/ui/util.c @@ -15,6 +15,9 @@ static int perf_stdio__error(const char *format, va_list args) static int perf_stdio__warning(const char *format, va_list args) { + if (quiet) + return 0; + fprintf(stderr, "Warning:\n"); vfprintf(stderr, format, args); return 0; @@ -45,6 +48,8 @@ int ui__warning(const char *format, ...) { int ret; va_list args; + if (quiet) + return 0; va_start(args, format); ret = perf_eops->warning(format, args);