Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1895995lqa; Tue, 30 Apr 2024 02:26:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWZ6ELaTT0869VWD2ot3NpJReQ2pds87IY1kCtQC858sPZa0/LU9mI4GzL5X+XK3oOsL1lv7umvt7NZnZ0Nq+nKh5GMHC7WNcnjg+mx4w== X-Google-Smtp-Source: AGHT+IHNu46s/95bow3l+R/OTQJ7nAEeGVVMQBkZYE9x3FC05hdi+o5BRD9TZTIanGInwBn5LB42 X-Received: by 2002:a17:90a:ff0e:b0:2a2:94c0:38d4 with SMTP id ce14-20020a17090aff0e00b002a294c038d4mr12434807pjb.31.1714469213796; Tue, 30 Apr 2024 02:26:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714469213; cv=pass; d=google.com; s=arc-20160816; b=LwfDETatldpPlbvk/cp7bwEt2rRWt3jrhkWUB8LKEqeraOCnQpbOOxcSMIRTe91n9Q 3Oqpr1df/bBSBhC3IZIvIT46d5a2Cpqq1nrMNf7Res1zvPPHIkKq2moXDzV10KD3SZTL wkph3FOeZ/Enm0tFw34HQOVIkwqTX9Na9J0xqR2h/12XQPEHstiKku1vo1/xzx50FJgj 86cqZ1+FIS0+LrL4OTdzdDkJEvE2H4HCzrNo8AsoYd7KNM9/o/wZKHwFdvJtxnXno2uY SUhIU9nj5BjeLwQAxjakGRKl9pD1R88qsQo2AT91eioAFNLnn+3q4OtmdnzdSE5yo9Tq nw4Q== 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=yFvEhpDaXmg9BXMihL4YArPI3eFmOuObqd6gNO/1dYU=; fh=WzinSAfJjQwQsWhpsrf2fBMcmep3NnSwaYa0TI1U7L8=; b=fQsZS3ovlZbxUNMqykzZKM0oejrdYANFJv7Fg+aTM0QIAGNCtNqLTJPXULb56AU4M+ 0TLyvnkQJZdOjZA+0Z/d6NSoBzur+vJRdQgKt26v11tbmpbz3nJsN/Uul9XVD3Xq5QVl BkI3bFAkGambJmyZKuD9JXKX+S14i5sGVdwQPAB5gfo83aa3VX3d521XZrkQEoinEv04 wW5ZX+4GZIX/lA1l5lAG9nr3YsI0kAB8xr2Pu9KrfU/Wa2wiuUHUMYnOh+Ep90611AeP TcXFTzL8OvBUYbRHzrmQu+Gw8lM9xfGKbB8rbg6t2YPWBvxUgndRjVuepUKgjdWIxNPp sJNg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Zm2ntcXt; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-163658-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163658-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d23-20020a17090a115700b002b1bcc04a25si3431741pje.7.2024.04.30.02.26.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 02:26:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163658-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Zm2ntcXt; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-163658-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163658-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 67287B22321 for ; Tue, 30 Apr 2024 09:22:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BC02F1BF6FA; Tue, 30 Apr 2024 09:18:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Zm2ntcXt" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 29E621BED7C for ; Tue, 30 Apr 2024 09:18:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714468735; cv=none; b=e0NFAOReQGSayI2raksQEJivhXdsWdFi5Uq/5/SQggs/8Nb3Xfh5CBP4woUkT8WlvYBDjM2DZC4Viv5Ii64/56Qav9XC5WyQh3DNg350ecBge8dHoMoRDeGHLvf1DSfNXfTz0mk+GSGHWqy3yRPyoiOOO7KPc5fNZoZjslQ44cs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714468735; c=relaxed/simple; bh=rdwNE4TivoWSLkLZ0FAD1O9FFZJKd8QQYOGbXyhpCkg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Fqkf/NCzNrtwOIe+jFNgSMWZnJ1iwMXRGMed1p99ZDWZqCxq9p7nKQlLX/KACPjCKnyS2g+vD6DTT7kyq2gNmGNURuhI3no+i7mxjoR6jZQzC3oq9FKMdG1Q1XwCVfGiEicrpzmRd1CtqaHKPb+gWMFPFQlGNtxcwNmv0uMTx9s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Zm2ntcXt; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714468733; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yFvEhpDaXmg9BXMihL4YArPI3eFmOuObqd6gNO/1dYU=; b=Zm2ntcXt7/4hf4QQ0qQwLT+CrUxmqAD6tOyHDEcjJgb46/aHkurm+iazXR7u5t5PauNkBh gz7NcAIJ9yz7dpivsJkAQw2oO10caTyNWv+n8SPzkuJHrn22NBZua5bpPcukSayWwTUefI XYmktD4x7RZ1ugcmf+ZSty7kAFt+h0c= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-593-bIDlG8WmPRyFIlnRIz9QIw-1; Tue, 30 Apr 2024 05:18:45 -0400 X-MC-Unique: bIDlG8WmPRyFIlnRIz9QIw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 20437800CA2; Tue, 30 Apr 2024 09:18:45 +0000 (UTC) Received: from vschneid-thinkpadt14sgen2i.remote.csb (unknown [10.39.193.247]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9823D477F81; Tue, 30 Apr 2024 09:18:42 +0000 (UTC) From: Valentin Schneider To: rcu@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Frederic Weisbecker , "Paul E. McKenney" , Peter Zijlstra , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang Subject: [PATCH v2 14/27] context_tracking, rcu: Rename rcu_dynticks_curr_cpu_in_eqs() into rcu_watching_curr_cpu() Date: Tue, 30 Apr 2024 11:17:18 +0200 Message-ID: <20240430091740.1826862-15-vschneid@redhat.com> In-Reply-To: <20240430091740.1826862-1-vschneid@redhat.com> References: <20240430091740.1826862-1-vschneid@redhat.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 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 The context_tracking.state RCU_DYNTICKS subvariable has been renamed to RCU_WATCHING, reflect that change in the related helpers. Note that "watching" is the opposite of "in EQS", so the negation is lifted out of the helper and into the callsites. Signed-off-by: Valentin Schneider --- include/linux/context_tracking.h | 12 ++++++++---- kernel/context_tracking.c | 6 +++--- kernel/rcu/tree.c | 6 +++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h index a6c36780cc3bd..d53092ffa9dba 100644 --- a/include/linux/context_tracking.h +++ b/include/linux/context_tracking.h @@ -113,13 +113,17 @@ extern void ct_idle_enter(void); extern void ct_idle_exit(void); /* - * Is the current CPU in an extended quiescent state? + * Is RCU watching the current CPU (IOW, it is not in an extended quiescent state)? + * + * Note that this returns the actual boolean data (watching / not watching), + * whereas ct_rcu_watching() returns the RCU_WATCHING subvariable of + * context_tracking.state. * * No ordering, as we are sampling CPU-local information. */ -static __always_inline bool rcu_dynticks_curr_cpu_in_eqs(void) +static __always_inline bool rcu_is_watching_curr_cpu(void) { - return !(raw_atomic_read(this_cpu_ptr(&context_tracking.state)) & CT_RCU_WATCHING); + return raw_atomic_read(this_cpu_ptr(&context_tracking.state)) & CT_RCU_WATCHING; } /* @@ -140,7 +144,7 @@ static __always_inline bool warn_rcu_enter(void) * lots of the actual reporting also relies on RCU. */ preempt_disable_notrace(); - if (rcu_dynticks_curr_cpu_in_eqs()) { + if (!rcu_is_watching_curr_cpu()) { ret = true; ct_state_inc(CT_RCU_WATCHING); } diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c index 9c8f7b9191cd4..e82f19bab9ed9 100644 --- a/kernel/context_tracking.c +++ b/kernel/context_tracking.c @@ -212,7 +212,7 @@ void noinstr ct_nmi_exit(void) * to us!) */ WARN_ON_ONCE(ct_nmi_nesting() <= 0); - WARN_ON_ONCE(rcu_dynticks_curr_cpu_in_eqs()); + WARN_ON_ONCE(!rcu_is_watching_curr_cpu()); /* * If the nesting level is not 1, the CPU wasn't RCU-idle, so @@ -271,7 +271,7 @@ void noinstr ct_nmi_enter(void) * to be in the outermost NMI handler that interrupted an RCU-idle * period (observation due to Andy Lutomirski). */ - if (rcu_dynticks_curr_cpu_in_eqs()) { + if (!rcu_is_watching_curr_cpu()) { if (!in_nmi()) rcu_task_exit(); @@ -281,7 +281,7 @@ void noinstr ct_nmi_enter(void) // ... but is watching here. instrumentation_begin(); - // instrumentation for the noinstr rcu_dynticks_curr_cpu_in_eqs() + // instrumentation for the noinstr rcu_is_watching_curr_cpu() instrument_atomic_read(&ct->state, sizeof(ct->state)); // instrumentation for the noinstr ct_kernel_enter_state() instrument_atomic_write(&ct->state, sizeof(ct->state)); diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index d8f89bc573448..bb0d9dd8b6d3a 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -600,7 +600,7 @@ void rcu_irq_exit_check_preempt(void) RCU_LOCKDEP_WARN(ct_nmi_nesting() != CT_NESTING_IRQ_NONIDLE, "Bad RCU nmi_nesting counter\n"); - RCU_LOCKDEP_WARN(rcu_dynticks_curr_cpu_in_eqs(), + RCU_LOCKDEP_WARN(!rcu_is_watching_curr_cpu(), "RCU in extended quiescent state!"); } #endif /* #ifdef CONFIG_PROVE_RCU */ @@ -640,7 +640,7 @@ void __rcu_irq_enter_check_tick(void) if (in_nmi()) return; - RCU_LOCKDEP_WARN(rcu_dynticks_curr_cpu_in_eqs(), + RCU_LOCKDEP_WARN(!rcu_is_watching_curr_cpu(), "Illegal rcu_irq_enter_check_tick() from extended quiescent state"); if (!tick_nohz_full_cpu(rdp->cpu) || @@ -722,7 +722,7 @@ notrace bool rcu_is_watching(void) bool ret; preempt_disable_notrace(); - ret = !rcu_dynticks_curr_cpu_in_eqs(); + ret = rcu_is_watching_curr_cpu(); preempt_enable_notrace(); return ret; } -- 2.43.0