From patchwork Wed Apr 12 13:21:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 82502 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp333126vqo; Wed, 12 Apr 2023 06:39:04 -0700 (PDT) X-Google-Smtp-Source: AKy350Z5Iq2wEqVEHcsOnHM14KJATmuhZPoA5K1YSQwaLkNGy4NztcBKWYj0iCI6xi2fV6z/lhh0 X-Received: by 2002:a17:903:246:b0:1a6:7ed1:7ce4 with SMTP id j6-20020a170903024600b001a67ed17ce4mr242622plh.44.1681306744546; Wed, 12 Apr 2023 06:39:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681306744; cv=none; d=google.com; s=arc-20160816; b=ciR2PV1WHIUu6N7Z8MJZ4f/J3HVJiSRElix0gbXWTbpRg40cLXs+dUe8/fzVL37REa r1/Ax3r9OgOn8wU0mf5w2qwc3PO8/fmkMsREqfOC2FOUxI2jJrK/TPR107j8XZpfGvaN ZRdzineihrN/rJK5rI2jVl28KBC+kA8NNV79BsDz5VyvGVBhjXnsbjmYYUzjEdGEe4GJ yd54BM467TvFUyvYJL2dODIATNlSutwB8xQRtn8IVaaCh3rCTcRLzCv+1ba6lhlUUAG3 qqCaeODv9DI5HJJsS/D4duOR/Pb4oU7PZ6V5bUc+J/W8z/K350lu2PKIHClXGflLJ3iA mx5Q== 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=noNK6Yzy6jUQdTTDACR1Ss+NgCjA4lOzrEHNJl+bGi8=; b=E6iyqdXBFS06oI9nrvN7BSqBurcH0Q9SuZZq6nmtpFaOYzNLN/CrtLn3jBT058uuQZ D5V3YOXa9J6FX/9Kw/kM8Q5O6fmbBNOIj8HWU/P73RHhUbQrFe2FrzMWpQG1MUNRvnmT 1mA9T7wZU6JDRJ+Pdc+sm/TQnNyPS1FdZOS6b2IM2zo4sbRt0az9t12tLls4mYEnnxJ+ Bdf1RDP3PC6Wk92JZeqrPIQFmay18PFwH6fQbhS+DLJi+Js71WT/f2Dqp40oC2xK+4Zc 6dwmbTxEvCshZCrdcx8kP9SrgHis+uo+BfKHIJUQSYZr+hOi1/5c4GiWCF5qgNgJyX0L gIvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ixVzsFSY; 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=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q20-20020a17090aa01400b00246f4db9a9fsi1859112pjp.177.2023.04.12.06.38.51; Wed, 12 Apr 2023 06:39:04 -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=@intel.com header.s=Intel header.b=ixVzsFSY; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230406AbjDLNXq (ORCPT + 99 others); Wed, 12 Apr 2023 09:23:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231524AbjDLNXY (ORCPT ); Wed, 12 Apr 2023 09:23:24 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8DB8272B; Wed, 12 Apr 2023 06:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681305779; x=1712841779; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GdoyU1mkO+uuh6+FXiTKLcjnbdTl7FIeNDqvfQ0Ihec=; b=ixVzsFSYJRZ80syfLzEnzuny1PeLGekxSVdSgVzno3rEFz7CyM2mBO14 uANEeEJE0bcNWFqleQecfIrMhNnVhaXc4yi4BMRDJzZf2pVG0mIhVQ20L sDJ0PDqGUUqKK7eObWi179mEoOIzGJEMF04ow1UqpI+g8yCXQP8/Umg3E t7XKSuNopo7qJCtevzmS19bylzJH7z24ncHMxXOPDGW9WUWKfCpMsCugG JIlIxxRLT+p3kDgknZ5bqK8kBX4K9Xk8sMJ2afyAuPbESDlB7jd6rAsTM r55x9d8PdWA01s5URZ3Jy6lCyNEYgl6dWP0+/uAn7Fc8lqJownJB5y2/G A==; X-IronPort-AV: E=McAfee;i="6600,9927,10678"; a="332590160" X-IronPort-AV: E=Sophos;i="5.98,339,1673942400"; d="scan'208";a="332590160" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2023 06:22:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10678"; a="639230078" X-IronPort-AV: E=Sophos;i="5.98,339,1673942400"; d="scan'208";a="639230078" Received: from chanse1-mobl2.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.251.213.80]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2023 06:22:17 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Reinette Chatre , Fenghua Yu , Shuah Khan Cc: Shaopeng Tan , =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 11/22] selftests/resctrl: Add flush_buffer() to fill_buf Date: Wed, 12 Apr 2023 16:21:11 +0300 Message-Id: <20230412132122.29452-12-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230412132122.29452-1-ilpo.jarvinen@linux.intel.com> References: <20230412132122.29452-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, URIBL_BLOCKED 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?1762977900830222406?= X-GMAIL-MSGID: =?utf-8?q?1762977900830222406?= Currently, flushing is only done after allocating and filling the buffer and cannot be controlled by the test cases. The new CAT test will want to control flushing within a test so introduce flush_buffer() for that purpose. Signed-off-by: Ilpo Järvinen --- tools/testing/selftests/resctrl/fill_buf.c | 5 +++++ tools/testing/selftests/resctrl/resctrl.h | 1 + 2 files changed, 6 insertions(+) diff --git a/tools/testing/selftests/resctrl/fill_buf.c b/tools/testing/selftests/resctrl/fill_buf.c index f5ca0c573891..316800715386 100644 --- a/tools/testing/selftests/resctrl/fill_buf.c +++ b/tools/testing/selftests/resctrl/fill_buf.c @@ -66,6 +66,11 @@ static void mem_flush(void *p, size_t s) sb(); } +void flush_buffer(unsigned long long span) +{ + mem_flush(startptr, span); +} + static void *malloc_and_init_memory(size_t s) { void *p = NULL; diff --git a/tools/testing/selftests/resctrl/resctrl.h b/tools/testing/selftests/resctrl/resctrl.h index 968ac2a321ff..594e72f04b63 100644 --- a/tools/testing/selftests/resctrl/resctrl.h +++ b/tools/testing/selftests/resctrl/resctrl.h @@ -99,6 +99,7 @@ int perf_event_open(struct perf_event_attr *hw_event, pid_t pid, int cpu, int group_fd, unsigned long flags); void free_buffer(void); int alloc_buffer(unsigned long long buf_size, int memflush); +void flush_buffer(unsigned long long span); int use_buffer(unsigned long long buf_size, int op, bool once); int run_fill_buf(unsigned long span, int memflush, int op, bool once); int resctrl_val(char **benchmark_cmd, struct resctrl_val_param *param);