Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp973309rwb; Thu, 22 Sep 2022 08:34:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM413sQDwKAam5BmxM9N22500Jvbg3+1GhjBP+yEdmKBqTgCfIy1c/6n+1kSvImjPBAL2txP X-Received: by 2002:a63:1953:0:b0:438:6e74:92e2 with SMTP id 19-20020a631953000000b004386e7492e2mr3658371pgz.150.1663860866512; Thu, 22 Sep 2022 08:34:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663860866; cv=none; d=google.com; s=arc-20160816; b=HwkHPFx5db5FJZUb1bAhLmMMFzL8BhNEVZ3hawmee+LRfQLSyRyCbc5EVP3wcnnlFr FDWLnxitC+b5FYD9bbuNSJbuQci8qqwleeYi5JisJ9Gu+KnhYsErCMRvLvQaJztuQGf7 EpR9Z/NECzqT0+94DHB+sKjKIPIenUkUdp1DzG8E/xtsoOMwwAjuMrXGBiY26bZTaUa6 Qwy46378rCJBMXg639/wQUybWHFsaMwrWXLwh4TccwACTFAYqulLlSemsqaOheciemBj 7fbbzf+GXnWglbXnwgysS8DIrgtlju82FvekcTnrUY4S+fwvF2cHrouOZYhydmEWpBNc Px4Q== 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:message-id:subject:cc:to:from:date:dkim-signature; bh=s+t51A9G5TKAVlX9W9Kx0FTvae9linxMEZpeImRvbaI=; b=ev/U7jvtsJfsQF98nkzGxBDTN/PmXLdhk0Fx/4JhWhxbPNnlP5/QTN4SaauHqrEGGa ySTUs8x6KUCYM3cmvNsd5S5QZa3Rv16TUiXMZFVuq1p9b7ZY8tHnakhz4F5nmvachRHV 5CA6WJoz2CE/UrQRg2MKbQPxAw2+10qp9BZAAgjKnbuiM4SmG6G+oS/EpikRb1egM2u+ r89DSTKHMyVaqk+ICzHEN9r3UIPksCUt8yilDAdb/Hw56N33DDIS5AqFfd756LESs8O3 hOh6hXSIIMCZvunLDuHv1dtC4JN1YxIZOMdV5oaGYie8JPvkI2ESj99lA/qbZ+ZauJ0N nbBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="D8CB/+yP"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i14-20020a170902c94e00b00174ef08284dsi143221pla.336.2022.09.22.08.33.39; Thu, 22 Sep 2022 08:34:26 -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=@infradead.org header.s=casper.20170209 header.b="D8CB/+yP"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231831AbiIVOcX (ORCPT + 99 others); Thu, 22 Sep 2022 10:32:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbiIVOb7 (ORCPT ); Thu, 22 Sep 2022 10:31:59 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69E02F6863 for ; Thu, 22 Sep 2022 07:31:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=s+t51A9G5TKAVlX9W9Kx0FTvae9linxMEZpeImRvbaI=; b=D8CB/+yPFbPniJg9eIvlCYqbMu EkpsMWif5gp7LArh7MdnvyxFiY084ZJ5bnQ4+LAo3ZU/9XxQ/hDVLO5OZcDq8Cpt9O1uwgkFz0I54 j78ifkg1LqqekztVknxn19mrmbMIgaLdfOgckbyiD6WP2KadgbI8p/1Oh1L6tdHFW46nZHcR1pGIp ww7gg+YVZK2xbDIQ3MpXKUodey/y3g6019d6ZJS4fWzgLM1HHY07I/0luUGwttVIoPiJiNMEH1QdY 79jBaKkkkQeb7QjVB6CR46DYDEu0bYxCP0X4u2i6TvE1qfiPfuzTLsIMdMsS0Xzt66D5N+HGDiuhW 78NjJ1Jg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1obNF0-0072zN-L7; Thu, 22 Sep 2022 14:31:50 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A62C5300169; Thu, 22 Sep 2022 16:31:46 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 8D7302BBFEF19; Thu, 22 Sep 2022 16:31:46 +0200 (CEST) Date: Thu, 22 Sep 2022 16:31:46 +0200 From: Peter Zijlstra To: Waiman Long Cc: Ingo Molnar , Will Deacon , Boqun Feng , Steven Rostedt , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] tracing: Disable interrupt or preemption before acquiring arch_spinlock_t Message-ID: References: <20220922133158.1731333-1-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220922133158.1731333-1-longman@redhat.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 Thu, Sep 22, 2022 at 09:31:58AM -0400, Waiman Long wrote: > It was found that some tracing functions in kernel/trace/trace.c acquire > an arch_spinlock_t with preemption and irqs enabled. An example is the > tracing_saved_cmdlines_size_read() function which intermittently causes > a "BUG: using smp_processor_id() in preemptible" warning when the LTP > read_all_proc test is run. > > That can be problematic in case preemption happens after acquiring the > lock. Add the necessary preemption or interrupt disabling code in the > appropriate places before acquiring an arch_spinlock_t. > > The convention here is to disable preemption for trace_cmdline_lock and > interupt for max_lock. > > Suggested-by: Steven Rostedt > Signed-off-by: Waiman Long This seems to be missing a Fixes: tag :-)