From patchwork Thu Oct 24 21:03:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 11210845 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 30E51112C for ; Thu, 24 Oct 2019 21:04:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1823F21D71 for ; Thu, 24 Oct 2019 21:04:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728840AbfJXVED (ORCPT ); Thu, 24 Oct 2019 17:04:03 -0400 Received: from mail-pg1-f174.google.com ([209.85.215.174]:40122 "EHLO mail-pg1-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728825AbfJXVED (ORCPT ); Thu, 24 Oct 2019 17:04:03 -0400 Received: by mail-pg1-f174.google.com with SMTP id 15so48904pgt.7 for ; Thu, 24 Oct 2019 14:04:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qoQi7SAaxDczqYDQpy3vOS9up78X8ZTS/VQcH+bp4mg=; b=IxwyvgUTmDuASTNBLHewTmdzzCOk2hKdxZBtsHkaLqmbCRDXJ42qfs1MgIj9w54Y6s B5LgpvHI0apDqmQq51sCBG6I5Fia5jcu+U4kaEoVbRyn7oY9KCibdYdGDdNQk+DJcacv JiyhOkl1nGSLLYXdKKiu2RpiuGdmPD/Vxt9KUnOtX/IXc5oLM4orGVNXhMi8YLez2I2m oKeXhAYhHJd8/GeG/hYRMjZ8N9LMaBXCLyl9m60YLAIj3a5i0f6r4Gyk5bv8F7vyVW9J 4IzWhm40zg5lChla+rd2N5RXbChoLIjczNfFPodOT28hqnMXIKOEg3jEkAPKLw0A8wAT vg9A== X-Gm-Message-State: APjAAAWIHWZkyKU6EqfEtzK4fsTa6ZoVzN0RvuDMy2CH8ovC40yIBnlB 3fMiwq7S30PMm2aB1nDA7WU= X-Google-Smtp-Source: APXvYqypn+Zb33wrTk7jLV/HR48JDoln5rG6kAzUh2FSPpYoBGrR76byn1PkFbJU1VHXS0zJ2Y82BA== X-Received: by 2002:a17:90a:654b:: with SMTP id f11mr9523225pjs.49.1571951040718; Thu, 24 Oct 2019 14:04:00 -0700 (PDT) Received: from desktop-bart.svl.corp.google.com ([2620:15c:2cd:202:4308:52a3:24b6:2c60]) by smtp.gmail.com with ESMTPSA id i22sm28270127pgg.20.2019.10.24.14.03.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 14:03:59 -0700 (PDT) From: Bart Van Assche To: Omar Sandoval Cc: linux-block@vger.kernel.org, Johannes Thumshirn , Chaitanya Kulkarni , Bart Van Assche Subject: [PATCH blktests v2 1/2] Move and rename uptime_s() Date: Thu, 24 Oct 2019 14:03:51 -0700 Message-Id: <20191024210352.71080-2-bvanassche@acm.org> X-Mailer: git-send-email 2.24.0.rc0.303.g954a862665-goog In-Reply-To: <20191024210352.71080-1-bvanassche@acm.org> References: <20191024210352.71080-1-bvanassche@acm.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Make it easy to use the uptime_s() function from block tests. Change the implementation of this function into something that is easier to read. Signed-off-by: Bart Van Assche --- common/multipath-over-rdma | 9 +-------- common/rc | 5 +++++ tests/nvmeof-mp/rc | 2 +- tests/srp/014 | 2 +- tests/srp/rc | 2 +- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/common/multipath-over-rdma b/common/multipath-over-rdma index 65ebb7b7f5f7..545a81e8c18e 100644 --- a/common/multipath-over-rdma +++ b/common/multipath-over-rdma @@ -129,19 +129,12 @@ held_by() { done } -# System uptime in seconds. -uptime_s() { - local a b - - echo "$( X-Patchwork-Id: 11210847 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8AEC51920 for ; Thu, 24 Oct 2019 21:04:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 71D0F21928 for ; Thu, 24 Oct 2019 21:04:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728825AbfJXVED (ORCPT ); Thu, 24 Oct 2019 17:04:03 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:46506 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726215AbfJXVED (ORCPT ); Thu, 24 Oct 2019 17:04:03 -0400 Received: by mail-pg1-f195.google.com with SMTP id f19so28959pgn.13 for ; Thu, 24 Oct 2019 14:04:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WUzELtZ0/6O3O7y93j4oi5o6nnW4ejVR2cqHnlxjhqk=; b=DFIiQgNd///C8hdOR1UesYuinnX5FWrM+ILQNcqoy+20o42ORn35Whr/ESWXvx0FMD 5/tJB9qNbbSSNE/ji3wAZjOVc1Z2IeFoshbLwTiJ4hZp0UJMQZAFZc5fvDcSNGqqoakq 2Q8HWPLSLyIZ4oR96vl1PHO4UYlFquDAbk9aNWuq0SLwpQ5hEyre2RQ2/hraKYFhQf1E QOsiL/luQWe1kwDJsn8G+T6PqREwY8Ha9NsqzGBAhd1tL191Bc39RVZUpCG08j6F2XYW 9MzMf1i6KJZzbcV1hBji4MYjQ+PZgoeZrXV0pqDoFYQ5CId/42JjwOOraoqPl0bIqVfA K6wA== X-Gm-Message-State: APjAAAUtTQgI0No/P1ORIkLmHjlaeJE431qG07SDJ9p+t2jm6fXKxYkC gD8joLJYBiIMD+2OV3MYTTY= X-Google-Smtp-Source: APXvYqyHx2TreEJGpqbrJPW3URG/eYbuu+t/XBrDJa7nCz/L3SF7igj1jBo3b/bbWCoDH9G1/IzDoA== X-Received: by 2002:a65:49c9:: with SMTP id t9mr30681pgs.61.1571951042114; Thu, 24 Oct 2019 14:04:02 -0700 (PDT) Received: from desktop-bart.svl.corp.google.com ([2620:15c:2cd:202:4308:52a3:24b6:2c60]) by smtp.gmail.com with ESMTPSA id i22sm28270127pgg.20.2019.10.24.14.04.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 14:04:01 -0700 (PDT) From: Bart Van Assche To: Omar Sandoval Cc: linux-block@vger.kernel.org, Johannes Thumshirn , Chaitanya Kulkarni , Bart Van Assche Subject: [PATCH blktests v2 2/2] Add a test that triggers blk_mq_update_nr_hw_queues() Date: Thu, 24 Oct 2019 14:03:52 -0700 Message-Id: <20191024210352.71080-3-bvanassche@acm.org> X-Mailer: git-send-email 2.24.0.rc0.303.g954a862665-goog In-Reply-To: <20191024210352.71080-1-bvanassche@acm.org> References: <20191024210352.71080-1-bvanassche@acm.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Note: the newly added test script only triggers blk_mq_update_nr_hw_queues() for kernel versions that include commit 45919fbfe1c4 ("null_blk: Enable modifying 'submit_queues' after an instance has been configured"). Signed-off-by: Bart Van Assche --- tests/block/029 | 64 +++++++++++++++++++++++++++++++++++++++++++++ tests/block/029.out | 1 + 2 files changed, 65 insertions(+) create mode 100755 tests/block/029 create mode 100644 tests/block/029.out diff --git a/tests/block/029 b/tests/block/029 new file mode 100755 index 000000000000..d298bac8db5c --- /dev/null +++ b/tests/block/029 @@ -0,0 +1,64 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright 2019 Google LLC +# +# Trigger blk_mq_update_nr_hw_queues(). + +. tests/block/rc +. common/null_blk + +DESCRIPTION="trigger blk_mq_update_nr_hw_queues()" +QUICK=1 + +requires() { + _have_null_blk +} + +# Configure one null_blk instance. +configure_null_blk() { + local nullb0="/sys/kernel/config/nullb/nullb0" + + mkdir "$nullb0" && + echo 0 > "$nullb0/completion_nsec" && + echo 512 > "$nullb0/blocksize" && + echo 16 > "$nullb0/size" && + echo 1 > "$nullb0/memory_backed" && + echo 1 > "$nullb0/power" && + ls -l /dev/nullb* &>>"$FULL" +} + +modify_nr_hw_queues() { + local deadline num_cpus + + deadline=$(($(_uptime_s) + TIMEOUT)) + num_cpus=$(nproc) + while [ "$(_uptime_s)" -lt "$deadline" ]; do + sleep .1 + echo 1 > /sys/kernel/config/nullb/nullb0/submit_queues + sleep .1 + echo "$num_cpus" > /sys/kernel/config/nullb/nullb0/submit_queues + done +} + +test() { + local sq=/sys/kernel/config/nullb/nullb0/submit_queues + + : "${TIMEOUT:=30}" + _init_null_blk nr_devices=0 queue_mode=2 && + configure_null_blk + if { echo 1 >$sq; } 2>/dev/null; then + modify_nr_hw_queues & + fio --rw=randwrite --bs=4K --loops=$((10**6)) \ + --iodepth=64 --group_reporting --sync=1 --direct=1 \ + --ioengine=libaio --filename="/dev/nullb0" \ + --runtime="${TIMEOUT}" --name=nullb0 \ + --output="${RESULTS_DIR}/block/fio-output-029.txt" \ + >>"$FULL" + wait + else + echo "Skipping test because $sq cannot be modified" >>"$FULL" + fi + rmdir /sys/kernel/config/nullb/nullb0 + _exit_null_blk + echo Passed +} diff --git a/tests/block/029.out b/tests/block/029.out new file mode 100644 index 000000000000..863339fb8ced --- /dev/null +++ b/tests/block/029.out @@ -0,0 +1 @@ +Passed