Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp542071imw; Fri, 15 Jul 2022 08:13:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1smRmW32oQTkVNxNviSOY8I3hcVzR1hcDudO/Vi+3b1cVzvGnBUpM53oAAm+JhK/YI1nY3w X-Received: by 2002:aa7:dd06:0:b0:43b:247e:3d6c with SMTP id i6-20020aa7dd06000000b0043b247e3d6cmr10875092edv.407.1657897994474; Fri, 15 Jul 2022 08:13:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657897994; cv=none; d=google.com; s=arc-20160816; b=coVWz432gLNJR91SOxuCXwDddH7YV3ujQhR2aGvONk8k18NZSpPJjvh1BONkA+v60V nrLNXWnjPfceBtYDAFg19yPXp21+lgy51m60c36gaej4VFgqKGYOjR0A7LIDy4vhPsZx Po1PGloIIxaHYqGrelvp7SGmyIJ3/yXZ8B7yq2xz547kBwsHkue5Vg7k5t3+YQ5Sqx/r F4FPaTYQ71MoQiMxP5fRLymf/NGDAcQDHkkczlDWk8Rk2uQxiesjB0HncvuWd8gAsl9T UmUN8BSZlFvmeAXVjMAs4VTNxtZgLmP5drmMM0xas8WLh3maj34sVccn41/tayUl+dQi G2+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=aiCcZmbOIQ8wywQ6VGDhioMFfdLDM85QltO/NUPi0vM=; b=y/rESJgdf7YfUc7IXElFoGhvVMpXXgZB1vNV5411+69lwYnFkcJ/EtI18nLp5lMNRL dfy/xkVBc7Xh+ARdr4tWyQaunNUFYv5vM5BluFJFMNxFxjO9PFeArgqh3z8f+XpYN4Va fXS9h5/2q6lJnjsvxDFb9+gPqoqFXh/aCifC8IIr/LtQZWpOH4BkkJDRu16TgLYevT7l 4MgpJmJrfUX3KP+DMc+N34B8kGxo97NUj4XYCEP9mghObbRHfZlGnjEl8D9EN3fALJYf dER07U7/3ZXumybqbqcx4KlMYDcbU6PsMUk7tO7lfiPYVrg17Y+0T4+Nx2I0MapdmuNZ 5C/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h9kv48vg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb37-20020a1709071ca500b00715849159c7si4402297ejc.56.2022.07.15.08.12.48; Fri, 15 Jul 2022 08:13:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h9kv48vg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232750AbiGOPKF (ORCPT + 99 others); Fri, 15 Jul 2022 11:10:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229628AbiGOPKC (ORCPT ); Fri, 15 Jul 2022 11:10:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53A147BE38 for ; Fri, 15 Jul 2022 08:10:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D0CAA62040 for ; Fri, 15 Jul 2022 15:10:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F9EFC34115; Fri, 15 Jul 2022 15:10:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657897801; bh=nxfXNsnqYstmD29o+5IdQlBgebahXtNZ5XkjmAqKmkg=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=h9kv48vg5F4c9IczeU9GMH+HJZKdXz6H3hHht971ds3O0kSgYdx9W08csOeiWbCJ3 BhXAfwmI3jCWydJxBn1LiUvZSEInWCmxJhKaYQgxZnLOKPx5VkoPsc5x7Ce43qEjiu elrDEkF71TuwElftwdp+vml0bztsDLNXKqS/ZvxlLqwMuUbo6xXGxKSkn1nh8JKZpU //Jz88NrD/m3a0dS3c/+GkFR46n9Dp7uEjDjQLuHoQoxjEKVg6hrDc23unAEZztDtk 83hrPn2DUpKWlAnsiQOKiI5CG5knXXLWYs2eKZKMVF3G/gwJYWtOpEpaLJ9u+UY61/ LkoC/lauX31KQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id BFF325C015D; Fri, 15 Jul 2022 08:10:00 -0700 (PDT) Date: Fri, 15 Jul 2022 08:10:00 -0700 From: "Paul E. McKenney" To: Steven Rostedt Cc: Marco Elver , Petr Mladek , John Ogness , Sergey Senozhatsky , kasan-dev@googlegroups.com, Thomas Gleixner , Johannes Berg , Alexander Potapenko , Dmitry Vyukov , Naresh Kamboju , Peter Zijlstra , Linux Kernel Functional Testing , linux-kernel@vger.kernel.org Subject: Re: [PATCH] printk: Make console tracepoint safe in NMI() context Message-ID: <20220715151000.GY1790663@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20220715120152.17760-1-pmladek@suse.com> <20220715095156.12a3a0e3@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220715095156.12a3a0e3@gandalf.local.home> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 15, 2022 at 09:51:56AM -0400, Steven Rostedt wrote: > On Fri, 15 Jul 2022 14:39:52 +0200 > Marco Elver wrote: > > > Couldn't this just use rcu_is_watching()? > > > > | * rcu_is_watching - see if RCU thinks that the current CPU is not idle > > Maybe, but I was thinking that Petr had a way to hit the issue that we > worry about. But since the non _rcuide() call requires rcu watching, > prehaps that is better to use. In case this helps... ;-) The rcu_is_watching() function is designed to be used from the current CPU, so it dispenses with memory ordering. However, it explicitly disables preemption in order to avoid weird preemption patterns. The formulation that Marco used is designed to be used from a remote CPU, and so it includes explicit memory ordering that is not needed in this case. But it does not disable preemption. So if preemption is enabled at that point in tracing, you really want to be using rcu_is_watching(). Thanx, Paul