Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lagidallocator] LAG ID allocator class #3

Open
wants to merge 28 commits into
base: voq-inbandif-port
Choose a base branch
from

Conversation

vganesan-nokia
Copy link
Owner

Signed-off-by: vedganes vedavinayagam.ganesan@nokia.com

Class for lag id allocation in atomic fashion. The LAG ID is allocated
from central chassis app db. A lua script loaded in the redis at the
time of lag allocator instantiation ensures allocation unique lag id when
multiple clients requests for lag id simultaneously. System wide unique
lag id is used for system lag in VOQ based switches.

vedganes and others added 25 commits September 10, 2020 01:55
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>

Kernel programming of static neigh and full mask static route for
system neighbors is moved to nbrmgr since orchagent should not own
kernel objects to avoid complication in warmboot reconciliation
The orchagent programms only SAI object for the system neighbors
and signals the completion of SAI programming by setting mac address
in SYSTE_NEIGH table of STATE_DB. Nbrmgr subscribes to these state
entries to program kernel entries corresponding to the system neighs
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>

VOQ Switch tests are added for VS tests. The following tests are added
as part of virtual chassis tests
- VOQ switch objects verification
- System port object syncing with chassis app db by checking presence of
system port RIFs in chassis app db in supervisor card
- Creation of system port RIF record creation in ASIC_DB
Following changes are done for the above tests:
- SYSTEM_PORT table is added in default_config.json of line cards. These
are loaded as part of config_db loading
- Core and Port index mapping file is added in line card directories.
This file is added to hwsku directory for processing by VS SAI
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>

Since the system port configs are moved to config_db.json, this file is
no longer used in virtual chasiss test.
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>

Code review comments fix 1.
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>

Change cout to SWSS_LOG_ for error logging
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>

Test case added for testing voq neighbor.
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>

Fixed review comments to use dvs_database.py lib to connect to redis
databases instead of using raw connection via swsscommon DBConnectors.
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>

Changed to call dvs apis to get access to databases for the local redis
instances. Changed comments format as suggested
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>

Changes are done to: (1) Setup inband interface - applicable for both
port type and vlan type (2) Add neighbors for inband interface and sync
to chassis app db (3) Postpone neighbor programming both in kernel
and in asic for remote neighbors till inband interface is operationally
up. (4) Update "oper" state in STATE DB for Inband interface
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>

Changes done to handle procssing specific to port type inband interface
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>

Class for lag id allocation in atomic fashion. The LAG ID is allocated
from central chassis app db. A lua script loaded in the redis at the
time of lag allocator instantiaion ensures allocation unqiue lag id when
multiple clients requests for lag id simultaneously. System wide unique
lag id is used for system lag in VOQ based switches.
SWSS_LOG_ENTER();

vector<string> keys;
keys.push_back(CHASSIS_APP_LAG_ID_START_NAME);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid taking redis data structure key name while invoking add/del/get operation. The keys can be internally hardcoded

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

vedganes added 3 commits December 17, 2020 11:36
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>

- Added tests for inband if (port type) and remote neigh programming in asic db
and kernel
- Fixed switch_id values in the system port config.
Signed-off-by: vedganes <vedavinayagam.ganesan@nokia.com>

Changes to fix code review comments. The lua script evaluation is not
passed with keys. The keys for the required data are internally
hardcoded in the script itself.
@vganesan-nokia vganesan-nokia changed the title [lagidallocator] LAG allocator class [lagidallocator] LAG ID allocator class Jan 18, 2021
@vganesan-nokia vganesan-nokia force-pushed the voq-inbandif-port branch 2 times, most recently from a10aa69 to 1f1fc0d Compare February 17, 2021 17:58
vganesan-nokia pushed a commit that referenced this pull request Nov 29, 2022
Currently, ASAN sometimes reports the BufferOrch::m_buffer_type_maps and QosOrch::m_qos_maps as leaked. However, their lifetime is the lifetime of a process so they are not really 'leaked'.
This also adds a simple way to add more suppressions later if required.

Example of ASAN report:

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x7f96aa952d30 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xead30)
    #1 0x55ca1da9f789 in __static_initialization_and_destruction_0 /__w/2/s/orchagent/bufferorch.cpp:39
    #2 0x55ca1daa02af in _GLOBAL__sub_I_bufferorch.cpp /__w/2/s/orchagent/bufferorch.cpp:1321
    #3 0x55ca1e2a9cd4  (/usr/bin/orchagent+0xe89cd4)

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x7f96aa952d30 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xead30)
    #1 0x55ca1da6d2da in __static_initialization_and_destruction_0 /__w/2/s/orchagent/qosorch.cpp:80
    #2 0x55ca1da6ecf2 in _GLOBAL__sub_I_qosorch.cpp /__w/2/s/orchagent/qosorch.cpp:2000
    #3 0x55ca1e2a9cd4  (/usr/bin/orchagent+0xe89cd4)

