2 * Copyright (c) 2015 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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 /** @cond DOCUMENTATION_IS_IN_BIHASH_DOC_H */
18 static inline void *BV (alloc_aligned) (BVT (clib_bihash) * h, uword nbytes)
22 /* Round to an even number of cache lines */
23 nbytes += CLIB_CACHE_LINE_BYTES - 1;
24 nbytes &= ~(CLIB_CACHE_LINE_BYTES - 1);
26 rv = alloc_arena_next (h);
27 alloc_arena_next (h) += nbytes;
29 if (rv >= alloc_arena_size (h))
32 return (void *) (uword) (rv + alloc_arena (h));
36 void BV (clib_bihash_init)
37 (BVT (clib_bihash) * h, char *name, u32 nbuckets, uword memory_size)
41 nbuckets = 1 << (max_log2 (nbuckets));
43 h->name = (u8 *) name;
44 h->nbuckets = nbuckets;
45 h->log2_nbuckets = max_log2 (nbuckets);
48 * Make sure the requested size is rational. The max table
49 * size without playing the alignment card is 64 Gbytes.
50 * If someone starts complaining that's not enough, we can shift
51 * the offset by CLIB_LOG2_CACHE_LINE_BYTES...
53 ASSERT (memory_size < (1ULL << BIHASH_BUCKET_OFFSET_BITS));
55 alloc_arena (h) = (uword) clib_mem_vm_alloc (memory_size);
56 alloc_arena_next (h) = 0;
57 alloc_arena_size (h) = memory_size;
59 bucket_size = nbuckets * sizeof (h->buckets[0]);
60 h->buckets = BV (alloc_aligned) (h, bucket_size);
62 h->alloc_lock = BV (alloc_aligned) (h, CLIB_CACHE_LINE_BYTES);
69 #if !defined (MFD_ALLOW_SEALING)
70 #define MFD_ALLOW_SEALING 0x0002U
73 void BV (clib_bihash_master_init_svm)
74 (BVT (clib_bihash) * h, char *name, u32 nbuckets, u64 memory_size)
78 vec_header_t *freelist_vh;
81 ASSERT (memory_size < (1ULL << 32));
82 /* Set up for memfd sharing */
83 if ((fd = memfd_create (name, MFD_ALLOW_SEALING)) == -1)
85 clib_unix_warning ("memfd_create");
89 if (ftruncate (fd, memory_size) < 0)
91 clib_unix_warning ("ftruncate");
95 /* Not mission-critical, complain and continue */
96 if ((fcntl (fd, F_ADD_SEALS, F_SEAL_SHRINK)) == -1)
97 clib_unix_warning ("fcntl (F_ADD_SEALS)");
99 mmap_addr = mmap (0, memory_size,
100 PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 /* offset */ );
102 if (mmap_addr == MAP_FAILED)
104 clib_unix_warning ("mmap failed");
108 h->sh = (void *) mmap_addr;
110 nbuckets = 1 << (max_log2 (nbuckets));
112 h->name = (u8 *) name;
113 h->sh->nbuckets = h->nbuckets = nbuckets;
114 h->log2_nbuckets = max_log2 (nbuckets);
116 alloc_arena (h) = (u64) (uword) mmap_addr;
117 alloc_arena_next (h) = CLIB_CACHE_LINE_BYTES;
118 alloc_arena_size (h) = memory_size;
120 bucket_size = nbuckets * sizeof (h->buckets[0]);
121 h->buckets = BV (alloc_aligned) (h, bucket_size);
122 h->sh->buckets_as_u64 = (u64) BV (clib_bihash_get_offset) (h, h->buckets);
124 h->alloc_lock = BV (alloc_aligned) (h, CLIB_CACHE_LINE_BYTES);
125 h->alloc_lock[0] = 0;
127 h->sh->alloc_lock_as_u64 =
128 (u64) BV (clib_bihash_get_offset) (h, (void *) h->alloc_lock);
130 BV (alloc_aligned) (h,
131 sizeof (vec_header_t) +
132 BIHASH_FREELIST_LENGTH * sizeof (u64));
133 freelist_vh->len = BIHASH_FREELIST_LENGTH;
134 freelist_vh->dlmalloc_header_offset = 0xDEADBEEF;
135 h->sh->freelists_as_u64 =
136 (u64) BV (clib_bihash_get_offset) (h, freelist_vh->vector_data);
137 h->freelists = (void *) (freelist_vh->vector_data);
142 void BV (clib_bihash_slave_init_svm)
143 (BVT (clib_bihash) * h, char *name, int fd)
147 BVT (clib_bihash_shared_header) * sh;
149 /* Trial mapping, to learn the segment size */
150 mmap_addr = mmap (0, 4096, PROT_READ, MAP_SHARED, fd, 0 /* offset */ );
151 if (mmap_addr == MAP_FAILED)
153 clib_unix_warning ("trial mmap failed");
157 sh = (BVT (clib_bihash_shared_header) *) mmap_addr;
159 memory_size = sh->alloc_arena_size;
161 munmap (mmap_addr, 4096);
163 /* Actual mapping, at the required size */
164 mmap_addr = mmap (0, memory_size,
165 PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 /* offset */ );
167 if (mmap_addr == MAP_FAILED)
169 clib_unix_warning ("mmap failed");
175 h->sh = (void *) mmap_addr;
176 alloc_arena (h) = (u64) (uword) mmap_addr;
179 h->name = (u8 *) name;
180 h->buckets = BV (clib_bihash_get_value) (h, h->sh->buckets_as_u64);
181 h->nbuckets = h->sh->nbuckets;
182 h->log2_nbuckets = max_log2 (h->nbuckets);
184 h->alloc_lock = BV (clib_bihash_get_value) (h, h->sh->alloc_lock_as_u64);
185 h->freelists = BV (clib_bihash_get_value) (h, h->sh->freelists_as_u64);
188 #endif /* BIHASH_32_64_SVM */
190 void BV (clib_bihash_set_kvp_format_fn) (BVT (clib_bihash) * h,
191 format_function_t * fmt_fn)
196 void BV (clib_bihash_free) (BVT (clib_bihash) * h)
198 vec_free (h->working_copies);
199 #if BIHASH_32_64_SVM == 0
200 vec_free (h->freelists);
203 (void) close (h->memfd);
205 clib_mem_vm_free ((void *) (uword) (alloc_arena (h)), alloc_arena_size (h));
206 memset (h, 0, sizeof (*h));
210 BVT (clib_bihash_value) *
211 BV (value_alloc) (BVT (clib_bihash) * h, u32 log2_pages)
213 BVT (clib_bihash_value) * rv = 0;
215 ASSERT (h->alloc_lock[0]);
218 ASSERT (log2_pages < vec_len (h->freelists));
221 if (log2_pages >= vec_len (h->freelists) || h->freelists[log2_pages] == 0)
223 vec_validate_init_empty (h->freelists, log2_pages, 0);
224 rv = BV (alloc_aligned) (h, (sizeof (*rv) * (1 << log2_pages)));
227 rv = BV (clib_bihash_get_value) (h, (uword) h->freelists[log2_pages]);
228 h->freelists[log2_pages] = rv->next_free_as_u64;
233 * Latest gcc complains that the length arg is zero
234 * if we replace (1<<log2_pages) with vec_len(rv).
237 memset (rv, 0xff, sizeof (*rv) * (1 << log2_pages));
242 BV (value_free) (BVT (clib_bihash) * h, BVT (clib_bihash_value) * v,
245 ASSERT (h->alloc_lock[0]);
247 ASSERT (vec_len (h->freelists) > log2_pages);
250 memset (v, 0xFE, sizeof (*v) * (1 << log2_pages));
252 v->next_free_as_u64 = (u64) h->freelists[log2_pages];
253 h->freelists[log2_pages] = (u64) BV (clib_bihash_get_offset) (h, v);
257 BV (make_working_copy) (BVT (clib_bihash) * h, BVT (clib_bihash_bucket) * b)
259 BVT (clib_bihash_value) * v;
260 BVT (clib_bihash_bucket) working_bucket __attribute__ ((aligned (8)));
261 BVT (clib_bihash_value) * working_copy;
262 u32 thread_index = os_get_thread_index ();
263 int log2_working_copy_length;
265 ASSERT (h->alloc_lock[0]);
267 if (thread_index >= vec_len (h->working_copies))
269 vec_validate (h->working_copies, thread_index);
270 vec_validate_init_empty (h->working_copy_lengths, thread_index, ~0);
274 * working_copies are per-cpu so that near-simultaneous
275 * updates from multiple threads will not result in sporadic, spurious
278 working_copy = h->working_copies[thread_index];
279 log2_working_copy_length = h->working_copy_lengths[thread_index];
281 h->saved_bucket.as_u64 = b->as_u64;
283 if (b->log2_pages > log2_working_copy_length)
286 * It's not worth the bookkeeping to free working copies
288 * clib_mem_free (working_copy);
290 working_copy = BV (alloc_aligned)
291 (h, sizeof (working_copy[0]) * (1 << b->log2_pages));
292 h->working_copy_lengths[thread_index] = b->log2_pages;
293 h->working_copies[thread_index] = working_copy;
296 v = BV (clib_bihash_get_value) (h, b->offset);
298 clib_memcpy (working_copy, v, sizeof (*v) * (1 << b->log2_pages));
299 working_bucket.as_u64 = b->as_u64;
300 working_bucket.offset = BV (clib_bihash_get_offset) (h, working_copy);
301 CLIB_MEMORY_BARRIER ();
302 b->as_u64 = working_bucket.as_u64;
303 h->working_copies[thread_index] = working_copy;
307 BVT (clib_bihash_value) *
308 BV (split_and_rehash)
309 (BVT (clib_bihash) * h,
310 BVT (clib_bihash_value) * old_values, u32 old_log2_pages,
313 BVT (clib_bihash_value) * new_values, *new_v;
314 int i, j, length_in_kvs;
316 ASSERT (h->alloc_lock[0]);
318 new_values = BV (value_alloc) (h, new_log2_pages);
319 length_in_kvs = (1 << old_log2_pages) * BIHASH_KVP_PER_PAGE;
321 for (i = 0; i < length_in_kvs; i++)
325 /* Entry not in use? Forget it */
326 if (BV (clib_bihash_is_free) (&(old_values->kvp[i])))
329 /* rehash the item onto its new home-page */
330 new_hash = BV (clib_bihash_hash) (&(old_values->kvp[i]));
331 new_hash >>= h->log2_nbuckets;
332 new_hash &= (1 << new_log2_pages) - 1;
333 new_v = &new_values[new_hash];
335 /* Across the new home-page */
336 for (j = 0; j < BIHASH_KVP_PER_PAGE; j++)
339 if (BV (clib_bihash_is_free) (&(new_v->kvp[j])))
341 clib_memcpy (&(new_v->kvp[j]), &(old_values->kvp[i]),
342 sizeof (new_v->kvp[j]));
346 /* Crap. Tell caller to try again */
347 BV (value_free) (h, new_values, new_log2_pages);
356 BVT (clib_bihash_value) *
357 BV (split_and_rehash_linear)
358 (BVT (clib_bihash) * h,
359 BVT (clib_bihash_value) * old_values, u32 old_log2_pages,
362 BVT (clib_bihash_value) * new_values;
363 int i, j, new_length, old_length;
365 ASSERT (h->alloc_lock[0]);
367 new_values = BV (value_alloc) (h, new_log2_pages);
368 new_length = (1 << new_log2_pages) * BIHASH_KVP_PER_PAGE;
369 old_length = (1 << old_log2_pages) * BIHASH_KVP_PER_PAGE;
372 /* Across the old value array */
373 for (i = 0; i < old_length; i++)
375 /* Find a free slot in the new linear scan bucket */
376 for (; j < new_length; j++)
378 /* Old value not in use? Forget it. */
379 if (BV (clib_bihash_is_free) (&(old_values->kvp[i])))
382 /* New value should never be in use */
383 if (BV (clib_bihash_is_free) (&(new_values->kvp[j])))
385 /* Copy the old value and move along */
386 clib_memcpy (&(new_values->kvp[j]), &(old_values->kvp[i]),
387 sizeof (new_values->kvp[j]));
392 /* This should never happen... */
393 clib_warning ("BUG: linear rehash failed!");
394 BV (value_free) (h, new_values, new_log2_pages);
402 static inline int BV (clib_bihash_add_del_inline)
403 (BVT (clib_bihash) * h, BVT (clib_bihash_kv) * add_v, int is_add,
404 int (*is_stale_cb) (BVT (clib_bihash_kv) *, void *), void *arg)
407 BVT (clib_bihash_bucket) * b, tmp_b;
408 BVT (clib_bihash_value) * v, *new_v, *save_new_v, *working_copy;
411 u32 new_log2_pages, old_log2_pages;
412 u32 thread_index = os_get_thread_index ();
413 int mark_bucket_linear;
416 hash = BV (clib_bihash_hash) (add_v);
418 bucket_index = hash & (h->nbuckets - 1);
419 b = &h->buckets[bucket_index];
421 hash >>= h->log2_nbuckets;
423 BV (clib_bihash_lock_bucket) (b);
425 /* First elt in the bucket? */
426 if (BV (clib_bihash_bucket_is_empty) (b))
430 BV (clib_bihash_unlock_bucket) (b);
434 BV (clib_bihash_alloc_lock) (h);
435 v = BV (value_alloc) (h, 0);
436 BV (clib_bihash_alloc_unlock) (h);
439 tmp_b.as_u64 = 0; /* clears bucket lock */
440 tmp_b.offset = BV (clib_bihash_get_offset) (h, v);
442 CLIB_MEMORY_BARRIER ();
444 b->as_u64 = tmp_b.as_u64;
445 BV (clib_bihash_unlock_bucket) (b);
449 /* WARNING: we're still looking at the live copy... */
450 limit = BIHASH_KVP_PER_PAGE;
451 v = BV (clib_bihash_get_value) (h, b->offset);
453 v += (b->linear_search == 0) ? hash & ((1 << b->log2_pages) - 1) : 0;
454 if (b->linear_search)
455 limit <<= b->log2_pages;
460 * Because reader threads are looking at live data,
461 * we have to be extra careful. Readers do NOT hold the
462 * bucket lock. We need to be SLOWER than a search, past the
463 * point where readers CHECK the bucket lock.
467 * For obvious (in hindsight) reasons, see if we're supposed to
468 * replace an existing key, then look for an empty slot.
470 for (i = 0; i < limit; i++)
472 if (!memcmp (&(v->kvp[i]), &add_v->key, sizeof (add_v->key)))
474 CLIB_MEMORY_BARRIER (); /* Add a delay */
475 clib_memcpy (&(v->kvp[i]), add_v, sizeof (*add_v));
476 BV (clib_bihash_unlock_bucket) (b);
481 * Look for an empty slot. If found, use it
483 for (i = 0; i < limit; i++)
485 if (BV (clib_bihash_is_free) (&(v->kvp[i])))
488 * Copy the value first, so that if a reader manages
489 * to match the new key, the value will be right...
491 clib_memcpy (&(v->kvp[i].value),
492 &add_v->value, sizeof (add_v->value));
493 CLIB_MEMORY_BARRIER (); /* Make sure the value has settled */
494 clib_memcpy (&(v->kvp[i]), &add_v->key, sizeof (add_v->key));
496 ASSERT (b->refcnt > 0);
497 BV (clib_bihash_unlock_bucket) (b);
501 /* look for stale data to overwrite */
504 for (i = 0; i < limit; i++)
506 if (is_stale_cb (&(v->kvp[i]), arg))
508 CLIB_MEMORY_BARRIER ();
509 clib_memcpy (&(v->kvp[i]), add_v, sizeof (*add_v));
510 BV (clib_bihash_unlock_bucket) (b);
515 /* Out of space in this bucket, split the bucket... */
517 else /* delete case */
519 for (i = 0; i < limit; i++)
521 /* Found the key? Kill it... */
522 if (!memcmp (&(v->kvp[i]), &add_v->key, sizeof (add_v->key)))
524 memset (&(v->kvp[i]), 0xff, sizeof (*(add_v)));
525 /* Is the bucket empty? */
526 if (PREDICT_TRUE (b->refcnt > 1))
529 BV (clib_bihash_unlock_bucket) (b);
532 else /* yes, free it */
534 /* Save old bucket value, need log2_pages to free it */
535 tmp_b.as_u64 = b->as_u64;
536 CLIB_MEMORY_BARRIER ();
538 /* Kill and unlock the bucket */
541 /* And free the backing storage */
542 BV (clib_bihash_alloc_lock) (h);
543 /* Note: v currently points into the middle of the bucket */
544 v = BV (clib_bihash_get_value) (h, tmp_b.offset);
545 BV (value_free) (h, v, tmp_b.log2_pages);
546 BV (clib_bihash_alloc_unlock) (h);
552 BV (clib_bihash_unlock_bucket) (b);
556 /* Move readers to a (locked) temp copy of the bucket */
557 BV (clib_bihash_alloc_lock) (h);
558 BV (make_working_copy) (h, b);
560 v = BV (clib_bihash_get_value) (h, h->saved_bucket.offset);
562 old_log2_pages = h->saved_bucket.log2_pages;
563 new_log2_pages = old_log2_pages + 1;
564 mark_bucket_linear = 0;
566 working_copy = h->working_copies[thread_index];
569 new_v = BV (split_and_rehash) (h, working_copy, old_log2_pages,
576 /* Try re-splitting. If that fails, fall back to linear search */
577 new_v = BV (split_and_rehash) (h, working_copy, old_log2_pages,
583 /* pinned collisions, use linear search */
585 BV (split_and_rehash_linear) (h, working_copy, old_log2_pages,
587 mark_bucket_linear = 1;
591 /* Try to add the new entry */
593 new_hash = BV (clib_bihash_hash) (add_v);
594 limit = BIHASH_KVP_PER_PAGE;
595 if (mark_bucket_linear)
596 limit <<= new_log2_pages;
597 new_hash >>= h->log2_nbuckets;
598 new_hash &= (1 << new_log2_pages) - 1;
599 new_v += mark_bucket_linear ? 0 : new_hash;
601 for (i = 0; i < limit; i++)
603 if (BV (clib_bihash_is_free) (&(new_v->kvp[i])))
605 clib_memcpy (&(new_v->kvp[i]), add_v, sizeof (*add_v));
610 /* Crap. Try again */
611 BV (value_free) (h, save_new_v, new_log2_pages);
613 * If we've already doubled the size of the bucket once,
614 * fall back to linear search now.
622 tmp_b.log2_pages = new_log2_pages;
623 tmp_b.offset = BV (clib_bihash_get_offset) (h, save_new_v);
624 tmp_b.linear_search = mark_bucket_linear;
625 tmp_b.refcnt = h->saved_bucket.refcnt + 1;
626 ASSERT (tmp_b.refcnt > 0);
628 CLIB_MEMORY_BARRIER ();
629 b->as_u64 = tmp_b.as_u64;
630 BV (clib_bihash_alloc_unlock) (h);
634 int BV (clib_bihash_add_del)
635 (BVT (clib_bihash) * h, BVT (clib_bihash_kv) * add_v, int is_add)
637 return BV (clib_bihash_add_del_inline) (h, add_v, is_add, 0, 0);
640 int BV (clib_bihash_add_or_overwrite_stale)
641 (BVT (clib_bihash) * h, BVT (clib_bihash_kv) * add_v,
642 int (*stale_callback) (BVT (clib_bihash_kv) *, void *), void *arg)
644 return BV (clib_bihash_add_del_inline) (h, add_v, 1, stale_callback, arg);
647 int BV (clib_bihash_search)
648 (BVT (clib_bihash) * h,
649 BVT (clib_bihash_kv) * search_key, BVT (clib_bihash_kv) * valuep)
653 BVT (clib_bihash_value) * v;
654 BVT (clib_bihash_bucket) * b;
659 hash = BV (clib_bihash_hash) (search_key);
661 bucket_index = hash & (h->nbuckets - 1);
662 b = &h->buckets[bucket_index];
664 if (BV (clib_bihash_bucket_is_empty) (b))
667 if (PREDICT_FALSE (b->lock))
669 volatile BVT (clib_bihash_bucket) * bv = b;
674 hash >>= h->log2_nbuckets;
676 v = BV (clib_bihash_get_value) (h, b->offset);
677 limit = BIHASH_KVP_PER_PAGE;
678 v += (b->linear_search == 0) ? hash & ((1 << b->log2_pages) - 1) : 0;
679 if (PREDICT_FALSE (b->linear_search))
680 limit <<= b->log2_pages;
682 for (i = 0; i < limit; i++)
684 if (BV (clib_bihash_key_compare) (v->kvp[i].key, search_key->key))
693 u8 *BV (format_bihash) (u8 * s, va_list * args)
695 BVT (clib_bihash) * h = va_arg (*args, BVT (clib_bihash) *);
696 int verbose = va_arg (*args, int);
697 BVT (clib_bihash_bucket) * b;
698 BVT (clib_bihash_value) * v;
700 u64 active_elements = 0;
701 u64 active_buckets = 0;
702 u64 linear_buckets = 0;
705 s = format (s, "Hash table %s\n", h->name ? h->name : (u8 *) "(unnamed)");
707 for (i = 0; i < h->nbuckets; i++)
710 if (BV (clib_bihash_bucket_is_empty) (b))
713 s = format (s, "[%d]: empty\n", i);
719 if (b->linear_search)
724 s = format (s, "[%d]: heap offset %lld, len %d, linear %d\n", i,
725 b->offset, (1 << b->log2_pages), b->linear_search);
728 v = BV (clib_bihash_get_value) (h, b->offset);
729 for (j = 0; j < (1 << b->log2_pages); j++)
731 for (k = 0; k < BIHASH_KVP_PER_PAGE; k++)
733 if (BV (clib_bihash_is_free) (&v->kvp[k]))
736 s = format (s, " %d: empty\n",
737 j * BIHASH_KVP_PER_PAGE + k);
744 s = format (s, " %d: %U\n",
745 j * BIHASH_KVP_PER_PAGE + k,
746 h->fmt_fn, &(v->kvp[k]));
750 s = format (s, " %d: %U\n",
751 j * BIHASH_KVP_PER_PAGE + k,
752 BV (format_bihash_kvp), &(v->kvp[k]));
761 s = format (s, " %lld active elements %lld active buckets\n",
762 active_elements, active_buckets);
763 s = format (s, " %d free lists\n", vec_len (h->freelists));
765 for (i = 0; i < vec_len (h->freelists); i++)
768 BVT (clib_bihash_value) * free_elt;
769 u64 free_elt_as_u64 = h->freelists[i];
771 while (free_elt_as_u64)
773 free_elt = BV (clib_bihash_get_value) (h, free_elt_as_u64);
775 free_elt_as_u64 = free_elt->next_free_as_u64;
778 if (nfree || verbose)
779 s = format (s, " [len %d] %u free elts\n", 1 << i, nfree);
782 s = format (s, " %lld linear search buckets\n", linear_buckets);
783 used_bytes = alloc_arena_next (h);
785 " arena: base %llx, next %llx\n"
786 " used %lld b (%lld Mbytes) of %lld b (%lld Mbytes)\n",
787 alloc_arena (h), alloc_arena_next (h),
788 used_bytes, used_bytes >> 20,
789 alloc_arena_size (h), alloc_arena_size (h) >> 20);
793 void BV (clib_bihash_foreach_key_value_pair)
794 (BVT (clib_bihash) * h, void *callback, void *arg)
797 BVT (clib_bihash_bucket) * b;
798 BVT (clib_bihash_value) * v;
799 void (*fp) (BVT (clib_bihash_kv) *, void *) = callback;
801 for (i = 0; i < h->nbuckets; i++)
804 if (BV (clib_bihash_bucket_is_empty) (b))
807 v = BV (clib_bihash_get_value) (h, b->offset);
808 for (j = 0; j < (1 << b->log2_pages); j++)
810 for (k = 0; k < BIHASH_KVP_PER_PAGE; k++)
812 if (BV (clib_bihash_is_free) (&v->kvp[k]))
815 (*fp) (&v->kvp[k], arg);
817 * In case the callback deletes the last entry in the bucket...
819 if (BV (clib_bihash_bucket_is_empty) (b))
832 * fd.io coding-style-patch-verification: ON
835 * eval: (c-set-style "gnu")