unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 32f2919abc9a1e78b52f80b070c65e0ab0b2edc0 2261 bytes (raw)
name: gnu/packages/patches/hwloc-1-test-btrfs.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
 
From 093316a897a2eb4972a7a3a5888f40975d03f6bf Mon Sep 17 00:00:00 2001
From: Brice Goglin <Brice.Goglin@inria.fr>
Date: Tue, 5 Apr 2022 17:39:50 +0200
Subject: [PATCH] linux: (partial) fix the discovery of hugepages on btrfs
 fsroot

btrfs always returns 1 in directory stat.st_nlink.
It breaks make check in tests/linux/ because the hugepages discovery
uses st_nlink to allocate the memory page_types array.

Always allocate at least 3 page_types slots
(enough for all known cases, 1 for normal, 2 for huge pages)

(partially cherry-picked from commit 7f351cec9bfe54a031f35ad16c9cfb99784d76dc)

We don't reallocate later if needed as in 2.x commit 7f351cec9bfe54a031f35ad16c9cfb99784d76dc
because v1.11 doesn't deserve a complete fix. Just commit the minimal change
so that tests/linux/2i386-2t-hugepagesizecount with HWLOC_PAGESIZE_DEBUG=4096
doesn't crash in btrfs anymore (test-topology.sh fails during make check if /tmp is in btrfs).

Thanks to Philippe Swartvagher for the report.

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
---
 src/topology-linux.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/topology-linux.c b/src/topology-linux.c
index 58c275fea..269eca7f5 100644
--- a/src/topology-linux.c
+++ b/src/topology-linux.c
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2009 CNRS
- * Copyright © 2009-2019 Inria.  All rights reserved.
+ * Copyright © 2009-2022 Inria.  All rights reserved.
  * Copyright © 2009-2013, 2015 Université Bordeaux
  * Copyright © 2009-2014 Cisco Systems, Inc.  All rights reserved.
  * Copyright © 2015 Intel, Inc.  All rights reserved.
@@ -2329,7 +2329,14 @@ hwloc_get_procfs_meminfo_info(struct hwloc_topology *topology,
 
   err = hwloc_stat("/sys/kernel/mm/hugepages", &st, data->root_fd);
   if (!err) {
-    types = 1 + st.st_nlink-2;
+    types = 1 /* normal non-huge size */ + st.st_nlink - 2 /* ignore . and .. */;
+    if (types < 3)
+      /* some buggy filesystems (e.g. btrfs when reading from fsroot)
+       * return wrong st_nlink for directories (always 1 for btrfs).
+       * use 3 as a sane default (default page + 2 huge sizes).
+       * hwloc_parse_hugepages_info() will extend it if needed.
+       */
+      types = 3;
     has_sysfs_hugepages = 1;
   }
 

debug log:

solving 32f2919abc ...
found 32f2919abc in https://yhetil.org/guix-patches/20220407153002.885065-1-philippe.swartvagher@inria.fr/

applying [1/1] https://yhetil.org/guix-patches/20220407153002.885065-1-philippe.swartvagher@inria.fr/
diff --git a/gnu/packages/patches/hwloc-1-test-btrfs.patch b/gnu/packages/patches/hwloc-1-test-btrfs.patch
new file mode 100644
index 0000000000..32f2919abc

1:47: trailing whitespace.
 
1:61: trailing whitespace.
 
Checking patch gnu/packages/patches/hwloc-1-test-btrfs.patch...
1:61: new blank line at EOF.
+
Applied patch gnu/packages/patches/hwloc-1-test-btrfs.patch cleanly.
warning: 3 lines add whitespace errors.

index at:
100644 32f2919abc9a1e78b52f80b070c65e0ab0b2edc0	gnu/packages/patches/hwloc-1-test-btrfs.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).