Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp571106rdb; Tue, 16 Jan 2024 08:59:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IHhESqZLSiUwbP+5o8rS/8leBR+5SogvrRpVsJTyeTFtfbzTReRX5wdIn5s4G2vT71SB80H X-Received: by 2002:a81:c743:0:b0:5fa:f0ab:d376 with SMTP id i3-20020a81c743000000b005faf0abd376mr5722806ywl.8.1705424397748; Tue, 16 Jan 2024 08:59:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705424397; cv=none; d=google.com; s=arc-20160816; b=yxMbyQODD0kKno67oqrpXMeSk2X+xhQ4SA4+K6/IbjFpMbPRbXQ3WStqzuMV50chvs xATblIiW+Qj6wScUddEZvPfTXfqBojJIzuvQ/rv+KPJH0gWUb5vAnuiXdncYojLOSD4M hOY72TdExm9edG8GcLO+cEUR1LnPtXNhx8gjkeSKCToybYUmTKVK7M1ij5Wd5hasM/T8 USPXBeOHC0rEM3f8oOgXBaHGvK8yA9FAfUDN9JCIZxzWD6oAd4E3Pls5EuxjJpaWw4Tk 9UH7DICR/0EAyvc92r+GLPxKvhzqPFaExKOpwynRD5irsv6YwLyaa9P916eRbQb8ZRD/ hDlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=xhEplOPEe/xJ92nQzcbzmgOQQYebUDrCpldb5o92Vg0=; fh=Gad9dG/lKKZ+enoK/15dNn9kNMI94sYQhN9R2c5iDyY=; b=XEp3nfF+6i1LjtqVmJvdDVi1CrEtLB9lOGKgjj7WYEYSDKQ2f9GgnmbCfspm0zCMjf xevKTJNmu0zF9NX8F6R/bbXrLq0rHXVjVh33L4q4+V80bXl/QCFaPkGBKsT1ZfWklGKs dlZSVo9I3Il+/wxIXige5RftHJ1trdVbRjRCq3euj0FeVxVgSamnfA16alXo+Jrz655M N+o48cX7acAmfpTeL/X5Ix7+zeiQ1CXRhTWSRVyXy5y59oeKtnumu1Q27zwMn5ELkGeK HemL2GO736+x83KAppRVNUr62ctf3OFKnpCcZe5V148IRFR4hFIGHzocbveXOCz9zE5Y y2TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SeIC3MBd; spf=pass (google.com: domain of linux-kernel+bounces-27603-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27603-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id e8-20020a0cf348000000b00681748ba319si864070qvm.276.2024.01.16.08.59.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 08:59:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27603-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SeIC3MBd; spf=pass (google.com: domain of linux-kernel+bounces-27603-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27603-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 7F3E11C23486 for ; Tue, 16 Jan 2024 16:59:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 647D11CF96; Tue, 16 Jan 2024 16:59:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SeIC3MBd" 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 9B6D51CF83; Tue, 16 Jan 2024 16:59:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA7D1C433F1; Tue, 16 Jan 2024 16:59:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705424360; bh=RV6RHxZ8pi7Vlm2CfQaWVbRHsR98YGEaSTvb/bPpLA8=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=SeIC3MBdlWckJdKsiVjPDC2t7XY0nXII0yImtIvMrDbQvf0HcjcJli2i/b0i9Fql+ 6tVXwArZQYUuRk5yUPg3Noq3Td2NeMldaMvj04YTSzZbptRjDqR34gBd3jNooVQ0Mo 2c4gh8TCW7/Emss7q1O9PTAEoWxXJaSKI8vg+Z7VpXYoHRw8NC7hUw4JeLExeNI7Y+ Hnxqd1/YBaw5I8G/9ve/+vxVa1/VAye9N0BpDZ3loe3WLIrf7kzYpD1uOmjGkHP5cG ve+IOWTGel/85ZO+pIBcsQGyEe1fyozlidSsxJFUxiP/6ld3KUH1OSmjq/H2xGhHA0 Kcj+PNSaH8J8g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 9DEA5CE04A3; Tue, 16 Jan 2024 08:59:17 -0800 (PST) Date: Tue, 16 Jan 2024 08:59:17 -0800 From: "Paul E. McKenney" To: Frederic Weisbecker Cc: Zqiang , quic_neeraju@quicinc.com, joel@joelfernandes.org, rcu@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rcu/nocb: Fix WARN_ON_ONCE() in the rcu_nocb_bypass_lock() Message-ID: <7167b868-4160-47f0-8dd6-68c2af71e591@paulmck-laptop> Reply-To: paulmck@kernel.org References: <20240110081128.18683-1-qiang.zhang1211@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Jan 12, 2024 at 05:09:12PM +0100, Frederic Weisbecker wrote: > On Wed, Jan 10, 2024 at 04:11:28PM +0800, Zqiang wrote: > > For the kernels built with CONFIG_RCU_NOCB_CPU_DEFAULT_ALL=y and > > CONFIG_RCU_LAZY=y, here are the following scenarios that will trigger > > WARN_ON_ONCE() in the rcu_nocb_bypass_lock() and rcu_nocb_wait_contended(). > > > > CPU2 CPU11 > > kthread > > rcu_nocb_cb_kthread ksys_write > > rcu_do_batch vfs_write > > rcu_torture_timer_cb proc_sys_write > > __kmem_cache_free proc_sys_call_handler > > kmemleak_free drop_caches_sysctl_handler > > delete_object_full drop_slab > > __delete_object shrink_slab > > put_object lazy_rcu_shrink_scan > > call_rcu rcu_nocb_flush_bypass > > __call_rcu_commn rcu_nocb_bypass_lock > > raw_spin_trylock(&rdp->nocb_bypass_lock) fail > > atomic_inc(&rdp->nocb_lock_contended); > > rcu_nocb_wait_contended WARN_ON_ONCE(smp_processor_id() != rdp->cpu); > > WARN_ON_ONCE(atomic_read(&rdp->nocb_lock_contended)) | > > |_ _ _ _ _ _ _ _ _ _same rdp and rdp->cpu != 11_ _ _ _ _ _ _ _ _ __| > > > > This commit therefore use the rcu_nocb_try_flush_bypass() instead of > > rcu_nocb_flush_bypass() in lazy_rcu_shrink_scan(), if the nocb_bypass > > queue is being flushed, the rcu_nocb_try_flush_bypass will return directly. > > > > Signed-off-by: Zqiang > > Reviewed-by: Frederic Weisbecker Queued with Joel's and Frederic's Reviewed-by, thank you all! Thanx, Paul