Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 Cisco and/or its affiliates. |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at: |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | |
| 16 | #define _GNU_SOURCE |
| 17 | #include <stdlib.h> |
| 18 | #include <sys/types.h> |
| 19 | #include <sys/stat.h> |
| 20 | #include <fcntl.h> |
Artem Belov | f6defa1 | 2019-02-26 01:47:34 +0000 | [diff] [blame] | 21 | #include <unistd.h> |
Damjan Marion | 1ee346a | 2019-03-18 17:06:51 +0100 | [diff] [blame] | 22 | #include <sched.h> |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 23 | |
| 24 | #include <vppinfra/format.h> |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 25 | #include <vppinfra/linux/sysfs.h> |
| 26 | #include <vppinfra/mem.h> |
| 27 | #include <vppinfra/hash.h> |
| 28 | #include <vppinfra/pmalloc.h> |
Damjan Marion | f8cb701 | 2020-10-09 17:16:55 +0200 | [diff] [blame] | 29 | #include <vppinfra/cpu.h> |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 30 | |
| 31 | #if __SIZEOF_POINTER__ >= 8 |
| 32 | #define DEFAULT_RESERVED_MB 16384 |
| 33 | #else |
| 34 | #define DEFAULT_RESERVED_MB 256 |
| 35 | #endif |
| 36 | |
| 37 | static inline clib_pmalloc_chunk_t * |
| 38 | get_chunk (clib_pmalloc_page_t * pp, u32 index) |
| 39 | { |
| 40 | return pool_elt_at_index (pp->chunks, index); |
| 41 | } |
| 42 | |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 43 | static inline uword |
| 44 | pmalloc_size2pages (uword size, u32 log2_page_sz) |
| 45 | { |
| 46 | return round_pow2 (size, 1ULL << log2_page_sz) >> log2_page_sz; |
| 47 | } |
| 48 | |
Damjan Marion | dae1c7e | 2020-10-17 13:32:25 +0200 | [diff] [blame] | 49 | __clib_export int |
Damjan Marion | 5a6c809 | 2019-02-21 14:44:59 +0100 | [diff] [blame] | 50 | clib_pmalloc_init (clib_pmalloc_main_t * pm, uword base_addr, uword size) |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 51 | { |
Dave Barach | 16e4a4a | 2020-04-16 12:00:14 -0400 | [diff] [blame] | 52 | uword base, pagesize; |
Damjan Marion | c04e2b0 | 2018-10-25 15:56:04 +0200 | [diff] [blame] | 53 | u64 *pt = 0; |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 54 | |
| 55 | ASSERT (pm->error == 0); |
| 56 | |
Damjan Marion | 9787f5f | 2018-10-24 12:56:32 +0200 | [diff] [blame] | 57 | pagesize = clib_mem_get_default_hugepage_size (); |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 58 | pm->def_log2_page_sz = min_log2 (pagesize); |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 59 | pm->lookup_log2_page_sz = pm->def_log2_page_sz; |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 60 | |
Damjan Marion | c04e2b0 | 2018-10-25 15:56:04 +0200 | [diff] [blame] | 61 | /* check if pagemap is accessible */ |
Damjan Marion | 6bfd076 | 2020-09-11 22:16:53 +0200 | [diff] [blame] | 62 | pt = clib_mem_vm_get_paddr (&pt, CLIB_MEM_PAGE_SZ_DEFAULT, 1); |
Damjan Marion | c04e2b0 | 2018-10-25 15:56:04 +0200 | [diff] [blame] | 63 | if (pt == 0 || pt[0] == 0) |
| 64 | pm->flags |= CLIB_PMALLOC_F_NO_PAGEMAP; |
| 65 | |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 66 | size = size ? size : ((u64) DEFAULT_RESERVED_MB) << 20; |
| 67 | size = round_pow2 (size, pagesize); |
| 68 | |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 69 | pm->max_pages = size >> pm->def_log2_page_sz; |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 70 | |
Dave Barach | 16e4a4a | 2020-04-16 12:00:14 -0400 | [diff] [blame] | 71 | base = clib_mem_vm_reserve (base_addr, size, pm->def_log2_page_sz); |
Damjan Marion | 5a6c809 | 2019-02-21 14:44:59 +0100 | [diff] [blame] | 72 | |
Dave Barach | 16e4a4a | 2020-04-16 12:00:14 -0400 | [diff] [blame] | 73 | if (base == ~0) |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 74 | { |
Dave Barach | 16e4a4a | 2020-04-16 12:00:14 -0400 | [diff] [blame] | 75 | pm->error = clib_error_return (0, "failed to reserve %u pages", |
| 76 | pm->max_pages); |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 77 | return -1; |
| 78 | } |
| 79 | |
Dave Barach | 16e4a4a | 2020-04-16 12:00:14 -0400 | [diff] [blame] | 80 | pm->base = uword_to_pointer (base, void *); |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 81 | return 0; |
| 82 | } |
| 83 | |
| 84 | static inline void * |
| 85 | alloc_chunk_from_page (clib_pmalloc_main_t * pm, clib_pmalloc_page_t * pp, |
| 86 | u32 n_blocks, u32 block_align, u32 numa_node) |
| 87 | { |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 88 | clib_pmalloc_chunk_t *c = 0; |
| 89 | clib_pmalloc_arena_t *a; |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 90 | void *va; |
| 91 | u32 off; |
| 92 | u32 alloc_chunk_index; |
| 93 | |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 94 | a = pool_elt_at_index (pm->arenas, pp->arena_index); |
| 95 | |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 96 | if (pp->chunks == 0) |
| 97 | { |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 98 | u32 i, start = 0, prev = ~0; |
| 99 | |
| 100 | for (i = 0; i < a->subpages_per_page; i++) |
| 101 | { |
| 102 | pool_get (pp->chunks, c); |
| 103 | c->start = start; |
| 104 | c->prev = prev; |
| 105 | c->size = pp->n_free_blocks / a->subpages_per_page; |
| 106 | start += c->size; |
| 107 | if (prev == ~0) |
| 108 | pp->first_chunk_index = c - pp->chunks; |
| 109 | else |
| 110 | pp->chunks[prev].next = c - pp->chunks; |
| 111 | prev = c - pp->chunks; |
| 112 | } |
| 113 | c->next = ~0; |
| 114 | pp->n_free_chunks = a->subpages_per_page; |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 115 | } |
| 116 | |
Damjan Marion | 78c0ff7 | 2019-01-23 12:50:24 +0100 | [diff] [blame] | 117 | if (pp->n_free_blocks < n_blocks) |
| 118 | return 0; |
| 119 | |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 120 | alloc_chunk_index = pp->first_chunk_index; |
| 121 | |
| 122 | next_chunk: |
| 123 | c = pool_elt_at_index (pp->chunks, alloc_chunk_index); |
| 124 | off = (block_align - (c->start & (block_align - 1))) & (block_align - 1); |
| 125 | |
| 126 | if (c->used || n_blocks + off > c->size) |
| 127 | { |
| 128 | if (c->next == ~0) |
| 129 | return 0; |
| 130 | alloc_chunk_index = c->next; |
| 131 | goto next_chunk; |
| 132 | } |
| 133 | |
| 134 | /* if alignment is needed create new empty chunk */ |
| 135 | if (off) |
| 136 | { |
| 137 | u32 offset_chunk_index; |
| 138 | clib_pmalloc_chunk_t *co; |
| 139 | pool_get (pp->chunks, c); |
| 140 | pp->n_free_chunks++; |
| 141 | offset_chunk_index = alloc_chunk_index; |
| 142 | alloc_chunk_index = c - pp->chunks; |
| 143 | |
| 144 | co = pool_elt_at_index (pp->chunks, offset_chunk_index); |
| 145 | c->size = co->size - off; |
| 146 | c->next = co->next; |
| 147 | c->start = co->start + off; |
| 148 | c->prev = offset_chunk_index; |
| 149 | co->size = off; |
| 150 | co->next = alloc_chunk_index; |
| 151 | } |
| 152 | |
| 153 | c->used = 1; |
| 154 | if (c->size > n_blocks) |
| 155 | { |
| 156 | u32 tail_chunk_index; |
| 157 | clib_pmalloc_chunk_t *ct; |
| 158 | pool_get (pp->chunks, ct); |
| 159 | pp->n_free_chunks++; |
| 160 | tail_chunk_index = ct - pp->chunks; |
| 161 | c = pool_elt_at_index (pp->chunks, alloc_chunk_index); |
| 162 | ct->size = c->size - n_blocks; |
| 163 | ct->next = c->next; |
| 164 | ct->prev = alloc_chunk_index; |
| 165 | ct->start = c->start + n_blocks; |
| 166 | |
| 167 | c->size = n_blocks; |
| 168 | c->next = tail_chunk_index; |
| 169 | if (ct->next != ~0) |
| 170 | pool_elt_at_index (pp->chunks, ct->next)->prev = tail_chunk_index; |
| 171 | } |
| 172 | else if (c->next != ~0) |
| 173 | pool_elt_at_index (pp->chunks, c->next)->prev = alloc_chunk_index; |
| 174 | |
| 175 | c = get_chunk (pp, alloc_chunk_index); |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 176 | va = pm->base + ((pp - pm->pages) << pm->def_log2_page_sz) + |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 177 | (c->start << PMALLOC_LOG2_BLOCK_SZ); |
| 178 | hash_set (pm->chunk_index_by_va, pointer_to_uword (va), alloc_chunk_index); |
| 179 | pp->n_free_blocks -= n_blocks; |
| 180 | pp->n_free_chunks--; |
| 181 | return va; |
| 182 | } |
| 183 | |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 184 | static void |
| 185 | pmalloc_update_lookup_table (clib_pmalloc_main_t * pm, u32 first, u32 count) |
| 186 | { |
| 187 | uword seek, va, pa, p; |
| 188 | int fd; |
| 189 | u32 elts_per_page = 1U << (pm->def_log2_page_sz - pm->lookup_log2_page_sz); |
| 190 | |
| 191 | vec_validate_aligned (pm->lookup_table, vec_len (pm->pages) * |
| 192 | elts_per_page - 1, CLIB_CACHE_LINE_BYTES); |
| 193 | |
Dave Barach | 96e2d44 | 2018-11-14 11:42:03 -0500 | [diff] [blame] | 194 | p = (uword) first *elts_per_page; |
Damjan Marion | c04e2b0 | 2018-10-25 15:56:04 +0200 | [diff] [blame] | 195 | if (pm->flags & CLIB_PMALLOC_F_NO_PAGEMAP) |
| 196 | { |
Damjan Marion | 878b65a | 2018-10-26 10:29:35 +0200 | [diff] [blame] | 197 | while (p < (uword) elts_per_page * count) |
Damjan Marion | c04e2b0 | 2018-10-25 15:56:04 +0200 | [diff] [blame] | 198 | { |
| 199 | pm->lookup_table[p] = pointer_to_uword (pm->base) + |
| 200 | (p << pm->lookup_log2_page_sz); |
| 201 | p++; |
| 202 | } |
| 203 | return; |
| 204 | } |
| 205 | |
| 206 | fd = open ((char *) "/proc/self/pagemap", O_RDONLY); |
Damjan Marion | 878b65a | 2018-10-26 10:29:35 +0200 | [diff] [blame] | 207 | while (p < (uword) elts_per_page * count) |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 208 | { |
| 209 | va = pointer_to_uword (pm->base) + (p << pm->lookup_log2_page_sz); |
Damjan Marion | 878b65a | 2018-10-26 10:29:35 +0200 | [diff] [blame] | 210 | pa = 0; |
Damjan Marion | 6bfd076 | 2020-09-11 22:16:53 +0200 | [diff] [blame] | 211 | seek = (va >> clib_mem_get_log2_page_size ()) * sizeof (pa); |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 212 | if (fd != -1 && lseek (fd, seek, SEEK_SET) == seek && |
| 213 | read (fd, &pa, sizeof (pa)) == (sizeof (pa)) && |
| 214 | pa & (1ULL << 63) /* page present bit */ ) |
| 215 | { |
Damjan Marion | 6bfd076 | 2020-09-11 22:16:53 +0200 | [diff] [blame] | 216 | pa = (pa & pow2_mask (55)) << clib_mem_get_log2_page_size (); |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 217 | } |
| 218 | pm->lookup_table[p] = va - pa; |
| 219 | p++; |
| 220 | } |
| 221 | |
| 222 | if (fd != -1) |
| 223 | close (fd); |
| 224 | } |
| 225 | |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 226 | static inline clib_pmalloc_page_t * |
| 227 | pmalloc_map_pages (clib_pmalloc_main_t * pm, clib_pmalloc_arena_t * a, |
| 228 | u32 numa_node, u32 n_pages) |
| 229 | { |
Damjan Marion | f8cb701 | 2020-10-09 17:16:55 +0200 | [diff] [blame] | 230 | clib_mem_page_stats_t stats = {}; |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 231 | clib_pmalloc_page_t *pp = 0; |
Damjan Marion | f8cb701 | 2020-10-09 17:16:55 +0200 | [diff] [blame] | 232 | int rv, i, mmap_flags; |
Damjan Marion | 801c701 | 2019-10-30 18:07:35 +0100 | [diff] [blame] | 233 | void *va = MAP_FAILED; |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 234 | uword size = (uword) n_pages << pm->def_log2_page_sz; |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 235 | |
| 236 | clib_error_free (pm->error); |
| 237 | |
| 238 | if (pm->max_pages <= vec_len (pm->pages)) |
| 239 | { |
| 240 | pm->error = clib_error_return (0, "maximum number of pages reached"); |
| 241 | return 0; |
| 242 | } |
| 243 | |
Tom Jones | cb3372d | 2024-01-26 17:34:51 +0000 | [diff] [blame] | 244 | #ifdef __linux__ |
Damjan Marion | 6bfd076 | 2020-09-11 22:16:53 +0200 | [diff] [blame] | 245 | if (a->log2_subpage_sz != clib_mem_get_log2_page_size ()) |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 246 | { |
| 247 | pm->error = clib_sysfs_prealloc_hugepages (numa_node, |
| 248 | a->log2_subpage_sz, n_pages); |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 249 | |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 250 | if (pm->error) |
| 251 | return 0; |
| 252 | } |
Tom Jones | cb3372d | 2024-01-26 17:34:51 +0000 | [diff] [blame] | 253 | #endif /* __linux__ */ |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 254 | |
Damjan Marion | f8cb701 | 2020-10-09 17:16:55 +0200 | [diff] [blame] | 255 | rv = clib_mem_set_numa_affinity (numa_node, /* force */ 1); |
| 256 | if (rv == CLIB_MEM_ERROR && numa_node != 0) |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 257 | { |
| 258 | pm->error = clib_error_return_unix (0, "failed to set mempolicy for " |
| 259 | "numa node %u", numa_node); |
| 260 | return 0; |
| 261 | } |
| 262 | |
Damjan Marion | 54e8e39 | 2018-11-07 17:55:26 +0100 | [diff] [blame] | 263 | mmap_flags = MAP_FIXED; |
Damjan Marion | c04e2b0 | 2018-10-25 15:56:04 +0200 | [diff] [blame] | 264 | |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 265 | if (a->flags & CLIB_PMALLOC_ARENA_F_SHARED_MEM) |
| 266 | { |
| 267 | mmap_flags |= MAP_SHARED; |
Damjan Marion | bdbb0c5 | 2020-09-17 10:40:44 +0200 | [diff] [blame] | 268 | a->fd = clib_mem_vm_create_fd (a->log2_subpage_sz, "%s", a->name); |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 269 | if (a->fd == -1) |
| 270 | goto error; |
Damjan Marion | 54e8e39 | 2018-11-07 17:55:26 +0100 | [diff] [blame] | 271 | if ((ftruncate (a->fd, size)) == -1) |
| 272 | goto error; |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 273 | } |
| 274 | else |
| 275 | { |
Tom Jones | 77ce67f | 2024-01-26 14:15:54 +0000 | [diff] [blame] | 276 | #ifdef __linux__ |
Damjan Marion | 6bfd076 | 2020-09-11 22:16:53 +0200 | [diff] [blame] | 277 | if (a->log2_subpage_sz != clib_mem_get_log2_page_size ()) |
Damjan Marion | 8ebd792 | 2018-11-28 10:46:03 +0100 | [diff] [blame] | 278 | mmap_flags |= MAP_HUGETLB; |
Tom Jones | 77ce67f | 2024-01-26 14:15:54 +0000 | [diff] [blame] | 279 | #endif /* __linux__ */ |
Damjan Marion | 8ebd792 | 2018-11-28 10:46:03 +0100 | [diff] [blame] | 280 | |
Damjan Marion | 54e8e39 | 2018-11-07 17:55:26 +0100 | [diff] [blame] | 281 | mmap_flags |= MAP_PRIVATE | MAP_ANONYMOUS; |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 282 | a->fd = -1; |
| 283 | } |
| 284 | |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 285 | va = pm->base + (((uword) vec_len (pm->pages)) << pm->def_log2_page_sz); |
| 286 | if (mmap (va, size, PROT_READ | PROT_WRITE, mmap_flags, a->fd, 0) == |
| 287 | MAP_FAILED) |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 288 | { |
| 289 | pm->error = clib_error_return_unix (0, "failed to mmap %u pages at %p " |
| 290 | "fd %d numa %d flags 0x%x", n_pages, |
| 291 | va, a->fd, numa_node, mmap_flags); |
Andrew Yourtchenko | 9ce3523 | 2019-11-18 10:23:54 +0000 | [diff] [blame] | 292 | va = MAP_FAILED; |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 293 | goto error; |
| 294 | } |
| 295 | |
Damjan Marion | 6bfd076 | 2020-09-11 22:16:53 +0200 | [diff] [blame] | 296 | if (a->log2_subpage_sz != clib_mem_get_log2_page_size () && |
| 297 | mlock (va, size) != 0) |
Artem Belov | f6defa1 | 2019-02-26 01:47:34 +0000 | [diff] [blame] | 298 | { |
Damjan Marion | 801c701 | 2019-10-30 18:07:35 +0100 | [diff] [blame] | 299 | pm->error = clib_error_return_unix (0, "Unable to lock pages"); |
| 300 | goto error; |
Artem Belov | f6defa1 | 2019-02-26 01:47:34 +0000 | [diff] [blame] | 301 | } |
| 302 | |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 303 | clib_memset (va, 0, size); |
| 304 | |
Damjan Marion | f8cb701 | 2020-10-09 17:16:55 +0200 | [diff] [blame] | 305 | rv = clib_mem_set_default_numa_affinity (); |
| 306 | if (rv == CLIB_MEM_ERROR && numa_node != 0) |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 307 | { |
| 308 | pm->error = clib_error_return_unix (0, "failed to restore mempolicy"); |
| 309 | goto error; |
| 310 | } |
| 311 | |
| 312 | /* we tolerate move_pages failure only if request os for numa node 0 |
| 313 | to support non-numa kernels */ |
Damjan Marion | f8cb701 | 2020-10-09 17:16:55 +0200 | [diff] [blame] | 314 | clib_mem_get_page_stats (va, CLIB_MEM_PAGE_SZ_DEFAULT, 1, &stats); |
| 315 | |
Klement Sekera | ec62af5 | 2021-04-20 18:08:45 +0200 | [diff] [blame] | 316 | if (stats.per_numa[numa_node] != 1 && |
| 317 | !(numa_node == 0 && stats.unknown == 1)) |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 318 | { |
Damjan Marion | f8cb701 | 2020-10-09 17:16:55 +0200 | [diff] [blame] | 319 | u16 allocated_at = ~0; |
| 320 | if (stats.unknown) |
| 321 | clib_error_return (0, |
| 322 | "unable to get information about numa allocation"); |
| 323 | |
| 324 | for (u16 i = 0; i < CLIB_MAX_NUMAS; i++) |
| 325 | if (stats.per_numa[i] == 1) |
| 326 | allocated_at = i; |
| 327 | |
| 328 | clib_error_return (0, |
| 329 | "page allocated on the wrong numa node (%u), " |
| 330 | "expected %u", |
| 331 | allocated_at, numa_node); |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 332 | |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 333 | goto error; |
| 334 | } |
| 335 | |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 336 | for (i = 0; i < n_pages; i++) |
| 337 | { |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 338 | vec_add2 (pm->pages, pp, 1); |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 339 | pp->n_free_blocks = 1 << (pm->def_log2_page_sz - PMALLOC_LOG2_BLOCK_SZ); |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 340 | pp->index = pp - pm->pages; |
| 341 | pp->arena_index = a->index; |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 342 | vec_add1 (a->page_indices, pp->index); |
| 343 | a->n_pages++; |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 344 | } |
| 345 | |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 346 | |
| 347 | /* if new arena is using smaller page size, we need to rebuild whole |
| 348 | lookup table */ |
| 349 | if (a->log2_subpage_sz < pm->lookup_log2_page_sz) |
| 350 | { |
| 351 | pm->lookup_log2_page_sz = a->log2_subpage_sz; |
| 352 | pmalloc_update_lookup_table (pm, vec_len (pm->pages) - n_pages, |
| 353 | n_pages); |
| 354 | } |
| 355 | else |
| 356 | pmalloc_update_lookup_table (pm, 0, vec_len (pm->pages)); |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 357 | |
| 358 | /* return pointer to 1st page */ |
| 359 | return pp - (n_pages - 1); |
| 360 | |
| 361 | error: |
Damjan Marion | 801c701 | 2019-10-30 18:07:35 +0100 | [diff] [blame] | 362 | if (va != MAP_FAILED) |
| 363 | { |
| 364 | /* unmap & reserve */ |
| 365 | munmap (va, size); |
| 366 | mmap (va, size, PROT_NONE, MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, |
| 367 | -1, 0); |
| 368 | } |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 369 | if (a->fd != -1) |
| 370 | close (a->fd); |
| 371 | return 0; |
| 372 | } |
| 373 | |
Damjan Marion | dae1c7e | 2020-10-17 13:32:25 +0200 | [diff] [blame] | 374 | __clib_export void * |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 375 | clib_pmalloc_create_shared_arena (clib_pmalloc_main_t * pm, char *name, |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 376 | uword size, u32 log2_page_sz, u32 numa_node) |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 377 | { |
| 378 | clib_pmalloc_arena_t *a; |
| 379 | clib_pmalloc_page_t *pp; |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 380 | u32 n_pages; |
| 381 | |
| 382 | clib_error_free (pm->error); |
| 383 | |
| 384 | if (log2_page_sz == 0) |
| 385 | log2_page_sz = pm->def_log2_page_sz; |
| 386 | else if (log2_page_sz != pm->def_log2_page_sz && |
Damjan Marion | 6bfd076 | 2020-09-11 22:16:53 +0200 | [diff] [blame] | 387 | log2_page_sz != clib_mem_get_log2_page_size ()) |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 388 | { |
| 389 | pm->error = clib_error_create ("unsupported page size (%uKB)", |
| 390 | 1 << (log2_page_sz - 10)); |
| 391 | return 0; |
| 392 | } |
| 393 | |
| 394 | n_pages = pmalloc_size2pages (size, pm->def_log2_page_sz); |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 395 | |
| 396 | if (n_pages + vec_len (pm->pages) > pm->max_pages) |
| 397 | return 0; |
| 398 | |
Damjan Marion | f8cb701 | 2020-10-09 17:16:55 +0200 | [diff] [blame] | 399 | if (numa_node == CLIB_PMALLOC_NUMA_LOCAL) |
| 400 | numa_node = clib_get_current_numa_node (); |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 401 | |
| 402 | pool_get (pm->arenas, a); |
| 403 | a->index = a - pm->arenas; |
| 404 | a->name = format (0, "%s%c", name, 0); |
| 405 | a->numa_node = numa_node; |
| 406 | a->flags = CLIB_PMALLOC_ARENA_F_SHARED_MEM; |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 407 | a->log2_subpage_sz = log2_page_sz; |
| 408 | a->subpages_per_page = 1U << (pm->def_log2_page_sz - log2_page_sz); |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 409 | |
| 410 | if ((pp = pmalloc_map_pages (pm, a, numa_node, n_pages)) == 0) |
| 411 | { |
| 412 | vec_free (a->name); |
| 413 | memset (a, 0, sizeof (*a)); |
| 414 | pool_put (pm->arenas, a); |
| 415 | return 0; |
| 416 | } |
| 417 | |
Kingwel Xie | 5efaeee | 2018-11-10 02:56:00 -0500 | [diff] [blame] | 418 | return pm->base + ((uword) pp->index << pm->def_log2_page_sz); |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 419 | } |
| 420 | |
| 421 | static inline void * |
| 422 | clib_pmalloc_alloc_inline (clib_pmalloc_main_t * pm, clib_pmalloc_arena_t * a, |
| 423 | uword size, uword align, u32 numa_node) |
| 424 | { |
| 425 | clib_pmalloc_page_t *pp; |
| 426 | u32 n_blocks, block_align, *page_index; |
| 427 | |
| 428 | ASSERT (is_pow2 (align)); |
| 429 | |
Damjan Marion | f8cb701 | 2020-10-09 17:16:55 +0200 | [diff] [blame] | 430 | if (numa_node == CLIB_PMALLOC_NUMA_LOCAL) |
| 431 | numa_node = clib_get_current_numa_node (); |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 432 | |
| 433 | if (a == 0) |
| 434 | { |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 435 | if (size > 1ULL << pm->def_log2_page_sz) |
| 436 | return 0; |
| 437 | |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 438 | vec_validate_init_empty (pm->default_arena_for_numa_node, |
| 439 | numa_node, ~0); |
| 440 | if (pm->default_arena_for_numa_node[numa_node] == ~0) |
| 441 | { |
| 442 | pool_get (pm->arenas, a); |
| 443 | pm->default_arena_for_numa_node[numa_node] = a - pm->arenas; |
| 444 | a->name = format (0, "default-numa-%u%c", numa_node, 0); |
| 445 | a->numa_node = numa_node; |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 446 | a->log2_subpage_sz = pm->def_log2_page_sz; |
| 447 | a->subpages_per_page = 1; |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 448 | } |
| 449 | else |
| 450 | a = pool_elt_at_index (pm->arenas, |
| 451 | pm->default_arena_for_numa_node[numa_node]); |
| 452 | } |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 453 | else if (size > 1ULL << a->log2_subpage_sz) |
| 454 | return 0; |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 455 | |
| 456 | n_blocks = round_pow2 (size, PMALLOC_BLOCK_SZ) / PMALLOC_BLOCK_SZ; |
| 457 | block_align = align >> PMALLOC_LOG2_BLOCK_SZ; |
| 458 | |
| 459 | vec_foreach (page_index, a->page_indices) |
| 460 | { |
| 461 | pp = vec_elt_at_index (pm->pages, *page_index); |
| 462 | void *rv = alloc_chunk_from_page (pm, pp, n_blocks, block_align, |
| 463 | numa_node); |
| 464 | |
| 465 | if (rv) |
| 466 | return rv; |
| 467 | } |
| 468 | |
| 469 | if ((a->flags & CLIB_PMALLOC_ARENA_F_SHARED_MEM) == 0 && |
| 470 | (pp = pmalloc_map_pages (pm, a, numa_node, 1))) |
| 471 | return alloc_chunk_from_page (pm, pp, n_blocks, block_align, numa_node); |
| 472 | |
| 473 | return 0; |
| 474 | } |
| 475 | |
Damjan Marion | dae1c7e | 2020-10-17 13:32:25 +0200 | [diff] [blame] | 476 | __clib_export void * |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 477 | clib_pmalloc_alloc_aligned_on_numa (clib_pmalloc_main_t * pm, uword size, |
| 478 | uword align, u32 numa_node) |
| 479 | { |
| 480 | return clib_pmalloc_alloc_inline (pm, 0, size, align, numa_node); |
| 481 | } |
| 482 | |
Damjan Marion | f4cfa2a | 2022-06-01 16:18:23 +0200 | [diff] [blame] | 483 | __clib_export void * |
| 484 | clib_pmalloc_alloc_aligned (clib_pmalloc_main_t *pm, uword size, uword align) |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 485 | { |
| 486 | return clib_pmalloc_alloc_inline (pm, 0, size, align, |
| 487 | CLIB_PMALLOC_NUMA_LOCAL); |
| 488 | } |
| 489 | |
Damjan Marion | 4a251d0 | 2021-05-06 17:28:12 +0200 | [diff] [blame] | 490 | __clib_export void * |
| 491 | clib_pmalloc_alloc_from_arena (clib_pmalloc_main_t *pm, void *arena_va, |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 492 | uword size, uword align) |
| 493 | { |
| 494 | clib_pmalloc_arena_t *a = clib_pmalloc_get_arena (pm, arena_va); |
| 495 | return clib_pmalloc_alloc_inline (pm, a, size, align, 0); |
| 496 | } |
| 497 | |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 498 | static inline int |
| 499 | pmalloc_chunks_mergeable (clib_pmalloc_arena_t * a, clib_pmalloc_page_t * pp, |
| 500 | u32 ci1, u32 ci2) |
| 501 | { |
| 502 | clib_pmalloc_chunk_t *c1, *c2; |
| 503 | |
| 504 | if (ci1 == ~0 || ci2 == ~0) |
| 505 | return 0; |
| 506 | |
| 507 | c1 = get_chunk (pp, ci1); |
| 508 | c2 = get_chunk (pp, ci2); |
| 509 | |
| 510 | if (c1->used || c2->used) |
| 511 | return 0; |
| 512 | |
| 513 | if (c1->start >> (a->log2_subpage_sz - PMALLOC_LOG2_BLOCK_SZ) != |
| 514 | c2->start >> (a->log2_subpage_sz - PMALLOC_LOG2_BLOCK_SZ)) |
| 515 | return 0; |
| 516 | |
| 517 | return 1; |
| 518 | } |
| 519 | |
Damjan Marion | dae1c7e | 2020-10-17 13:32:25 +0200 | [diff] [blame] | 520 | __clib_export void |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 521 | clib_pmalloc_free (clib_pmalloc_main_t * pm, void *va) |
| 522 | { |
| 523 | clib_pmalloc_page_t *pp; |
| 524 | clib_pmalloc_chunk_t *c; |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 525 | clib_pmalloc_arena_t *a; |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 526 | uword *p; |
| 527 | u32 chunk_index, page_index; |
| 528 | |
| 529 | p = hash_get (pm->chunk_index_by_va, pointer_to_uword (va)); |
| 530 | |
| 531 | if (p == 0) |
| 532 | os_panic (); |
| 533 | |
| 534 | chunk_index = p[0]; |
| 535 | page_index = clib_pmalloc_get_page_index (pm, va); |
| 536 | hash_unset (pm->chunk_index_by_va, pointer_to_uword (va)); |
| 537 | |
| 538 | pp = vec_elt_at_index (pm->pages, page_index); |
| 539 | c = pool_elt_at_index (pp->chunks, chunk_index); |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 540 | a = pool_elt_at_index (pm->arenas, pp->arena_index); |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 541 | c->used = 0; |
| 542 | pp->n_free_blocks += c->size; |
| 543 | pp->n_free_chunks++; |
| 544 | |
| 545 | /* merge with next if free */ |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 546 | if (pmalloc_chunks_mergeable (a, pp, chunk_index, c->next)) |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 547 | { |
| 548 | clib_pmalloc_chunk_t *next = get_chunk (pp, c->next); |
| 549 | c->size += next->size; |
| 550 | c->next = next->next; |
| 551 | if (next->next != ~0) |
| 552 | get_chunk (pp, next->next)->prev = chunk_index; |
| 553 | memset (next, 0, sizeof (*next)); |
| 554 | pool_put (pp->chunks, next); |
| 555 | pp->n_free_chunks--; |
| 556 | } |
| 557 | |
| 558 | /* merge with prev if free */ |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 559 | if (pmalloc_chunks_mergeable (a, pp, c->prev, chunk_index)) |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 560 | { |
| 561 | clib_pmalloc_chunk_t *prev = get_chunk (pp, c->prev); |
| 562 | prev->size += c->size; |
| 563 | prev->next = c->next; |
| 564 | if (c->next != ~0) |
| 565 | get_chunk (pp, c->next)->prev = c->prev; |
| 566 | memset (c, 0, sizeof (*c)); |
| 567 | pool_put (pp->chunks, c); |
| 568 | pp->n_free_chunks--; |
| 569 | } |
| 570 | } |
| 571 | |
| 572 | static u8 * |
| 573 | format_pmalloc_page (u8 * s, va_list * va) |
| 574 | { |
| 575 | clib_pmalloc_page_t *pp = va_arg (*va, clib_pmalloc_page_t *); |
| 576 | int verbose = va_arg (*va, int); |
| 577 | u32 indent = format_get_indent (s); |
| 578 | |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 579 | if (pp->chunks == 0) |
| 580 | return s; |
| 581 | |
| 582 | s = format (s, "free %u chunks %u free-chunks %d ", |
| 583 | (pp->n_free_blocks) << PMALLOC_LOG2_BLOCK_SZ, |
| 584 | pool_elts (pp->chunks), pp->n_free_chunks); |
| 585 | |
| 586 | if (verbose >= 2) |
| 587 | { |
| 588 | clib_pmalloc_chunk_t *c; |
| 589 | c = pool_elt_at_index (pp->chunks, pp->first_chunk_index); |
| 590 | s = format (s, "\n%U%12s%12s%8s%8s%8s%8s", |
| 591 | format_white_space, indent + 2, |
| 592 | "chunk offset", "size", "used", "index", "prev", "next"); |
| 593 | while (1) |
| 594 | { |
| 595 | s = format (s, "\n%U%12u%12u%8s%8d%8d%8d", |
| 596 | format_white_space, indent + 2, |
| 597 | c->start << PMALLOC_LOG2_BLOCK_SZ, |
| 598 | c->size << PMALLOC_LOG2_BLOCK_SZ, |
| 599 | c->used ? "yes" : "no", |
| 600 | c - pp->chunks, c->prev, c->next); |
| 601 | if (c->next == ~0) |
| 602 | break; |
| 603 | c = pool_elt_at_index (pp->chunks, c->next); |
| 604 | } |
| 605 | } |
| 606 | return s; |
| 607 | } |
| 608 | |
Damjan Marion | dae1c7e | 2020-10-17 13:32:25 +0200 | [diff] [blame] | 609 | __clib_export u8 * |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 610 | format_pmalloc (u8 * s, va_list * va) |
| 611 | { |
| 612 | clib_pmalloc_main_t *pm = va_arg (*va, clib_pmalloc_main_t *); |
| 613 | int verbose = va_arg (*va, int); |
| 614 | u32 indent = format_get_indent (s); |
| 615 | |
| 616 | clib_pmalloc_page_t *pp; |
| 617 | clib_pmalloc_arena_t *a; |
| 618 | |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 619 | s = format (s, "used-pages %u reserved-pages %u default-page-size %U " |
Damjan Marion | c04e2b0 | 2018-10-25 15:56:04 +0200 | [diff] [blame] | 620 | "lookup-page-size %U%s", vec_len (pm->pages), pm->max_pages, |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 621 | format_log2_page_size, pm->def_log2_page_sz, |
Damjan Marion | c04e2b0 | 2018-10-25 15:56:04 +0200 | [diff] [blame] | 622 | format_log2_page_size, pm->lookup_log2_page_sz, |
| 623 | pm->flags & CLIB_PMALLOC_F_NO_PAGEMAP ? " no-pagemap" : ""); |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 624 | |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 625 | |
| 626 | if (verbose >= 2) |
| 627 | s = format (s, " va-start %p", pm->base); |
| 628 | |
| 629 | if (pm->error) |
| 630 | s = format (s, "\n%Ulast-error: %U", format_white_space, indent + 2, |
| 631 | format_clib_error, pm->error); |
| 632 | |
| 633 | |
| 634 | /* *INDENT-OFF* */ |
Damjan Marion | b2c31b6 | 2020-12-13 21:47:40 +0100 | [diff] [blame] | 635 | pool_foreach (a, pm->arenas) |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 636 | { |
| 637 | u32 *page_index; |
Damjan Marion | 567e61d | 2018-10-24 17:08:26 +0200 | [diff] [blame] | 638 | s = format (s, "\n%Uarena '%s' pages %u subpage-size %U numa-node %u", |
| 639 | format_white_space, indent + 2, a->name, |
| 640 | vec_len (a->page_indices), format_log2_page_size, |
| 641 | a->log2_subpage_sz, a->numa_node); |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 642 | if (a->fd != -1) |
| 643 | s = format (s, " shared fd %d", a->fd); |
| 644 | if (verbose >= 1) |
| 645 | vec_foreach (page_index, a->page_indices) |
| 646 | { |
| 647 | pp = vec_elt_at_index (pm->pages, *page_index); |
| 648 | s = format (s, "\n%U%U", format_white_space, indent + 4, |
| 649 | format_pmalloc_page, pp, verbose); |
| 650 | } |
Damjan Marion | b2c31b6 | 2020-12-13 21:47:40 +0100 | [diff] [blame] | 651 | } |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 652 | /* *INDENT-ON* */ |
| 653 | |
| 654 | return s; |
| 655 | } |
| 656 | |
Damjan Marion | dae1c7e | 2020-10-17 13:32:25 +0200 | [diff] [blame] | 657 | __clib_export u8 * |
Mohsin Kazmi | 6ec99c3 | 2018-11-07 16:55:18 +0100 | [diff] [blame] | 658 | format_pmalloc_map (u8 * s, va_list * va) |
| 659 | { |
| 660 | clib_pmalloc_main_t *pm = va_arg (*va, clib_pmalloc_main_t *); |
| 661 | |
| 662 | u32 index; |
| 663 | s = format (s, "%16s %13s %8s", "virtual-addr", "physical-addr", "size"); |
| 664 | vec_foreach_index (index, pm->lookup_table) |
| 665 | { |
| 666 | uword *lookup_val, pa, va; |
| 667 | lookup_val = vec_elt_at_index (pm->lookup_table, index); |
Kingwel Xie | dbc34b8 | 2018-11-11 22:55:58 -0500 | [diff] [blame] | 668 | va = |
| 669 | pointer_to_uword (pm->base) + |
| 670 | ((uword) index << pm->lookup_log2_page_sz); |
Mohsin Kazmi | 6ec99c3 | 2018-11-07 16:55:18 +0100 | [diff] [blame] | 671 | pa = va - *lookup_val; |
| 672 | s = |
| 673 | format (s, "\n %16p %13p %8U", uword_to_pointer (va, u64), |
| 674 | uword_to_pointer (pa, u64), format_log2_page_size, |
| 675 | pm->lookup_log2_page_sz); |
| 676 | } |
| 677 | return s; |
| 678 | } |
| 679 | |
Damjan Marion | 68b4da6 | 2018-09-30 18:26:20 +0200 | [diff] [blame] | 680 | /* |
| 681 | * fd.io coding-style-patch-verification: ON |
| 682 | * |
| 683 | * Local Variables: |
| 684 | * eval: (c-set-style "gnu") |
| 685 | * End: |
| 686 | */ |