Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp914079imm; Mon, 21 May 2018 17:08:07 -0700 (PDT) X-Google-Smtp-Source: AB8JxZocGMRK4s7Sd11dLDe3Q3hzh/CXE9YvZejZM+E+IAXAOJmjjMUUGnmSm3Xix/fi9aMlYFFv X-Received: by 2002:a62:a6ce:: with SMTP id r75-v6mr22057881pfl.82.1526947687822; Mon, 21 May 2018 17:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526947687; cv=none; d=google.com; s=arc-20160816; b=BT7vZz50dxhwutXQqOa9/Tm2lgo/kIXa530UIj/KpeuywResHQzIhG6+SpqWUKpkzO 6hDELOzmrZGzTZbFMEnGjX949o3Y4kV8MwuItxm39rk5CYh9wtYNpaMd9sFSKH/Rck6U 7kPB/D+Lw5S5vY43fA4pgTji+cA6gB/ZpGT4CyVwcx9pdgXzpYfVKEN5Y2eQcbMhnpaD GqxRVPweH301ABdU1/C2waImMY9HDQ2tqW4bgIrJO/OjMYzG0+DyBq7GSbtrgaqhRfRq WK7O0eYeaqrdfPLMA6jJ+IzD7fjBvOvqTkhSJcHFMX3CUS13EPLbf+WASqf7OMynhIrP Guhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=hECqjjzfO4xjKBqw/Cs8g6jrXVcqMYzDw0SXubIHwcA=; b=aDXemHvsFvDWM8636aNCHk5YcvaGboM+2SvYOF/0YEmSDiVvV3LxnV79LWjo5Wm6zD GjuNfb+0yo4YGm9txO2e/7lvAROyC7Sp0ddSlKdbcp+3PqJJzNclLqsxMJM80JnAyeMu fVC396pKYa9LqhZ8jHNgdbtyzj35cA3yD0OFXtcSqFrayB0SHcspzZ1TXKgZAxlXGCtx gvWiob81jx3BxzGg8AYEU8EhjarfOzZh2mYsKwyCdHIoPHn4QWIzMn0maDGoaRLrYhZb dlDjuJ+yKNZzs70TKIwgIiTNeKlmVSe14T2Af1y5YcDchk86trRl3k9AcH7L757VOYmT 8AaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=XwNpvoA5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8-v6si9264662pgv.169.2018.05.21.17.07.53; Mon, 21 May 2018 17:08:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=XwNpvoA5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751496AbeEVAHh (ORCPT + 99 others); Mon, 21 May 2018 20:07:37 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:34369 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751125AbeEVAHf (ORCPT ); Mon, 21 May 2018 20:07:35 -0400 Received: by mail-pf0-f196.google.com with SMTP id a14-v6so7846808pfi.1 for ; Mon, 21 May 2018 17:07:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hECqjjzfO4xjKBqw/Cs8g6jrXVcqMYzDw0SXubIHwcA=; b=XwNpvoA5R5iAZ+zgL/TWM7BYiQGY+nBucZ8L+5mOeYSkEUgSIT2Fk7UxVQYIBecKvK nb7sBB6fChhhGEHgFirbVnHeYw2jBLiA52E+jsJUkuigF83DATtcj1BbDaX/cFa7ygdj 0aPpUWzIpN/HlKY42VkZ8hEOqC74XmyDezEhs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hECqjjzfO4xjKBqw/Cs8g6jrXVcqMYzDw0SXubIHwcA=; b=X9ajkiU+aleBo2gTqdL1r4ID8hw6lWqXeepSkVY0bRvGbEJVwd5ssgi+G47sHSLhUF nAa8t0zVDxnbahSDhsGUY/nVAKZS9JZHJZuPzDFHpOC/Aibo6uUC3PFpVqXZCMnBix3O Wrt2WdwxlPDYy2UlhtXOARJxM2e8NXuEhB4eyRJ71JVw6mPNScbVWwgeya81jFQ09Ch6 TQ+LrTPCUeILWKCxZLPJyd3gmRkwQdsI1h15PD+7XpXFw3B6RW6esctImHnK8srYwcer n50409uGBvLcsUG8U+Wx/ne41o2zwGal8lDfqP9dFoUBXDzTrKJ75sWtdQK/54syCkYr I56g== X-Gm-Message-State: ALKqPwcoRph9ufLPT6OxrtEfrLDUPQg4GOMweUh+63ACYfNU5J5SV9Pz leBpx0CHO1+BqnZNcwrc/UFUqA== X-Received: by 2002:a63:b248:: with SMTP id t8-v6mr326440pgo.174.1526947655429; Mon, 21 May 2018 17:07:35 -0700 (PDT) Received: from localhost ([2620:0:1000:1600:3122:ea9c:d178:eb]) by smtp.gmail.com with ESMTPSA id g26-v6sm29875985pfh.76.2018.05.21.17.07.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 May 2018 17:07:34 -0700 (PDT) Date: Mon, 21 May 2018 17:07:34 -0700 From: Joel Fernandes To: "Paul E. McKenney" Cc: Joel Fernandes , linux-kernel@vger.kernel.org, Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , byungchul.park@lge.com, kernel-team@android.com Subject: Re: [PATCH v3 4/4] rcu: Unlock non-start node only after accessing its gp_seq_needed Message-ID: <20180522000734.GD40541@joelaf.mtv.corp.google.com> References: <20180521044220.123933-1-joel@joelfernandes.org> <20180521044220.123933-5-joel@joelfernandes.org> <20180521232537.GJ3803@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180521232537.GJ3803@linux.vnet.ibm.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 21, 2018 at 04:25:38PM -0700, Paul E. McKenney wrote: > On Sun, May 20, 2018 at 09:42:20PM -0700, Joel Fernandes wrote: > > We acquire gp_seq_needed locklessly. To be safe, lets do the unlocking > > after the access. > > Actually, no, we hold rnp_start's ->lock throughout. And this CPU (or in > the case of no-CBs CPUs, this task) is in charge of rdp->gp_seq_needed, > so nothing else is accessing it. Or at least that is the intent. ;-) I was talking about protecting the internal node's rnp->gp_seq_needed, not the rnp_start's gp_seq_needed. We are protecting them in the loop: like this: for(...) if (rnp != rnp_start) raw_spin_lock_rcu_node(rnp); [...] // access rnp->gp_seq and rnp->gp_seq_needed [...] if (rnp != rnp_start) raw_spin_unlock_rcu_node(rnp); But we don't need to do such protection in unlock_out ? I'm sorry if I'm missing something, but I'm wondering if rnp->gp_seq_needed of an internal node can be accessed locklessly, then why can't that be done also in the funnel locking loop - after all we are holding the rnp_start's lock through out right? thanks! - Joel