From patchwork Tue Dec 27 02:30:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuang Wang X-Patchwork-Id: 36737 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1190335wrt; Mon, 26 Dec 2022 18:33:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXtKfs/NLcvqIyeSA42xUGrWkt6OLL5lodjwxBspjA/YYvSyMuHQe6Oe8k/9mwfp/g1beLzc X-Received: by 2002:a17:90a:664a:b0:223:ff2e:ca5c with SMTP id f10-20020a17090a664a00b00223ff2eca5cmr22940077pjm.42.1672108419515; Mon, 26 Dec 2022 18:33:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672108419; cv=none; d=google.com; s=arc-20160816; b=DsBOqGyqHJGYuVremRYHtm9toCJMWU78bQJVe7FdiDtA22eY05EJXyuPDcZL25IPaF zpxyqZVGyBQXSiNoa/oZgf8riucmGz2X9z1aeNumYuUS226EWBiksmNDuGLo8Qdz2R7M 6rXsTRyvvfrqa0wdqq4Fiw3PjiBdQM1neltf9yfAIQ+OursZXal7qYpBvNIEL4ZV/djr eHgdcqeCplqGBHtgKYruznDIUX0TWwuASEaNh/ArtVHj8pRlopZo490AdcQkWukoYriC G5vUpUZcC2DsYnt9CEVa7FMw+CbUBLu6Pk/N8dCtgrnSGnDhMWv1ca3eGj989R916UkP eIow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=yF/RCAm9t4WU+SnTtfg7uF5BF4LZjOgAhiX2hd2wX/4=; b=qarg2n+3+E5ja83QkPETxBNhQznUbCVL4HCGe5yMewCauUTjfviZQQUBcVDHFNdvar 8/Yz8zd0pMatG036HAIFfabYGYKGOHQgEaFuVnvLLNTJz3sGTgNaKv4Xg4tp1YfNtOmK slmNbh13I/7mvkyAUgeAfwfnkZW8ApsKpfjgEhixVIIuvnCmoVK023fnC5uce8s0fY9u 4g5Azf0J0vioC3OJMl4UbQLR6/NM1kX/8VrxgklcZmHXvjvjF5QM94Rie+/2ovkqEsMk LBuEqZI3KPbGtHm5cw29NjUiTyLJJzo9QYQ+HytBZkwAQR6dFRCG+S0RRcADfq9VODxJ S/1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=C5WwR3mh; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mw4-20020a17090b4d0400b00218cbdb0de5si17826239pjb.72.2022.12.26.18.33.27; Mon, 26 Dec 2022 18:33:39 -0800 (PST) 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=fail header.i=@gmail.com header.s=20210112 header.b=C5WwR3mh; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229643AbiL0CcE (ORCPT + 99 others); Mon, 26 Dec 2022 21:32:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232648AbiL0Cb0 (ORCPT ); Mon, 26 Dec 2022 21:31:26 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6617E63FD for ; Mon, 26 Dec 2022 18:30:55 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id hd14-20020a17090b458e00b0021909875bccso13577217pjb.1 for ; Mon, 26 Dec 2022 18:30:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=yF/RCAm9t4WU+SnTtfg7uF5BF4LZjOgAhiX2hd2wX/4=; b=C5WwR3mhPyjHzEJ0/Os0JQZUyDAt+bGBvC9eFADQ71Q+XUC+XCk8/WSIsuTglj8avg uMGW9yTnWZBcZciNSfbpVGz+xlNdvOO4mVznq74+hWB8ojpaGv/fLMXhCU1FBPRsyeft bgjqWwwmOM81B4OXYyQIP6+DH0n1GUzE92HW0mcYKK+TOfp5f0b5/mumWMF3oxuq1r+n nqFh4SFmOVcCpv6cI7yPqlqiGM7s/xWtF5l0rrrpdyI/F37OX8xlrPb91O76Xou8mPP5 +9dc7KE8w16lhOiGSEhNiU3Kb1/sri7le3egAwlWeJ+kURf988rlQe/XGs2BkydEcEfh bbqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yF/RCAm9t4WU+SnTtfg7uF5BF4LZjOgAhiX2hd2wX/4=; b=ejyA/sWIib8GjaLqBHHBv3zog+8Vv6/m5TxKxpjqZcW0+O5XtL2P6y5/UFx1XYqDNe TatUkyAldwJT4xmrX+u820GDfow2JlndmZtdfvkn9K9IyXNRkpfOKX0IuT6FVh2Ksx/L 7r84OgBPSBWyeNOkMHjdIkkBa6Pcu0CFs/Q+OYECsuhqS9Yo3FfGXRizGA6w5ejV58Lo flXEqIYVlRSbxJibEWuHbv9zwvmuDDgQ016cQZnQ/LRDDUnXEszSjRbhfE9zIBnlSwwx JVUkyUaNt/UAvvDJiey7L/6ygyqW/J7q3g9ZIDxu3LUOwpguBT8yQyThnc7t5F1UWGqJ lgPg== X-Gm-Message-State: AFqh2kqC87uQq0hkGZACNgrRjQx6DvPKwF1YUKrertIrKeqyGIH9Mz7U AxNUb0+w3w73asMbdcoCUravXSzifTg= X-Received: by 2002:a17:90a:d910:b0:213:9bf5:6a10 with SMTP id c16-20020a17090ad91000b002139bf56a10mr36780839pjv.49.1672108254547; Mon, 26 Dec 2022 18:30:54 -0800 (PST) Received: from localhost.localdomain ([47.242.114.172]) by smtp.gmail.com with ESMTPSA id j9-20020a17090aeb0900b00218b32f6a9esm7072531pjz.18.2022.12.26.18.30.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Dec 2022 18:30:53 -0800 (PST) From: Chuang Wang Cc: Chuang Wang , Steven Rostedt , Daniel Bristot de Oliveira , Masami Hiramatsu , linux-kernel@vger.kernel.org Subject: [PATCH] tracing/osnoise: Use built-in RCU list checking Date: Tue, 27 Dec 2022 10:30:36 +0800 Message-Id: <20221227023036.784337-1-nashuiliang@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753332757877309689?= X-GMAIL-MSGID: =?utf-8?q?1753332757877309689?= list_for_each_entry_rcu() has built-in RCU and lock checking. Pass cond argument to list_for_each_entry_rcu() to silence false lockdep warning when CONFIG_PROVE_RCU_LIST is enabled. Execute as follow: [tracing]# echo osnoise > current_tracer [tracing]# echo 1 > tracing_on [tracing]# echo 0 > tracing_on The trace_types_lock is held when osnoise_tracer_stop() or timerlat_tracer_stop() are called in the non-RCU read side section. So, pass lockdep_is_held(&trace_types_lock) to silence false lockdep warning. Fixes: dae181349f1e ("tracing/osnoise: Support a list of trace_array *tr") Signed-off-by: Chuang Wang Acked-by: Daniel Bristot de Oliveira --- kernel/trace/trace_osnoise.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c index 94c1b5eb1dc0..210e1f168392 100644 --- a/kernel/trace/trace_osnoise.c +++ b/kernel/trace/trace_osnoise.c @@ -147,9 +147,8 @@ static void osnoise_unregister_instance(struct trace_array *tr) * register/unregister serialization is provided by trace's * trace_types_lock. */ - lockdep_assert_held(&trace_types_lock); - - list_for_each_entry_rcu(inst, &osnoise_instances, list) { + list_for_each_entry_rcu(inst, &osnoise_instances, list, + lockdep_is_held(&trace_types_lock)) { if (inst->tr == tr) { list_del_rcu(&inst->list); found = 1;