From patchwork Tue Jan 29 23:54:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 10787361 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CC9481399 for ; Tue, 29 Jan 2019 23:54:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8CE42880A for ; Tue, 29 Jan 2019 23:54:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD67F2898D; Tue, 29 Jan 2019 23:54:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F3B32880A for ; Tue, 29 Jan 2019 23:54:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727342AbfA2XyQ (ORCPT ); Tue, 29 Jan 2019 18:54:16 -0500 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:39004 "EHLO out30-44.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726846AbfA2XyQ (ORCPT ); Tue, 29 Jan 2019 18:54:16 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R211e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=bo.liu@linux.alibaba.com;NM=1;PH=DS;RN=1;SR=0;TI=SMTPD_---0TJEYufj_1548806053; Received: from localhost(mailfrom:bo.liu@linux.alibaba.com fp:SMTPD_---0TJEYufj_1548806053) by smtp.aliyun-inc.com(127.0.0.1); Wed, 30 Jan 2019 07:54:14 +0800 From: Liu Bo To: linux-block@vger.kernel.org Subject: [PATCH blktests] block: add test for io hang due to blk-iolatency Date: Wed, 30 Jan 2019 07:54:07 +0800 Message-Id: <20190129235407.64401-1-bo.liu@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.2.gb21ebb6 MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add test for verifying io hang when enabling blk-iolatency after a few IOs have been done. This is a regression test for "blk-iolatency: fix IO hang due to negative inflight counter". Signed-off-by: Liu Bo Signed-off-by: Liu Bo --- tests/block/022 | 42 ++++++++++++++++++++++++++++++++++++++++++ tests/block/022.out | 2 ++ 2 files changed, 44 insertions(+) create mode 100755 tests/block/022 create mode 100644 tests/block/022.out diff --git a/tests/block/022 b/tests/block/022 new file mode 100755 index 0000000..6e5ab42 --- /dev/null +++ b/tests/block/022 @@ -0,0 +1,42 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2019 Bo Liu +# +# This test is a regression test for io hang due to blk-iolatency, the patch is +# "blk-iolatency: fix IO hang due to negative inflight counter" + +. tests/block/rc +. common/cgroup +. common/null_blk +DESCRIPTION="This test will demonstrate io hang due to blk-iolatency" + +requires() { + _have_null_blk && _have_cgroup2_controller_file io io.latency +} + +test() { + local CGROUP2_DIR + local dir + echo "Running ${TEST_NAME}" + + if ! _init_null_blk queue_mode=2; then + return 1 + fi + + _init_cgroup2 + dir=$(_cgroup2_base_dir) + + echo $$ > ${CGROUP2_DIR}/cgroup.procs + xfs_io -f -d -c "pwrite 0 4k" /dev/nullb0 + + # target=1s + echo "`cat /sys/block/nullb0/dev` target=1000000" > ${CGROUP2_DIR}/io.latency + + xfs_io -f -d -c "pwrite 0 4k" /dev/nullb0 + + echo $$ > ${dir}/cgroup.procs + _exit_cgroup2 + _exit_null_blk + + echo "Test complete" +} diff --git a/tests/block/022.out b/tests/block/022.out new file mode 100644 index 0000000..14d43cb --- /dev/null +++ b/tests/block/022.out @@ -0,0 +1,2 @@ +Running block/022 +Test complete