From patchwork Fri Feb 19 18:47:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 385147 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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 26911C433DB for ; Fri, 19 Feb 2021 18:48:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DBAB964E92 for ; Fri, 19 Feb 2021 18:48:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229763AbhBSSs6 (ORCPT ); Fri, 19 Feb 2021 13:48:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229555AbhBSSs5 (ORCPT ); Fri, 19 Feb 2021 13:48:57 -0500 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E3FBC061756 for ; Fri, 19 Feb 2021 10:48:17 -0800 (PST) Received: by mail-qk1-x72d.google.com with SMTP id m144so6484743qke.10 for ; Fri, 19 Feb 2021 10:48:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RgnhYIQMPQxwiAAU1IQs8Oj0PgY8gIQvuDFaFx9DTuc=; b=o8QzdDGGR/qBv5aqw9JvjNoG6FZcHKAarbwIekKfnS3mg9GCfxfZFIpw3M8Req/G8L ZWcQIlnCUc+92/NZCHit5Abw0wTW5/7bFqhXPU/clJ7MkzRTuAa3R6WN2M/Srv42ob12 xSRUNv+rRMQBfpUQv/FaJRLHTGbipH9AlQqUalpwk2xK3VFxkpt118fADygXqtoqzCcE eoiHuFd5CDjj6cKvOYqIYhoHMeklMFu9bAsIPe4X8SCx4521GHfVl/RtE0KXKfJgKXoX yLjodarFXYsGvD5O0D9kdalT42Q+FOtT2GGLRX0A74g/arwRURqtfTtfqL/8ebMur8MW hdUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=RgnhYIQMPQxwiAAU1IQs8Oj0PgY8gIQvuDFaFx9DTuc=; b=AyUVkfhw/Gz9OMalyqiDo8qPNKIMiIBRQV8+bwohmy8Zpf8mSes01E4tmLahz7tIrl +PmQKx3L+fopy3BgEyESZjht+kCwCgne+FRW08/VhgggBG+b07dlWfJHyERWWAOH6A7Q iCpKzoEXVhf3L+vPx1O80SEgp7JFHJkIwn+PaLlfgVH5rQDrCQ9eG5uAx651wCWPGmoh szPvxcxq2n3Mlur1CqtpitXwouQdmRMug6Kph1uWEzhPnSAPvRAAE9Q7c3orf62W/seg 9HsFo35eP+dcWcM28laK6a1WrhP6Rnh8ihfrTQJ4na3JyvZj/EhXlRH3yCAxDeZwXJjT /KRA== X-Gm-Message-State: AOAM531Lhsy1CBU8iG/u/hMoJ3frDDYiztcJ9QFkGZ3bnVwzOOb1dAaS 2btvmUPbA8ayJxKLlKZvg1Ovv/zvq1vtFBgN X-Google-Smtp-Source: ABdhPJwxNxA9X5YnepSWz4IUdi2fkPUpNZGw2hVmIelOgb0CHcmN87OdXzWoQKo2L9KPkuX3QB3z1Q== X-Received: by 2002:a37:9a84:: with SMTP id c126mr10533515qke.399.1613760496274; Fri, 19 Feb 2021 10:48:16 -0800 (PST) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-06-184-147-140-29.dsl.bell.ca. [184.147.140.29]) by smtp.gmail.com with ESMTPSA id s136sm6831647qka.106.2021.02.19.10.48.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 10:48:15 -0800 (PST) Sender: John Kacur From: John Kacur To: RT , Daniel Wagner Cc: Sebastian Andrzej Siewior , Kurt Kanzenbach , Clark Williams , Christian Eggers , John Kacur Subject: [PATCH 1/3] Revert "cyclictest: Use affinity_mask for steering thread placement" Date: Fri, 19 Feb 2021 13:47:59 -0500 Message-Id: <20210219184801.13905-2-jkacur@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210219184801.13905-1-jkacur@redhat.com> References: <20210219184801.13905-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org This reverts commit 8305e65092deeaf900366c6250d4b319f6c274b6. Reverting to put back the code that allows us to run on machines without libnuma. However, there were some ideas in this patch that were not directly related to that and could be revisited. Signed-off-by: John Kacur --- src/cyclictest/cyclictest.c | 38 ++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index c3d45f3ae31b..e2753db39c02 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -892,6 +892,7 @@ static int interval = DEFAULT_INTERVAL; static int distance = -1; static struct bitmask *affinity_mask = NULL; static int smp = 0; +static int setaffinity = AFFINITY_UNSPECIFIED; static int clocksources[] = { CLOCK_MONOTONIC, @@ -1019,12 +1020,22 @@ static void process_options(int argc, char *argv[], int max_cpus) break; if (optarg) { parse_cpumask(optarg, max_cpus, &affinity_mask); + setaffinity = AFFINITY_SPECIFIED; } else if (optind < argc && (atoi(argv[optind]) || argv[optind][0] == '0' || argv[optind][0] == '!')) { parse_cpumask(argv[optind], max_cpus, &affinity_mask); + setaffinity = AFFINITY_SPECIFIED; + } else { + setaffinity = AFFINITY_USEALL; } + + if (setaffinity == AFFINITY_SPECIFIED && !affinity_mask) + display_help(1); + if (verbose) + printf("Using %u cpus.\n", + numa_bitmask_weight(affinity_mask)); break; case 'A': case OPT_ALIGNED: @@ -1117,6 +1128,7 @@ static void process_options(int argc, char *argv[], int max_cpus) case OPT_SMP: /* SMP testing */ smp = 1; num_threads = -1; /* update after parsing */ + setaffinity = AFFINITY_USEALL; break; case 't': case OPT_THREADS: @@ -1185,16 +1197,23 @@ static void process_options(int argc, char *argv[], int max_cpus) use_nanosleep = MODE_CLOCK_NANOSLEEP; } + /* if smp wasn't requested, test for numa automatically */ + if (!smp) { + if (setaffinity == AFFINITY_UNSPECIFIED) + setaffinity = AFFINITY_USEALL; + } + if (option_affinity && smp) { warn("-a ignored due to smp mode\n"); if (affinity_mask) { numa_bitmask_free(affinity_mask); affinity_mask = NULL; } + setaffinity = AFFINITY_USEALL; } if (smi) { - if (affinity_mask) + if (setaffinity == AFFINITY_UNSPECIFIED) fatal("SMI counter relies on thread affinity\n"); if (!has_smi_counter()) @@ -1777,7 +1796,7 @@ int main(int argc, char **argv) } /* Restrict the main pid to the affinity specified by the user */ - if (affinity_mask) { + if (affinity_mask != NULL) { int res; errno = 0; @@ -1940,13 +1959,18 @@ int main(int argc, char **argv) if (status != 0) fatal("error from pthread_attr_init for thread %d: %s\n", i, strerror(status)); - if (affinity_mask) + switch (setaffinity) { + case AFFINITY_UNSPECIFIED: cpu = -1; break; + case AFFINITY_SPECIFIED: cpu = cpu_for_thread_sp(i, max_cpus, affinity_mask); - else + if (verbose) + printf("Thread %d using cpu %d.\n", i, cpu); + break; + case AFFINITY_USEALL: cpu = cpu_for_thread_ua(i, max_cpus); - - if (verbose) - printf("Thread %d using cpu %d.\n", i, cpu); + break; + default: cpu = -1; + } /* find the memory node associated with the cpu i */ node = rt_numa_numa_node_of_cpu(cpu); From patchwork Fri Feb 19 18:48:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 385146 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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 D2ABEC433E0 for ; Fri, 19 Feb 2021 18:49:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A913164E92 for ; Fri, 19 Feb 2021 18:49:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229819AbhBSStA (ORCPT ); Fri, 19 Feb 2021 13:49:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229765AbhBSSs7 (ORCPT ); Fri, 19 Feb 2021 13:48:59 -0500 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0FE7C06178A for ; Fri, 19 Feb 2021 10:48:18 -0800 (PST) Received: by mail-qk1-x72d.google.com with SMTP id q85so6504937qke.8 for ; Fri, 19 Feb 2021 10:48:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YcFhlT+fPiCFHLN3NGgRPm6WFJQlwU4WvRTGNRYPLFk=; b=f9bXoWYa2S97Zb7IPhsBs9GqgrUA9BG3iW4NQeI0xsetgyXpwu2Z4ylcOPz4XHenKm xgY3KCrZl6Rwi+nf26angwCc6vdMbfFP8Bz4YPtBYVe5Nc+iSbsNk8GaerhEOWLB2Cmm 4ROLJWZtmZFFQQ2rVAwVoQBXa/jzStDIKdc28ByTT6mVYlJJ4DO/DBsIz0+RKV3e/rmL DG3q40i3zlwiZfId/MIWFCoCfjfkXcrIDKn/TekbFhG5rLTlMphiEg+Ys0PHuKWUHaCQ y21hjrYj0gT2gncRcR51hGwx4BTQbXZMoEjxoY4Mra/FsSAwCXqmsJBDXh6HbS8iOkJx O6Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=YcFhlT+fPiCFHLN3NGgRPm6WFJQlwU4WvRTGNRYPLFk=; b=NteC/YKKYEVd8JLQ6C18khhSqlG0/f5X6Cg4JFMifAC+vXZlJCnPWEfg4sIo8VDAyA PHHAkfuQSceGQHor6SYDVHwMRPX7o1nwKwrmv6mhF9VlBSAprRXXvze5HUg4gtUBsyxD UC943B7IqCGpbokEBQXIb/gG16gCnxMkgVGgCeqkPqSfyOs3vUhJj12h/nuR4ACxiIix UeCIeQSOl5G0LsE2NytDjEfpH9k4bBV+VW9ffR4/BFQ8kP/ZY3LZ3Xhx8A8jQLQjeLVY rycCc1LTtGMkmDjslgxjrWPej5lq2lN0jhbWaHvov/j0AjwOmSRVxeSpE5MsbeDDBXfd zrQQ== X-Gm-Message-State: AOAM532ciXfpZFefHbs/OYJPY0S3VKJcYTR6wNJs0+aiw5A21EWppMlf Bssa4FMvwQ1GDcuCAGhEEm0XEEbcLhla9dyk X-Google-Smtp-Source: ABdhPJwkNdQTCzitMyYtyetbuxFpJbVmHod4wfedLV9elIcIv87CBO60lGMu9q4ebLKjLIM2LrNHqg== X-Received: by 2002:a05:620a:98d:: with SMTP id x13mr10826278qkx.432.1613760498072; Fri, 19 Feb 2021 10:48:18 -0800 (PST) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-06-184-147-140-29.dsl.bell.ca. [184.147.140.29]) by smtp.gmail.com with ESMTPSA id s136sm6831647qka.106.2021.02.19.10.48.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 10:48:17 -0800 (PST) Sender: John Kacur From: John Kacur To: RT , Daniel Wagner Cc: Sebastian Andrzej Siewior , Kurt Kanzenbach , Clark Williams , Christian Eggers , John Kacur Subject: [PATCH 3/3] Revert "signaltest: Always use libnuma" Date: Fri, 19 Feb 2021 13:48:01 -0500 Message-Id: <20210219184801.13905-4-jkacur@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210219184801.13905-1-jkacur@redhat.com> References: <20210219184801.13905-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org This reverts commit 3079f1b10d086b878f52607035b328f450b8033e. libnuma is a build-time requirement but not a runtime requirement Signed-off-by: John Kacur --- src/signaltest/signaltest.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c index 1d1b070cf12b..4f8e7caea2c1 100644 --- a/src/signaltest/signaltest.c +++ b/src/signaltest/signaltest.c @@ -207,6 +207,7 @@ static int quiet; static int lockall; static struct bitmask *affinity_mask = NULL; static int smp = 0; +static int numa = 0; static int setaffinity = AFFINITY_UNSPECIFIED; static char outfile[MAX_PATH]; @@ -222,7 +223,6 @@ static void process_options(int argc, char *argv[], unsigned int max_cpus) { int option_affinity = 0; int error = 0; - int numa = 0; for (;;) { int option_index = 0; @@ -253,6 +253,8 @@ static void process_options(int argc, char *argv[], unsigned int max_cpus) /* smp sets AFFINITY_USEALL in OPT_SMP */ if (smp) break; + if (numa_initialize()) + fatal("Couldn't initialize libnuma"); numa = 1; if (optarg) { parse_cpumask(optarg, max_cpus, &affinity_mask); @@ -337,6 +339,9 @@ static void process_options(int argc, char *argv[], unsigned int max_cpus) /* if smp wasn't requested, test for numa automatically */ if (!smp) { + if (numa_initialize()) + fatal("Couldn't initialize libnuma"); + numa = 1; if (setaffinity == AFFINITY_UNSPECIFIED) setaffinity = AFFINITY_USEALL; } @@ -412,9 +417,6 @@ int main(int argc, char **argv) int status, cpu; int max_cpus = sysconf(_SC_NPROCESSORS_ONLN); - if (numa_initialize()) - fatal("Couldn't initialize libnuma"); - process_options(argc, argv, max_cpus); if (check_privs())