Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp98295rdb; Fri, 29 Sep 2023 18:48:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGxL8AOmVxbPoD/FL6geXk17AiIdPovRqfQrypZrwtvNSMo+be1F4cAcOcqecZoBHoggzGJ X-Received: by 2002:a17:903:1109:b0:1c4:4251:68b3 with SMTP id n9-20020a170903110900b001c4425168b3mr6129536plh.54.1696038490500; Fri, 29 Sep 2023 18:48:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696038490; cv=none; d=google.com; s=arc-20160816; b=mz8M6wc/wN+cxlwlebXdJfCQKdHpgClc/y42I9wTdhoVYprg6Nci55vLACnq9fq0WB qYGLrfzqShFJmr7pImsmf5VZ3zPw/XIpw0Z/khxCUiqyNEW/smRY4kuv4RXG0V+vlUmi AIHBbyXyjq8LmBNquHBCgDo4shoL6n26oKq7wZNmW2dsqNDAB64Q3iati25amqP4Brp9 xniSpiH6gv079Gcthhk5JqTe8sLoKTGdgUFThq8Q6aMGJHKeebVBp/SMoEigA5e260pc eY9fcwERas2MLGKp9dexwN2zqi5QVEz0iZrHZr5BmTmPYXGubmuV4jxmDeLxRjFve+sw kUgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=jPAXVGa1vaZNDKI9GqcxOhnuNCrtvlqJP4AnZpE32Zw=; fh=GvG/19GkoZJCHVZxR4kD9rDBNg4FSy88tuot5kkkch4=; b=GlyUgtZ8lctUbbHwwleWJvGmkqwzYJUAo5NcA/Zf30RK5unBCLbECu3NvcJ3AhlhcW KrhUeu/M7gCB9xmkdzqlKOO5b/7+7Koz3o3ICCLzCrgmVM/cRKNA4PbIgppSmR/trJdO GR/OBIo2YtrZrig0SHeYhOfbYjuOoyq9XBJWAVLEKuwe/krs8xKB7CRkkJM9KrdYVE/W 5fK7OaHVcW5xonofiCgSS5krB67Oi4w6F6nsYKEZf2YSMfDk3RDclo0xldvXvhosfE3y 8Dyr3pWbHRVPWpRRjgUvxNAC7w3GCEW9cCF162RhbmX7pek4vAA6Au5r1PoZ6GtLFdgx 4cQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=pouZxb7W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id u7-20020a170902e5c700b001c61073b06bsi16638999plf.427.2023.09.29.18.48.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 18:48:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=pouZxb7W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 167C383B85D1; Fri, 29 Sep 2023 13:14:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233516AbjI2UOZ (ORCPT + 99 others); Fri, 29 Sep 2023 16:14:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233365AbjI2UOX (ORCPT ); Fri, 29 Sep 2023 16:14:23 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A70A1AB for ; Fri, 29 Sep 2023 13:14:15 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2bfea381255so236496841fa.3 for ; Fri, 29 Sep 2023 13:14:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1696018453; x=1696623253; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=jPAXVGa1vaZNDKI9GqcxOhnuNCrtvlqJP4AnZpE32Zw=; b=pouZxb7W6gqWlNn9qZf4kA4FURTPm0gEavOitK5PvNTxVQycRF4PPfVHPS1g/1LFSj BWwETay+0bFf5PNZo+CdO1ami1j7EbYDBmD29l7ysUrCmkTCk6TVIEM2nM8H+PbSmFBN AXk7myI4ZEmDJGbL3wfuu3vfbD11h3Ejm5HZpI+PLw15/lXW00exSyjN5OFRii0g29Ei lwVqEBqMHK703n3vtNkHG9z703rFRCT1UdBnUZCSBrjLZ/33X3mB6LsvpeZuqidjs3kF eWTzbvCZoFgJV7X7jxIl5JNUnpRzXVyEK5E3D2icNqiqzvlcUsyt4Ebnc7PJCQtV5QkG qAVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696018453; x=1696623253; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jPAXVGa1vaZNDKI9GqcxOhnuNCrtvlqJP4AnZpE32Zw=; b=eDmYN0GGlWm/bKkgak6vViBWcjhNR+fD9jrO9j+MxUbGKUmw+8CPpWg2dQv13ndPlN bxGBJdogXsg0vB3RrOCosnOyk6v4me2/Qmte/xkj+qHjyQPsWBSU4HydjMWK6zKl6tNQ rFnZMK2EVMqvPgOAZFg7ZGECdP7NW7L4N6eX0GL8zmkYCjvU3CV4KzRPu/0evq8RjAg5 qYru0PUOexrJm2ExtDc9vHcLUhWlTI009Rnx6ijFquBpAwY2Rfrogp3fQrf8vOHM0AO7 ppabtBvmwxGJQWLt/jk0obTe/wQ3Gr2dOQW0X8OMPTnigl61JGH9gBTcHg16/dso8ya/ 5CZg== X-Gm-Message-State: AOJu0YwpMHNDbpuv5/gOLaeX3OaIOMurTXe9n/PO4jvji8BQ3tqMawWT tUlNm1JudT3cm8KRvniIZXxtRuXXKcKN3HiiqnhC2g== X-Received: by 2002:a05:6512:401a:b0:503:19bc:efb with SMTP id br26-20020a056512401a00b0050319bc0efbmr5920186lfb.29.1696018453380; Fri, 29 Sep 2023 13:14:13 -0700 (PDT) MIME-Version: 1.0 References: <20230929191637.416931-1-cleger@rivosinc.com> In-Reply-To: <20230929191637.416931-1-cleger@rivosinc.com> From: Atish Kumar Patra Date: Fri, 29 Sep 2023 13:14:02 -0700 Message-ID: Subject: Re: [PATCH v2] tracing: relax trace_event_eval_update() execution with cond_resched() To: =?UTF-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= Cc: Steven Rostedt , Masami Hiramatsu , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 groat.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 (groat.vger.email [0.0.0.0]); Fri, 29 Sep 2023 13:14:59 -0700 (PDT) On Fri, Sep 29, 2023 at 12:17=E2=80=AFPM Cl=C3=A9ment L=C3=A9ger 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 cond_resched() in trace_event_eval_update() allows > other tasks to be executed and thus continue working asynchronously > like before without blocking any pending task at boot time. > > Signed-off-by: Cl=C3=A9ment L=C3=A9ger > --- > > Changes in v2: > - Use cond_resched() instead of schedule() > > 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..f49d6ddb6342 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]); > } > } > + cond_resched(); > } > up_write(&trace_event_sem); > } (First email got rejected as gmail decided to switch back the format to html :(). Sorry for the noise. Thanks for the fix. The boot time improvement is evident in both spike/Qemu. FWIW Tested-by: Atish Patra Reviewed-by: Atish Patra > -- > 2.40.1 >