From patchwork Thu Jun 13 21:00:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Liaw X-Patchwork-Id: 1947569 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=ddHtnFiy; 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=JXgwj5+P; 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) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W0Zb95cXgz20QH for ; Fri, 14 Jun 2024 07:01:41 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.linux.it; i=@lists.linux.it; q=dns/txt; s=picard; t=1718312499; h=date : in-reply-to : mime-version : references : 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=f/MJSyIL2EJpgSKKpyp7/LDpJtKAdjCJPT6iEhTOKLw=; b=ddHtnFiyunsX68xryBC6i6OkF+Xnw58e6DONfRCzqjl+BNQevjntFQbDiFf3umCPVgKb7 428OGfEw4z+Kl0ww4XBuwi/gDfO64sdPPDUXeSO6OEu1OVqjlswZrXryvxw9VRP9tes+w3T OduyOzDwlXjYL/cEQu//an2qtGtWS/I= Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 7B4D23D0C5A for ; Thu, 13 Jun 2024 23:01:39 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [IPv6:2001:4b78:1:20::3]) (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 68EA13D0C5A for ; Thu, 13 Jun 2024 23:01:06 +0200 (CEST) Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) (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-3.smtp.seeweb.it (Postfix) with ESMTPS id BB7771A00438 for ; Thu, 13 Jun 2024 23:01:05 +0200 (CEST) Received: by mail-pg1-x54a.google.com with SMTP id 41be03b00d2f7-6e4d1605a03so1400164a12.3 for ; Thu, 13 Jun 2024 14:01:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718312464; x=1718917264; darn=lists.linux.it; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=j6mpbqsQj4TDIMg3c1XJXVU2quuYMeVG+UUMI9pH1XQ=; b=JXgwj5+P/QfKQMkfLeI0P4rdc7P/HsSAq5jii7C3qL1CvF3JP2YdjtpUPHwg4xFtGv eHP7af6etfKctog+aYD+h+8jTUSXdb9Gk7ggmAay1Ikpq/lpQqxywl5S2FQbA1U8YXn0 6kWDNZCSIvdTtaGIcOv2t94RmgkuuxiLl7Ps0Tb0rdHJSzsUIqX9bvo4JkQQm3QbkHG+ V4ZMFRy6syUk+sxpp8C8o2voge14rjRKb4EMR9wRAZ8WjZ74qy1eUj9TR1xt2BTHvgKm /BKIfhqQmDP3E1lnm0jDPg0UGQkK6/4rRWpZr5oDbXcxHTOfdn+UeXeRWOyUitgFA5sl lvZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718312464; x=1718917264; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=j6mpbqsQj4TDIMg3c1XJXVU2quuYMeVG+UUMI9pH1XQ=; b=O9/Y/zvk/XlRfvp70qm67mOhF/bIyHAb/izUQStj640xlkrfsuS9i6LLRjIX65/J+s OiOXeTgE+kdImamNJrDzjOJh3huSflkv15hIVqNc5M92Vd6/XumDsP6PexdkA8oF34fJ IceJt/U8V5kD7ognmHYX9wwgj2Hv2SINF2n81iMliFcfbE+s7YkTekTQuZ0Ikbk+ZbUW zYohUCh13nNAZBKTYuhN7osInu1pNIRryjafVJ9K2D+/EsIqb67eU4TM+XKkXYMqBEO8 WM6Rq3vlhokXtlqBBYONw0oLWjSZeVnBKKFPrC0j/mU0Hmybz9MvEguPSXuvfHw999po SAyg== X-Gm-Message-State: AOJu0YwqV55Vibr4NETHwWfUyNN586t+CeAYR2hfTtn1Jonz/IlX0iAi og16uRlO7q+f50Yrq6ChTnCmbbN8xYLHudKEVDwhBGhe94pM1xmC7ll/EBUVqhN6vsrtRx4+nAd q6hxElnDk2Tw2r4UaNSqG02ftP1r5prilVTB1g3y3cjTeruOe+iwmOEWNcxRL/Gwzf5Wq6Bzb1k KIcefoi/QBMuTVuVebetCy/ZKA2z4= X-Google-Smtp-Source: AGHT+IGf6xMrRzS959QtvDEDIAwLioXT83+UfAQ4dfpeGqS2o3OgMhvNca5cC1jEaIlGYXt0uOz5RWcQEIk= X-Received: from edliaw.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:305d]) (user=edliaw job=sendgmr) by 2002:a63:2446:0:b0:6be:96a4:1363 with SMTP id 41be03b00d2f7-7019a78c7d5mr2029a12.10.1718312463886; Thu, 13 Jun 2024 14:01:03 -0700 (PDT) Date: Thu, 13 Jun 2024 21:00:58 +0000 In-Reply-To: <20240613210059.352767-1-edliaw@google.com> Mime-Version: 1.0 References: <20240613210059.352767-1-edliaw@google.com> X-Mailer: git-send-email 2.45.2.627.g7a2c4fd464-goog Message-ID: <20240613210059.352767-2-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,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, 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-3.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-3.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v4 1/2] sched/starvation: Fix sched_setaffinity return check 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: kernel-team@android.com Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" TST_EXP_POSITIVE to check the return value is incorrect because sched_setaffinity returns 0 on success / -1 on failure. Signed-off-by: Edward Liaw --- testcases/kernel/sched/cfs-scheduler/starvation.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testcases/kernel/sched/cfs-scheduler/starvation.c b/testcases/kernel/sched/cfs-scheduler/starvation.c index eb9fd6ff5..1d0d5ff97 100644 --- a/testcases/kernel/sched/cfs-scheduler/starvation.c +++ b/testcases/kernel/sched/cfs-scheduler/starvation.c @@ -54,7 +54,8 @@ static void setup(void) CPU_SET(0, &mask); - TST_EXP_POSITIVE(sched_setaffinity(0, sizeof(mask), &mask)); + if (!sched_setaffinity(0, sizeof(mask), &mask)) + tst_brk(TBROK | TERRNO, "sched_setaffinity() failed"); if (tst_parse_long(str_loop, &loop, 1, LONG_MAX)) tst_brk(TBROK, "Invalid number of loop number '%s'", str_loop); From patchwork Thu Jun 13 21:00:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Liaw X-Patchwork-Id: 1947570 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=D0FHiAwN; 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=I0/akAQJ; 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 4W0Zbf062rz20QH for ; Fri, 14 Jun 2024 07:02:06 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.linux.it; i=@lists.linux.it; q=dns/txt; s=picard; t=1718312523; h=date : in-reply-to : mime-version : references : 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=JPC8rwzLorzy+xTmSMf06n1Auuf7n2usBOuH4Zx9YIE=; b=D0FHiAwN7Q/3YSB3N2DieoVAg1LBye+YyNHV4RcCXOjojiLZ30A5qJZEHaZAfWBLzNtPr tQf6JMlhR8jW8+ZUZrKSY8DCICo+UHrXfTTJvnIlzm2te8vxdGfmUVZNqJEskHPKwVMKvm0 K2QbTOeW22GLqUbgtK9OMu4yGkXbnQE= Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id A01633D0C68 for ; Thu, 13 Jun 2024 23:02:03 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) (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 053903D0C62 for ; Thu, 13 Jun 2024 23:01:07 +0200 (CEST) Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) (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-5.smtp.seeweb.it (Postfix) with ESMTPS id 755B7600BFD for ; Thu, 13 Jun 2024 23:01:07 +0200 (CEST) Received: by mail-pj1-x104a.google.com with SMTP id 98e67ed59e1d1-2c2e7927a77so1309144a91.3 for ; Thu, 13 Jun 2024 14:01:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718312466; x=1718917266; darn=lists.linux.it; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=7tcpVP6ZIV5BKbOnCsVfRUmjz6PTJVpdIFbEniVmaMw=; b=I0/akAQJj/403MlApsI/J3y9cPYHk8wpX7RS1gCOfq4E7HMmRUj55MIqDOb3CGBnEU lGIwkRjU4CqbEtC8N5QaG8vnr1miVSKvB92vpMXPHRFBFCitpohf8RPP+dzMgEULgNAC 6SiP0DrUowvHHm2i1ijc8qKp2o2RBFakdWSWcyLp8MMhkrpMAIZ5HJ8AsKWLwP1DEDfp /5aSbttfh2VU/jJQ6Bf+JQ3mkWZfP1lWLyvWR8pEllvlEKMuv4WHUzEwSAfu/sSIA8iQ DxGmOe2e/deYa+KTqOzsvzvEEhOmZXTywN3RlzaWYIwHbiQrqMvWMtNAt80zXU9CSh+j /BCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718312466; x=1718917266; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7tcpVP6ZIV5BKbOnCsVfRUmjz6PTJVpdIFbEniVmaMw=; b=nfHUiWnRWP9/EK6UgG/7VbSXgdFt0Drvqwe2t/SiA7ViCcF6xv2pZNIfd4J3VHnLFW IbRH3Xl9iXDMVQIdIkm6wuoeFlz9O/0KBJ+Mq2K1Sn+6k8MMHyxuYvU3K3Nl6vN8IIV4 Tk5osfobCy7ZtglCiv3fErD8RgWeY/ISTJh0VbQexbvE5qTiQO07AKcUNfhSc17kOoS+ W69sQ7zNK22IJ4Uyvgxzslpd7nK2CMqINUix/t9Mtik0cdjAAMiyeprDEgA57glKzjp+ /NdkzrY2EkoBB0pAhulzvgtR6QbsSjm37W1JFLY7glQXG67XZIZavMIoQlEXTevIHtNV aOYA== X-Gm-Message-State: AOJu0Yw0isYbt37JuhWbxSBGr4QcV56ow+aUkttwjZ7vEz8eCKgKHrnC +x/4T9KCxkFcGc7lE6M0SZS/70wYth81Vxa+C+7Ti0bZRJsE1NvKoOHPdnmkhQes0rtKYN9pReg OUU080z8G3ECtF8JaRgjSig4E77hfeg6XpLCVkWriBEffzbz8b1PVDZPKwe0vchs0pRkwUag5tc SjCs4Nm+Wj3bbf88/oW2gPGddjVpo= X-Google-Smtp-Source: AGHT+IEiKwO4/rWU7zBAdLls+5f4oqZuRI6LeAQ213l/S4QJz4ZgGHR83MZbN3kAMKXXUSyxWJ++/DO5dXg= X-Received: from edliaw.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:305d]) (user=edliaw job=sendgmr) by 2002:a17:90a:c711:b0:2c2:c661:fa3e with SMTP id 98e67ed59e1d1-2c4dbd30a72mr21664a91.6.1718312465519; Thu, 13 Jun 2024 14:01:05 -0700 (PDT) Date: Thu, 13 Jun 2024 21:00:59 +0000 In-Reply-To: <20240613210059.352767-1-edliaw@google.com> Mime-Version: 1.0 References: <20240613210059.352767-1-edliaw@google.com> X-Mailer: git-send-email 2.45.2.627.g7a2c4fd464-goog Message-ID: <20240613210059.352767-3-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,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, 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-5.smtp.seeweb.it X-Virus-Scanned: clamav-milter 1.0.3 at in-5.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH v4 2/2] sched/starvation: Choose from available cpus 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: kernel-team@android.com Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" From: Edward Liaw via ltp Use the first available cpu in the sched_getaffinity set. This test was failing as a 32bit test for some arm architectures where cpu 0 does not support 32bit applications. Signed-off-by: Edward Liaw --- .../kernel/sched/cfs-scheduler/starvation.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/testcases/kernel/sched/cfs-scheduler/starvation.c b/testcases/kernel/sched/cfs-scheduler/starvation.c index 1d0d5ff97..0f876880d 100644 --- a/testcases/kernel/sched/cfs-scheduler/starvation.c +++ b/testcases/kernel/sched/cfs-scheduler/starvation.c @@ -49,10 +49,26 @@ again: static void setup(void) { cpu_set_t mask; + int cpu = 0; + long ncpus = tst_ncpus_conf(); CPU_ZERO(&mask); - CPU_SET(0, &mask); + /* Restrict test to a single cpu */ + if (!sched_getaffinity(0, sizeof(mask), &mask)) + tst_brk(TBROK | TERRNO, "sched_getaffinity() failed"); + + if (CPU_COUNT(&mask) == 0) + tst_brk(TBROK, "No cpus available"); + + while (CPU_ISSET(cpu, &mask) == 0 && cpu < ncpus) + cpu++; + + CPU_ZERO(&mask); + + CPU_SET(cpu, &mask); + + tst_res(TINFO, "Setting affinity to CPU %d", cpu); if (!sched_setaffinity(0, sizeof(mask), &mask)) tst_brk(TBROK | TERRNO, "sched_setaffinity() failed");