Received: by 10.192.165.148 with SMTP id m20csp1205416imm; Wed, 25 Apr 2018 14:28:30 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoOO7+nXvsGaI8Pr0uUiIOXh9BLd+z/MHKJVtRBAuw+69mKcznJ812gJFoyESjUgU7Edd7g X-Received: by 10.99.67.132 with SMTP id q126mr1448558pga.294.1524691710517; Wed, 25 Apr 2018 14:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524691710; cv=none; d=google.com; s=arc-20160816; b=AxDfS//IMtdSJlWWVgYgIySBx4iGe8V2U0lFzCb3s9SankCahwqwGs2xKKf/JTj8lv v9KYJ581tiIRN4mzX9KycFaOqoMamRAVP9fdn23oW2ieZgmS04axmpbuVULdyMk5dmWI w2rrPzY7/NnRSVLAkO0vkefZmaXCuz4PZbioMXd5lSl0lGKMarJi43C40qIufkHkMPiv A58SVQ0Ohn72DQTV/Q4yS/L8AkcAP/yeEPibr3O+HtX5kNDDa4HX+OxsZr4g6nKwLLSr LwLudCqFyi/S26tm62nlVrg5tqrp3Of0UHZlqenxInttlt08Q4ekzv8BhIDC3DVirjwr xCvw== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=1tzupXE+G9SPKXz3q9ijX1l5dZC0yby+quhL5AFOWt4=; b=I7a597qySaBh9oSzqWtcl5aq/wk/UwG6x8qUE9dEKzbgDTQu3HAuO5uHpRSO5xXDjs uAMcA4lflBEa/gDlfNkZ8QtaMD3/ntF5l1uBKa53YbWlvRw7H0MWoyhOJUZZL+TbdA1D QbepaQdsKfJUUilpF3chNem94mhW/fDBfHbaZETKajqKw24fdJx7u8Wosom3lSMN/YNm lESGp5zUadLII3pRZU0y93aQGQCIBCsrA3W8uU0VUwG4pCcmBE4pF2WS8yBUWBrnM8Rp PhetT2jvntmqA/EAn08DUtvVwRBSupwD3AL0oLNKy/6LF1Jy5FkCrRj5CexdDD7kEcgd j2KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=WcX2VE3x; 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 bj5-v6si1410656plb.67.2018.04.25.14.28.16; Wed, 25 Apr 2018 14:28: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=WcX2VE3x; 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 S1751588AbeDYV1M (ORCPT + 99 others); Wed, 25 Apr 2018 17:27:12 -0400 Received: from mail-it0-f51.google.com ([209.85.214.51]:51228 "EHLO mail-it0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750868AbeDYV1K (ORCPT ); Wed, 25 Apr 2018 17:27:10 -0400 Received: by mail-it0-f51.google.com with SMTP id o20-v6so21868180itc.1 for ; Wed, 25 Apr 2018 14:27:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=1tzupXE+G9SPKXz3q9ijX1l5dZC0yby+quhL5AFOWt4=; b=WcX2VE3x5LDrQEa7nZD8qGR9PQ2Aom6CmeOk+e1e7eoQ/GYUjX09LP3wOSMsW2CYQD kzjXoL2+9E+4fokaP9Z7P66qJ4WLUzIt7pfLk8EmPsPufWyTygfGBeJpPVMoIJGP+5Pt 6dqgL0MhKPunwe/cCso/PjkEtKUL4uewnCxxuuu5wIOZfoMtlk97kkW3jBY5AlXjPgYg 2GQ280Tn4sS1nJDh9IDz1GBXbRVzhH8ZE0uFtodOCiEXNJ7eiwuaB48/vjf7CX2opvve vvVuoBGw4EhG5PNZG6foLn6iXfEBr/oPupZcvHvlFRTNu5B262WAfHOvitFsp4DDiHzg B0oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=1tzupXE+G9SPKXz3q9ijX1l5dZC0yby+quhL5AFOWt4=; b=PjBDmy6nwstLjsroneQxK9yf+8UgwO/T3A0GXShHnnfxWHbBhnRnA8zLjXbV0hYMqP x8K/jqUDvJLWeePeR2Kg8Trg32xvg5xJX+RUJZQmR+AxeC56JS0/4dYRZAJECActjbI5 kKEfdBatgkT5n71vWAsrdl+RoAWIC2fCxT5KAxya47L4wCnTmzjpyjVM7Vu3KnGYquU3 iAPZPsmAyvsnc39h1FZW1xvdO/m47ezB8jUIx12TkjiRdS09EG+zLkhjWOiQCwYcoVF1 PYVaQpJtxZRjj37dJmC5DjUWTS52UOSyX7mTwyUBaL2RaVye5MyM8zCvpZMaDHCoVtn9 63vw== X-Gm-Message-State: ALQs6tBfmZm1hLFJyxyPPpvttn0SnkYOqvmX3OqKtYEKfOh8xAcPexKR lm4370kp19zhKQaS8jaH63Zs7wKyusTB/bU89Dnhew== X-Received: by 2002:a24:5f45:: with SMTP id r66-v6mr23852895itb.126.1524691628933; Wed, 25 Apr 2018 14:27:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.181.213 with HTTP; Wed, 25 Apr 2018 14:27:08 -0700 (PDT) In-Reply-To: <20180425042056.GA21412@linux.vnet.ibm.com> References: <20180423172244.694dbc9d@gandalf.local.home> <20180424155655.GA820@linux.vnet.ibm.com> <20180424172658.GT26088@linux.vnet.ibm.com> <20180424182302.GA404@linux.vnet.ibm.com> <20180424182623.GA1357@linux.vnet.ibm.com> <849066633.939.1524612064698.JavaMail.zimbra@efficios.com> <68e4c123-a223-5e26-e57a-da2515041bf3@google.com> <20180425001049.GX26088@linux.vnet.ibm.com> <20180425042056.GA21412@linux.vnet.ibm.com> From: Joel Fernandes Date: Wed, 25 Apr 2018 14:27:08 -0700 Message-ID: Subject: Re: [RFC v4 3/4] irqflags: Avoid unnecessary calls to trace_ if you can To: Paul McKenney Cc: Mathieu Desnoyers , rostedt , Namhyung Kim , Masami Hiramatsu , linux-kernel , linux-rt-users , Peter Zijlstra , Ingo Molnar , Tom Zanussi , Thomas Gleixner , Boqun Feng , fweisbec , Randy Dunlap , kbuild test robot , baohong liu , vedang patel , kernel-team 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, Apr 24, 2018 at 9:20 PM, Paul E. McKenney wrote: [..] >> > >> > Sounds good, thanks. >> > >> > Also I found the reason for my boot issue. It was because the >> > init_srcu_struct in the prototype was being done in an initcall. >> > Instead if I do it in start_kernel before the tracepoint is used, it >> > fixes it (although I don't know if this is dangerous to do like this >> > but I can get it to boot atleast.. Let me know if this isn't the >> > right way to do it, or if something else could go wrong) >> > >> > diff --git a/init/main.c b/init/main.c >> > index 34823072ef9e..ecc88319c6da 100644 >> > --- a/init/main.c >> > +++ b/init/main.c >> > @@ -631,6 +631,7 @@ asmlinkage __visible void __init start_kernel(void) >> > WARN(!irqs_disabled(), "Interrupts were enabled early\n"); >> > early_boot_irqs_disabled = false; >> > >> > + init_srcu_struct(&tracepoint_srcu); >> > lockdep_init_early(); >> > >> > local_irq_enable(); >> > -- >> > >> > I benchmarked it and the performance also looks quite good compared >> > to the rcu tracepoint version. >> > >> > If you, Paul and other think doing the init_srcu_struct like this >> > should be Ok, then I can try to work more on your srcu prototype and >> > roll into my series and post them in the next RFC series (or let me >> > know if you wanted to work your srcu stuff in a separate series..). >> >> That is definitely not what I was expecting, but let's see if it works >> anyway... ;-) >> >> But first, I was instead expecting something like this: >> >> DEFINE_SRCU(tracepoint_srcu); >> >> With this approach, some of the initialization happens at compile time >> and the rest happens at the first call_srcu(). >> >> This will work -only- if the first call_srcu() doesn't happen until after >> workqueue_init_early() has been invoked. Which I believe must have been >> the case in your testing, because otherwise it looks like __call_srcu() >> would have complained bitterly. >> >> On the other hand, if you need to invoke call_srcu() before the call >> to workqueue_init_early(), then you need the patch that I am beating >> into shape. Plus you would need to use DEFINE_SRCU() and to avoid >> invoking init_srcu_struct(). > > And here is the patch. I do not intend to send it upstream unless it > actually proves necessary, and it appears that current SRCU does what > you need. > > You would only need this patch if you wanted to invoke call_srcu() > before workqueue_init_early() was called, which does not seem likely. Cool. So I was chatting with Paul and just to update everyone as well, I tried the DEFINE_SRCU instead of the late init_srcu_struct call and can make it past boot too (thanks Paul!). Also I don't see a reason we need the RCU callback to execute early and its fine if it runs later. Also, I was thinking of introducing a separate trace_*event*_srcu API as a replacement to the _rcuidle API. Then I can make use of it for my tracepoints, and then later can use it for the other tracepoints needing _rcuidle. After that we can finally get rid of the _rcuidle API if there are no other users of it. This is just a rough plan, but let me know if there's any issue with this plan that you can think off. IMO, I believe its simpler if the caller worries about whether it can tolerate if tracepoint probes can block or not, than making it a property of the tracepoint. That would also simplify the patch to introduce srcu and keep the tracepoint creation API simple and less confusing, but let me know if I'm missing something about this. Thanks, - Joel