-
Notifications
You must be signed in to change notification settings - Fork 273
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
[nvidia] Skip SAI discovery on ports on fast-boot #1416
base: master
Are you sure you want to change the base?
Changes from all commits
995d79b
9ce1a02
7811b60
56c4012
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,7 +89,8 @@ namespace syncd | |
|
||
virtual void onPostPortCreate( | ||
_In_ sai_object_id_t port_rid, | ||
_In_ sai_object_id_t port_vid) = 0; | ||
_In_ sai_object_id_t port_vid, | ||
_In_ bool discoverPortObjects = true) = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is very strict to ports, if we decide later on to do something similar on other objects then this is not optimal solution There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function is meant to be used on ports. Considering current approach, I assume there will be onPostXCreate() functions for other object types. Then, if needed, they can accept a boolean flag in the same way. This is simple and gives required granularity. |
||
|
||
virtual void postPortRemove( | ||
_In_ sai_object_id_t portRid) = 0; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2023,7 +2023,7 @@ sai_status_t Syncd::processBulkOidCreate( | |
|
||
if (objectType == SAI_OBJECT_TYPE_PORT) | ||
{ | ||
m_switches.at(switchVid)->onPostPortCreate(objectRids[idx], objectVids[idx]); | ||
m_switches.at(switchVid)->onPostPortCreate(objectRids[idx], objectVids[idx], shouldDiscoverPortObjects()); | ||
} | ||
} | ||
} | ||
|
@@ -3152,7 +3152,7 @@ sai_status_t Syncd::processOidCreate( | |
|
||
if (objectType == SAI_OBJECT_TYPE_PORT) | ||
{ | ||
m_switches.at(switchVid)->onPostPortCreate(objectRid, objectVid); | ||
m_switches.at(switchVid)->onPostPortCreate(objectRid, objectVid, shouldDiscoverPortObjects()); | ||
} | ||
} | ||
|
||
|
@@ -5338,3 +5338,23 @@ syncd_restart_type_t Syncd::handleRestartQuery( | |
|
||
return RequestShutdownCommandLineOptions::stringToRestartType(op); | ||
} | ||
|
||
bool Syncd::shouldDiscoverPortObjects() const | ||
{ | ||
SWSS_LOG_ENTER(); | ||
|
||
#ifdef SKIP_SAI_PORT_DISCOVERY_ON_FAST_BOOT | ||
const bool discoverPortObjectsInFastBoot = false; | ||
#else | ||
const bool discoverPortObjectsInFastBoot = true; | ||
#endif | ||
Comment on lines
+5346
to
+5350
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fast boot cak be initiated after code was compiled which then this check will be hardcoded There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also there are no tests for testing this code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This was the intention. For Nvidia - skip discover on ports in fast boot. The runtime check for fast boot is done in the condition below. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be runtime check There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kcudnik What is the benefit of runtime check here? Syncd is compiled per platform and on Nvidia we do not want to run discovery. We know this at compile time. |
||
|
||
// Comparing with m_veryFirstRun, so that we only skip discovery when switch is fast booting | ||
// and not after it finished fast boot (e.g. port breakout after fast-reboot). | ||
if ((m_commandLineOptions->m_startType == SAI_START_TYPE_FAST_BOOT) && m_veryFirstRun) | ||
{ | ||
return discoverPortObjectsInFastBoot; | ||
} | ||
|
||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i feel like this eintrie change in this function is overcomplicated, it sholud be something like this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kcudnik
Regarding
object_type(oid) == SAI_OBJECT_TYPE_PORT
, the function is calledonPostPortCreate
so unless someone is calling it on object other than port I don't think this check is needed.Do you mean early return? Like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, i thoung you also modify discover process, since it will also discover all objects on all ports, so i guess on cold boot you only need onpostportcreate, but this could still crash on next fast-boot
please do couple of fst-boot to fast-boot reboots with your patch to see if this will wrok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking at taht code, you only need to modify SaiDiscovery process with flag to ignore port discovery, no else code is needed to be changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and ig you look on master, in SaiDiscovery.cpp file at line 34, you can actually pass new flag - to not discover port objects over VendorSaiOptions class to not forward all bool arguments to discover ports, if you want
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, since we don want to skip port ddetection on other platforms than yours
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and you can disable those ports in init script for your platform only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kcudnik Platform is known at compile time, syncd is compiled differently for different platforms. My change as is right now should not affect other platforms. This change purpose is to improve startup time, however with platform detection done in script I will add some additional CPU cycles for that. Even though it is very small, on some lower systems the init scripts execution time is worse, that's why I am leaning towards moving all to compile time if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's know at compile time, put this:
in si discovery
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also add log warn message, that discovery port was disabled on nvidia platform