Received: by 10.192.165.148 with SMTP id m20csp5059937imm; Tue, 1 May 2018 08:24:30 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoesgNh0bkleEHzoJ2HlnZTxDmWpKBs+D6PNTnEiCk402tlTKCNI8i2ww//+jDQU4Z+R6Ta X-Received: by 2002:a17:902:a70c:: with SMTP id w12-v6mr1593500plq.74.1525188270207; Tue, 01 May 2018 08:24:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525188270; cv=none; d=google.com; s=arc-20160816; b=1JhBSI2cZe2RkZgyjTLyyc0+ZuJkkphuP6ECdN2PXoy7Qzt8oOgfK12CTjR5uwd7rJ s8FlO/shA6DaeCxGKfSWlqZVm40mPQ88zZe00iVFhkRSc507f2beYTpaeB0NgqEKZcNO CcdQypVw0yrY6r1mXH4LZ+W3mmANMDLZ/fP/hTiboC3KH7A0OUBXuf0s6yTFOK0cr0n9 4p8uIzhdZ5bV1JrgNRP50wz040SSE29x+IcM9PktFbooYOY9TqYfdYCOl79CNxB3cgGT dIAJ6aah26iMhijZ0PBkCq8aBamI2+ur4u+M7Y+lHObSOigZsKuuUh5HZXe5WVAjIHII s3cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=OGYPzDWUkrlLdwVSuOu86/J7+dIk5cknQzmHLb4Flek=; b=GI7y7tJlb3G7L9szU4beFurnHCRmr8C1A0wolwmnuQcAdD2ZzFeDde4xAosRzje3k9 LhuU0bssnlyi/b//GF1+3Is2cpTGWbIyCQ9gqy5lzcVy/kZScas/iGPzHX28Fn74JTik ARTbjhjgygo3R8+jSuPHYDQOa4BJi80ZjSnw9PSgtA4COPOBj8I/beNUytd4u4KgPYOh GnJNlVmvJBOnRv9QuVOubIN0iEeIweCWvx81tPUc1pc1LiqeMHwBWq3sUIW808pUTQis al2VED85zL6vaTgsxLrRm23PJcgNcLJzM9aDWu/07/8nJ/aGYWcctg0+vBIbCrMIct8e N93Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=mBgjEukz; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w73si4474093pfd.19.2018.05.01.08.24.15; Tue, 01 May 2018 08:24:30 -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=@google.com header.s=20161025 header.b=mBgjEukz; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755771AbeEAPYF (ORCPT + 99 others); Tue, 1 May 2018 11:24:05 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:51945 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755316AbeEAPYE (ORCPT ); Tue, 1 May 2018 11:24:04 -0400 Received: by mail-it0-f67.google.com with SMTP id n202-v6so13269084ita.1 for ; Tue, 01 May 2018 08:24:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OGYPzDWUkrlLdwVSuOu86/J7+dIk5cknQzmHLb4Flek=; b=mBgjEukzQ8azBDxIld7DKAaulRdn2ILhoNhjqFOGE/lNIM5eY7ebu36/fVLj/xEswE 2WvwblhzghTyMND8zbqxsbvyTGYvgK8qlFnSgm//nSTNNQnlbv6g2YYlgGCIZUtFkdgV 1dbeovSjxJ22PY77GJcJoKijWIVIS6bjah8s3e8WEBeP2IDoTSo/s18If8i8X5aB0Jir RyyVY3gFdLWLfWSzTTi1EygvpkiYtqXVZdnnsTIiF/BAbkNaOJxN/1SmAM6wnuPB6lTG SsmFEQ0fe114FfbmEhNS6+FfC3pKJY1gyje9Hi+CsV0aw0Rz8oV/eFQggmfRvyd8pB6w jdOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OGYPzDWUkrlLdwVSuOu86/J7+dIk5cknQzmHLb4Flek=; b=WJFCzVQ/ub/hfSgInRw7Ev5EFBA5BFCD0UDOjVRVx1OtJePnkGBJlQJ0AGLz0gVanq BgrW1m+k42Xj6u5MBCKM96i/LaJRDI+NkSp9eM4cPIeaHyCHWrb08+No897PcSLXWLz6 r5IxbjOZYVQUkbuinU2dHelmG0t+xBwP0y44ieisTSM7Z3H6RuAQIDGNLmRqvM4dA5Zk qJ9TcJiVOkKs6Z+Sj+8+oZgwtdUdi5vya9uwP1inukheYHHGNm6dLxYu4Uoqt8laJanF v28kDYWyqb0k5ufP+Bw+rW5mkpGbUGqeJn89T/0OkcgzK6nVN+1rtmPX4Fi6yMiuX2iY xU9w== X-Gm-Message-State: ALQs6tBTFBd1YeBXaZNN1K29sjUA0LejjsI3O7oTCSZudn4NvXrVBa8j gOwvHPsxDHwjL0ovcjGNPxpbHVv5qdmwlRn59p9gFw== X-Received: by 2002:a24:6d5:: with SMTP id 204-v6mr16200515itv.47.1525188243108; Tue, 01 May 2018 08:24:03 -0700 (PDT) MIME-Version: 1.0 References: <20180501014204.67548-1-joelaf@google.com> <20180501014204.67548-6-joelaf@google.com> <20180501102401.2cac5781@gandalf.local.home> <20180501143601.GG26088@linux.vnet.ibm.com> <20180501152135.GJ26088@linux.vnet.ibm.com> In-Reply-To: <20180501152135.GJ26088@linux.vnet.ibm.com> From: Joel Fernandes Date: Tue, 01 May 2018 15:23:52 +0000 Message-ID: Subject: Re: [PATCH RFC v5 5/6] tracepoint: Make rcuidle tracepoint callers use SRCU To: Paul McKenney Cc: Steven Rostedt , LKML , Peter Zijlstra , Ingo Molnar , Mathieu Desnoyers , Tom Zanussi , Namhyung Kim , Thomas Gleixner , Boqun Feng , "Cc: Frederic Weisbecker" , Randy Dunlap , Masami Hiramatsu , Fenguang Wu , Baohong Liu , Vedang Patel , "Cc: Android Kernel" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 1, 2018 at 8:20 AM Paul E. McKenney wrote: [...] > > > > > --- a/kernel/tracepoint.c > > > > > +++ b/kernel/tracepoint.c > > > > > @@ -31,6 +31,9 @@ > > > > > extern struct tracepoint * const __start___tracepoints_ptrs[]; > > > > > extern struct tracepoint * const __stop___tracepoints_ptrs[]; > > > > > > > > > > +DEFINE_SRCU(tracepoint_srcu); > > > > > +EXPORT_SYMBOL_GPL(tracepoint_srcu); > > > > > + > > > > > /* Set to 1 to enable tracepoint debug output */ > > > > > static const int tracepoint_debug; > > > > > > > > > > @@ -67,11 +70,16 @@ static inline void *allocate_probes(int count) > > > > > return p == NULL ? NULL : p->probes; > > > > > } > > > > > > > > > > -static void rcu_free_old_probes(struct rcu_head *head) > > > > > +static void srcu_free_old_probes(struct rcu_head *head) > > > > > { > > > > > kfree(container_of(head, struct tp_probes, rcu)); > > > > > } > > > > > > > > > > +static void rcu_free_old_probes(struct rcu_head *head) > > > > > +{ > > > > > + call_srcu(&tracepoint_srcu, head, srcu_free_old_probes); > > > > > > > > Hmm, is it OK to call call_srcu() from a call_rcu() callback? I guess > > > > it would be. > > > > > It is perfectly legal, and quite a bit simpler than setting something > > > up to wait for both to complete concurrently. > > > > Cool. Also in this case if we call both in sequence, then I felt there > > could be a race to free the old data since both callbacks would try to do > > the same thing. The same thing being freeing of the same set of old probes > > which would need some synchronization between the 2 callbacks. With the > > chaining, since the ordering is assured there wouldn't be a question of > > such a race. I could add this reasoning to the changelog as well. > Actually, as long as you have a solid happens-before between both of the > callbacks and the freeing, you are in good shape. A release-acquire would > work fine, as would a lock acquired in both callbacks and then acquired > (and possibly released) before the free. Got it, thanks. For now, if its Ok with you and others, I will leave it in the chained configuration. I also feel this is temporary since in the future if we switch to single rcu mechanism for tracepoints (srcu), then we could do with just a single callback. thanks, - Joel