Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp443851rdb; Thu, 5 Oct 2023 10:15:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9yrbMByCX/B3voQTaVSH6pHAfn47NDPjWALOBPHXCeXkfap1CVH2Jpx7PcaLvJKA2Islf X-Received: by 2002:a05:6a20:1004:b0:14c:628b:4b98 with SMTP id gs4-20020a056a20100400b0014c628b4b98mr5278430pzc.4.1696526137761; Thu, 05 Oct 2023 10:15:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696526137; cv=none; d=google.com; s=arc-20160816; b=RJlkN4kMbFV94ZDUJUxxCmGLNk+x1E/xERxYDB1TqVDeUYDBI9nZ3q7Jwrt4RyywTo BsFJgOe4zv8CyACXJR2+YSh6llG48BQAkxnWHT59W/P5mH8RuS6oCsmCvmL+UCstDT/A vHrcl+hmYLtWXqGyRfe3aLQGvaRQ7lHyHAQgGze3ri7omyoxmeRQ7Kv1Yt8LLgBJzaBK TiqFSGZ1eRgk6HGI70wX0vzGo4TRRVQ2JNCqAsPO5fkebDBFTF7rmRyDGeUywJlKK93m NMppYJLjVpLUS+tPhAaTevqs3HvoR9eRaESWSjTZ6tJ2VaBOtDWn4ZddvMqcWD5JwR9k JuXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=MdqE1QXzZBxC4UvHDnV/0ctc/iRv4fmK/Ej1t0SOJgU=; fh=zxzeTajBvIgxg5LbiRuDqPhOGmAUNdzk0U/RrMIud38=; b=FARnevpLPKkj5yG+2YhdPK8/IEv+1kpP2igl5Zl9oIyv69zZMtSaG9Od/IBAFoI8i6 VMEHJIIuWGOzNjRvpRYh7EkY8EuCUs/60RczqVWDDmtzEiFp27kB2TQ0YFIi2g/0OVb7 bdZh6J95Ap96cSXrtw8S4F9yK+zkkf3hKFjW/RxbcSCAPONbm/xF95XD2D1Bj0Odg0xU 8C7fMhKgETAnHUVqMF08CplrCoUWFAEnPF7zGXMyElmTD9qO6pKWlVmAsb0/a8ZTV+jU /yr54ngZf+1vQcbCcHtrrCGD3zL+cBtCocms5HvauK+urwrT6fuFFa1q7mYbkAGleugs R8Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=DmWx5Lby; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id f3-20020a056a00228300b00690b8833ccbsi1847214pfe.270.2023.10.05.10.15.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 10:15:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=DmWx5Lby; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 182F18095D85; Fri, 29 Sep 2023 08:10:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233537AbjI2PKb (ORCPT + 99 others); Fri, 29 Sep 2023 11:10:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230104AbjI2PKa (ORCPT ); Fri, 29 Sep 2023 11:10:30 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA03CD6 for ; Fri, 29 Sep 2023 08:10:25 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-32337a39009so1269965f8f.1 for ; Fri, 29 Sep 2023 08:10:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1696000224; x=1696605024; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=MdqE1QXzZBxC4UvHDnV/0ctc/iRv4fmK/Ej1t0SOJgU=; b=DmWx5Lby+OMEk7SnGUHSNC3ed3MDt6Apfo366825LLy8CRvgAfjc2pOri4jmH6VWTf UmIAzZOPZ396gq+j2jfwi3qVkNsDACFxY8PDzjmcrEEhJzOyyOegzulIo1WWuwMKb98Y yQR82eTlZrHhCOlkHDdLRTWGnY9e99ytWuVJexub5q4JRLYRQsV83mhYNhBqgLNLoLIi MkTHYlxFTgtR+sQh4i1YCl42ipnC0R2YdossRZY1gW5m2l2SgQSOWjA2MkR8vk1jmtu4 87MN9qaZA5NtWC5aVN+lNHxv945QKOFuVy3209IYjkxAzzcs75SZpUr95SQmiJRqbqme Alcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696000224; x=1696605024; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MdqE1QXzZBxC4UvHDnV/0ctc/iRv4fmK/Ej1t0SOJgU=; b=hHSObZSmNybY6xSvfCjykgrXYIynayE0d1sobmXO8XRwQRJB+qRR9mQkJzT/YXrGs7 Jd/EK1oRuglj+nPP4VdOKo7ZTqoMbiynpv/KtFiQp+dO/bZz0WjGEo7fGVG0Yb+fIRIK ZTnYBa6adz3LtBzmebvLkMuaqZ+ji2QOOiobJChulbziN5A1tGmW0Mm9qyg5gxpR6X2R THy5qxgkf8cFAk36FnKkR25xruuKDKU2boZViRnheoAjJqAO+zmEQfWlmZiAvBhbhJHH rgXrCaJXEJnDOJtoEwblc83OqiRMi+kcROlY9OTSjPKFA/zVFT6zKVC0Gw2hL+qbVShN VU3g== X-Gm-Message-State: AOJu0Yx0Rkfuhw0Kw08gamPn82eKsJGw9SLgsTYMe+PHeP3ihgIVgkUN C/0DZq9509F4JnRApY5ozKdtrg== X-Received: by 2002:adf:f9d1:0:b0:323:2b68:e0e0 with SMTP id w17-20020adff9d1000000b003232b68e0e0mr3467259wrr.0.1696000223437; Fri, 29 Sep 2023 08:10:23 -0700 (PDT) Received: from ?IPV6:2a01:e0a:999:a3a0:4e67:5f1a:c933:c857? ([2a01:e0a:999:a3a0:4e67:5f1a:c933:c857]) by smtp.gmail.com with ESMTPSA id d29-20020adfa41d000000b003197869bcd7sm16622036wra.13.2023.09.29.08.10.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Sep 2023 08:10:22 -0700 (PDT) Message-ID: Date: Fri, 29 Sep 2023 17:10:22 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] tracing: relax trace_event_eval_update() execution with schedule() Content-Language: en-US To: Steven Rostedt Cc: Masami Hiramatsu , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Atish Patra References: <20230929141348.248761-1-cleger@rivosinc.com> <20230929110657.7a4b38ef@rorschach.local.home> From: =?UTF-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= In-Reply-To: <20230929110657.7a4b38ef@rorschach.local.home> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 29 Sep 2023 08:10:56 -0700 (PDT) On 29/09/2023 17:06, Steven Rostedt wrote: > On Fri, 29 Sep 2023 16:13:48 +0200 > Clément Léger wrote: > >> When kernel is compiled without preemption, the eval_map_work_func() >> (which calls trace_event_eval_update()) will not be preempted up to its >> complete execution. This can actually cause a problem since if another >> CPU call stop_machine(), the call will have to wait for the >> eval_map_work_func() function to finish executing in the workqueue >> before being able to be scheduled. This problem was observe on a SMP >> system at boot time, when the CPU calling the initcalls executed >> clocksource_done_booting() which in the end calls stop_machine(). We >> observed a 1 second delay because one CPU was executing >> eval_map_work_func() and was not preempted by the stop_machine() task. >> >> Adding a call to schedule() in trace_event_eval_update() allows to let >> other tasks to be executed and thus continue working asynchronously like >> before without blocking any pending task at boot time. >> >> Signed-off-by: Clément Léger >> --- >> kernel/trace/trace_events.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c >> index 91951d038ba4..dbdf57a081c0 100644 >> --- a/kernel/trace/trace_events.c >> +++ b/kernel/trace/trace_events.c >> @@ -2770,6 +2770,7 @@ void trace_event_eval_update(struct trace_eval_map **map, int len) >> update_event_fields(call, map[i]); >> } >> } >> + schedule(); > > The proper answer to this is "cond_resched()" but still, there's going > to be work to get rid of all that soon [1]. But I'll take a cond_resched() > now until that is implemented. Hi Steven, Thanks for the information, I'll update the patch and send a V2. Clément > > -- Steve > >> } >> up_write(&trace_event_sem); >> } > > [1] https://lore.kernel.org/all/87cyyfxd4k.ffs@tglx/