Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1473677lqb; Sun, 26 May 2024 02:43:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV3NU74g8TtgMtjxt96QlIK+ZCYWQrcejg3OtfWobDllnAD5j4l4w2PxXa7UFXj06zAvWHSYRz3BroVuDdDkf4mYT7jeSHxnQR/tlHBCQ== X-Google-Smtp-Source: AGHT+IHCULHE6FMsJA9tySyD2Q2U9/DBMfOBU00xrTIUErBv5vdDE6hu1yyt1St8yYSruQTQFnfm X-Received: by 2002:a05:6870:c111:b0:24f:e000:a706 with SMTP id 586e51a60fabf-24fe000acc9mr2401559fac.22.1716716617052; Sun, 26 May 2024 02:43:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716716617; cv=pass; d=google.com; s=arc-20160816; b=HMzzOE6uHcaTprM2g9vp8hKC/J/msxnTNKA9PHlBIoWbx3qt7FSLBVr0EF82CMr30M U7FJBTP2pbKg1gsjiy1YAinMOUrwk2G3Rrf12va5crfIN5PuAbaWK+6yZCI763olqWCC U4P6HSZE3WMaU0jTxpx517yXybZrE9Zyqo+rN1HIOVTQLV5JwW+IeFQhi5Wg1WjKjGUH URjPeHecfQ9RKGQ8k8CdTUWDJCL+pbzmL8NPCAtfLYgry49TwkbJDEkuC197GWLfsxNM KCM/PAPCNJzs04K57xr8PFvWZbheucKvnTmXT5cAzTFSWrg1Llb0LtoXRI/wvHgDXzif h+DA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=WDdpjiyQfJo5HwOiOYbhqA2WpCmu6R3TLJdU6Cncu5M=; fh=TguFPPEs8H++1MhEXN4qLJ8xX0RwFhmeENVGDcyq1XI=; b=wQEEysKSvpAjng1OoMFG1B616g4Xz+nUn0D7Va8jAESqjiJG0dwngyo897xgDuXUkM 2VFpmTc4R65tyHRYnDTkD2l8zFjE6qY3sF/YB8cgrBA3HSxCScRbypElHDdRB/+7TwJB hLeiKUKXyweoHestpKMFb0GK/hLX1/QdatjEaLvyaVBE4BwPBWTSwHD8m1IAr4OFV0eP K8Qyp8QSXvqFXEaxUY0XomhOkDX3YsNQMl7bEOlJQX8tJsF5tJOUdCZetWpSTjbanBRT /uZOREb90a9Cf7IRzGbBh63kB+6IpVXsG1Hv7RWojcvm1iedR9fDSyym87LWz1Zn4vTK BvZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Hdcp8wzD; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-189649-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189649-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f8fd4d3230si4354970b3a.257.2024.05.26.02.43.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 02:43:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189649-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Hdcp8wzD; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-189649-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189649-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 812CC281B5C for ; Sun, 26 May 2024 09:43:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B08A71A269; Sun, 26 May 2024 09:42:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Hdcp8wzD" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CD082182CC; Sun, 26 May 2024 09:42:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716716525; cv=none; b=qiBlhDIY7mbF9jENOTE2asiwZnNd5BAU4kBbpk/Svojt3yrMItsGfAh7s+TBjcbvbY7eSK+pelFlK3DxGtCiSm1xXNjfR3Y34Az0H1p4gnRHHSuJIYFPdZNaZHH3TnDA5txinH+Syd5Y55vwmY9DfzWLDb/McYtPSAKGQUGU4Mw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716716525; c=relaxed/simple; bh=2kgOJxhRKd0EVxoNovoZleo/gdwICs8TiV38XI6S1Xk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Fd9mg5ERzJFGghLKfmg5egg4rU1YEVDqzD+oEXDZF8N9v4R1eXWjFAdD7OkzsBzOyIh0MaMra+0HggLME+z7eqC+pZ82s2ECCVSzKFZxUTAz49vrUqlINnFGjbBVPVTxCiB+cM7EZV3ghFsvtlaDzoAR9tQNdem9h/em/PHwVfA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Hdcp8wzD; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50507C2BD10; Sun, 26 May 2024 09:42:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716716525; bh=2kgOJxhRKd0EVxoNovoZleo/gdwICs8TiV38XI6S1Xk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hdcp8wzD3DmvVCUypZfAsdIsfhF0sBLU8pys0MwfPe4w8U1cwoz4WNdotq2vK8dTu v9ZKGhQJANAdnC5d7hBu6GgIYovI11FgGfvBMW/8BilpfVPr53tea4B0MUxYj2TZeL k00GzTayvdWf/RjQ+RJ/PO3pWqM7K7bgrMbOX+VvBj/3048FmZK4j5Ylw/mEUBohYW FqCQpX0zSAnsrARf2UjayHLS9HGJn1iDSw8stikAUJu51kAKFiIPHiPHktI1xxn2Ia AOf2spwOTal0cdkmprXl8kuzxRNd2viSZGHUpjaUcAZ+FYCG27M5FmPSDtOHsPJ5cB PgfqpuolBLi+Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zqiang , "Paul E . McKenney" , Uladzislau Rezki , Sasha Levin , dave@stgolabs.net, josh@joshtriplett.org, frederic@kernel.org, neeraj.upadhyay@kernel.org, joel@joelfernandes.org, boqun.feng@gmail.com, rcu@vger.kernel.org Subject: [PATCH AUTOSEL 6.9 08/15] rcutorture: Make stall-tasks directly exit when rcutorture tests end Date: Sun, 26 May 2024 05:41:40 -0400 Message-ID: <20240526094152.3412316-8-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240526094152.3412316-1-sashal@kernel.org> References: <20240526094152.3412316-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.9.1 Content-Transfer-Encoding: 8bit From: Zqiang [ Upstream commit 431315a563015f259b28e34c5842f6166439e969 ] When the rcutorture tests start to exit, the rcu_torture_cleanup() is invoked to stop kthreads and release resources, if the stall-task kthreads exist, cpu-stall has started and the rcutorture.stall_cpu is set to a larger value, the rcu_torture_cleanup() will be blocked for a long time and the hung-task may occur, this commit therefore add kthread_should_stop() to the loop of cpu-stall operation, when rcutorture tests ends, no need to wait for cpu-stall to end, exit directly. Use the following command to test: insmod rcutorture.ko torture_type=srcu fwd_progress=0 stat_interval=4 stall_cpu_block=1 stall_cpu=200 stall_cpu_holdoff=10 read_exit_burst=0 object_debug=1 rmmod rcutorture [15361.918610] INFO: task rmmod:878 blocked for more than 122 seconds. [15361.918613] Tainted: G W 6.8.0-rc2-yoctodev-standard+ #25 [15361.918615] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [15361.918616] task:rmmod state:D stack:0 pid:878 tgid:878 ppid:773 flags:0x00004002 [15361.918621] Call Trace: [15361.918623] [15361.918626] __schedule+0xc0d/0x28f0 [15361.918631] ? __pfx___schedule+0x10/0x10 [15361.918635] ? rcu_is_watching+0x19/0xb0 [15361.918638] ? schedule+0x1f6/0x290 [15361.918642] ? __pfx_lock_release+0x10/0x10 [15361.918645] ? schedule+0xc9/0x290 [15361.918648] ? schedule+0xc9/0x290 [15361.918653] ? trace_preempt_off+0x54/0x100 [15361.918657] ? schedule+0xc9/0x290 [15361.918661] schedule+0xd0/0x290 [15361.918665] schedule_timeout+0x56d/0x7d0 [15361.918669] ? debug_smp_processor_id+0x1b/0x30 [15361.918672] ? rcu_is_watching+0x19/0xb0 [15361.918676] ? __pfx_schedule_timeout+0x10/0x10 [15361.918679] ? debug_smp_processor_id+0x1b/0x30 [15361.918683] ? rcu_is_watching+0x19/0xb0 [15361.918686] ? wait_for_completion+0x179/0x4c0 [15361.918690] ? __pfx_lock_release+0x10/0x10 [15361.918693] ? __kasan_check_write+0x18/0x20 [15361.918696] ? wait_for_completion+0x9d/0x4c0 [15361.918700] ? _raw_spin_unlock_irq+0x36/0x50 [15361.918703] ? wait_for_completion+0x179/0x4c0 [15361.918707] ? _raw_spin_unlock_irq+0x36/0x50 [15361.918710] ? wait_for_completion+0x179/0x4c0 [15361.918714] ? trace_preempt_on+0x54/0x100 [15361.918718] ? wait_for_completion+0x179/0x4c0 [15361.918723] wait_for_completion+0x181/0x4c0 [15361.918728] ? __pfx_wait_for_completion+0x10/0x10 [15361.918738] kthread_stop+0x152/0x470 [15361.918742] _torture_stop_kthread+0x44/0xc0 [torture 7af7f9cbba28271a10503b653f9e05d518fbc8c3] [15361.918752] rcu_torture_cleanup+0x2ac/0xe90 [rcutorture f2cb1f556ee7956270927183c4c2c7749a336529] [15361.918766] ? __pfx_rcu_torture_cleanup+0x10/0x10 [rcutorture f2cb1f556ee7956270927183c4c2c7749a336529] [15361.918777] ? __kasan_check_write+0x18/0x20 [15361.918781] ? __mutex_unlock_slowpath+0x17c/0x670 [15361.918789] ? __might_fault+0xcd/0x180 [15361.918793] ? find_module_all+0x104/0x1d0 [15361.918799] __x64_sys_delete_module+0x2a4/0x3f0 [15361.918803] ? __pfx___x64_sys_delete_module+0x10/0x10 [15361.918807] ? syscall_exit_to_user_mode+0x149/0x280 Signed-off-by: Zqiang Signed-off-by: Paul E. McKenney Signed-off-by: Uladzislau Rezki (Sony) Signed-off-by: Sasha Levin --- kernel/rcu/rcutorture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 5dfea5c6de577..4a2cf312e695a 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -2487,8 +2487,8 @@ static int rcu_torture_stall(void *args) preempt_disable(); pr_alert("%s start on CPU %d.\n", __func__, raw_smp_processor_id()); - while (ULONG_CMP_LT((unsigned long)ktime_get_seconds(), - stop_at)) + while (ULONG_CMP_LT((unsigned long)ktime_get_seconds(), stop_at) && + !kthread_should_stop()) if (stall_cpu_block) { #ifdef CONFIG_PREEMPTION preempt_schedule(); -- 2.43.0