summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/linux
AgeCommit message (Collapse)AuthorFilesLines
2021-07-22vppinfra: add abstract socket & netns fnsNathan Skrzypczak2-0/+87
* Add clib_socket_init support for abstract sockets if name starts with an '@' * Add clib_socket_init_netns to open socket in netns * Add clib_netns_open Type: feature Change-Id: I89637ad657c702ec38ddecb5c03a1673d0dfb104 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2021-07-13vppinfra: fix SIGSEGV in clib_mem_vm_unmapchenqijun1-4/+6
while one mprotect PROT_NONE on hdr->next or hdr->prev, the other one with the PROT_NONE is unmap at the same time, cause SIGSEGV. Type: fix Signed-off-by: arikachen <eaglesora@gmail.com> Change-Id: I21c0497da140c9654b566e47f767a90346715ed8
2021-04-19vppinfra: momve clib_sysfs_list_to_bitmap to sysfs.cDamjan Marion2-0/+29
Type: refactor Change-Id: Ia5a7ebd5c8492326f5bf2f1264f1c5ef38ccb4dc Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-04-18vppinfra: remove linux/syscall.hDamjan Marion2-73/+7
For portabiliy reasons it is better to have all wrapped in clib code. I.e. instead of using getcpu() we have clib_get_current_numa_node () and clib_get_current_cpu_id(). Type: refactor Change-Id: I29b52d7f29bc7f93873402c4070561f564b71c63 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-02-26vppinfra: mem leak in show memory main-heapFlorin Coras1-1/+5
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I23d1dda86c781ac077dbee7cb0e1ddeaa328c660
2021-02-04vppinfra: fix mem map mt issue due to snprintfFlorin Coras1-1/+1
Type: fix Apparently snprintf is not thread safe!? Thread 6 "vpp_wk_3" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffeed1a3700 (LWP 819375)] 0x00007ffff58fc2b4 in __GI__IO_default_xsputn (n=<optimized out>, data=<optimized out>, f=<optimized out>) at genops.c:394 394 genops.c: No such file or directory. (gdb) bt 0 0x00007ffff58fc2b4 in __GI__IO_default_xsputn (n=<optimized out>, data=<optimized out>, f=<optimized out>) at genops.c:394 1 __GI__IO_default_xsputn (f=0x7ffeec35e050, data=<optimized out>, n=9) at genops.c:370 2 0x00007ffff58e127c in __vfprintf_internal (s=s@entry=0x7ffeec35e050, format=format@entry=0x7ffff5f833ce "%s", ap=ap@entry=0x7ffeec35e1d0, mode_flags=mode_flags@entry=2) at ../libio/libioP.h:948 3 0x00007ffff58f611a in __vsnprintf_internal (string=0x7ffed57ed018 "", maxlen=<optimized out>, format=0x7ffff5f833ce "%s", args=args@entry=0x7ffeec35e1d0, mode_flags=2) at vsnprintf.c:114 4 0x00007ffff5997fd1 in ___snprintf_chk (s=<optimized out>, maxlen=<optimized out>, flag=<optimized out>, slen=<optimized out>, format=<optimized out>) at snprintf_chk.c:38 5 0x00007ffff5f7fd74 in clib_mem_vm_map_internal (base=<optimized out>, log2_page_sz=<optimized out>, size=<optimized out>, fd=<optimized out>, offset=<optimized out>, name=0x0) at /scratch/fcoras/vpp/src/vppinfra/linux/mem.c:502 Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I8ff7cfed422273dbdc55068772e11f5e550a9b60
2020-10-26vppinfra: clib_mem_vm_{un}map thread safeDamjan Marion1-0/+22
Type: improvement Change-Id: I1ab1b100000b4d7212c58e10312e16e7527bd333 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-21vppinfra: fix ASAN annotationBenoît Ganne1-0/+1
Type: fix Change-Id: I90b537eba7f56dbb1928f0ab5f157218affb43f5 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-10-17vppinfra: explicitly export symbolsDamjan Marion2-14/+14
Type: improvement Change-Id: I57a9f85f7df1fc48656b72592349f4c544302f77 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-08vppinfra: fix coverity warningsDave Barach1-4/+4
Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I654747d618cc4fe99b7774827303769fe43392ed
2020-10-06vppinfra: add heap header in front of dlmalloc spaceDamjan Marion1-0/+2
This patch adds smal header in front of dlmalloc space, and it stores some additional information about the heap. Immediate benefit of this patch is that we know the underlying page size si we can display heap page statistics / real memory usage. Type: improvement Change-Id: Ibd6989cc2f2f64630ab08734c9552e15029c5f3f Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-02vppinfra: use clib_mem_create_heap() to create numa heap(s)Damjan Marion1-157/+0
Type: improvement Change-Id: Ie04302c576869bc7bfaa9f13ed2ea8a403a393d4 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-02vppinfra: fix legacy huge pages creation for default sizeBenoît Ganne1-1/+14
Type: fix Change-Id: I941b92ebec66ccd9c9e9a12d485844313c9f117b Signed-off-by: Benoît Ganne <bganne@cisco.com> Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2020-10-01svm: simplify memfd client segment mappingFlorin Coras1-58/+0
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I33c6a5d1686cc32a6cde149083256d6cf0770fc5
2020-09-25vppinfra: add clib_mem_set_numa_affinity()Damjan Marion1-8/+57
Type: improvement Change-Id: I81a7fb71c8ce0c0d22e326a4ddd01bc1c1aea5f7 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-09-17stats: configurable page sizeDamjan Marion1-72/+116
Type: improvement Change-Id: I9973bce20a0a2a8a7e227cf96518de5b79374425 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-09-17vlib: show FD in 'show memory map'Damjan Marion1-0/+1
Type: improvement Change-Id: I04752c011e4ca58f56aa53f6ae27bae93a5c4590 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-09-17vppinfra: support main heap with different page sizesDamjan Marion1-24/+247
Type: improvement Change-Id: I381fc3dec8580208d0e24637d791af69011aa83b Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-09-17vppinfra: detect memory attributes on clib_mem_initDamjan Marion1-4/+70
Type: improvement Change-Id: I298aadfdf17d98dfb1ada1ec4f87e0821e6aeb7f Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-09-14vppinfra: add clib_log2_page_sz and format/unformat functionsDamjan Marion1-2/+3
Type: improvement Change-Id: Ie44dbf9396cfed19dba153810b7bd76ce5377cd4 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-04-22misc: fix coverity warningsDave Barach1-1/+1
Type: fix Ticket: VPP-1837 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I9ec87d2293d8f92c3e488a0f61083cf815ac496c
2020-04-21vppinfra: bihash improvementsDave Barach1-0/+32
Template instances can allocate BIHASH_KVP_PER_PAGE data records tangent to the bucket, to remove a dependent read / prefetch. Template instances can ask for immediate memory allocation, to avoid several branches in the lookup path. Clean up l2 fib, gpb plugin codes: use clib_bihash_get_bucket(...) Use hugepages for bihash allocation arenas Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Signed-off-by: Damjan Marion <damarion@cisco.com> Change-Id: I92fc11bc58e48d84e2d61f44580916dd1c56361c
2020-02-11svm: numa awareness for ssvm segmentsFlorin Coras1-1/+39
Type: feature Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I999836a7893a89aac5243b111eac35fddd03e2a6
2020-02-07 misc: address sanitizer: fix vm instrumentationBenoît Ganne1-0/+2
Type: fix Change-Id: Ifd61c0683c85fe7340965c225ed23e46ec88e01a Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-03-18Fix build with newer linux headersDamjan Marion1-2/+4
Change-Id: Ibfdcec60567ec357205fa137257f2d8cba44b01c Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-01-01Default huge page size to the regular page sizeDave Barach1-0/+6
With this simple tweak, vpp is OK for "make test" or non-dpdk driver operation over a kernel which doesn't support hugepages at all. Tested on a Raspberry-pi 3B+ running the Ubuntu 18.04 64-bit server beta image. It's amazing that such a minimal system will not only self-compile vpp, but also run the unit tests. It's slow, but what do you expect for that amount of money? Change-Id: I7f080f871c828cc4b44be13809495278fadbd717 Signed-off-by: Dave Barach <dave@barachs.net>
2018-10-25pmalloc: support for 4K pagesDamjan Marion1-15/+26
Change-Id: Iecceffe06a92660976ebb58cd3cbec4be8931db0 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-10-24vppinfra: autodetect default hugepage sizeDamjan Marion2-8/+56
Change-Id: I5ff713ad0b254c74c5622e3b9425cca365b5ee97 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-10-23Numa-aware, growable physical memory allocator (pmalloc)Damjan Marion1-0/+6
Change-Id: Ic4c46bc733afae8bf0d8146623ed15633928de30 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-10-22vppinfra: use log2 page size in hugepage functionsDamjan Marion3-19/+27
Change-Id: Ibec32c6df32f4cd9889d378e244f170c93ad295b Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-10-22Fix dereferencing null string in dpdk_early_initJuraj Sloboda1-0/+2
Change-Id: Iffba7ebe5af8fadc0251f3a10022739d45f394ce Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
2018-10-19vppinfra: use memfd_create for hugepage mounts if supportedDamjan Marion1-25/+51
Starting with kernel 4.14 hugepage fd can be retrieved with memfd_systemcall Change-Id: I0f3bd6d0a7757ffe7b98e83763502013ac763ecb Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-10-16Fix coverity issue for potentially overflowing of page sizeHaiyang Tan1-2/+3
Change-Id: I2779626d745badb63386efcf729da7a094a4f297 Signed-off-by: Haiyang Tan <haiyangtan@tencent.com>
2018-10-10vppinfra: introduce clib_mem_vm_ext_free() to avoid fd leaksHaiyang Tan1-0/+11
Change-Id: I8691a10493d159a97574550c111f07722960a7cd Signed-off-by: Haiyang Tan <haiyangtan@tencent.com>
2018-08-2832/64 shmem bihash interoperabilityDave Barach1-3/+3
Move the binary api segment above 4gb Change-Id: I40e8aa7a97722a32397f5a538b5ff8344c50d408 Signed-off-by: Dave Barach <dave@barachs.net>
2018-04-18vppinfra: make set_mempolicy failure non-critical unless NUMA_FORCE is setDamjan Marion1-1/+2
Change-Id: I6c1c855cf5fc2ee06f1c7ddd6576ca16cd556fdd Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-04-11Clean up temp dir in failure casesDave Barach1-0/+3
Change-Id: Icfb99a09726c01e96ff14967afbafa4116e02eff Signed-off-by: Dave Barach <dbarach@cisco.com>
2018-03-09Correct address calculation for VPP-1168Lee Roberts1-1/+1
Use (u64) cast to ensure proper address calculations. Change-Id: I6bad50010b140189f1b0af177e55da0045bd7a93 Signed-off-by: Lee Roberts <lee.roberts@hpe.com>
2018-03-06glibc 2.27 fixMarco Varlese1-0/+2
With glibc 2.27 the memfd_create has been added to the devel libraries. That's causing the internally defined static function to clash with the system wide one. This patch addresses that issue on systems with latest glibc libraries. Change-Id: I788bf49b23d5b5f1cb1c0374e243d8a429178a71 Signed-off-by: Marco Varlese <marco.varlese@suse.com>
2018-03-04vppinfra: fix clib_mem_vm_ext_alloc non-shared allocationsDamjan Marion1-3/+7
Change-Id: I6d049c0875b91f67f008dc04ae7efe2f8ddc276e Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-02-06Provide page-aligned length to ftruncate.Igor Mikhailov (imichail)1-1/+1
For some files such as hugepages files, ftruncate() fails with the error "Invalid argument" if the 'length' parameter is not on a page boundary. Change-Id: I42a9cde98707da15e3c5d1653046e2277fc7a424 Signed-off-by: Igor Mikhailov (imichail) <imichail@cisco.com>
2018-01-25session: add support for memfd segmentsFlorin Coras1-1/+1
- update segment manager and session api to work with both flavors of ssvm segments - added generic ssvm slave/master init and del functions - cleanup/refactor tcp_echo - fixed uses of svm fifo pool as vector Change-Id: Ieee8b163faa407da6e77e657a2322de213a9d2a0 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-01-17ssvm: reuse clib mem infra for memfd segmentsFlorin Coras1-6/+51
Change-Id: I67648dbed3c7ed291b3e1ce617d83a776d3623bb Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-01-09physmem: fix physmem allocation on kernels without NUMA supportDamjan Marion1-4/+4
Change-Id: I056598a1818a39c2da73e252600c14585e5aae83 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-09-27Various fixes for issues found by Coverity (VPP-972)Chris Luke1-0/+6
174267: Revisit this string termination issue 174816: Add check for NULL when trace is enabled 177211: Add notation that mutex is not required here 177117: Added check for log2_page_size == 0 and returns an error if so 163697,163698: Added missing sw_if_index validation Change-Id: I5a76fcf6505c785bfb3269e353360031c6a0fd0f Signed-off-by: Chris Luke <chrisy@flirble.org>
2017-09-18Fixes for issues Coverity has reported (VPP-972)Chris Luke1-1/+1
177117: fstat() returns -1 on error; the code is checking for any positive value instead 175142: final return could never be reached; simple refactoring 175235,175236: Warning suppressed with an explicit cast to (void) 174817: Final return couldn't be reached; is is_in_order is 0 then 'rv' is already returned above 172095,172093: If is_is_set does not get set to 1, then return 0 has already been invoked 174405: Re-kill this (nothing sets rv) 171136: Looks like a cmd line flag to set test_bytes was missing; added it, and refactored the argc/argv processing to avoid two other potential segv's 176813: Add range checking for term width/height. First stab at a reasonable range is 1-512 for both. 175350: Fix implicit casting in shift operation 174272: Not a c+p error; try using a coverity annotation to ignore it 174273,175320: Annotated FORWARD_NULL Change-Id: I58d0f860fc2209f59f8d1b6b344d631b8d429ace Signed-off-by: Chris Luke <chrisy@flirble.org>
2017-09-15vppinfra: add clib_mem_vm_ext_alloc functionDamjan Marion4-0/+612
Change-Id: Iff33694fc42cc3bcc73cf1372339053a6365039c Signed-off-by: Damjan Marion <damarion@cisco.com>