linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix for machines without numa
@ 2021-02-22 22:07 John Kacur
  2021-02-22 22:07 ` [PATCH 1/2] rt-tests: Don't assume numa is available at runtime John Kacur
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: John Kacur @ 2021-02-22 22:07 UTC (permalink / raw)
  To: RT, Christian Eggers
  Cc: Daniel Wagner, Kurt Kanzenbach, Clark Williams,
	Sebastian Andrzej Siewior, John Kacur

Trying to return the code to a state where numa is required at compile
time but not at runtime

- The first patch should allow cyclictest to run on a machine
without numa.

- The second patch is a clean-up of some old code

The code is pushed in git to branch unstable/devel/no-numa-runtime
so that people can test before I integrate the code back in the main
branch

Thanks

John

John Kacur (2):
  rt-tests: Don't assume numa is available at runtime
  rt-tests: remove rt_numa_bitmask_count in rt_numa.h

 src/cyclictest/cyclictest.c |  8 ++------
 src/cyclictest/rt_numa.h    | 12 ------------
 src/lib/rt-numa.c           | 17 +++++++++++------
 src/signaltest/signaltest.c |  8 ++------
 4 files changed, 15 insertions(+), 30 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] rt-tests: Don't assume numa is available at runtime
  2021-02-22 22:07 [PATCH 0/2] Fix for machines without numa John Kacur
@ 2021-02-22 22:07 ` John Kacur
  2021-02-22 22:07 ` [PATCH 2/2] rt-tests: remove rt_numa_bitmask_count in rt_numa.h John Kacur
  2021-02-24  9:25 ` [PATCH 0/2] Fix for machines without numa Kurt Kanzenbach
  2 siblings, 0 replies; 5+ messages in thread
From: John Kacur @ 2021-02-22 22:07 UTC (permalink / raw)
  To: RT, Christian Eggers
  Cc: Daniel Wagner, Kurt Kanzenbach, Clark Williams,
	Sebastian Andrzej Siewior, John Kacur

- Rework numa_initialize a bit to return the status of numa
- Don't fail if numa is not available after the call to numa_initialize

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 src/cyclictest/cyclictest.c |  8 ++------
 src/lib/rt-numa.c           | 17 +++++++++++------
 src/signaltest/signaltest.c |  8 ++------
 3 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 3e31937f7088..157047837259 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1018,9 +1018,7 @@ static void process_options(int argc, char *argv[], int max_cpus)
 			/* smp sets AFFINITY_USEALL in OPT_SMP */
 			if (smp)
 				break;
