Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp4085440rdh; Fri, 29 Sep 2023 10:34:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH7aG8NhdT04HqWpxclC+r6bG6eFdjJQCJ3qPK4iL2uxCgL07Hpb/060Tnu/4d9JV4KQXVi X-Received: by 2002:a05:6a00:1d0b:b0:68f:b986:ff69 with SMTP id a11-20020a056a001d0b00b0068fb986ff69mr7869531pfx.6.1696008859841; Fri, 29 Sep 2023 10:34:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696008859; cv=none; d=google.com; s=arc-20160816; b=BHd1sgHRUNg+aTGiZXOImwbKjytRyLgqAr7MGfMZg9UxNSxShUiVfQEfPKVbB289ME Wl9hmHDcswPg5H6+f2wAb3HMXvP5tqMDFbYwgIgYVneb5sGt6sq3rqqvkI2F9WI0B5Hf aUjSSF5g5gAVrpjXQgtei1ArruzxFMeh2Sw41nYEmNL0Igp1v9vAAa42EG4UhEKU4QhK sPGlnOpa89S3eXOz2aTQ1H7GfmUXz9w0AzLwicL6GkqoNursdQbmOilj2CmnQfAJHpaq +qo57vd9114hSImofonc1SSQOOjOoL5ASy2zmYShErKqO8hbbu90+KKU3mDuhqtOlpjH beDg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=0oAyXAB8Kt0enGgPoo66x41kbTf1AFVvqj5ECchyAUM=; fh=ALcOqEPZ4ZGV3FeBEaGfPRnshlCd40Bkhxj2Q0p74r8=; b=jlYFN/5C2WEoab3bsaxGLODLdBcOcF6VZvfBjKJcVtjz9QrxQ7qIAOMSzH33fX9F2F 7nznLYNggqxTtxFzMTsB9OjGfcGCGo4/yupsHj+5SDvxcV32/Sa1GbG6X+ltROROSKog Wlmb+dIWvzAyWkeVVCDmxMDI9AVASQ3vc+4mYCmCTylleJ97HjV6Tq5DCEIiOgkOLcCy V7IWBSwF2XXANYAFrDNqlp4ZJZGFLRL/n2pyqqvBJA5ANNOR6/lRixsf52jrNKw6vR9H tAdmb6W+/wbhzuDbi8dk/dxwq2g3VZdwOxU0rMz6jeO170CNQxiFIz2jDavN3puJXgK0 Y7tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=aSMTqIrF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id q22-20020a056a00151600b00690f49d9e44si22527367pfu.400.2023.09.29.10.34.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 10:34:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=aSMTqIrF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id E377B81E0FCF; Fri, 29 Sep 2023 07:15:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233272AbjI2OOt (ORCPT + 99 others); Fri, 29 Sep 2023 10:14:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233482AbjI2OOc (ORCPT ); Fri, 29 Sep 2023 10:14:32 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F9A510D7 for ; Fri, 29 Sep 2023 07:14:01 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3232e96deaaso1627712f8f.0 for ; Fri, 29 Sep 2023 07:14:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1695996839; x=1696601639; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=0oAyXAB8Kt0enGgPoo66x41kbTf1AFVvqj5ECchyAUM=; b=aSMTqIrFhTn3HiOITEseOFuCDAONUERX6t6TWwOkq756TUc+lGPv+3nICCbvU2nw+f OFPGdCOLa2uzlCH7t4Lqf3leqQrUDQfuJsJFBJs5sHGoFULKiJZq3VXxESagRtaShtIO bJapw0oJ/a/z1bk3HWQG7YsbJgQjZ/gM/t3iSkXcCCam4TS2OskTN0Oz9mpGvSGnDo0P nXyEq7gqsRDBFNRpSWw9oWkbxKnzOigzbETaMNWKnhG/GgWcpBT9SNZnmO/XvbWhv1N4 xYchjpm8F3QzbqlXYMYnbHPTLNbbCWqpixoT8AYhRUX4HLcBi7CmCnWw+OXybjh1e3pm lKsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695996839; x=1696601639; 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=0oAyXAB8Kt0enGgPoo66x41kbTf1AFVvqj5ECchyAUM=; b=pcXIeCI8bF/fsKjVxPAS9xCm/uVlAzu8Mtk9HmtfsIZG3aUobCtdgGvXUayQhbmEjq 3ju+3ezegwsGp62RynPRA/C/12SPPzL1gr0cQbbptvoDfeNsOFSqbVACBcauNIirP+hS GIHnVNzrYp1yYZ85X4QXYYR9qDaOjNqMFejgZ+BZGAnTLQoHQl9uCDjQIHblMs1fCLFf bDRrA7jJoWFsqR5o1qeg7B2wMAHwmNfPwkh88agY6wkaXW8u0AOxpymYoSoI0igLTn/U sd3Q3s+oC1t7SnujkKYRtgXuQqMZabZix06r1DQQsokjPo0WAledwDud/hh9lmHp7+ve 7moA== X-Gm-Message-State: AOJu0Yx1xQA62GBRnnLwrCbukowCIam/X5wpiqA7h7WAM3VGadSFCs7k fhcEZBeu19aLRXNEluHRPb/DYQ== X-Received: by 2002:a5d:5151:0:b0:31a:e54e:c790 with SMTP id u17-20020a5d5151000000b0031ae54ec790mr3671242wrt.6.1695996838175; Fri, 29 Sep 2023 07:13:58 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:999:a3a0:4e67:5f1a:c933:c857]) by smtp.gmail.com with ESMTPSA id g12-20020a5d698c000000b0031c8a43712asm21606043wru.69.2023.09.29.07.13.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 07:13:57 -0700 (PDT) From: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= To: Steven Rostedt , Masami Hiramatsu Cc: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Atish Patra Subject: [PATCH] tracing: relax trace_event_eval_update() execution with schedule() Date: Fri, 29 Sep 2023 16:13:48 +0200 Message-Id: <20230929141348.248761-1-cleger@rivosinc.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Fri, 29 Sep 2023 07:15:22 -0700 (PDT) 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(); } up_write(&trace_event_sem); } -- 2.40.1