From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63606C4338F for ; Sun, 22 Aug 2021 18:17:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 220D96124D for ; Sun, 22 Aug 2021 18:17:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 220D96124D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AYirYojWyEI9yOH++ygGJ2wlEFn1BzhNQlxFVjYdxjo=; b=DGT96BTC64dY6Z HZTCCWU1mu5qBSiuVJxxzlNuAhZ9Aqri4ZTsX1uOQpMa5FxXt6RLe9C4UqRtHt+viGJRMKFvyRjx3 y/ftDOlZkDfC+TIHosH7UXnGr+3NzzfCyV9BBsAcCBBrEMzUGAecyrYPGbd9KWswQ/sk29a/zjAfx MxPPMVGbOMAALgYozMCurwIlB3SJewmFBnKdHPLNeFv/FRMO0iIJdcPTMyzjjS8VyW26hX9a93PzA 2PY6BwL+G8MHRGurMHd79AzURDRZBF82ebHMLQfyXf4o8GxGQyl3r0Sk00ZO9FkQyZHbPnd/rYPft GLhlmies39k94LQzOvEw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mHs0V-00EV9x-Ba; Sun, 22 Aug 2021 18:15:43 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mHs0Q-00EV8o-Vz for linux-arm-kernel@lists.infradead.org; Sun, 22 Aug 2021 18:15:40 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C7C731042; Sun, 22 Aug 2021 11:15:37 -0700 (PDT) Received: from e113632-lin (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CD3FF3F5A1; Sun, 22 Aug 2021 11:15:34 -0700 (PDT) From: Valentin Schneider To: Sebastian Andrzej Siewior Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, rcu@vger.kernel.org, linux-rt-users@vger.kernel.org, Catalin Marinas , Will Deacon , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Steven Rostedt , Daniel Bristot de Oliveira , "Paul E. McKenney" , Frederic Weisbecker , Josh Triplett , Mathieu Desnoyers , Davidlohr Bueso , Lai Jiangshan , Joel Fernandes , Anshuman Khandual , Vincenzo Frascino , Steven Price , Ard Biesheuvel , Boqun Feng , Mike Galbraith Subject: Re: [PATCH v3 3/4] rcu/nocb: Protect NOCB state via local_lock() under PREEMPT_RT In-Reply-To: <20210817153613.l5f66czar6pajexo@linutronix.de> References: <20210811201354.1976839-1-valentin.schneider@arm.com> <20210811201354.1976839-4-valentin.schneider@arm.com> <20210817153613.l5f66czar6pajexo@linutronix.de> Date: Sun, 22 Aug 2021 19:15:32 +0100 Message-ID: <87bl5p73cr.mognet@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210822_111539_100121_5C774911 X-CRM114-Status: GOOD ( 12.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 17/08/21 17:36, Sebastian Andrzej Siewior wrote: >> +static inline int rcu_lockdep_is_held_nocb_local(struct rcu_data *rdp) >> +{ >> + return lockdep_is_held( >> +#ifdef CONFIG_PREEMPT_RT >> + &rdp->nocb_local_lock.lock >> +#else >> + &rdp->nocb_local_lock >> +#endif >> + ); >> +} > > Now that I see it and Paul asked for it, please just use !RT version. > return lockdep_is_held(&rdp->nocb_local_lock); > > and RT will work, too. > The above was required due to the (previous) definition of local_lock_t: typedef struct { spinlock_t lock; } local_lock_t; On -rt11 I see this is now: typedef spinlock_t local_lock_t; which indeed means the iffdefery can (actually it *has* to) go. >> static inline bool rcu_current_is_nocb_kthread(struct rcu_data *rdp) >> { >> /* Race on early boot between thread creation and assignment */ >> @@ -1629,6 +1664,22 @@ static void rcu_nocb_unlock_irqrestore(struct rcu_data *rdp, >> } >> } >> >> +/* >> + * The invocation of rcu_core() within the RCU core kthreads remains preemptible >> + * under PREEMPT_RT, thus the offload state of a CPU could change while >> + * said kthreads are preempted. Prevent this from happening by protecting the >> + * offload state with a local_lock(). >> + */ >> +static void rcu_nocb_local_lock(struct rcu_data *rdp) >> +{ >> + local_lock(&rcu_data.nocb_local_lock); >> +} >> + >> +static void rcu_nocb_local_unlock(struct rcu_data *rdp) >> +{ >> + local_unlock(&rcu_data.nocb_local_lock); >> +} >> + > Do you need to pass rdp given that it is not used? > Not anymore, you're right. >> /* Lockdep check that ->cblist may be safely accessed. */ >> static void rcu_lockdep_assert_cblist_protected(struct rcu_data *rdp) >> { > > Sebastian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel