1. 24 Jan, 2020 2 commits
    • Dan Melnic's avatar
      Handle __clang__ warnings under Windows · 6884ecfc
      Dan Melnic authored
      Summary: Handle __clang__ warnings under Windows
      
      Differential Revision: D19529853
      
      fbshipit-source-id: 936f4acaaf0f601fc09e5e7de447b9c9b4c34151
      6884ecfc
    • Jason Fried's avatar
      memory leak fix · e95c0a25
      Jason Fried authored
      Summary:
      release() returns ptr contained and thus we never actually call the destructor :|
      
      .reset() is what we wanted, call the destructor NOW.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19548008
      
      fbshipit-source-id: be904a7b5fb84aae5deef408e9d8e05fcd930a4c
      e95c0a25
  2. 23 Jan, 2020 12 commits
    • Andrew Krieger's avatar
      Back out "Use extended alignment safe allocator in CPUThreadPoolExecutor" · 4e91e1ca
      Andrew Krieger authored
      Differential Revision: D19539438
      
      fbshipit-source-id: 88c536a72a9b54d36ead2215d935745710d1d3db
      4e91e1ca
    • Paul McKenney's avatar
      Add documentation header for Folly::rcu_retire as well as call and retire member functions. (#1308) · c94486da
      Paul McKenney authored
      Summary:
      Pull Request resolved: https://github.com/facebook/folly/pull/1308
      
      The current documentation for the various Folly::Rcu retire functions is lacking, so this commit adds comment headers.
      
      Reviewed By: magedm
      
      Differential Revision: D18631443
      
      fbshipit-source-id: 690d3c6f0d7c3142d74c97b3388fd973ca2abaac
      c94486da
    • Paul McKenney's avatar
      Add documentation header for Folly::rcu_reader and Foly::rcu_reader_domain (#1307) · 10d2951e
      Paul McKenney authored
      Summary:
      Pull Request resolved: https://github.com/facebook/folly/pull/1307
      
      The current documentation for Folly::rcu_reader and Foly::rcu_reader_domain is lacking, so this commit adds comment headers.
      
      Reviewed By: ot, magedm
      
      Differential Revision: D18620267
      
      fbshipit-source-id: 98d26aa2f54fccf85de1fc5fda99a1843739bee0
      10d2951e
    • Mohamed Bassem's avatar
      Update the CheckAtomic CMake module to check for __atomic_fetch_add_4 instead... · 99c5b866
      Mohamed Bassem authored
      Update the CheckAtomic CMake module to check for __atomic_fetch_add_4 instead of __atomic_is_lock_free
      
      Summary:
      When building with clang, the build fails with:
      
      ```
      -- Looking for __atomic_is_lock_free in atomic
      -- Looking for __atomic_is_lock_free in atomic - not found
      CMake Error at cmake/CheckAtomic.cmake:90 (message):
        Host compiler appears to require libatomic, but cannot find it.
      Call Stack (most recent call first):
        CMakeLists.txt:75 (include)
      ```
      
      And the error is:
      
      ```
      /usr/share/cmake-3.10/Modules/CheckFunctionExists.c:7:3: error: conflicting types for '__atomic_is_lock_free'
        CHECK_FUNCTION_EXISTS(void);
        ^
      <command line>:1:31: note: expanded from here
      #define CHECK_FUNCTION_EXISTS __atomic_is_lock_free
                                    ^
      /usr/share/cmake-3.10/Modules/CheckFunctionExists.c:7:3: note: '__atomic_is_lock_free' is a builtin with type 'int (unsigned long, const volatile void *)'
      <command line>:1:31: note: expanded from here
      #define CHECK_FUNCTION_EXISTS __atomic_is_lock_free
                                    ^
      /usr/share/cmake-3.10/Modules/CheckFunctionExists.c:17:25: error: too few arguments to function call, expected 2, have 0
        CHECK_FUNCTION_EXISTS();
        ~~~~~~~~~~~~~~~~~~~~~ ^
      ```
      
      LLVM's CheckAtomic (https://fburl.com/bk14shjt) uses `__atomic_fetch_add_4` so I'm modifying the configs to use it as well to check for the existence of the library.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19497168
      
      fbshipit-source-id: 64f77487efd16dba49055f6c4cb1cdd0fc4ae6da
      99c5b866
    • Maged Michael's avatar
      hazptr: Rename hazptr_obj_batch to hazptr_obj_cohort · 2c1539c1
      Maged Michael authored
      Summary: Rename hazptr obj batch to obj cohort, a more accurate description.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D19518771
      
      fbshipit-source-id: f50a8a481f260dde4fce10fb9664d4f86c263b60
      2c1539c1
    • Nathan Bronson's avatar
      fix tests for platforms with small std::string · 8221b02b
      Nathan Bronson authored
      Summary:
      F14MapTest's continuousCapacitySmall test implicitly assumed
      that folly::F14FastMap<std::size_t, std::string> uses the vector storage
      policy, but this is not the case if std::string is 8 bytes.  Remove the
      assumption.
      
      Differential Revision: D19431446
      
      fbshipit-source-id: 6e6f0cbe7f57b23b2df38c87bb36a6532ab97a14
      8221b02b
    • Lucian Grijincu's avatar
      Revert D19384064: Support inline class member functions in stack trace. · ad8ac4d9
      Lucian Grijincu authored
      Differential Revision:
      D19384064
      
      Original commit changeset: a2a6397b94aa
      
      fbshipit-source-id: e8ba1e8f6b3c3d3840a912e4c094b570b23ccbcf
      ad8ac4d9
    • Lucian Grijincu's avatar
      Revert D19437477: Prefer linkage name to name for inline function frames. · 96349f7f
      Lucian Grijincu authored
      Differential Revision:
      D19437477
      
      Original commit changeset: 1755a71678cb
      
      fbshipit-source-id: 7fce386def631d1cf217de528b15d37aee5e921b
      96349f7f
    • Lucian Grijincu's avatar
      Revert D19444082: Get the correct file name for inline functions. · 40883f36
      Lucian Grijincu authored
      Differential Revision:
      D19444082
      
      Original commit changeset: 5a5524046090
      
      fbshipit-source-id: ecb9b9048af9c00c951cb6e540433b5a3cecaf71
      40883f36
    • Lucian Grijincu's avatar
      Revert D19438098: Support debug_ranges lookup when matching address for inline functions. · 3c7f1b3a
      Lucian Grijincu authored
      Differential Revision:
      D19438098
      
      Original commit changeset: 12f1d5c60067
      
      fbshipit-source-id: de234114216abf243256fa7ac8c1faf7b0b4bb0b
      3c7f1b3a
    • Andrew Krieger's avatar
      Use aligned allocation for hazptr_rec<Atom> · cf917cf0
      Andrew Krieger authored
      Summary:
      The default allocator for `new` does not apparently respect the extended alignment requirement for `hasptr_rec<Atom>`. We use folly's AlignedSysAllocator for these cases, which will then pass UBSan checks for alignment.
      
      ```
      xplat/folly/synchronization/HazptrDomain.h:572:20: runtime error: constructor call on misaligned address 0x60c0000004c0 for type 'hazptr_rec<atomic>', which requires 128 byte alignment
      0x60c0000004c0: note: pointer points here
       02 00 00 7f  be be be be be be be be  be be be be be be be be  be be be be be be be be  be be be be
                    ^
          #0 0x77949e in folly::hazptr_domain<std::atomic>::acquire_new_hprec() xplat/folly/synchronization/HazptrDomain.h:572:16
          #1 0x7791cc in folly::hazptr_domain<std::atomic>::hprec_acquire() xplat/folly/synchronization/HazptrDomain.h:227:35
          #2 0x766a7f in folly::hazptr_holder<std::atomic>::hazptr_holder(folly::hazptr_domain<std::atomic>&) xplat/folly/synchronization/HazptrHolder.h:71:21
          #3 0x766a7f in void folly::UnboundedQueue<folly::CPUThreadPoolExecutor::CPUTask, false, false, false, 6ul, 7ul, std::atomic>::enqueueImpl<folly::CPUThreadPoolExecutor::CPUTask>(folly::CPUThreadPoolExecutor::CPUTask&&) xplat/folly/concurrency/UnboundedQueue.h:374
      ```
      
      Reviewed By: magedm
      
      Differential Revision: D19237973
      
      fbshipit-source-id: 0edea12bb3f028d21830689d52f7e0290d187ff9
      cf917cf0
    • Andrew Krieger's avatar
      Use extended alignment safe allocator in CPUThreadPoolExecutor · d2bc79c0
      Andrew Krieger authored
      Summary:
      Until C++17 types with extended alignment need special handling
      in eg. std::vector and also std::unique_ptr. CPUThreadPoolExecutor has a
      default queue that requires extended alignment, but also allows the user
      to provide their own blocking queue. To handle this we move the private
      member to a shared_ptr which supported type erased destructors, and then
      use allocate_shared for the default queue type with a custom allocator
      that will satisfy alignment constraints.
      
      ```
      .../unique_ptr.h:825:34: runtime error: constructor call on misaligned address 0x613000000040 for type 'folly::UnboundedBlockingQueue<folly::CPUThreadPoolExecutor::CPUTask>', which requires 128 byte alignment
      0x613000000040: note: pointer points here
       02 00 00 1c  be be be be be be be be  be be be be be be be be  be be be be be be be be  be be be be
                    ^
          #0 0x75b35e in std::_MakeUniq<folly::UnboundedBlockingQueue<folly::CPUThreadPoolExecutor::CPUTask> >::__single_object std::make_unique<folly::UnboundedBlockingQueue<folly::CPUThreadPoolExecutor::CPUTask> >() .../unique_ptr.h:825:30
          #1 0x75602f in folly::CPUThreadPoolExecutor::CPUThreadPoolExecutor(unsigned long, std::shared_ptr<folly::ThreadFactory>) xplat/folly/executors/CPUThreadPoolExecutor.cpp:66:18
          #2 0x756c6c in folly::CPUThreadPoolExecutor::CPUThreadPoolExecutor(unsigned long) xplat/folly/executors/CPUThreadPoolExecutor.cpp:84:7
      ```
      
      Differential Revision: D19237477
      
      fbshipit-source-id: c88b26e2ca17e168f124ba27c0989f787b1ce4fd
      d2bc79c0
  3. 22 Jan, 2020 9 commits
    • Gabriel Russo's avatar
      Removed redudant parenthesis to remove warnings on gen/Base.h · 3a9a0976
      Gabriel Russo authored
      Summary: `-Wredundant-parens` complains about those.
      
      Reviewed By: luciang
      
      Differential Revision: D19347715
      
      fbshipit-source-id: 7460ff1ee675774e8811db95d12ac02ce7e924ea
      3a9a0976
    • Gabriel Russo's avatar
      Suppress unnecessary packing warnings · 56c80f8e
      Gabriel Russo authored
      Reviewed By: yfeldblum
      
      Differential Revision: D19331966
      
      fbshipit-source-id: ad369c51eb1253faf293fc37457d2c8122e3d227
      56c80f8e
    • Matt Ma's avatar
      Support debug_ranges lookup when matching address for inline functions. · 339d51d3
      Matt Ma authored
      Summary:
      Range lists are contained in a separate object file section called .debug_ranges. A range list is
      indicated by a DW_AT_ranges attribute whose value is represented as an offset from the
      beginning of the .debug_ranges section to the beginning of the range list.
      
      Each entry in a range list is either:
      - a range list entry,
      - a base address selection entry, or
      - an end of list entry.
      
      Reviewed By: luciang
      
      Differential Revision: D19438098
      
      fbshipit-source-id: 12f1d5c60067b0674c44f35ef2731781eb93f1d5
      339d51d3
    • Matt Ma's avatar
      Get the correct file name for inline functions. · ed7837d1
      Matt Ma authored
      Summary:
      Here is an example for class inline member function declared and defined in the same file:
      
      ```
      Definition:
      0x00004c0a:           DW_TAG_subprogram [55] *
                              DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x00177124] = "_ZNK5folly10symbolizer4test24ClassWithInlineFunctions9inlineBarERNS0_10FrameArrayILm100EEE")
                              DW_AT_name [DW_FORM_strp] ( .debug_str[0x00089a73] = "inlineBar")
                              DW_AT_decl_file [DW_FORM_data1] (0x1a)
                              DW_AT_decl_line [DW_FORM_data1] (0xa5)
                              DW_AT_declaration [DW_FORM_flag_present]  (true)
                              DW_AT_external [DW_FORM_flag_present] (true)
                              DW_AT_accessibility [DW_FORM_data1] (0x01)
      …
      
      Declaration:   -- no DW_AT_decl_file
      0x000164c1:   DW_TAG_subprogram [228] *
                      DW_AT_specification [DW_FORM_ref4]  (cu + 0x48ea => {0x00004c0a})
                      DW_AT_inline [DW_FORM_data1]  (0x01)
                      DW_AT_object_pointer [DW_FORM_ref4] (cu + 0x161ac => {0x000164cc})
      
      …
      
      Inline function call
      0x0001657b:     DW_TAG_inlined_subroutine [140] *
                        DW_AT_abstract_origin [DW_FORM_ref4]  (cu + 0x161a1 => {0x000164c1})
                        DW_AT_low_pc [DW_FORM_addr] (0x000000000040fa6e)
                        DW_AT_high_pc [DW_FORM_data4] (0x00000055)
                        DW_AT_call_file [DW_FORM_data1] (0x1a)
                        DW_AT_call_line [DW_FORM_data1] (0xe2)
      ```
      
      Here is an example for class inline member function declared and defined in different files:
      
      ```
      Definition:  DW_AT_decl_file: 0x01  --> SymbolizerTestUtils.h
      0x00004c3d:           DW_TAG_subprogram [55] *
                              DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x0017717f] = "_ZNK5folly10symbolizer4test22InlineFunctionsWrapper9inlineBarERNS0_10FrameArrayILm100EEE")
                              DW_AT_name [DW_FORM_strp] ( .debug_str[0x00089a73] = "inlineBar")
                              DW_AT_decl_file [DW_FORM_data1] (0x01)
                              DW_AT_decl_line [DW_FORM_data1] (0x30)
                              DW_AT_declaration [DW_FORM_flag_present]  (true)
                              DW_AT_external [DW_FORM_flag_present] (true)
                              DW_AT_accessibility [DW_FORM_data1] (0x01)
      
      …
      
      Declaration:   DW_AT_decl_file: 0xbf  --> SymbolizerTestUtils-inl.h
      0x00017ee8:   DW_TAG_subprogram [231] *
                      DW_AT_decl_file [DW_FORM_data1] (0xbf)
                      DW_AT_decl_line [DW_FORM_data1] (0x21)
                      DW_AT_specification [DW_FORM_ref4]  (cu + 0x491d => {0x00004c3d})
                      DW_AT_inline [DW_FORM_data1]  (0x01)
                      DW_AT_object_pointer [DW_FORM_ref4] (cu + 0x17bd5 => {0x00017ef5})
      
      …
      
      Inline function call
      0x00017fa5:     DW_TAG_inlined_subroutine [158] *
                        DW_AT_abstract_origin [DW_FORM_ref4]  (cu + 0x17bc8 => {0x00017ee8})
                        DW_AT_low_pc [DW_FORM_addr] (0x00000000004104ee)
                        DW_AT_high_pc [DW_FORM_data4] (0x00000055)
                        DW_AT_call_file [DW_FORM_data1] (0x1a)
                        DW_AT_call_line [DW_FORM_data2] (0x0101)
      ```
      
      Reviewed By: luciang
      
      Differential Revision: D19444082
      
      fbshipit-source-id: 5a552404609073af04b0cc0b86b5e19d5149a1e1
      ed7837d1
    • Matt Ma's avatar
      Prefer linkage name to name for inline function frames. · 8feeb7e4
      Matt Ma authored
      Summary: Linkage name (DW_AT_linkage_name) contains more information than the identifier name (DW_AT_name).
      
      Reviewed By: luciang
      
      Differential Revision: D19437477
      
      fbshipit-source-id: 1755a71678cbe9e90ba7bc085e4c46b7784c273e
      8feeb7e4
    • Matt Ma's avatar
      Support inline class member functions in stack trace. · 1c998314
      Matt Ma authored
      Summary:
      Actually class inline functions exist in both .debug_info and .debug_types sections. In this diff, only the information in .debug_info is used.
      
      Step 1. Find the DW_TAG_inlined_subroutine debug info entry (DIE) based on the given address.
      Step 2. Find the DW_TAG_subprogram DIE based on the DW_AT_abstract_origin attr in inlined_subroutine, but this DIE is just a declaration.
      Step 3. Find the actual definition DW_TAG_subprogram DIE based on the DW_AT_specification attr.
      
      ```
      .debug_info
      
      0x00003657:           DW_TAG_subprogram [56] *   ---- step 3
                              DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x0002932d] = "_ZN5folly10symbolizer4test24ClassWithInlineFunctions9inlineBarERNS0_10FrameArrayILm100EEE")
                              DW_AT_name [DW_FORM_strp] ( .debug_str[0x00014064] = "inlineBar")
                              DW_AT_decl_file [DW_FORM_data1] (0x18)
                              DW_AT_decl_line [DW_FORM_data1] (0xa1)
                              DW_AT_declaration [DW_FORM_flag_present]  (true)
                              DW_AT_external [DW_FORM_flag_present] (true)
                              DW_AT_accessibility [DW_FORM_data1] (0x01)
      
      …
      
      0x0000cd74:   DW_TAG_subprogram [203] * .   ---- step 2
                      DW_AT_specification [DW_FORM_ref4]  (cu + 0x358f => {0x00003657})
                      DW_AT_inline [DW_FORM_data1]  (0x01)
                      DW_AT_object_pointer [DW_FORM_ref4] (cu + 0xccb7 => {0x0000cd7f})
      
      …
      0x0000cda0:   DW_TAG_subprogram [181] *
                      DW_AT_low_pc [DW_FORM_addr] (0x00000000002a4980)
                      DW_AT_high_pc [DW_FORM_data4] (0x00001e22)
                      DW_AT_frame_base [DW_FORM_exprloc]  (<0x1> 56 )
                      DW_AT_object_pointer [DW_FORM_ref4] (cu + 0xccf0 => {0x0000cdb8})
                      DW_AT_specification [DW_FORM_ref4]  (cu + 0x312f => {0x000031f7})
      
      …
      
      0x0000ce02:     DW_TAG_inlined_subroutine [157] *               ---- step 1
                        DW_AT_abstract_origin [DW_FORM_ref4]  (cu + 0xccac => {0x0000cd74})
                        DW_AT_low_pc [DW_FORM_addr] (0x00000000002a4f66)
                        DW_AT_high_pc [DW_FORM_data4] (0x000000c0)
                        DW_AT_call_file [DW_FORM_data1] (0x18)
                        DW_AT_call_line [DW_FORM_data1] (0xe6)
      
      .debug_types
      
      0x00020fdf:         DW_TAG_class_type [33] *
                            DW_AT_calling_convention [DW_FORM_data1]  (0x05)
                            DW_AT_name [DW_FORM_strp] ( .debug_str[0x00067094] = "ClassWithInlineFunctions")
                            DW_AT_byte_size [DW_FORM_data1] (0x08)
                            DW_AT_decl_file [DW_FORM_data1] (0x18)
                            DW_AT_decl_line [DW_FORM_data1] (0x9f)
      
      …
      
      0x00020ff5:           DW_TAG_subprogram [56] *
                              DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x0002932d] = "_ZN5folly10symbolizer4test24ClassWithInlineFunctions9inlineBarERNS0_10FrameArrayILm100EEE")
                              DW_AT_name [DW_FORM_strp] ( .debug_str[0x00014064] = "inlineBar")
                              DW_AT_decl_file [DW_FORM_data1] (0x18)
                              DW_AT_decl_line [DW_FORM_data1] (0xa1)
                              DW_AT_declaration [DW_FORM_flag_present]  (true)
                              DW_AT_external [DW_FORM_flag_present] (true)
                              DW_AT_accessibility [DW_FORM_data1] (0x01)
      
      ```
      
      Reviewed By: luciang
      
      Differential Revision: D19384064
      
      fbshipit-source-id: a2a6397b94aab9de58d013cf4ad19e658e180d31
      1c998314
    • Victor Zverovich's avatar
      Pass benchmark name as StringPiece · 683c7bb8
      Victor Zverovich authored
      Summary: In cases where `addBenchmark` is called directly the name often resides in `std::string` which requires calling `c_str()`. Make it possible to pass `std::string` by making the function take `StringPiece` instead of `const char*`.
      
      Reviewed By: rhodo
      
      Differential Revision: D19507553
      
      fbshipit-source-id: 49dd2bb77daefffeda3fc2153215de77b530f214
      683c7bb8
    • Mohamed Bassem's avatar
      Find the backtrace function using find_package instead of check_function_exists · 6aecd684
      Mohamed Bassem authored
      Summary: When building folly with clang, backtrace was marked as not found. This diff uses `find_package(Backtrace)` instead which allowed us to use the symbolizer libs.
      
      Reviewed By: simpkins
      
      Differential Revision: D19497120
      
      fbshipit-source-id: a8f8b4ffe9a2d53a53b6c7be32ac2a832a840877
      6aecd684
    • Joe Kirchoff's avatar
      Don't static_cast literal value · f656e771
      Joe Kirchoff authored
      Summary: Use functional style cast on literal value instead of static_cast
      
      Reviewed By: yfeldblum, jdonald
      
      Differential Revision: D19459138
      
      fbshipit-source-id: 103f644322394779fc5cd8512d7a5244d2231091
      f656e771
  4. 21 Jan, 2020 2 commits
  5. 20 Jan, 2020 1 commit
  6. 18 Jan, 2020 3 commits
    • Shrikrishna Khare's avatar
      fbcode_builder: getdeps: OpenNSA: install more headers · 4db6e3b7
      Shrikrishna Khare authored
      Summary:
      FBOSS needs to use header files from more directories in OpenNSA,
      so make those available in include directory.
      
      Differential Revision: D19461874
      
      fbshipit-source-id: 1fe3fbbc39477baecf9cd4f7c7a964be40cbbb12
      4db6e3b7
    • Dan Melnic's avatar
      Fix linter issue · 044b292a
      Dan Melnic authored
      Summary:
      Fix linter issue
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: danobi
      
      Differential Revision: D19435633
      
      fbshipit-source-id: 858755eda1873b20cd7dae6e24b39ce21d15608a
      044b292a
    • Lee Howes's avatar
      Fix logging function choice · 5a54b7a9
      Lee Howes authored
      Summary: Corrects incorrect logging function being called.
      
      Reviewed By: lewissbaker
      
      Differential Revision: D19453995
      
      fbshipit-source-id: 5268a8ed5ef8379da84e83ec05db9e88317f3b9a
      5a54b7a9
  7. 17 Jan, 2020 3 commits
    • Dan Melnic's avatar
      Workaround for warning caused by clang pretending to be cl · 6d886fc7
      Dan Melnic authored
      Summary: Workaround for warning caused by clang pretending to be cl
      
      Differential Revision: D19426072
      
      fbshipit-source-id: ba59913fe9b6c27f32db06f341429952fc4312b5
      6d886fc7
    • Shrikrishna Khare's avatar
      fbcode_builder: getdeps: OpenNSA update source URL · 413451f0
      Shrikrishna Khare authored
      Summary:
      This is an interim solution that unblocks failing FBOSS OSS builds.
      
      Broadcom's OpenNSA is available on github and contains large precompiled
      libraries. For large files (> 100Mb), github uses git-lfs.
      
      git clones to OpenNSA started failing yesterday with:
      
      Error downloading object: lib/x86-64/libopennsa.a (7f21d94): Smudge error:
      Error downloading lib/x86-64/libopennsa.a
      (7f21d941ac32ccae38adb05b3386be739bdccd502a878364d386e7a5cb172f35): batch
      response: This repository is over its data quota. Account responsible for LFS
      bandwidth should purchase more data packs to restore access.
      
      Github documents (refer:
      https://help.github.com/en/github/managing-large-files/about-storage-and-bandwidth-usage)
      “When you download a file tracked with Git LFS, the total file size is counted
      against the repository owner’s bandwidth limit”. It appears we are hitting that
      limit.
      
      Thus, github is not a good choice here. Even if we create a 'github release
      tarball', the tarball continues to carry lfs files and thus downloading those
      counts towards the quota (which is limited).
      
      Broadcom paid some amount to bump up the quota, but it is matter of time before
      we hit it esp given that these builds run on-diff.
      
      A better solution is to download a tarball (that contains real files, not lfs),
      and then allow Facebook lfs to cache it.
      
      While github does not support that, it seems bitbucket does.
      
      Thus, we forked OpenNSA from github into a bitbucket repo and this patch
      modifies the manifest to download a tarball from bitbucket that will be cached.
      
      Broadcom is working on a cleaner solution but this will keep our FBOSS OSS build
      clean in the interim.
      
      Reviewed By: wez
      
      Differential Revision: D19437386
      
      fbshipit-source-id: b1213a186a0af57b9fd71b30e8899e80affd4cc0
      413451f0
    • Maged Michael's avatar
      hazptr: Make using a thread pool executor for default domain asynchronous reclamation the default · b9f837ee
      Maged Michael authored
      Summary: Add a call in folly init to folly::start_hazptr_thread_pool_executor() to make the default hazptr domain use a CPUThreadPoolExecutor by default.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D19107125
      
      fbshipit-source-id: 1cebe0864de14b54349f723061c4c2b5905b105b
      b9f837ee
  8. 16 Jan, 2020 3 commits
    • Lewis Baker's avatar
      Add overload of blockingWait() that takes DrivableExecutor · 8c7f9c00
      Lewis Baker authored
      Summary:
      This allows the caller to, for example, pass their own ManualExecutor or EventBase
      and have the task scheduled onto that executor and have the current thread drive
      that executor until it completes.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19205803
      
      fbshipit-source-id: 6042f68decf8d7d9bb1d37977e5804b0504daa41
      8c7f9c00
    • Subodh Iyengar's avatar
      Add socket to notifyDataAvailable · d4d80f77
      Subodh Iyengar authored
      Summary: add the socket to the callback parameter
      
      Reviewed By: yangchi
      
      Differential Revision: D19192549
      
      fbshipit-source-id: 068bdb560273ab3203a1b7eaefa5b01c4e4e9968
      d4d80f77
    • Dan Melnic's avatar
      Add support for registered fds · 584b74cf
      Dan Melnic authored
      Summary: Add support for registered fds
      
      Reviewed By: kevin-vigor
      
      Differential Revision: D19313387
      
      fbshipit-source-id: 19527958b3986992cdafbad2c4c4902c887a9e9f
      584b74cf
  9. 15 Jan, 2020 5 commits
    • Shrikrishna Khare's avatar
      fbcode_builder: getdeps: fboss remove OpenNSL manifest · dafd4506
      Shrikrishna Khare authored
      Summary:
      Broadcom has formally replaced OpenNSL with newer OpenNSA:
      https://github.com/Broadcom-Network-Switching-Software/OpenNSA/blob/master/README.md
      
      With D16401189, FBOSS no longer depends on OpenNSL, but uses the new OpenNSA
      instead. Remove this manifest.
      
      Reviewed By: wez
      
      Differential Revision: D19413708
      
      fbshipit-source-id: f3662f1101d59a5e0e59cb7238797d652564ff90
      dafd4506
    • Yedidya Feldblum's avatar
      Use getrandom instead of /dev/urandom when available · 6fc7dd10
      Yedidya Feldblum authored
      Summary:
      [Folly] Use `getrandom` instead of `/dev/urandom` when available.
      
      The C library function `getrandom` is available on linux >= 3.17 and glibc >= 2.25.
      
      Reviewed By: ot, simpkins, luciang
      
      Differential Revision: D19211519
      
      fbshipit-source-id: 07e7e856fc81d1f04efca4a6cfa0b76ada08f443
      6fc7dd10
    • Eric Niebler's avatar
      make msan happy with exception_wrapper · 44e0aff1
      Eric Niebler authored
      Summary:
      When reading a `std::exception_ptr` out of a moved-from `folly::exception_wrapper`, we end up reading a `std::exception_ptr` field of a deleted `ExceptionPtr` object. This was causing MSAN much consternation.
      
      The fix is to test for emptiness in `to_exception_ptr` and return a default-constructed `std::exception_ptr`.
      
      This commit also adds extra test cases, since `to_exception_ptr` does something slightly different depending on whether the `exception_wrapper` object is `const` or not.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19403528
      
      fbshipit-source-id: fde74a5c4b2ddb2025703432c1ac5a19d26b9426
      44e0aff1
    • Kirk Shoop's avatar
      prevent asan failures in SingletonThreadLocal · 9450078d
      Kirk Shoop authored
      Summary:
      I have been encountering
      
      ```
      AddressSanitizer:DEADLYSIGNAL
      =================================================================
      ==937752==ERROR: AddressSanitizer: SEGV on unknown address 0x24a12000e4f18 (pc 0x7f3902a6e696 bp 0x7f37bc5e4380 sp 0x7f37bc5e42a0 T107)
      ==937752==The signal is caused by a READ memory access.
      SCARINESS: 20 (wild-addr-read)
      
          #0 0x7f3902a6e695 in folly::ThreadLocalPtr<folly::SingletonThreadLocal<folly::hazptr_tc<std::atomic>, void, folly::detail::DefaultMake<folly::hazptr_tc<std::atomic> >, void>::Wrapper, void, void>::get() const folly/ThreadLocal.h:160
          #1 0x7f3902a6d600 in get folly/ThreadLocal.h:69
          #2 0x7f3902a6d600 in folly::ThreadLocal<folly::SingletonThreadLocal<folly::hazptr_tc<std::atomic>, void, folly::detail::DefaultMake<folly::hazptr_tc<std::atomic> >, void>::Wrapper, void, void>::operator*() const folly/ThreadLocal.h:78
          #3 0x7f3902a6ca1b in folly::SingletonThreadLocal<folly::hazptr_tc<std::atomic>, void, folly::detail::DefaultMake<folly::hazptr_tc<std::atomic> >, void>::getWrapper() folly/SingletonThreadLocal.h:149
          #4 0x7f3902a6cbe5 in folly::SingletonThreadLocal<folly::hazptr_tc<std::atomic>, void, folly::detail::DefaultMake<folly::hazptr_tc<std::atomic> >, void>::LocalLifetime::~LocalLifetime() folly/SingletonThreadLocal.h:121
          #5 0x7f38f04d9fd5 in (anonymous namespace)::run(void*) /data/users/kirkshoop/gcc/trunk/libstdc++-v3/libsupc++/atexit_thread.cc:75:16
          #6 0x7f38ef9ee551 in __nptl_deallocate_tsd.part.8 /home/engshare/third-party2/glibc/2.26/src/glibc-2.26/nptl/pthread_create.c:301:8
          #7 0x7f38ef9ef7c8 in __nptl_deallocate_tsd /home/engshare/third-party2/glibc/2.26/src/glibc-2.26/sysdeps/nptl/futex-internal.h:200:3
          #8 0x7f38ef9ef7c8 in start_thread /home/engshare/third-party2/glibc/2.26/src/glibc-2.26/nptl/pthread_create.c:475:3
      ```
      
      I tried using a unique Tag for the SingletonThreadLocal for debugging purposes and this seemed to fix the issue.
      
      Reviewed By: magedm
      
      Differential Revision: D19356179
      
      fbshipit-source-id: a18c6b02f0a40e0509753075614eeff71d859bf7
      9450078d
    • Shrikrishna Khare's avatar
      OpenNSA: Don't use opennsl, switch to bcm-only API · 8dc11efb
      Shrikrishna Khare authored
      Summary:
      With the release of OpenNSA (https://github.com/Broadcom-Network-Switching-Software/OpenNSA), we can stop using opennsal altogether!
      
      This diff was created using following steps:
      
      cd fboss/agent
      find . ! -path "*\/oss*" -type f \( ! -iname "*TARGETS*" \) -exec sed -i -e 's/opennsl_spl_//g' {} \;
      find . ! -path "*\/oss*" -type f \( ! -iname "*TARGETS*" \) -exec sed -i -e 's/opennsl/bcm/g' {} \;
      find . ! -path "*\/oss*" -type f \( ! -iname "*TARGETS*" \) -exec sed -i -e 's/OPENNSL/BCM/g' {} \;
      find . ! -path "*\/oss*" -type f \( ! -iname "*TARGETS*" \) -exec sed -i -e 's/OpenNSL/Bcm/g' {} \; # for symbols like snmpBcmTransmittedPkts2048to4095Octets
      
      Furthermore:
      
      - In all TARGETS under fboss/agent replace wrapped_opennsl_symbols with wrapped_bcm_symbols.
      - hg mv agent/facebook/test/OpenNSLInterface.h agent/facebook/test/BcmInterface.h
      - BcmEgress.cpp remove operator== overload for opennsl API altogether, and remove operator== BCM API version from inside unnamed namespace, and put it in fboss namespace.
      - BcmCinter.h and BcmCinter.cpp now have some duplicate definitions as opennsl_ got renamed to bcm_. Delete one of the definitions "as appropriate".
      - Similarly, remove duplicate definitions in FakeSdk.h and FakeSdk.cpp
      - Similarly, remove duplicate definitions in SdkTracer.cpp (remove definitions calling CALL_WRAPPERS_RV_NO_CINTER). And lastly, remove CALL_WRAPPERS_RV_NO_CINTER itself.
      - arc lint
      - Remove OpennslCompatTests.cpp
      - Fix ./agent/hw/bcm/tests/facebook/BcmEgressTest.cpp to have #include
        "fboss/agent/facebook/test/MockOpenNSL.h" instead of MockBcm.h
      
      TODO:
      - This patch retains the directory structure (facebook/ subdirectory), which will be fixed in subsequent patches.
      - Remove opennsl references from TARGETS file, additional cleanup etc.
      - Remove all oss directories...
      
      Differential Revision: D16401189
      
      fbshipit-source-id: 607b6c0f97ffcacf3707f6b7a4c9454cc0b24476
      8dc11efb