- What I did
Added an lsan suppression config with static variable leak suppression

- Why I did it
To suppress ASAN false positives

- How I verified it
Run a test that produces the static variable leaks report and checked that report has these leaks suppressed.

Signed-off-by: Yakiv Huryk <yhuryk@nvidia.com>
vganesan-nokia pushed a commit that referenced this pull request Jan 5, 2024
**What I did**

Fix the Mem Leak by moving the raw pointers in type_maps to use smart pointers

**Why I did it**

```
Indirect leak of 83776 byte(s) in 476 object(s) allocated from:
    #0 0x7f0a2a414647 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99
    #1 0x5555590cc923 in __gnu_cxx::new_allocator, std::allocator > const, referenced_object> > >::allocate(unsigned long, void const*) /usr/include/c++/10/ext/new_allocator.h:115
    #2 0x5555590cc923 in std::allocator_traits, std::allocator > const, referenced_object> > > >::allocate(std::allocator, std::allocator > const, referenced_object> > >&, unsigned long) /usr/include/c++/10/bits/alloc_traits.h:460
    #3 0x5555590cc923 in std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, referenced_object>, std::_Select1st, std::allocator > const, referenced_object> >, std::less, std::allocator > >, std::allocator, std::allocator > const, referenced_object> > >::_M_get_node() /usr/include/c++/10/bits/stl_tree.h:584
    #4 0x5555590cc923 in std::_Rb_tree_node, std::allocator > const, referenced_object> >* std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, referenced_object>, std::_Select1st, std::allocator > const, referenced_object> >, std::less, std::allocator > >, std::allocator, std::allocator > const, referenced_object> > >::_M_create_node, std::allocator > const&>, std::tuple<> >(std::piecewise_construct_t const&, std::tuple, std::allocator > const&>&&, std::tuple<>&&) /usr/include/c++/10/bits/stl_tree.h:634
    sonic-net#5 0x5555590cc923 in std::_Rb_tree_iterator, std::allocator > const, referenced_object> > std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, referenced_object>, std::_Select1st, std::allocator > const, referenced_object> >, std::less, std::allocator > >, std::allocator, std::allocator > const, referenced_object> > >::_M_emplace_hint_unique, std::allocator > const&>, std::tuple<> >(std::_Rb_tree_const_iterator, std::allocator > const, referenced_object> >, std::piecewise_construct_t const&, std::tuple, std::allocator > const&>&&, std::tuple<>&&) /usr/include/c++/10/bits/stl_tree.h:2461
    sonic-net#6 0x5555590e8757 in std::map, std::allocator >, referenced_object, std::less, std::allocator > >, std::allocator, std::allocator > const, referenced_object> > >::operator[](std::__cxx11::basic_string, std::allocator > const&) /usr/include/c++/10/bits/stl_map.h:501
    sonic-net#7 0x5555590d48b0 in Orch::setObjectReference(std::map, std::allocator >, std::map, std::allocator >, referenced_object, std::less, std::allocator > >, std::allocator, std::allocator > const, referenced_object> > >*, std::less, std::allocator > >, std::allocator, std::allocator > const, std::map, std::allocator >, referenced_object, std::less, std::allocator > >, std::allocator, std::allocator > const, referenced_object> > >*> > >&, std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&) orchagent/orch.cpp:450
    sonic-net#8 0x5555594ff66b in QosOrch::handleQueueTable(Consumer&, std::tuple, std::allocator >, std::__cxx11::basic_string, std::allocator >, std::vector, std::allocator >, std::__cxx11::basic_string, std::allocator > >, std::allocator, std::allocator >, std::__cxx11::basic_string, std::allocator > > > > >&) orchagent/qosorch.cpp:1763
    sonic-net#9 0x5555594edbd6 in QosOrch::doTask(Consumer&) orchagent/qosorch.cpp:2179
    sonic-net#10 0x5555590c8743 in Consumer::drain() orchagent/orch.cpp:241
    sonic-net#11 0x5555590c8743 in Consumer::drain() orchagent/orch.cpp:238
    sonic-net#12 0x5555590c8743 in Consumer::execute() orchagent/orch.cpp:235
    sonic-net#13 0x555559090dad in OrchDaemon::start() orchagent/orchdaemon.cpp:755
    sonic-net#14 0x555558e9be25 in main orchagent/main.cpp:766
    sonic-net#15 0x7f0a299b6d09 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x23d09)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant