From patchwork Thu Jul 8 15:18:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 471621 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB895C07E99 for ; Thu, 8 Jul 2021 15:18:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C2FA6613D1 for ; Thu, 8 Jul 2021 15:18:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231963AbhGHPVO (ORCPT ); Thu, 8 Jul 2021 11:21:14 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:43338 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231951AbhGHPVN (ORCPT ); Thu, 8 Jul 2021 11:21:13 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 1B88821D1A; Thu, 8 Jul 2021 15:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1625757511; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PJALGm/UJuYtsiLT5DCOXNqTowrtTlQ1muuYP/2gBMM=; b=1Dw+pJAdZNbbag7QayBqP1tmN+86qmtq+RE1L798a2hkwdsmagg3pVSFHVXCI0uqmjQQY3 FyIH5SSARs2zlMpvlsCAZ0Kn3K0o/mtmDvejQFZnoiDgfapZMemATlH0pap2wciNtYnCro l+EVvMdB933MqW9s/8QgGN3GpQlmDNg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1625757511; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PJALGm/UJuYtsiLT5DCOXNqTowrtTlQ1muuYP/2gBMM=; b=IfYACxh1JiG0CXNUreJ9zXUsKy2tJECKHm/sqmmcl1eB44kP1EY01YcH3rbUBJ9lo52W6z h/Dlm2AmMpS8hYAQ== Received: from localhost (unknown [10.163.25.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id F121FA3B8D; Thu, 8 Jul 2021 15:18:30 +0000 (UTC) From: Daniel Wagner To: Clark Williams , John Kacur Cc: linux-rt-users@vger.kernel.org, Daniel Wagner Subject: [PATCH rt-tests v2 1/3] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np() Date: Thu, 8 Jul 2021 17:18:25 +0200 Message-Id: <20210708151827.21430-2-dwagner@suse.de> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210708151827.21430-1-dwagner@suse.de> References: <20210708151827.21430-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org pthread_getaffinity_np() prevents static builds as glibc does not expose it for this configuration. Instead use sched_getaffinity() which is always present and has the exact same semantics. Fixes: f240656b056b ("rt-tests: cyclictest: Fix -t without a user specified [NUM]") Signed-off-by: Daniel Wagner --- src/lib/rt-numa.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib/rt-numa.c b/src/lib/rt-numa.c index babcc634d57e..bb0121a65eca 100644 --- a/src/lib/rt-numa.c +++ b/src/lib/rt-numa.c @@ -68,15 +68,13 @@ int cpu_for_thread_sp(int thread_num, int max_cpus, struct bitmask *cpumask) int cpu_for_thread_ua(int thread_num, int max_cpus) { int res, num_cpus, i, m, cpu; - pthread_t thread; cpu_set_t cpuset; - thread = pthread_self(); CPU_ZERO(&cpuset); - res = pthread_getaffinity_np(thread, sizeof(cpu_set_t), &cpuset); + res = sched_getaffinity(0, sizeof(cpu_set_t), &cpuset); if (res != 0) - fatal("pthread_getaffinity_np failed: %s\n", strerror(res)); + fatal("sched_getaffinity failed: %s\n", strerror(res)); num_cpus = CPU_COUNT(&cpuset); m = thread_num % num_cpus; From patchwork Thu Jul 8 15:18:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 472164 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D677C07E9C for ; Thu, 8 Jul 2021 15:18:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 13C5261418 for ; Thu, 8 Jul 2021 15:18:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231965AbhGHPVO (ORCPT ); Thu, 8 Jul 2021 11:21:14 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:39604 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231849AbhGHPVO (ORCPT ); Thu, 8 Jul 2021 11:21:14 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 6CDEC201EA; Thu, 8 Jul 2021 15:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1625757511; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1T9kS3zygjo3SGBbBmjpFRl4HtEuh3g4rzClCMU8OYk=; b=dmVuoaaJl3a7XpKPesUA55HonxZFeVbk0iSYnTRw2qsw6TecqyOrostYt0/XyCS/+YN+vb /V7cBSl1LWX+4PGpfMggonyJOmtLcaAbgEHLBPXhSwsw1uhNgg676UIQ8H2zJaBVWm72eh R7r6ionRc0as5ByK/vVnWUlg7zxRGZ8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1625757511; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1T9kS3zygjo3SGBbBmjpFRl4HtEuh3g4rzClCMU8OYk=; b=vp2tsrEq7K/q/qrtxUfZVwkzRxk9SOUzbtbwFzXa+RbubZV+cFGGx7hhC7vxEkLtv4QK5e S/GCwTxyxPSTAiDQ== Received: from localhost (unknown [10.163.25.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 4FDEEA3B8F; Thu, 8 Jul 2021 15:18:31 +0000 (UTC) From: Daniel Wagner To: Clark Williams , John Kacur Cc: linux-rt-users@vger.kernel.org, Daniel Wagner Subject: [PATCH rt-tests v2 2/3] signaltest: Fix printf format specifier Date: Thu, 8 Jul 2021 17:18:26 +0200 Message-Id: <20210708151827.21430-3-dwagner@suse.de> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210708151827.21430-1-dwagner@suse.de> References: <20210708151827.21430-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org The fields are not uint64 just longs, update the printf format specifiers. Signed-off-by: Daniel Wagner --- src/signaltest/signaltest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c index 6e8f6b51b003..4d89a1aba9d9 100644 --- a/src/signaltest/signaltest.c +++ b/src/signaltest/signaltest.c @@ -393,9 +393,9 @@ static void write_stats(FILE *f, void *data) for (i = 0; i < num_threads; i++) { fprintf(f, " \"%u\": {\n", i); s = &par->stats[i]; - fprintf(f, " \"cycles\": %" PRIu64 ",\n", s->cycles); - fprintf(f, " \"min\": %" PRIu64 ",\n", s->min); - fprintf(f, " \"max\": %" PRIu64 ",\n", s->max); + fprintf(f, " \"cycles\": %ld,\n", s->cycles); + fprintf(f, " \"min\": %ld,\n", s->min); + fprintf(f, " \"max\": %ld,\n", s->max); fprintf(f, " \"avg\": %.2f,\n", s->avg/s->cycles); fprintf(f, " \"cpu\": %d\n", par->cpu); fprintf(f, " }%s\n", i == num_threads - 1 ? "" : ","); From patchwork Thu Jul 8 15:18:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 471620 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2192C11F67 for ; Thu, 8 Jul 2021 15:18:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F26D613D1 for ; Thu, 8 Jul 2021 15:18:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231989AbhGHPVP (ORCPT ); Thu, 8 Jul 2021 11:21:15 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:43346 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231956AbhGHPVO (ORCPT ); Thu, 8 Jul 2021 11:21:14 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id BE6EA21F6C; Thu, 8 Jul 2021 15:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1625757511; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bMJhYoeMj0eMMWp9w6kEHsJ02/1wdajPhRsTxe9Y3PM=; b=H0d/8svRdMpJf6cGQc4HU9Yj+G2gQNI+hElEzN/wKxgVv9g1rnMTNluuSbjSSw2DqOKaxj iTuw0x38i+GqsoH5wrczShp2nrtOQFLte6RM7GkQpjSMcHlVgBpxkaDYv3lyaOvWAERQc7 fTat5s/yht+ISa0nRp8zF3efETGiAKU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1625757511; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bMJhYoeMj0eMMWp9w6kEHsJ02/1wdajPhRsTxe9Y3PM=; b=xKZR4j0Na6/476ChPYIoqflUJWwfprvcen0mSpEzwC6Hrr9A4qpbXORFDdMiYEsybNNny0 tYuoQhDxQfQwvpCQ== Received: from localhost (unknown [10.163.25.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id A2DF7A3B97; Thu, 8 Jul 2021 15:18:31 +0000 (UTC) From: Daniel Wagner To: Clark Williams , John Kacur Cc: linux-rt-users@vger.kernel.org, Daniel Wagner Subject: [PATCH rt-tests v2 3/3] cyclicdeadline: Fix buffer allocation Date: Thu, 8 Jul 2021 17:18:27 +0200 Message-Id: <20210708151827.21430-4-dwagner@suse.de> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210708151827.21430-1-dwagner@suse.de> References: <20210708151827.21430-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org gcc complains with "‘sprintf’ output between 2 and 12 bytes" but the buffer is only 10 bytes long. Update the buffer size to hold the complete range of [-2147483648, 2147483646]. Signed-off-by: Daniel Wagner Signed-off-by: John Kacur Signed-off-by: John Kacur --- src/sched_deadline/cyclicdeadline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c index ffefa9e6fecb..8447424273ee 100644 --- a/src/sched_deadline/cyclicdeadline.c +++ b/src/sched_deadline/cyclicdeadline.c @@ -1092,7 +1092,7 @@ int main(int argc, char **argv) /* Default cpu to use is the last one */ if (!all_cpus && !setcpu) { - setcpu_buf = malloc(10); + setcpu_buf = malloc(12); if (!setcpu_buf) fatal("malloc"); sprintf(setcpu_buf, "%d", cpu_count - 1);