Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp436960ybk; Wed, 20 May 2020 03:31:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6a5jeNdgSjejF5/ExKVvM+Fflc9AdoLGAq/GZGU9NNnU3qSTtzVbBdiS6pBOHob0X4o7P X-Received: by 2002:a50:9e48:: with SMTP id z66mr2654763ede.388.1589970662457; Wed, 20 May 2020 03:31:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589970662; cv=none; d=google.com; s=arc-20160816; b=TRp9EnyOvG4TiiWxbwk5fkFSnmmN/BmM+ORIGoZmtp2bJoQ2CXTo4VizVn/iM8GJ7g uuiKWECaNBuvsrkOhlqOkhiTKzaku9s5bYVx+ckwKsu9mrP5lY2OKpUHrMsF7iWa0dpu qLndGDMbgvbjrqjyBC9bLrgeL74UYKIWCQH7cWnDJ9jNf7sfO98qy3rwOXF3/AK9UnWE zgjMkoHyhfaL1PowZlOEiO4SeovNr+HHAggJKMYtT0yUmW7Jqdv3IJGBHmaCVhUnEm7K S/ao4cnUdpVrHnkL2Imeqb3nk4Bp7rje20JRBgQ+VNVq3hSSmWkKi9LQFwudL9fb5Weu wnOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Pcnkdhzo7iybmY/3WHM6a4StwuJiDWWOYzMSkFwQnZk=; b=MBYqZGwF1iGa12762KaocEZzNXZfWGuQQ1V/Nt2OgdsJsO2vFZPBOEcd6azq+IfX0c us+OqJjRCq6bojo9qcPTogwhbWDK4kvcfZ01oDHmiJGJPaelYQfZbnpjHn/SZz5jcqk1 QvSyOsHnvhu69fq1gW6aDvwg6PMw+1S6SYLPozXY2UOY7U0VihQlXzv2av5Y80sRo/tt WHn6UKJG6/JQqdR5eIk19HXhQVdz/vggDtsnMV1o+1Pwp/EDwAwDB8KriANl1/z0z+F5 M9g75M+i+9K9iyc1I5Sgi/KiJzv4IlpqjrfO5W7ZRqfhty+bLpsl9KTMGO2LsQZK+3wE gtog== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=faG8a+VJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w19si1531679eji.578.2020.05.20.03.30.39; Wed, 20 May 2020 03:31:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=faG8a+VJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726576AbgETK3E (ORCPT + 99 others); Wed, 20 May 2020 06:29:04 -0400 Received: from merlin.infradead.org ([205.233.59.134]:52856 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726224AbgETK3D (ORCPT ); Wed, 20 May 2020 06:29:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Pcnkdhzo7iybmY/3WHM6a4StwuJiDWWOYzMSkFwQnZk=; b=faG8a+VJtLLWswqGM9/4fhymDn ufqqw9OgQjgXYtTDE7nAqGEUdCbbE2Mt/fpp63fk46qu6qX+ljtb8wZ7wboqp/1JE6Q1rPogvGY7E aH+OHEZuBDWr0kx9FKcShW4Vdal8XB6MiwHbYBbwZSSOkSED9YHFeU/e8ovIYSim6E5QyJ6n1ICMI p52jeQShZ7j88YNZ4qqNCH0opOnYjNi5QkG/GSkh8Tupe7O2bax+HUl83cRkhQyjEGQvKlwawZFwR LZ6V1P4+spyRr73FS1hNVmp+QPPDGfrmUQOOTKLfjuTtJpy2VWT6Evp/B1+rON9sujijy0f9drG/r dI/lIRoQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jbLtW-0005Q2-Jj; Wed, 20 May 2020 10:24:14 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A4543300478; Wed, 20 May 2020 12:24:08 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 06F5325D60CB3; Wed, 20 May 2020 12:24:08 +0200 (CEST) Date: Wed, 20 May 2020 12:24:07 +0200 From: Peter Zijlstra To: Sebastian Andrzej Siewior Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Steven Rostedt , Will Deacon , Thomas Gleixner , "Paul E . McKenney" , Linus Torvalds , Lai Jiangshan , Josh Triplett , Mathieu Desnoyers , rcu@vger.kernel.org Subject: Re: [PATCH 3/8] srcu: Use local_lock() for per-CPU struct srcu_data access Message-ID: <20200520102407.GF317569@hirez.programming.kicks-ass.net> References: <20200519201912.1564477-1-bigeasy@linutronix.de> <20200519201912.1564477-4-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200519201912.1564477-4-bigeasy@linutronix.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 19, 2020 at 10:19:07PM +0200, Sebastian Andrzej Siewior wrote: > diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c > index 0c71505f0e19c..8d2b5f75145d7 100644 > --- a/kernel/rcu/srcutree.c > +++ b/kernel/rcu/srcutree.c > @@ -25,6 +25,7 @@ > #include > #include > #include > +#include > > #include "rcu.h" > #include "rcu_segcblist.h" > @@ -735,6 +736,7 @@ static void srcu_flip(struct srcu_struct *ssp) > smp_mb(); /* D */ /* Pairs with C. */ > } > > +static DEFINE_LOCAL_LOCK(sda_lock); > /* > * If SRCU is likely idle, return true, otherwise return false. > * > @@ -765,13 +767,13 @@ static bool srcu_might_be_idle(struct srcu_struct *ssp) > unsigned long tlast; > > /* If the local srcu_data structure has callbacks, not idle. */ > - local_irq_save(flags); > + local_lock_irqsave(sda_lock, flags); > sdp = this_cpu_ptr(ssp->sda); > if (rcu_segcblist_pend_cbs(&sdp->srcu_cblist)) { > - local_irq_restore(flags); > + local_unlock_irqrestore(sda_lock, flags); > return false; /* Callbacks already present, so not idle. */ > } > - local_irq_restore(flags); > + local_unlock_irqrestore(sda_lock, flags); Would it perhaps make sense to stick the local_lock in struct srcu_data ?