Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp250185rwb; Tue, 15 Nov 2022 23:14:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf68B/T/h6UQlp110Kbj2rpQ7cPxFfaRYsmaTnOZIkLLb3DnrOup/W0rfJAe9C8TVeRQdC7Y X-Received: by 2002:a17:906:b1c8:b0:78d:474c:2a59 with SMTP id bv8-20020a170906b1c800b0078d474c2a59mr16486676ejb.759.1668582872689; Tue, 15 Nov 2022 23:14:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668582872; cv=none; d=google.com; s=arc-20160816; b=HnBqYG/IDwUDO3vWWSLT429eO5rOrDoo3tYY2v3yw9vfFUO9y6qtpARPx4OkIRY8Dc 2kngRugZys45PigwiggGUS/+DyS72/CLTaGMCY6R4ZOV7LHn9PCe7jPheSRAajowYamF dpIIvvO5r93MlRO4gr6JIOqCUT8FErvloOM+1VnjnUty2ewjsZbPHj1vJzV6ZJcbMQTM FnC4EEHuEC1ugJE1e55O4RUSDoXPhyabc3cHpeZy0VEm1FnNWTQEnqJyJ3LsJ0IZOiB+ LsOzeGn+QRpderlRKUAvt2/WXTKqxzJH7lR5MbqIvIcOp/3k6WZGCC3P3QjSeozBqw1/ ok7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=erZsxKYXAgKOEUDWXG47JzujBm/v2Kj9tsD/l1IPFtI=; b=D18OJvpNDuybqHdvGzwMCxJAk2RfRZDVOUgJC88HLadclOImZ05vjQ1t5tU48urfaG STiryCmbKFhazy7gbSue2VFCnTqzky/eIYbGS0WzzJQCx1vXUedH4AVcpH6yh4W8lK1g oMwl/1K5eEMwyahshmNJw0reIJfAeqo9akRXdohNGfRTBSHPadV/se1qCAWU354M+U4g rUD+xOXKP0Sb5Hk3Gw12zuLHSUiR2xEe8e2hcNchf0HzrJEOe+07QVciTNdx5QkaC1Bc Ev1lnvQ5IjUghh63FiOJJ6wqqAzy6Ezv7Nvr4qsoABm8P0k8yHS2oPtdU1KnYfvyrkAe uMmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mEhPZu3h; 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 t37-20020a056402242500b0046443638c9esi12702817eda.262.2022.11.15.23.14.11; Tue, 15 Nov 2022 23:14:32 -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=pass header.i=@kernel.org header.s=k20201202 header.b=mEhPZu3h; 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 S232920AbiKPGhX (ORCPT + 90 others); Wed, 16 Nov 2022 01:37:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233086AbiKPGga (ORCPT ); Wed, 16 Nov 2022 01:36:30 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3B7413E1C; Tue, 15 Nov 2022 22:36:27 -0800 (PST) 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 sin.source.kernel.org (Postfix) with ESMTPS id 48DF2CE19E5; Wed, 16 Nov 2022 06:36:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC374C433D6; Wed, 16 Nov 2022 06:36:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668580584; bh=evQXOWfzVqP+AWTRzWS1x5xxJxZ//Oz93Xhj355NnaE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mEhPZu3huyY3vjMNH7uKCusmU6IkabZe1AJjFTEysaCHB4pGHpmnX/q9edoibF2jX zsdnqgu/5+ooYj9cqWWedEfFS8E6L+wtzsm1yWDfZJ2GIUiS7zzHa3M7vBKSp9+H4f b5Q1Qv+GFvVcAvcO1OoUVJOzWyqKatLhaXZStTJMkOAdQQkl34icyo8VZnbA14mqIr RFk115FB5N092rei/Ttv/7RCUFH9KHNxJXJK8JGn6ZBQ4B6zHv2Fr1wT8fyNlD9tUY IvUykAiZfKRp4RgpKqepLyKutZSYqdlO8sGCJShKxg54LMjdLVoLWPI1ycmHKGt9WW b83xZXytX0tKg== Date: Wed, 16 Nov 2022 15:36:20 +0900 From: Masami Hiramatsu (Google) To: "Guilherme G. Piccoli" Cc: linux-kernel@vger.kernel.org, rostedt@goodmis.org, rcu@vger.kernel.org, kernel-dev@igalia.com, kernel@gpiccoli.net, "Paul E . McKenney" , Masami Hiramatsu , Mark Rutland Subject: Re: [PATCH] ftrace: Prevent RCU stall on PREEMPT_VOLUNTARY kernels Message-Id: <20221116153620.353819e9c6acb1bf39adeca2@kernel.org> In-Reply-To: <20221115204847.593616-1-gpiccoli@igalia.com> References: <20221115204847.593616-1-gpiccoli@igalia.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, 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 Tue, 15 Nov 2022 17:48:47 -0300 "Guilherme G. Piccoli" wrote: > The function match_records() may take a while due to a large > number of string comparisons, so when in PREEMPT_VOLUNTARY > kernels we could face RCU stalls due to that. > > Add a cond_resched() to prevent that. > > Suggested-by: Steven Rostedt > Acked-by: Paul E. McKenney # from RCU CPU stall warning perspective > Cc: Masami Hiramatsu > Cc: Mark Rutland > Signed-off-by: Guilherme G. Piccoli This looks good to me. Acked-by: Masami Hiramatsu (Google) Thanks! > --- > > Hi Steve / Paul, thanks for the discussions on the first thread [0], > much appreciated! Here is the "official" version. > > Steve: lemme know if it's good for you, and in case you prefer to > send it yourself (since you proposed it on IRC), fine by me! > > Paul: kept your ACK (thanks for that BTW) even though I changed the > place of cond_resched() to align with Steve's preference. Lemme know > in case you want to drop this ACK. > > Cheers, > > Guilherme > > > [0] https://lore.kernel.org/lkml/1ef5fe19-a82f-835e-fda5-455e9c2b94b4@igalia.com/ > > > kernel/trace/ftrace.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c > index 7dc023641bf1..80639bdb85f6 100644 > --- a/kernel/trace/ftrace.c > +++ b/kernel/trace/ftrace.c > @@ -4192,6 +4192,7 @@ match_records(struct ftrace_hash *hash, char *func, int len, char *mod) > } > found = 1; > } > + cond_resched(); > } while_for_each_ftrace_rec(); > out_unlock: > mutex_unlock(&ftrace_lock); > -- > 2.38.0 > -- Masami Hiramatsu (Google)