Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp798795ybz; Wed, 15 Apr 2020 19:21:38 -0700 (PDT) X-Google-Smtp-Source: APiQypKpfACOQRl5tn1rqaJYvrIS/Ddmnh43/0J1f0iZGvqIg4f2fR65ufk0eSULsWf5dPa3pza9 X-Received: by 2002:a17:906:7b53:: with SMTP id n19mr5090173ejo.244.1587003697978; Wed, 15 Apr 2020 19:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587003697; cv=none; d=google.com; s=arc-20160816; b=QwLlTw6Fb1ZDrFzPvAIKuIiGxF6f6oCqY5abqjUWQqQgEo7Nr1EDpnRxX18pVA7bP5 QphR6wN6FJyPGuGuU4E6gTrPbW3JQ0Eol7C2pFH0TFzIfFohARvPpc87CMUn0rUzMsfE AqxKfmbYAXt3yFoVQB7hgZYob3n3E3rw8rzh5EAaccR/kdlTz6RqyJoqkZ+7tsxK/U22 1ghvVCMChHbKLABWz4Tn2hCYQ/0jvc38U77hBwonWw8/CJsf1mADg+4/3gW3HpZz5dUn bdyuR7DEqgJjT14gVYlb8j1s2tjtE9YOfaGMqC0IbLahtO42kQ33L//NFHTZq7FOvDdv Qw2A== 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; bh=EQ31clhLZb3VXpySOphZmzfjZTGe/r/2/PRRcbkZITI=; b=uuhPWDcmNRZdXZENYamveE0RJuAbW6pvksGCzD8Rb8RqhkLeP2GhaezbyMuwBSWyTu fPZ9UOahi2W1UqVn8A5iw2mSgfUCZuIvgnQylX18tMGaf7sRj5RbHERKdChh4iIEQX27 34X1v9LsY80mrJbFPyNlQCLBFjMlifcDgOjHJbl2rjuwq60cXN0pGUyXWATNTkziz+ej pCZtTMK75uMFAL8rwoBboEbZD2ew5MfsYJLMxWg+VBESLlCq1vjmGBctebGA6pKrRhGW vktdNdeyaDblFzlGaSiPIThksGoXmOPfxbG83MV2PTne4b5Y2tZTpZMba8Nd95WybCkR bhQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="nMC/qWTk"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t9si12149952ejr.422.2020.04.15.19.21.15; Wed, 15 Apr 2020 19:21:37 -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=pass header.i=@linaro.org header.s=google header.b="nMC/qWTk"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732508AbgDPCSJ (ORCPT + 99 others); Wed, 15 Apr 2020 22:18:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1731031AbgDPCSE (ORCPT ); Wed, 15 Apr 2020 22:18:04 -0400 Received: from mail-oo1-xc43.google.com (mail-yw1-xc43.google.com [IPv6:2607:f8b0:4864:20::c43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21D12C061A0C for ; Wed, 15 Apr 2020 19:18:04 -0700 (PDT) Received: by mail-oo1-xc43.google.com with SMTP id g14so338736ooa.4 for ; Wed, 15 Apr 2020 19:18:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EQ31clhLZb3VXpySOphZmzfjZTGe/r/2/PRRcbkZITI=; b=nMC/qWTktNUMDXE45p0WHAv3qQ2luZCbAsFW6wl4sjF9gcgJ2G0R1JMPV+jsMydNRD TgG00U1QJCed8qep3C0HhtJUBBm9jXAAWCH4+6f+n4MvVZi0CFKVUxhx8w4aEtQn2gnl mV39d+E0efQh4qKgDRPWlFW+FpJgq1suZWlAUlBbsHVw7Gnfzv0Z8GHkrxtDnYte1cWX eSV+BKQjR8jLSML/UZAbJe1mjGtohQPot93lIc8u4s3pCYUQtlR/bobRukMR0zq9BJz3 IHZGlD/NXR0f73j71Pwl0LZFjYjx7I0yvCjfbngCyuxYISAiPP+YyhEhsZ8UCTNdLKx3 /rXw== 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=EQ31clhLZb3VXpySOphZmzfjZTGe/r/2/PRRcbkZITI=; b=gcmuAF4EgVmdpV2mNHbM8az2RJvaeVu5isrQrsOwFQAJIS5Zjvhd8EiIm3VHzxFc3B a117iI93Zy3jP0DDZoJzhsZOyNova8E5/stHgS43jrP3F58dLYZqLpIU1PvVAn6TWyB8 zCdZ1+JRd61cbCArgdTy/c4lS6D2yQczpAxziLYDNg9cM/zkFjaidFZF7jccLov8+t7T Rs6lyequo4InhGEdTIq6dtXZzYWAZopx1AFdAFDtay1XtyBafBVy9wi2S8TjaalsWS4h hPZSNzkbTH70JGv8GWYiHutUZioeZ91hYdIXAc82z66+FE679p5Agg05Ne3IHzRM+mxh TUcw== X-Gm-Message-State: AGi0PuYsdc+wPfz5Yf+QRrnRnJWAtBUsvjLj7z03/864nqxFcDkJCx1n vbLqpWp5zfg4HrINT1kD7FLOXh7ag4+AupJMuxYlxQ== X-Received: by 2002:a4a:4c8d:: with SMTP id a135mr24835704oob.36.1587003483373; Wed, 15 Apr 2020 19:18:03 -0700 (PDT) MIME-Version: 1.0 References: <20200415085348.5511a5fe@gandalf.local.home> <20200415161424.584d07d3@gandalf.local.home> <20200415164116.40564f2c@gandalf.local.home> <20200415174918.154a86d0@gandalf.local.home> <20200415220459.GE17661@paulmck-ThinkPad-P72> <20200415185121.381a4bc3@gandalf.local.home> <20200415204827.24f2c548@oasis.local.home> In-Reply-To: <20200415204827.24f2c548@oasis.local.home> From: John Stultz Date: Wed, 15 Apr 2020 19:17:52 -0700 Message-ID: Subject: Re: On trace_*_rcuidle functions in modules To: Steven Rostedt Cc: "Paul E. McKenney" , Josh Triplett , lkml , Bjorn Andersson , Saravana Kannan , Todd Kjos , Stephen Boyd , Peter Zijlstra , Thomas Gleixner 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 Wed, Apr 15, 2020 at 5:48 PM Steven Rostedt wrote: > > On Wed, 15 Apr 2020 17:06:24 -0700 > John Stultz wrote: > > > So you're saying the recent change to move to using trace_*_rcuidle() > > was unnecessary? > > > > Or is there a different notifier then cpu_pm_register_notifier() that > > the driver should be using (that one seems to be using > > atomic_notifier_chain_register())? > > From looking at the trace event in __tcs_buffer_write() in > drivers/soc/qcom/rpmh-rsc.c, the _rcuidle() was added by: > > efde2659b0fe8 ("drivers: qcom: rpmh-rsc: Use rcuidle tracepoints for rpmh") > > Which shows a backtrace dump of: > > Call trace: > dump_backtrace+0x0/0x174 > show_stack+0x20/0x2c > dump_stack+0xc8/0x124 > lockdep_rcu_suspicious+0xe4/0x104 > __tcs_buffer_write+0x230/0x2d0 > rpmh_rsc_write_ctrl_data+0x210/0x270 > rpmh_flush+0x84/0x24c > rpmh_domain_power_off+0x78/0x98 > _genpd_power_off+0x40/0xc0 > genpd_power_off+0x168/0x208 > genpd_power_off+0x1e0/0x208 > genpd_power_off+0x1e0/0x208 > genpd_runtime_suspend+0x1ac/0x220 > __rpm_callback+0x70/0xfc > rpm_callback+0x34/0x8c > rpm_suspend+0x218/0x4a4 > __pm_runtime_suspend+0x88/0xac > psci_enter_domain_idle_state+0x3c/0xb4 > cpuidle_enter_state+0xb8/0x284 > cpuidle_enter+0x38/0x4c > call_cpuidle+0x3c/0x68 > do_idle+0x194/0x260 > cpu_startup_entry+0x24/0x28 > secondary_start_kernel+0x150/0x15c > > > There's no notifier that calls this. This is called by the rpm_callback > logic. Perhaps that callback will require a call to rcu_irq_enter() > before calling the callback. Yea. Sorry, its extra confusing as the call stack there includes patches who's equivalents are only now in -next (I myself managed to confuse what was upstream vs in -next in this thread and suddenly couldn't find the code I had described - apologies). See: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/soc/qcom/rpmh-rsc.c?h=next-20200415#n795 > In any case, I think it is wrong that these callbacks are called > without RCU watching. The _rcuidle() on that tracepoint should be > removed, and we fix the code that gets there to ensure that RCU is > enabled. I agree with Peter, that no module code should be executed > without RCU watching. For sanity sake, it seems like the rule should be we avoid driver code executing without RCU watching. The fact of if it's a loadable module or not is super subtle, and likely that more folks will trip over it. But ok. I'll follow around to understand if the commit efde2659b0fe8 ("drivers: qcom: rpmh-rsc: Use rcuidle tracepoints for rpmh") is actually necessary and see what would be needed to revert it. thanks -john