Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1297002rwb; Tue, 4 Oct 2022 19:30:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5r5+XIdFCPKGDBCvpVCucMXh5oJ6QZygOzrqbywRiPjuF3F0KGTYFOE1YQRFE1bxV4F3wb X-Received: by 2002:a17:903:124c:b0:179:da2f:2463 with SMTP id u12-20020a170903124c00b00179da2f2463mr29215894plh.128.1664937036656; Tue, 04 Oct 2022 19:30:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664937036; cv=none; d=google.com; s=arc-20160816; b=FUG2+GvlVZPag17WLZop6LkzCrlP4lTvSRa7qiua0ARPT8q2zKFE/eF8aJcLIS2klI sAeTkZGDFNML7cC7h24l/t7mgYl5VA10t14M4F6cceD0mFwjwSt5MioOzqsL57vJxJdy lbRCrIPX5oXzU+tx8Dd957ozEEjUZs61B/rpivzPJECUhDitElbOWMx/WMQvGVeDftFs HOd0BLeDysVRdg8FGoDlUmdZ6d2xoaBjdG4IYaIIE4V8ix94YAePj/l5bCXoTsQRVjP4 PuVGZ+6ctHQuVF9MbSydos03OmiYItBz8fhZJD6HnzGw2aYJxjpIs5I+nDoRMN35Ed9y pqBQ== 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=Xip4zQb/P1NvxiFoZdYmk8c8EZn+x93yAE5YB1BZp/Y=; b=WHjsLiCAmJ4JYow54wdatQzmvxTBFaPGZbWsQFSKAGcDZAWFVVCGQ9xjPCCYArzF26 r3Mih6AxTpia+C/rk8CHh5FnF7C2uOtsTDwavphNli6JiHdf1HD52vCjJVAS+PoQpXvQ hpuoi9RskjFI6dLeBmbZgafKMLAKsW/OrAy1B25UHlSQiMNedUZAtfPvd6jan/ndVZY6 ZVZEmm0ZA6f6NKJq3x3oDtZCs5p5FzXfCbORmxkevcpDDgGltkr6iBkvPBdzTHLy6XO3 U0b6i8VYEifImghLzbtfkSOH1BRaiz9j0jv9kqCLRukNhEwT7y9D5DWTsejzOptn9bSA aUHA== 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=fujitsu.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a631e11000000b0043caa6f10dbsi8132145pge.803.2022.10.04.19.30.22; Tue, 04 Oct 2022 19:30:36 -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=fujitsu.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229741AbiJEBnp (ORCPT + 99 others); Tue, 4 Oct 2022 21:43:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229725AbiJEBnn (ORCPT ); Tue, 4 Oct 2022 21:43:43 -0400 Received: from esa9.hc1455-7.c3s2.iphmx.com (esa9.hc1455-7.c3s2.iphmx.com [139.138.36.223]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A4DC564FD; Tue, 4 Oct 2022 18:43:41 -0700 (PDT) X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="79241595" X-IronPort-AV: E=Sophos;i="5.95,159,1661785200"; d="scan'208";a="79241595" Received: from unknown (HELO oym-r3.gw.nic.fujitsu.com) ([210.162.30.91]) by esa9.hc1455-7.c3s2.iphmx.com with ESMTP; 05 Oct 2022 10:43:39 +0900 Received: from oym-m3.gw.nic.fujitsu.com (oym-nat-oym-m3.gw.nic.fujitsu.com [192.168.87.60]) by oym-r3.gw.nic.fujitsu.com (Postfix) with ESMTP id 6295BD63BE; Wed, 5 Oct 2022 10:43:38 +0900 (JST) Received: from yto-om1.fujitsu.com (yto-om1.o.css.fujitsu.com [10.128.89.162]) by oym-m3.gw.nic.fujitsu.com (Postfix) with ESMTP id 98AC4D9495; Wed, 5 Oct 2022 10:43:37 +0900 (JST) Received: from cn-r05-10.example.com (n3235113.np.ts.nmh.cs.fujitsu.co.jp [10.123.235.113]) by yto-om1.fujitsu.com (Postfix) with ESMTP id 62ECD405D4705; Wed, 5 Oct 2022 10:43:37 +0900 (JST) From: Shaopeng Tan To: Fenghua Yu , Reinette Chatre , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, tan.shaopeng@jp.fujitsu.com Subject: [PATCH v2 1/4] selftests/resctrl: Fix set up shemata with 100% allocation on first run in MBM test. Date: Wed, 5 Oct 2022 10:39:30 +0900 Message-Id: <20221005013933.1486054-2-tan.shaopeng@jp.fujitsu.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20221005013933.1486054-1-tan.shaopeng@jp.fujitsu.com> References: <20221005013933.1486054-1-tan.shaopeng@jp.fujitsu.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,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 There is a comment "Set up shemata with 100% allocation on the first run" in function mbm_setup(), but there is an increment bug and the condition "num_of_runs == 0" will never be met and write_schemata() will never be called to set schemata to 100%. This is currently fine because resctl_val_parm->num_resctrlfs is always 1 and umount/mount will be run in each test to set the schemata to 100%. To make mbm_setup() future code-change proof, fix to call write-schemata() properly when the function is called for the first time. Also, remove static local variable 'num_of_runs' because this is not needed as there is resctl_val_param->num_of_runs which should be used instead like in cat_setup(). Signed-off-by: Shaopeng Tan --- tools/testing/selftests/resctrl/mbm_test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/resctrl/mbm_test.c b/tools/testing/selftests/resctrl/mbm_test.c index 8392e5c55ed0..4a54be314402 100644 --- a/tools/testing/selftests/resctrl/mbm_test.c +++ b/tools/testing/selftests/resctrl/mbm_test.c @@ -89,12 +89,11 @@ static int check_results(int span) static int mbm_setup(int num, ...) { struct resctrl_val_param *p; - static int num_of_runs; va_list param; int ret = 0; /* Run NUM_OF_RUNS times */ - if (num_of_runs++ >= NUM_OF_RUNS) + if (p->num_of_runs >= NUM_OF_RUNS) return -1; va_start(param, num); @@ -102,9 +101,10 @@ static int mbm_setup(int num, ...) va_end(param); /* Set up shemata with 100% allocation on the first run. */ - if (num_of_runs == 0) + if (p->num_of_runs == 0) ret = write_schemata(p->ctrlgrp, "100", p->cpu_no, p->resctrl_val); + p->num_of_runs++; return ret; } -- 2.27.0