Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2694090lqt; Mon, 22 Apr 2024 20:40:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVYi09Ynu+rNje7bjlWymKWJrVfnMb8UceEgbf5TBlNPuZ+ezlp5OVgTyJTcSxUTG26+pN7OHMR3Hy/KNPCcdWq42td4/Twp+n729R8MA== X-Google-Smtp-Source: AGHT+IGEGvYuSdYpZDpJNf73cRX8e07clwYj3CrlRW3W8ucyghFbn8IfWI+in7KfpnkXicfuB1rJ X-Received: by 2002:a17:90b:286:b0:2a2:acf3:4108 with SMTP id az6-20020a17090b028600b002a2acf34108mr13660113pjb.0.1713843641502; Mon, 22 Apr 2024 20:40:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713843641; cv=pass; d=google.com; s=arc-20160816; b=gKP4pZSUIJ1WONIWWsNOx5DJDV5aLqtfMc7/wmO5ftQ9NjzxvyfsQcv0TBfDfDD9tG EnOWPl6ScJDBeJJTyyAvMPYZcVh0GYACSjAXuu+78JyFaPleiS5zfGZNYPXpoV2mINPJ GKmhGjqhmm1Ua2MeZCjADV6oZ6QZ/aBCWJbJ0GD16jJJjN3HNSZBqNzm+klRc0MKUjiy QsvBZDmGePV46E4Y5oin0hoUaIxysOBOOHtUAe55b+X9gljFnMHIlQzlBS2/zUCa05RZ WcNPRw6TxKho0U7rS7LKKJ3n8clbMBE3Tmg8Lftyr6EtoqdsN+8pzmbnnuZ+ZoyeBe3H kwLg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id; bh=eKPOQCMhNaRtCIjvBwZ47ZeU4HbOBI3d/5pb39mjxZU=; fh=r0iSqF0o15VLLfcLdAeBnfVZJFERIK9ltFWbe69Mm7A=; b=z0mELgt9SzGsWzsmgvqDQ0DZ+KD0Pnwg+WTA63vUkSxhJOqRYT3oyKj5zUqivsPisp yixsJ+nl58b8zX5QNeSRs3HwptNfZ7/XhC7MEVtroNhLzjK8YpsDheAYaLycuJMuO+05 UNJ+liMF8QgNoKZGaZkRxdpiaES46i3CIVyvWTx6yz/mzblzAR4gcPrMQAQYZRjGlk8B BcJ1TWvUKwgw1lmb7MgNP/Iyff35Vpa0dTLpPB/h6hddPnN5DEQywYr3ykL5tBLHokBZ EaBXyAJQC8T5J2mozbgVFvZWoHJNa1H5LAbJQaYbqemXXIBwgdxdGeRb0XbRA//z4oqN MkEQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-154461-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154461-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b1-20020a17090a990100b002adec71b7e9si2669974pjp.32.2024.04.22.20.40.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 20:40:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-154461-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-154461-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154461-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 3E595B23143 for ; Tue, 23 Apr 2024 03:39:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 894DC1C694; Tue, 23 Apr 2024 03:39:10 +0000 (UTC) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C20115E89; Tue, 23 Apr 2024 03:39:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713843550; cv=none; b=mb1snbxhwxNbt6l/56pSGc720iWiRBS4Ouh9DCYpGNOhKSBnUGmjQlbHqq4pNHyZvHTTLoheiV6UlnBpaPDXe7PR/fqJKW+cr+ce2GIDlMudjE9nJJYDEujwdXijk0Ar7LMRBCzGPreoARqTIWebgbwm3h52NvsiC9DDyAvB4DE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713843550; c=relaxed/simple; bh=pNiBG+e9qgp5dz04/zKlKcKVo2+IvJWVJQw3C1VcUgQ=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=X8YLitB30h+YHptIduFWmxX4Cy3ZBpHhH85GUGEUGkg9jgVbCbyVySYM6hjZkkB07o84KdhN0Bet8vxnKJ9rg7LcVK+FhCawL4umcGnXKMaIlETrdOxqA/KznRdZzfUckFA+8LngqHyjYVruVZJtopPCg94yIgrlmvwxGpv07s8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4VNnrW2q2tz1HBjK; Tue, 23 Apr 2024 11:38:03 +0800 (CST) Received: from kwepemf500004.china.huawei.com (unknown [7.202.181.242]) by mail.maildlp.com (Postfix) with ESMTPS id 58B4D1A016C; Tue, 23 Apr 2024 11:39:03 +0800 (CST) Received: from [10.67.121.175] (10.67.121.175) by kwepemf500004.china.huawei.com (7.202.181.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 23 Apr 2024 11:39:02 +0800 Message-ID: Date: Tue, 23 Apr 2024 11:39:02 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] dmaengine: dmatest: fix timeout caused by kthread_stop To: Vinod Koul CC: , References: <20230720114102.51053-1-haijie1@huawei.com> From: Jie Hai In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemf500004.china.huawei.com (7.202.181.242) Hi, Vinod Koul, Stop an ongoing test by "echo 0 > /sys/module/dmatest/parameters/run". If the current code is executed inside the while loop "while (!(kthread_should_stop() || (params->iterations && total_tests >= params->iterations)))" and before the call of "wait_event_freezable_timeout", the "wait_event_freezable_timeout" will be interrupted and result in "time out" for the test even if the test is not completed. Operations to the problem is as follows, and the failures are probabilistic: modprobe hisi_dma modprobe dmatest echo 0 > /sys/module/dmatest/parameters/iterations echo "dma0chan0" > /sys/module/dmatest/parameters/channel echo "dma0chan1" > /sys/module/dmatest/parameters/channel echo "dma0chan2" > /sys/module/dmatest/parameters/channel echo 1 > /sys/module/dmatest/parameters/run echo 0 > /sys/module/dmatest/parameters/run dmesg: [52575.636992] dmatest: Added 1 threads using dma0chan0 [52575.637555] dmatest: Added 1 threads using dma0chan1 [52575.638044] dmatest: Added 1 threads using dma0chan2 [52581.020355] dmatest: Started 1 threads using dma0chan0 [52581.020585] dmatest: Started 1 threads using dma0chan1 [52581.020814] dmatest: Started 1 threads using dma0chan2 [52587.705782] dmatest: dma0chan0-copy0: result #57691: 'test timed out' with src_off=0xfe6 dst_off=0x89 len=0x1d9a (0) [52587.706527] dmatest: dma0chan0-copy0: summary 57691 tests, 1 failures 51179.98 iops 411323 KB/s (0) [52587.707028] dmatest: dma0chan1-copy0: result #63178: 'test timed out' with src_off=0xdf dst_off=0x6ab len=0x389e (0) [52587.707767] dmatest: dma0chan1-copy0: summary 63178 tests, 1 failures 62851.60 iops 503835 KB/s (0) [52587.708376] dmatest: dma0chan2-copy0: result #60527: 'test timed out' with src_off=0x10e dst_off=0x58 len=0x3ea4 (0) [52587.708951] dmatest: dma0chan2-copy0: summary 60527 tests, 1 failures 52403.78 iops 420014 KB/s (0) On 2024/4/18 1:18, Vinod Koul wrote: > On 20-07-23, 19:41, Jie Hai wrote: >> The change introduced by commit a7c01fa93aeb ("signal: break >> out of wait loops on kthread_stop()") causes dmatest aborts >> any ongoing tests and possible failure on the tests. This patch > > Have you see this failure? Any log of that.. > >> use wait_event_timeout instead of wait_event_freezable_timeout >> to avoid interrupting ongoing tests by signal brought by >> kthread_stop(). >> >> Signed-off-by: Jie Hai >> --- >> drivers/dma/dmatest.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c >> index ffe621695e47..c06b8b16645a 100644 >> --- a/drivers/dma/dmatest.c >> +++ b/drivers/dma/dmatest.c >> @@ -827,7 +827,7 @@ static int dmatest_func(void *data) >> } else { >> dma_async_issue_pending(chan); >> >> - wait_event_freezable_timeout(thread->done_wait, >> + ret = wait_event_timeout(thread->done_wait, >> done->done, >> msecs_to_jiffies(params->timeout)); >> >> -- >> 2.33.0 >