Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp403039lqh; Tue, 7 May 2024 02:46:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUfXsWuIJcqYWF7zPxWk0a5ZU2w9ljxHiDfq33rEjKBuKaACKWkw04lMU5ujko9GyPMWiW61yMWa9dQRoehd/5wl5ELTuLVL+2hs5159w== X-Google-Smtp-Source: AGHT+IG+BV19UMHGam6ebYtgvhHbRoDcWN0PDR5t5PqQowVaD+ZVGy95dIVRtNhoJZCDtEbEPYNt X-Received: by 2002:a17:903:246:b0:1e5:62:7ac7 with SMTP id j6-20020a170903024600b001e500627ac7mr15772059plh.3.1715075180170; Tue, 07 May 2024 02:46:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715075180; cv=pass; d=google.com; s=arc-20160816; b=SZqSZyTatJ6gzMs3R4F+SDsikC3kpy+1E6xkaBjL+8VEvk2wgSW1LtlMXFKGxahcks w2PQZGG5KA8kdznRG64OIwh3OkUlzgU3hrlnzkFhwDlEOPjrPKwfPL4Dd8tN9fu4y3ed qi2hby0MMi3B9tpGfoKABDe7ZOAuxmqBxTwqE2oAVbhRmUKeSYKkwGtAxi/eTpPJr4Ql zSFs+BDoWpG0NV7236ntAAcx9/CRw+WEYq2IGLo3ebFYSN7fABUqgoC741kr75otBA8I twIYvqNIvtGlTTr3TnP9fDQl9gqVekdFqlagR9nSxatfV6xIlpxlsYJrnR/uh8yyqrZC YmrQ== 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=4giIpQovPJ+xyAcNjMeRcsmVa+ZmTidW6qcBvozTz1s=; fh=NSZdDU2LtKcxgSUsnZASOn0CtQprZf/jGw+4m6Ebhr8=; b=TzPLZ7Qa7dLwteIqSJCpPN408t8lnGM1BPTUkkfFTW9P4Dd6IqyDviRIqyZi+c18bs U3p+CW6Tw7JcSN15Bsv91BofvO7VC+zpCWbUhQBikBvNf0a8hzrHScAwEBQU5vyFb9Xc 76nFnyldle3CYiNPJyBopEi8ZtLK1hOjdk+dgWfGnWooNJMBPAMvwZ9XUBj9LGJMXuCS 3mrYV9sQ0JWaNsyVWwshr+Hjp8ZkXL93O5gdZvbmPfibDaBbhKsBVY2dYkk+5wcCIKf3 Wx2PRiXXBJi/O4NIcnKEQ0HW9k69lBAP1nNpN9QMYC404RIEJIwFMxj7xlspOgw0Az70 X4pg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lcHzRh6c; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-171004-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171004-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e8-20020a170902b78800b001e02aae12aesi9879901pls.401.2024.05.07.02.46.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 02:46:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171004-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lcHzRh6c; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-171004-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171004-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A696F285F11 for ; Tue, 7 May 2024 09:45:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7AC2D16C855; Tue, 7 May 2024 09:36:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lcHzRh6c" Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B68216ABDE; Tue, 7 May 2024 09:36:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715074580; cv=none; b=Vy8V1IY2L6j6aY6ZdIolxA8KMYzyo5/JNR0JTtfLMuwJ9AxlQDQZvLJ9uxbsgLhb4VpnvyOrIlWsRrW9THB8QSD76DzCtkRA61sJ2xWk5wR5GoVLeKjDJ0B3SATsPzT20SvQhQMfgW90Qa88aUz3rzJyUEyB8QVa5kDTCBK40rM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715074580; c=relaxed/simple; bh=o8QNqUWMDKmYcupNV+ex08qslA455LJ6fBNThqJ+gjo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kUfmlVe4qMPqT/Vt/EaDNRqw4NND8KFw9s0XiImpCvFVBRNfOeSirk1o+1ZKnULMM79q9kGLKy4x15TbbJuKVTcZfDcjtggMxUbNeJLUWZ2X444V9ACYvu0gi2ykKrXL69mdlo6AuoN8IBPdhbxJdSgTMCEOa0IqLnI1dMTe3kU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lcHzRh6c; arc=none smtp.client-ip=209.85.208.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2e34e85ebf4so16684711fa.2; Tue, 07 May 2024 02:36:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715074576; x=1715679376; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4giIpQovPJ+xyAcNjMeRcsmVa+ZmTidW6qcBvozTz1s=; b=lcHzRh6cXbmo0+iVSqIlwKMJUWA+Q7mnLNR3/wZEsRvMcLk32sdlM0AJ7vQW8zuJpX xLr2Lxl0SGW6ClhDkSwFanVzXsMzN62hqFK6pIg44YiMVEKMPRmPpoQKamFN3b2m1kUa noy9rmSlMG7dmGPT+eitnP4YbSC3Su9u9vOUYe0JPeFXJ/ASJ38oNilJLmXIKarLYbb1 EWft7g5ZkAtchljdcJe+9CMopMn/A4zvcjE3Fq6kj3ngM3mk7Dh//Oy04D6qj4ajl5Pc yFsk4C2n71rC4RofZcvorxBO4Ho+DTDh+RgY3y2ns89oU6NT3N1FjBmM1ZAuwZxBpA/d hOXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715074576; x=1715679376; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4giIpQovPJ+xyAcNjMeRcsmVa+ZmTidW6qcBvozTz1s=; b=IDPTZvV+uBcUyrC/43Br5CjfH7sD3Vbr25BJZxdR1cRW337WTUioO0Z9GSWYzffinQ tVs5rrWevz3PrU0+4OoK49cZq2Hh5L4qXANyD2cNb39CGrQio1pwSpR/fPbdQX/4Tmy+ GqRmnrj2L5kZZ8pE+VmtNzALiD6fshZ6HPLNjhR7802Xmk3SWSrV0FhanDnrtHhEY9wm PotzFJzzfD8DYBTE21m/NbE5odDDi34Trd1zHsxoEYQiGO3YLcn7lq2aQ1tcQrMOnuol PBKF4GDxRmO5H69MpHMAcBI6koJTMwi3WcD8y3FU6b4r/gxC46wP2PM/eiCVUwAVYHbP 9tXA== X-Forwarded-Encrypted: i=1; AJvYcCW2NEbSEWKUuruVJZyKTaTI6nm1nEdOWT7lZPGtmExcCb9efUro57CuxUwXSAYMfYGJoP2PVqFPmI5wRJBenxtMTVHVNcb5gVg6rz3y X-Gm-Message-State: AOJu0YznvVPJg4xp1O1jxaqWHtLBCI+aj684uGWP0F9aBo6Qt04JbdQS QzjBAMA8yCMRX044iJ03MuE5jjC0a9USxnJefxIo7a+CLi9JbX6W X-Received: by 2002:a2e:9ccd:0:b0:2e2:466b:1a68 with SMTP id g13-20020a2e9ccd000000b002e2466b1a68mr6610640ljj.41.1715074576562; Tue, 07 May 2024 02:36:16 -0700 (PDT) Received: from pc638.lan (host-185-121-47-193.sydskane.nu. [185.121.47.193]) by smtp.gmail.com with ESMTPSA id t18-20020a2e9d12000000b002e29c50c4dcsm1335473lji.27.2024.05.07.02.36.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 02:36:16 -0700 (PDT) From: "Uladzislau Rezki (Sony)" To: "Paul E . McKenney" Cc: RCU , Neeraj upadhyay , Boqun Feng , Hillf Danton , Joel Fernandes , LKML , Uladzislau Rezki , Oleksiy Avramchenko , Frederic Weisbecker , Zqiang Subject: [PATCH 45/48] rcutorture: Make stall-tasks directly exit when rcutorture tests end Date: Tue, 7 May 2024 11:35:27 +0200 Message-Id: <20240507093530.3043-46-urezki@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240507093530.3043-1-urezki@gmail.com> References: <20240507093530.3043-1-urezki@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Zqiang 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) --- 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 3f9c3766f52b..456185d9e6c0 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -2489,8 +2489,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.39.2