From patchwork Thu May 11 18:04:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Bristot de Oliveira X-Patchwork-Id: 92799 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp4580262vqo; Thu, 11 May 2023 11:23:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4DTAH3wNBZ746XFaKNiC4f7590zoXMJJ5LFgS1Tnf+ygWz7XQYxZXqhmk7f1kzjR/k25SL X-Received: by 2002:a05:6a00:2d99:b0:63b:5496:7b04 with SMTP id fb25-20020a056a002d9900b0063b54967b04mr30308726pfb.9.1683829418679; Thu, 11 May 2023 11:23:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683829418; cv=none; d=google.com; s=arc-20160816; b=wPrkdfCh5gasldLJCbfz7zVZhRt5MC0L84ngnFm4KSBPwf/NevUt6PdfiHH2uCfsSm XXTLM9HR5y5nWi17m/42n2bh3QN9kNWgEANbpgQSafxyWyhQJRZsJL1zuv25nPH0lg9o yW1QOhTOmwwoDy161L6ZqYwOTe4bFFa6v/Y7hXmtC+RW4Nyei9WKuqhs2P4kxn0UCJ5R 5lzomfCAMf9YenSxOATfHKQI0+acC7x5BAVB60iTTg3Nl5QLA8BoLPEw4eBp3UEwlyWH rrDhpwBNsBcdzC1e5TBvGQnYeNJjt/rJKWApY0iklb+EcZWSc12oEJZOkYfaM8ABzB1m I5eA== 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 :dkim-signature; bh=IuEl6VmCH9AG6rJIRnhgRWl3VGVJ2sbXriGj1FiN49U=; b=drdvUtNygeEhycPS+Rz+HH3LqPx73hl6PPBd8e5Oyi/YyW/cS9Kf3VWmNeQOVwd5Go 8htw/gsM2L5ACtTd+WxFcw+ujdBGxcQ6Kz51AAMIXvzj3WhyoRgF/2oQAlW8WGJMVN7a n9sY28m8N3LutJIgdQy1eS3dbG3A6J3S/BBf/0s/Rn748420DN629Y1PIm82Bdalb2h4 iVKwxvzclvUsHbt70hebbDFWC1J4QaLQbWJLTBZ2oTaSclUw1bIIXMJl/oXqItnpptor gMKLVWoRBNWk022YcfNqLb8a3AHVkAhHAPOmH5D3FYXG7W0+B1bCGzU8TBO2kX91BVSs gQAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bOsA92m9; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y1-20020aa79ae1000000b0063b8f3a4d42si8012668pfp.163.2023.05.11.11.23.26; Thu, 11 May 2023 11:23:38 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bOsA92m9; 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 S239252AbjEKSGI (ORCPT + 99 others); Thu, 11 May 2023 14:06:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239194AbjEKSFq (ORCPT ); Thu, 11 May 2023 14:05:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2AC58A4A; Thu, 11 May 2023 11:05:17 -0700 (PDT) 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 6033765094; Thu, 11 May 2023 18:04:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEF58C4339E; Thu, 11 May 2023 18:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683828296; bh=NspQ5eSfzkW/s4ZKEIvi8KiViH9J4SR7mF8q0fY8gJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bOsA92m9AdNn6Tp6Q5Wnrj0TfXWHfvnnMaQmEHfrYgBKfV4cchmUnOq3yX0DTJVcz e8ehWgWWzwpTh3Egygs1D4qVUcu0jzpTTghtHA2HrA9EySOso3fzW1BpaysjTP85lA otoTCSW4Y/IqsE/dYLDfwEk+uwFUtu8ReMEMNQbsjg9pFsXSxMOsOqu9Gmc2P8ZdkY Vo1OdGxb2JF0RFFWfuwf7aea4mUgop1gxxKOhUJllL4wN29+MRszUa8AkKfNkJazfA q4x46Nwl6tX+IBjW/PUg3noNu8sWh1H40XfzPqqmq7Wd9GuI6DMLnJ88bD4n7hq8yt KrtTfLkY1Kh7g== From: Daniel Bristot de Oliveira To: linux-trace-devel@vger.kernel.org, Steven Rostedt Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Juri Lelli , William White , Daniel Bristot de Oliveira , Masami Hiramatsu , Jonathan Corbet Subject: [PATCH 8/8] rtla/hwnoise: Reduce runtime to 75% Date: Thu, 11 May 2023 20:04:26 +0200 Message-Id: <09fd28d1be7a5f3e01da1c2c007cf56790635f39.1683827510.git.bristot@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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?1765623116518778992?= X-GMAIL-MSGID: =?utf-8?q?1765623116518778992?= osnoise runs 100% of time by default. It makes sense because osnoise is preemptive. hwnoise checks preemption once a second, so it reduces system progress. Reduce runtime to 75% to avoid problems by default. I added a Fixes as it might avoid problems for first time users as it lands on distros. Cc: Steven Rostedt Cc: Daniel Bristot de Oliveira Cc: Masami Hiramatsu Cc: Jonathan Corbet Fixes: 1f428356c38d ("rtla: Add hwnoise tool") Signed-off-by: Daniel Bristot de Oliveira --- tools/tracing/rtla/src/osnoise_top.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c index 85abba568faf..f7c959be8677 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -348,8 +348,14 @@ struct osnoise_top_params *osnoise_top_parse_args(int argc, char **argv) if (!params) exit(1); - if (strcmp(argv[0], "hwnoise") == 0) + if (strcmp(argv[0], "hwnoise") == 0) { params->mode = MODE_HWNOISE; + /* + * Reduce CPU usage for 75% to avoid killing the system. + */ + params->runtime = 750000; + params->period = 1000000; + } while (1) { static struct option long_options[] = {