Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp780380ybj; Thu, 7 May 2020 07:30:34 -0700 (PDT) X-Google-Smtp-Source: APiQypJsCessczgltrsfEtRNgSDs5H7u0rX6eBy2z2bT0u3usP3YqRBLbUj6VXG73od/wjY4+eog X-Received: by 2002:a17:906:cec5:: with SMTP id si5mr12379813ejb.267.1588861834151; Thu, 07 May 2020 07:30:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588861834; cv=none; d=google.com; s=arc-20160816; b=yCzVL5jxC1V+KGwMpCn2pXpQO2OukijK+BdKJIR4Nvmcj8XaUIqrXzXSwxcYS/9eYB V7/gHU3HPhEAZnVeZJ33/HwnN0g6AnZ0Zjmn6abAC/ZY8YaskwYpbfLzLBNCVQ9DZt9P KnZ5ASwszM+odFJd6lEKEakKIS8YO+ikiYd/lLjY6pyrGYi+vsLRN9ota3GScZohLcTH OthERv/hluNLEH0aeczyZ5gKhf+HySCbZz2Dz++leEBBSaQBqjonxGOgfQxyolw6B8dH L7z2jqtMWa1az33DwsRcYRqVBm3Id3L5Tbl2No9f/aJ5DCo1TTSd0PmldjwDxkZbaBKh G3sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GuWRnvyBXO+dxZMGl8doEcxdCqZys/ewIQeG7qT3HOc=; b=QU2TLkDqL1GOrBjHwwZhIlepr4zKfUMWF7N/OyigxZn2HmPHfAWifs2m6+RtXqc9Nf aFDp94VoZCqi2oH9maNldRzIYeuCCRowUOPCPMhNMCQ4oLyQ1W1AV7Nvvb81ZBGTTkYm r9uBcxiSBbea8lw83HJB9tC0QNJB7fnamgGJZwIVuLaAtZRw5pa7t/s5IMmD1bekqUOE RI3kxVdgpwEBNiIQvYZIMqsDNwSEYTjH0NLJgq28ngQCeo29XBlNNDvFe84+tYmbs41a XCGpBXlEaovaLgK62is99L++ND+6mtdc5KaK18DiyWYLv3Cl3Et+60sG9KJv16pdpva0 ruVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=s5J0jykQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cz11si3202404edb.383.2020.05.07.07.30.10; Thu, 07 May 2020 07:30:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=s5J0jykQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727998AbgEGO2M (ORCPT + 99 others); Thu, 7 May 2020 10:28:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:54258 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727945AbgEGO2F (ORCPT ); Thu, 7 May 2020 10:28:05 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A3FDE20936; Thu, 7 May 2020 14:28:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588861685; bh=b1s7I7MQRORTqaB8/KOfE25r43ZKqozH8LCVeScbEHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s5J0jykQaT6xmLnZIHfqVaIpyDmB9ThbHV10MDtAAPLU4GfM9VuNuOWHqZ/QRFZt8 amh1AGwF0oGfKrEVFxQyNPHuLKokDmUYx96UyeCP8aU7kGP8MNf7SPQK2/mBNJVTVm ex1RfDPEt0Mms69gWGxC1edNq6hPW/U/kYhQF2So= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Andy Shevchenko , Seraj Alijan , Vinod Koul , Sasha Levin , dmaengine@vger.kernel.org Subject: [PATCH AUTOSEL 5.6 31/50] dmaengine: dmatest: Fix process hang when reading 'wait' parameter Date: Thu, 7 May 2020 10:27:07 -0400 Message-Id: <20200507142726.25751-31-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200507142726.25751-1-sashal@kernel.org> References: <20200507142726.25751-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Shevchenko [ Upstream commit aa72f1d20ee973d68f26d46fce5e1cf6f9b7e1ca ] If we do % echo 1 > /sys/module/dmatest/parameters/run [ 115.851124] dmatest: Could not start test, no channels configured % echo dma8chan7 > /sys/module/dmatest/parameters/channel [ 127.563872] dmatest: Added 1 threads using dma8chan7 % cat /sys/module/dmatest/parameters/wait ... !!! HANG !!! ... The culprit is the commit 6138f967bccc ("dmaengine: dmatest: Use fixed point div to calculate iops") which makes threads not to run, but pending and being kicked off by writing to the 'run' node. However, it forgot to consider 'wait' routine to avoid above mentioned case. In order to fix this, check for really running threads, i.e. with pending and done flags unset. It's pity the culprit commit hadn't updated documentation and tested all possible scenarios. Fixes: 6138f967bccc ("dmaengine: dmatest: Use fixed point div to calculate iops") Cc: Seraj Alijan Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20200428113518.70620-1-andriy.shevchenko@linux.intel.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- 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 4993e3e5c5b01..364dd34799d45 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c @@ -240,7 +240,7 @@ static bool is_threaded_test_run(struct dmatest_info *info) struct dmatest_thread *thread; list_for_each_entry(thread, &dtc->threads, node) { - if (!thread->done) + if (!thread->done && !thread->pending) return true; } } -- 2.20.1