From patchwork Mon Oct 21 22:57:18 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: 11203161 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 54983913 for ; Mon, 21 Oct 2019 22:57:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3DF7920B7C for ; Mon, 21 Oct 2019 22:57:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730489AbfJUW5a (ORCPT ); Mon, 21 Oct 2019 18:57:30 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:35315 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730350AbfJUW5a (ORCPT ); Mon, 21 Oct 2019 18:57:30 -0400 Received: by mail-pg1-f194.google.com with SMTP id c8so3893491pgb.2 for ; Mon, 21 Oct 2019 15:57:30 -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=1yeeTbnyVvdJTAkff/hnVliiaKOyas0k2rMKAXPg1qc=; b=KWy6cP1SiYOFmaTpirg3RtB3IQoB8WWcrWsXLk+Vq9TYpWz9aeJ4sc9fAWtCaC/4Ji ghhq+YJsWB5xq5e/8vNbKnSUg+M5Oi44aX4jeMc0F2xy1FBK+LJgNsHEiWkhmvAEo4wv be1wIivTcaj3GV+O5AHTFWss1SU+dxzRlorZ0iESH+BifOeahDEtg8HDGe4Kwg/5LqoC Pm4wSfROV6kOcfbc/gbaceF+q4FGbJScUgwxrdXONn2bmCEv9QHCv0fx2twWCvA0v3z1 zNab+b4hhSpU+ZHodSXDyEPG7lOGGk3IIkqo3nd6DceRmnAY1IS2z/N6HwgjDop97qcq GGlw== X-Gm-Message-State: APjAAAWVOV6prUxK7JpF4EocDAK4emBuEx5GSRaHlvsCc9jedGajnpqP K2WB2ekB/PjUHJo6FMf+5J4= X-Google-Smtp-Source: APXvYqw2wiYQdTTr/+Bv/Z95m619C4BNn7k2+K0pT+L6Ig2oPd07kOR4oYrZuJwxQQPnDwgV3TOBXg== X-Received: by 2002:a17:90a:8d13:: with SMTP id c19mr637073pjo.63.1571698649711; Mon, 21 Oct 2019 15:57:29 -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 x70sm255474pfd.132.2019.10.21.15.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 15:57:28 -0700 (PDT) From: Bart Van Assche To: Omar Sandoval Cc: linux-block@vger.kernel.org, Johannes Thumshirn , Bart Van Assche Subject: [PATCH blktests 1/2] Move and rename uptime_s() Date: Mon, 21 Oct 2019 15:57:18 -0700 Message-Id: <20191021225719.211651-2-bvanassche@acm.org> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog In-Reply-To: <20191021225719.211651-1-bvanassche@acm.org> References: <20191021225719.211651-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. Signed-off-by: Bart Van Assche Reviewed-by: Chaitanya Kulkarni --- common/multipath-over-rdma | 9 +-------- common/rc | 9 +++++++++ tests/nvmeof-mp/rc | 2 +- tests/srp/014 | 2 +- tests/srp/rc | 2 +- 5 files changed, 13 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 "$(/dev/null && echo "${a%%.*}"; + } +} diff --git a/tests/nvmeof-mp/rc b/tests/nvmeof-mp/rc index 2493fcee12de..278843a1270d 100755 --- a/tests/nvmeof-mp/rc +++ b/tests/nvmeof-mp/rc @@ -113,7 +113,7 @@ simulate_network_failure_loop() { [ -e "$dev" ] || return $? [ -n "$duration" ] || return $? - deadline=$(($(uptime_s) + duration)) + deadline=$(($(_uptime_s) + duration)) while [ $rc = 0 ]; do sleep_until 5 ${deadline} || break for d in $(held_by "$dev"); do diff --git a/tests/srp/014 b/tests/srp/014 index 8ecd8a439a82..7afde6284b83 100755 --- a/tests/srp/014 +++ b/tests/srp/014 @@ -69,7 +69,7 @@ sg_reset_loop() { [ -e "$dev" ] || return $? [ -n "$duration" ] || return $? reset_type=(-d -b) - deadline=$(($(uptime_s) + duration)) + deadline=$(($(_uptime_s) + duration)) while true; do sleep_until 1 ${deadline} || break cmd="sg_reset --no-esc ${reset_type[i++ % 2]} $dev" diff --git a/tests/srp/rc b/tests/srp/rc index 696d94e5fb97..a1bc09b496ec 100755 --- a/tests/srp/rc +++ b/tests/srp/rc @@ -247,7 +247,7 @@ simulate_network_failure_loop() { [ -e "$dev" ] || return $? [ -n "$duration" ] || return $? - deadline=$(($(uptime_s) + duration)) + deadline=$(($(_uptime_s) + duration)) s=5 while [ $rc = 0 ]; do sleep_until 5 ${deadline} || break From patchwork Mon Oct 21 22:57:19 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: 11203163 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 8A303913 for ; Mon, 21 Oct 2019 22:57:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 733AB2089C for ; Mon, 21 Oct 2019 22:57:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730492AbfJUW5c (ORCPT ); Mon, 21 Oct 2019 18:57:32 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:44819 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730350AbfJUW5b (ORCPT ); Mon, 21 Oct 2019 18:57:31 -0400 Received: by mail-pf1-f193.google.com with SMTP id q21so9338087pfn.11 for ; Mon, 21 Oct 2019 15:57:31 -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=JcAPZHBup7EGGT2HEeVEwPdgfLi+5+AbDG/DlcY9dvU=; b=DgZhazjpR9XaYmdNRWnK3ML2mcDNHKnU52E7HVSOL+HqUVa9El9L5eL50kdrLIv9ed INyHny4ByzLChDFVL32zxcu+pJtNX3wTONO1x9/fgvV90/dI1xZIfFfgoFxIzNPQjaJj Fav1UVCWk4PcTIhB6GP6RQySTWGmxoENUazRKPD4Meh+8eLVEBMrxiJii6FN71MKC/9h yI6j5fehIoLT8TUTJqxtyTO314WGpq6BOvF4i4Qr+a4eZXRSzOanNs6G6WVLhbsWAY6z 3CP1LWEhGDT209HSc0MSODKIi1oe4VFCuoiy+Eo2KCuk9Oapi1voEARC43D2GfKwX4T8 9lzA== X-Gm-Message-State: APjAAAWpqTXOqpVrEipBwrXSmx33V+VlLuGe2Pc4SkV6KGJRnbjXmDBJ 49TaurPqnp+Jzmwks6hAhTE= X-Google-Smtp-Source: APXvYqyUtmNvZdeZBNvnCESRjXPVpTcuzRgWq6VAvTRqFcR4VABjlVCFNmD6vel09eFeNQOrgRNm8g== X-Received: by 2002:a17:90a:2522:: with SMTP id j31mr625715pje.123.1571698651086; Mon, 21 Oct 2019 15:57:31 -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 x70sm255474pfd.132.2019.10.21.15.57.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 15:57:30 -0700 (PDT) From: Bart Van Assche To: Omar Sandoval Cc: linux-block@vger.kernel.org, Johannes Thumshirn , Bart Van Assche Subject: [PATCH blktests 2/2] Add a test that triggers blk_mq_update_nr_hw_queues() Date: Mon, 21 Oct 2019 15:57:19 -0700 Message-Id: <20191021225719.211651-3-bvanassche@acm.org> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog In-Reply-To: <20191021225719.211651-1-bvanassche@acm.org> References: <20191021225719.211651-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 Signed-off-by: Bart Van Assche Reviewed-by: Chaitanya Kulkarni --- tests/block/029 | 63 +++++++++++++++++++++++++++++++++++++++++++++ tests/block/029.out | 1 + 2 files changed, 64 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..1999168603c1 --- /dev/null +++ b/tests/block/029 @@ -0,0 +1,63 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2019 Google Inc. +# +# 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() { + ( + cd /sys/kernel/config/nullb || return $? + ( + mkdir -p nullb0 && + cd nullb0 && + echo 0 > completion_nsec && + echo 512 > blocksize && + echo 16 > size && + echo 1 > memory_backed && + echo 1 > power + ) + ) && + ls -l /dev/nullb* &>>"$FULL" +} + +modify_nr_hw_queues() { + local deadline num_cpus + + deadline=$(($(_uptime_s) + TIMEOUT)) + num_cpus=$(find /sys/devices/system/cpu -maxdepth 1 -name 'cpu[0-9]*' | + wc -l) + 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() { + : "${TIMEOUT:=30}" + _init_null_blk nr_devices=0 queue_mode=2 && + configure_null_blk + 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 + 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