-			if (numa_initialize())
-				fatal("Couldn't initialize libnuma");
-			numa = 1;
+			numa = numa_initialize();
 			if (optarg) {
 				parse_cpumask(optarg, max_cpus, &affinity_mask);
 				setaffinity = AFFINITY_SPECIFIED;
@@ -1204,9 +1202,7 @@ static void process_options(int argc, char *argv[], int max_cpus)
 
 	/* if smp wasn't requested, test for numa automatically */
 	if (!smp) {
-		if (numa_initialize())
-			fatal("Couldn't initialize libnuma");
-		numa = 1;
+		numa = numa_initialize();
 		if (setaffinity == AFFINITY_UNSPECIFIED)
 			setaffinity = AFFINITY_USEALL;
 	}
diff --git a/src/lib/rt-numa.c b/src/lib/rt-numa.c
index dbeaef696876..babcc634d57e 100644
--- a/src/lib/rt-numa.c
+++ b/src/lib/rt-numa.c
@@ -13,19 +13,24 @@
 #include "rt-error.h"
 #include "rt-numa.h"
 
-/* numa_available() must be called before any other calls to the numa library */
+/*
+ * numa_available() must be called before any other calls to the numa library
+ * returns 0 if numa is available, or 1 if numa is not available
+ */
 int numa_initialize(void)
 {
-	static int is_initialized;
+	static int is_initialized;	// Only call numa_available once
+	static int numa;
 
 	if (is_initialized == 1)
-		return 0;
+		return numa;
 
-	if (numa_available() == -1)
-		return -1;
+	if (numa_available() != -1)
+		numa = 1;
 
 	is_initialized = 1;
-	return 0;
+
+	return numa;
 }
 
 int get_available_cpus(struct bitmask *cpumask)
diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index 4f8e7caea2c1..b1a7e1db8302 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -253,9 +253,7 @@ 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;
+			numa = numa_initialize();
 			if (optarg) {
 				parse_cpumask(optarg, max_cpus, &affinity_mask);
 				setaffinity = AFFINITY_SPECIFIED;
@@ -339,9 +337,7 @@ 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;
+		numa = numa_initialize();
 		if (setaffinity == AFFINITY_UNSPECIFIED)
 			setaffinity = AFFINITY_USEALL;
 	}
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] rt-tests: remove rt_numa_bitmask_count in rt_numa.h
  2021-02-22 22:07 [PATCH 0/2] Fix for machines without numa John Kacur
  2021-02-22 22:07 ` [PATCH 1/2] rt-tests: Don't assume numa is available at runtime John Kacur
@ 2021-02-22 22:07 ` John Kacur
  2021-02-24  9:25 ` [PATCH 0/2] Fix for machines without numa Kurt Kanzenbach
  2 siblings, 0 replies; 5+ messages in thread
From: John Kacur @ 2021-02-22 22:07 UTC (permalink / raw)
  To: RT, Christian Eggers
  Cc: Daniel Wagner, Kurt Kanzenbach, Clark Williams,
	Sebastian Andrzej Siewior, John Kacur

Remove rt_numa_bitmask_count as it is unused.
The code uses numa_bitmask_weight() from numa instead

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 src/cyclictest/rt_numa.h | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/src/cyclictest/rt_numa.h b/src/cyclictest/rt_numa.h
index 4cbd979c21e8..03f060e144ce 100644
--- a/src/cyclictest/rt_numa.h
+++ b/src/cyclictest/rt_numa.h
@@ -83,16 +83,4 @@ static inline void rt_bitmask_free(struct bitmask *mask)
 	numa_bitmask_free(mask);
 }
 
-/** Returns number of bits set in mask. */
-static inline unsigned int rt_numa_bitmask_count(const struct bitmask *mask)
-{
-	unsigned int num_bits = 0, i;
-	for (i = 0; i < mask->size; i++) {
-		if (rt_numa_bitmask_isbitset(mask, i))
-			num_bits++;
-	}
-	/* Could stash this instead of recomputing every time. */
-	return num_bits;
-}
-
 #endif	/* _RT_NUMA_H */
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] Fix for machines without numa
  2021-02-22 22:07 [PATCH 0/2] Fix for machines without numa John Kacur
  2021-02-22 22:07 ` [PATCH 1/2] rt-tests: Don't assume numa is available at runtime John Kacur
  2021-02-22 22:07 ` [PATCH 2/2] rt-tests: remove rt_numa_bitmask_count in rt_numa.h John Kacur
@ 2021-02-24  9:25 ` Kurt Kanzenbach
  2021-02-25  3:36   ` John Kacur
  2 siblings, 1 reply; 5+ messages in thread
From: Kurt Kanzenbach @ 2021-02-24  9:25 UTC (permalink / raw)
  To: John Kacur, RT, Christian Eggers
  Cc: Daniel Wagner, Clark Williams, Sebastian Andrzej Siewior, John Kacur

[-- Attachment #1: Type: text/plain, Size: 532 bytes --]

Hi John,

On Mon Feb 22 2021, John Kacur wrote:
> Trying to return the code to a state where numa is required at compile
> time but not at runtime
>
> - The first patch should allow cyclictest to run on a machine
> without numa.
>
> - The second patch is a clean-up of some old code
>
> The code is pushed in git to branch unstable/devel/no-numa-runtime
> so that people can test before I integrate the code back in the main
> branch

arm32 seems to work fine.

Tested-by: Kurt Kanzenbach <kurt@linutronix.de> # arm32

Thanks,
Kurt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] Fix for machines without numa
  2021-02-24  9:25 ` [PATCH 0/2] Fix for machines without numa Kurt Kanzenbach
@ 2021-02-25  3:36   ` John Kacur
  0 siblings, 0 replies; 5+ messages in thread
From: John Kacur @ 2021-02-25  3:36 UTC (permalink / raw)
  To: Kurt Kanzenbach
  Cc: RT, Christian Eggers, Daniel Wagner, Clark Williams,
	Sebastian Andrzej Siewior



On Wed, 24 Feb 2021, Kurt Kanzenbach wrote:

> Hi John,
> 
> On Mon Feb 22 2021, John Kacur wrote:
> > Trying to return the code to a state where numa is required at compile
> > time but not at runtime
> >
> > - The first patch should allow cyclictest to run on a machine
> > without numa.
> >
> > - The second patch is a clean-up of some old code
> >
> > The code is pushed in git to branch unstable/devel/no-numa-runtime
> > so that people can test before I integrate the code back in the main
> > branch
> 
> arm32 seems to work fine.
> 
> Tested-by: Kurt Kanzenbach <kurt@linutronix.de> # arm32
> 
> Thanks,
> Kurt
> 

Thanks, I added your tested by and merged all the changes into
unstable/devel/latest

John

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-02-25  3:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-22 22:07 [PATCH 0/2] Fix for machines without numa John Kacur
2021-02-22 22:07 ` [PATCH 1/2] rt-tests: Don't assume numa is available at runtime John Kacur
2021-02-22 22:07 ` [PATCH 2/2] rt-tests: remove rt_numa_bitmask_count in rt_numa.h John Kacur
2021-02-24  9:25 ` [PATCH 0/2] Fix for machines without numa Kurt Kanzenbach
2021-02-25  3:36   ` John Kacur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).