From patchwork Thu Feb 27 18:49:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Liaw X-Patchwork-Id: 2053251 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=lists.linux.it header.i=@lists.linux.it header.a=rsa-sha256 header.s=picard header.b=Mo/7Y6yo; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=hy6l2eKV; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=patchwork.ozlabs.org) Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Z3gNw4MC4z1xrB for ; Fri, 28 Feb 2025 05:49:20 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.linux.it; i=@lists.linux.it; q=dns/txt; s=picard; t=1740682160; h=date : mime-version : message-id : to : subject : list-id : list-unsubscribe : list-archive : list-post : list-help : list-subscribe : from : reply-to : cc : content-type : content-transfer-encoding : sender : from; bh=oU6e8HAzJ0RySktrf7Ka/icqSrQVJ6ZFlVR4mtOu/64=; b=Mo/7Y6yomPRpxOYPcOEmFyiHOY7dbeRPRVNovgHNOqBUGg9+TiWsbYmHKP6GTGfpHvpUz RfFqCsC+4Z29jOkRukj63QmUVIrb2T0sruTEMZSfeuIdZRznH5GNjFJkrsCk0SGJIxvo0Z0 4NeAhG0wiYa82K2urenxjHb1V+MpMWU= Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 1097D3C9E14 for ; Thu, 27 Feb 2025 19:49:20 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [IPv6:2001:4b78:1:20::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 98FFE3C9CA9 for ; Thu, 27 Feb 2025 19:49:16 +0100 (CET) Received: from mail-pj1-x1049.google.com (mail-pj1-x1049.google.com [IPv6:2607:f8b0:4864:20::1049]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id 15D1C656FC9 for ; Thu, 27 Feb 2025 19:49:16 +0100 (CET) Received: by mail-pj1-x1049.google.com with SMTP id 98e67ed59e1d1-2fc518f0564so2923780a91.2 for ; Thu, 27 Feb 2025 10:49:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1740682154; x=1741286954; darn=lists.linux.it; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=hfpMHficPWrAzmqPn/uU3GSK8Z7WKtGRF7GafZQXVK0=; b=hy6l2eKVEk7MY6PkbKFrXIxq7Lmkbaqi20Fa2hkvbX1Fto7ZFSShFju1J9qhqvhV/R gVfpHqdbrNywr0/T/cUDiwy6jgzZj3hUJT1aaLoFrynFXP4H78/6WPtTWiAx0LrXGXh5 3h6dO3MZfsl1J5QuJCHOZAyrvXsFG/M3fYnELRa5HyreAmQBoU2ZDqp2OUWvJbQgoKUX Ma/74pS+sfMsZlXkbSyfIsWEj7lkCd3QQV8zofJn9zdxttzaFFF4h4lUlQAoTKtXuH4M 57m/QzTBkFFzIM4bqAkQM93l8I4sqZ4uiLO2uOMIFkqweST6C+gCvvuu06PGvoZW6zlF b8WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740682154; x=1741286954; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=hfpMHficPWrAzmqPn/uU3GSK8Z7WKtGRF7GafZQXVK0=; b=w27h8gxZlDWbl+3xNY3u7DCXkZYsBItR//jEM0YqlyckDq0AYC4BHamqA5I7IinsO4 DXbyCON98KH5s/bCDxkRwJPjiroA4DREX9HsHqwr84WC7K1IbdD5Ehk6wsJvwStMZe6M izFN7GchSmwgP5YttvCQJ8aCNNxU2r7n0DBjfJYN03OVXp/udS5/aFf6kuLRVSLaAIxx hmz0zFAAvpFc9Ez5ZDtZNMOmGfwF+aKKfEV7uK95n1okZTms9mNgjaaLdoPzZtNtHYNi IOLDDuFwfSpSPhY+KwZqRHqkjYDh23Z4s6zOVg70J+9M7qQ0aRSn7FHn2aVGQLk2bZe+ YeBA== X-Gm-Message-State: AOJu0YzuP3UTlwYQz7AHOE2R2KQpFi4knmCcmW1URqFgfNEd7p9b+Cvw awrZCQQNLlO82BW2+0UgeUolNeNLIbi9iqlpEhoP0EiDRWUgP1x3Ldt9BFqU4rm1U+4FXnJ63A3 FxQQ34gqrW8pnaJj2fKC9v7bJ7crvbz1yVR4VAi+n7lR6NPeX3cPLtdYPgupsZUiZ1/JXRhTjht 60mJZTePb3BRFHcvfzKPcSEYqsLys= X-Google-Smtp-Source: AGHT+IFX+eMRG1U0jeQHiDNRbvysveuC0iz7z3is+s+AzguPnb39FjXHNt2dUL4KeGvb/RGIX1ugZx4/kys= X-Received: from pjbsf12.prod.google.com ([2002:a17:90b:51cc:b0:2e9:38ea:ca0f]) (user=edliaw job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:3ec4:b0:2ee:f80c:6889 with SMTP id 98e67ed59e1d1-2febabe1e9amr648594a91.33.1740682154442; Thu, 27 Feb 2025 10:49:14 -0800 (PST) Date: Thu, 27 Feb 2025 18:49:07 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.48.1.711.g2feabab25a-goog Message-ID: <20250227184907.392133-1-edliaw@google.com> To: ltp@lists.linux.it X-Spam-Status: No, score=-7.4 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_PASS,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL shortcircuit=no autolearn=disabled version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on in-2.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-2.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH] perf_event_open02: set process as RT during Setup stage X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Edward Liaw via ltp From: Edward Liaw Reply-To: Edward Liaw Cc: "kuan-ying.zhu" , kernel-team@android.com Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: "kuan-ying.zhu" Move the action of set the task RT from the Verify stage to the Setup stage. Avoid potential risks of task migration due to scheduler policy. Signed-off-by: kuan-ying.zhu Signed-off-by: Edward Liaw --- .../syscalls/perf_event_open/perf_event_open02.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c index 7306ecf51..7b3305a52 100644 --- a/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c +++ b/testcases/kernel/syscalls/perf_event_open/perf_event_open02.c @@ -198,6 +198,12 @@ static void setup(void) { int i; struct perf_event_attr tsk_event, hw_event; + struct sched_param sparam = {.sched_priority = 1}; + + if (sched_setscheduler(0, SCHED_FIFO, &sparam)) { + tst_brk(TBROK | TERRNO, + "sched_setscheduler(0, SCHED_FIFO, ...) failed"); + } for (i = 0; i < MAX_CTRS; i++) { hwfd[i] = -1; @@ -271,12 +277,7 @@ static void verify(void) unsigned long long vtsum = 0, vhsum = 0; int i; double ratio; - struct sched_param sparam = {.sched_priority = 1}; - - if (sched_setscheduler(0, SCHED_FIFO, &sparam)) { - tst_brk(TBROK | TERRNO, - "sched_setscheduler(0, SCHED_FIFO, ...) failed"); - } + struct sched_param sparam = {.sched_priority = 0}; all_counters_set(PR_TASK_PERF_EVENTS_ENABLE); do_work(8);