Skip to content

Core Page on Web Stats#101

Merged
koolzz merged 18 commits intosdnfv:developfrom
kevindweb:core_page
Apr 27, 2019
Merged

Core Page on Web Stats#101
koolzz merged 18 commits intosdnfv:developfrom
kevindweb:core_page

Conversation

@kevindweb
Copy link
Copy Markdown
Contributor

@kevindweb kevindweb commented Apr 13, 2019

Added a core page to view where all the threads are located.

Summary:

In the web stats view of onvm, seen through ./onvm/go.sh 0,1,2 1 0xF8 -s web, previously, the page was empty. Now, we have information about the cores, which can be seen in card format. Right now each core only runs one process, but with shared cpu in the future, will show multiple items on the same core.

Usage:
Run onvm web stats as shown above, and click on the Core Mappings page. This will be in the localhost (port 8080) of the node.

This PR includes
Resolves issues
Breaking API changes
Internal API changes
Usability improvements
Bug fixes
New functionality 👍
New NF/onvm_mgr args
Changes to starting NFs
Dependency updates
Web stats updates 👍

Merging notes:

  • Dependencies: None

TODO before merging :

  • Verify the Rx, Tx, and master thread is display correctly
  • Test many NFs
  • PR is ready for review

Review:

  • Sanity checks, assigned to @koolzz @dennisafa

    • Run make in /onvm and /examples directories
    • For extra testing, run ./build_web.sh in onvm_web (if needed)
    • Code style, assigned to @koolzz @dennisafa
  • Run linter

  • Check for memory leaks

    • Check that code is reusable
    • Code is clean, functions are concise
    • Verify that edge cases properly handled
  • Performance, assigned to @koolzz @dennisafa

    • Run Speed Tester NF, report performance.
  • Documentation, assigned to @koolzz @dennisafa

    • Check if the new changes are well documented, in both code and READMEs

@onvm
Copy link
Copy Markdown

onvm commented Apr 13, 2019

In response to PR creation

CI Message

Your results will arrive shortly

@koolzz koolzz self-requested a review April 13, 2019 19:00
@onvm
Copy link
Copy Markdown

onvm commented Apr 13, 2019

In response to PR creation

CI Message

Run successful see results:
[Results from nimbnode30]
Median TX pps for Speed Tester: 35191355

Linter Passed

@koolzz
Copy link
Copy Markdown
Member

koolzz commented Apr 13, 2019

Everything is minified and web stuff is rebuilt, I'll test later today
t

@kevindweb
Copy link
Copy Markdown
Contributor Author

Awesome thanks, I tried to limit the changes in c code, and there is no added code to any loops so performance shouldn't drop a result (most of the changes are initialization).

Copy link
Copy Markdown
Member

@koolzz koolzz left a comment

Choose a reason for hiding this comment

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

Lets try to make things more generic, adding new arguments into the call isn't the cleanest solution.

Comment thread onvm/onvm_mgr/onvm_stats.c Outdated

void
onvm_stats_add_event(const char *msg, struct onvm_nf_info *nf_info) {
onvm_stats_add_event(const char *msg, struct onvm_nf_info *nf_info, unsigned core) {
Copy link
Copy Markdown
Member

@koolzz koolzz Apr 13, 2019

Choose a reason for hiding this comment

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

Should this be more generic? I don't like adding a unsigned core argument as its not always used and we might need to support other arguments later. Could we provide an arg struct, with different IDs?

struct event_info {
       uint16_t type; 
       const char *msg;
       void *data;
};

We should also provide helper functions that generate this struct. For example smth like gen_event_info(msg) for our simple messages, that way we still have the oneline onvm_stats_add_event calls, but we could also do gen_event_info_with_core_arg(msg, core) (might need a better name) when we need more arguments.
And then the onvm_stats_add_event based on the event can parse arguments appropriately.

(this way we also combine msg + any other possible args)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ya that's a better way of doing it, I'll work on these fixes when I finish my other work this weekend

@twood02
Copy link
Copy Markdown
Member

twood02 commented Apr 13, 2019

Semi related question - do we currently show any info about what core an NF is running on in the text console stats? If not, we should

@koolzz
Copy link
Copy Markdown
Member

koolzz commented Apr 13, 2019

@twood2 We don't but that's definitely something we should include for this release

@kevindweb
Copy link
Copy Markdown
Contributor Author

check it out @onvm

@onvm
Copy link
Copy Markdown

onvm commented Apr 15, 2019

check it out @onvm

CI Message

Your results will arrive shortly

@kevindweb
Copy link
Copy Markdown
Contributor Author

@twood02 @koolzz Should I update the stdout stats to reflect the nf core in this pr? Or I can do it in another one, just seems relevant to this one, especially since I'm already updating onvm_mgr/stats.c

@onvm
Copy link
Copy Markdown

onvm commented Apr 15, 2019

check it out @onvm

CI Message

Run successful see results:
[Results from nimbnode30]
Median TX pps for Speed Tester: 35173967

Linter Failed

examples/aes_decrypt/aes.h:176: #endif line should be "#endif // AES_H" [build/header_guard] [5]
Total errors found: 1
examples/aes_encrypt/aes.h:185: #endif line should be "#endif // AES_H" [build/header_guard] [5]
Total errors found: 1
examples/flow_table/flow_table.h:63: #endif line should be "#endif // FLOW_TABLE_H" [build/header_guard] [5]
Total errors found: 1
examples/flow_table/msgbuf.h:71: #endif line should be "#endif // MSGBUF_H" [build/header_guard] [5]
Total errors found: 1
examples/flow_table/openflow.h:969: #endif line should be "#endif // OPENFLOW_H" [build/header_guard] [5]
examples/flow_table/openflow.h:50: Using deprecated casting style. Use static_cast(...) instead [readability/casting] [4]
examples/flow_table/openflow.h:569: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:634: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:771: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:804: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:865: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:926: Extra space before ( in function call [whitespace/parens] [4]
Total errors found: 8
examples/flow_table/sdn.c:334: { should almost always be at the end of the previous line [whitespace/braces] [4]
examples/flow_table/sdn.c:365: Should have a space between // and comment [whitespace/comments] [4]
Total errors found: 2
examples/flow_table/sdn.h:104: #endif line should be "#endif // SDN_H" [build/header_guard] [5]
Total errors found: 1
examples/flow_table/sdn_pkt_list.h:122: #endif line should be "#endif // SDN_PKT_LIST_H" [build/header_guard] [5]
Total errors found: 1
examples/flow_table/setupconn.h:53: #endif line should be "#endif // SETUPCONN_H" [build/header_guard] [5]
Total errors found: 1
examples/speed_tester/speed_tester.c:364: Lines should be <= 120 characters long [whitespace/line_length] [5]
Total errors found: 1
onvm/onvm_mgr/main.c:109: Lines should be <= 120 characters long [whitespace/line_length] [5]
Total errors found: 1
onvm/onvm_mgr/onvm_init.c:107: { should almost always be at the end of the previous line [whitespace/braces] [4]
onvm/onvm_mgr/onvm_init.c:114: { should almost always be at the end of the previous line [whitespace/braces] [4]
onvm/onvm_mgr/onvm_init.c:116: { should almost always be at the end of the previous line [whitespace/braces] [4]
Total errors found: 3
onvm/onvm_mgr/onvm_pkt.c:68: Are you taking an address of a cast? This is dangerous: could be a temp var. Take the address before doing the cast, rather than after [runtime/casting] [4]
Total errors found: 1
onvm/onvm_mgr/onvm_stats.c:240: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
onvm/onvm_mgr/onvm_stats.c:278: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
Total errors found: 2
onvm/onvm_nflib/onvm_common.h:366: #endif line should be "#endif // ONVM_COMMON_H" [build/header_guard] [5]
Total errors found: 1
onvm/onvm_nflib/onvm_config_common.h:208: #endif line should be "#endif // ONVM_CONFIG_COMMON_H" [build/header_guard] [5]
Total errors found: 1
onvm/onvm_nflib/onvm_msg_common.h:61: #endif line should be "#endif // ONVM_MSG_COMMON_H" [build/header_guard] [5]
Total errors found: 1
onvm/onvm_nflib/onvm_nflib.c:523: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
Total errors found: 1
onvm/onvm_nflib/onvm_pkt_common.c:98: Are you taking an address of a cast? This is dangerous: could be a temp var. Take the address before doing the cast, rather than after [runtime/casting] [4]
Total errors found: 1
onvm/onvm_nflib/onvm_sc_common.h:70: #endif line should be "#endif // ONVM_SC_COMMON_H" [build/header_guard] [5]
onvm/onvm_nflib/onvm_sc_common.h:70: Should have a space between // and comment [whitespace/comments] [4]
Total errors found: 2
onvm/onvm_nflib/onvm_sc_mgr.h:79: #endif line should be "#endif // ONVM_SC_MGR_H" [build/header_guard] [5]
Total errors found: 1

@kevindweb
Copy link
Copy Markdown
Contributor Author

Welp it seems nicer when there's no errors but whatever.

@koolzz
Copy link
Copy Markdown
Member

koolzz commented Apr 15, 2019

@twood02 @koolzz Should I update the stdout stats to reflect the nf core in this pr? Or I can do it in another one, just seems relevant to this one, especially since I'm already updating onvm_mgr/stats.c

I prefer a separate PR, the reason being is we want to make the stats code prettier (currently its a bit ugly). I was thinking of changing the description and value lines to global const char * values and overall cleanup. That can probably wait tho until shared CPU so we don't have to deal with conflicts, besides review shared CPU as that is higher priority 😉.

Comment thread onvm/onvm_mgr/onvm_stats.h Outdated
typedef enum { ONVM_STATS_NONE = 0, ONVM_STATS_STDOUT, ONVM_STATS_STDERR, ONVM_STATS_WEB } ONVM_STATS_OUTPUT;

struct onvm_event {
const char *type;
Copy link
Copy Markdown
Member

@koolzz koolzz Apr 15, 2019

Choose a reason for hiding this comment

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

type should be a numeric value, uint8_t would work.
Then you can define a few different types like ONVM_EVENT_NF_INFO, ONVM_EVENT_MGR_TX_CORE_INFO, ONVM_EVENT_MGR_RX_CORE_INFO smth like that

Comment thread onvm/onvm_mgr/onvm_stats.c Outdated
cJSON_AddStringToObject(source, "type", (const char *)event_info->type);

if (event_info->data != NULL) {
if (strcmp(event_info->type, "NF") == 0) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

And if you make type an int this will be a simple == check

Comment thread onvm/onvm_mgr/onvm_stats.c Outdated
cJSON_AddNumberToObject(source, "instance_id", (int16_t)nf_info->instance_id);
cJSON_AddNumberToObject(source, "service_id", (int16_t)nf_info->service_id);
cJSON_AddNumberToObject(source, "core", (int16_t)nf_info->core);
} else {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also be exhaustive, do

if(event_A) 
    bla
else if (event B) 
    blablabla
.
.
.
.
else 
    error as we don't support anything else

Comment thread onvm/onvm_mgr/onvm_stats.c Outdated
time_t time_raw_format;
struct tm *ptr_time;
struct onvm_nf_info *nf_info;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

extra space

Comment thread onvm/onvm_mgr/onvm_stats.c Outdated
cJSON_AddStringToObject(source, "type", "NF");
cJSON_AddStringToObject(new_event, "message", event_info->msg);

if (type == 0) {
Copy link
Copy Markdown
Member

@koolzz koolzz Apr 16, 2019

Choose a reason for hiding this comment

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

Skimmed through, this is the part that needs to be changed, avoid magic numbers. Always do #define COOL_MSG_NAME 2

Comment thread onvm/onvm_mgr/onvm_stats.h Outdated
#define ONVM_STATS_FILE ONVM_STATS_PATH_BASE "onvm_stats.txt"

#define ONVM_EVENT_MGR_INFO "Manager"
#define ONVM_EVENT_PORT_INFO "Port"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You already have the names so just bundle it up with msg IDs

@kevindweb
Copy link
Copy Markdown
Contributor Author

@onvm make sure we're all good

@onvm
Copy link
Copy Markdown

onvm commented Apr 20, 2019

@onvm make sure we're all good

CI Message

Your results will arrive shortly

@onvm
Copy link
Copy Markdown

onvm commented Apr 20, 2019

@onvm make sure we're all good

CI Message

Run successful see results:
[Results from nimbnode30]
Median TX pps for Speed Tester: 35165829

Linter Failed

examples/aes_decrypt/aes.h:176: #endif line should be "#endif // AES_H" [build/header_guard] [5]
Total errors found: 1
examples/aes_encrypt/aes.h:185: #endif line should be "#endif // AES_H" [build/header_guard] [5]
Total errors found: 1
examples/flow_table/flow_table.h:63: #endif line should be "#endif // FLOW_TABLE_H" [build/header_guard] [5]
Total errors found: 1
examples/flow_table/msgbuf.h:71: #endif line should be "#endif // MSGBUF_H" [build/header_guard] [5]
Total errors found: 1
examples/flow_table/openflow.h:969: #endif line should be "#endif // OPENFLOW_H" [build/header_guard] [5]
examples/flow_table/openflow.h:50: Using deprecated casting style. Use static_cast(...) instead [readability/casting] [4]
examples/flow_table/openflow.h:569: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:634: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:771: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:804: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:865: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:926: Extra space before ( in function call [whitespace/parens] [4]
Total errors found: 8
examples/flow_table/sdn.c:334: { should almost always be at the end of the previous line [whitespace/braces] [4]
examples/flow_table/sdn.c:365: Should have a space between // and comment [whitespace/comments] [4]
Total errors found: 2
examples/flow_table/sdn.h:104: #endif line should be "#endif // SDN_H" [build/header_guard] [5]
Total errors found: 1
examples/flow_table/sdn_pkt_list.h:122: #endif line should be "#endif // SDN_PKT_LIST_H" [build/header_guard] [5]
Total errors found: 1
examples/flow_table/setupconn.h:53: #endif line should be "#endif // SETUPCONN_H" [build/header_guard] [5]
Total errors found: 1
onvm/onvm_mgr/onvm_init.c:107: { should almost always be at the end of the previous line [whitespace/braces] [4]
onvm/onvm_mgr/onvm_init.c:114: { should almost always be at the end of the previous line [whitespace/braces] [4]
onvm/onvm_mgr/onvm_init.c:116: { should almost always be at the end of the previous line [whitespace/braces] [4]
Total errors found: 3
onvm/onvm_mgr/onvm_pkt.c:68: Are you taking an address of a cast? This is dangerous: could be a temp var. Take the address before doing the cast, rather than after [runtime/casting] [4]
Total errors found: 1
onvm/onvm_mgr/onvm_stats.c:240: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
Total errors found: 1
onvm/onvm_nflib/onvm_common.h:367: #endif line should be "#endif // ONVM_COMMON_H" [build/header_guard] [5]
Total errors found: 1
onvm/onvm_nflib/onvm_config_common.h:208: #endif line should be "#endif // ONVM_CONFIG_COMMON_H" [build/header_guard] [5]
Total errors found: 1
onvm/onvm_nflib/onvm_msg_common.h:61: #endif line should be "#endif // ONVM_MSG_COMMON_H" [build/header_guard] [5]
Total errors found: 1
onvm/onvm_nflib/onvm_nflib.c:523: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
Total errors found: 1
onvm/onvm_nflib/onvm_pkt_common.c:98: Are you taking an address of a cast? This is dangerous: could be a temp var. Take the address before doing the cast, rather than after [runtime/casting] [4]
Total errors found: 1
onvm/onvm_nflib/onvm_sc_common.h:70: #endif line should be "#endif // ONVM_SC_COMMON_H" [build/header_guard] [5]
onvm/onvm_nflib/onvm_sc_common.h:70: Should have a space between // and comment [whitespace/comments] [4]
Total errors found: 2
onvm/onvm_nflib/onvm_sc_mgr.h:79: #endif line should be "#endif // ONVM_SC_MGR_H" [build/header_guard] [5]
Total errors found: 1

@onvm
Copy link
Copy Markdown

onvm commented Apr 20, 2019

@onvm make sure we're all good

CI Message

Run successful see results:
[Results from nimbnode30]
Median TX pps for Speed Tester: 35165829

Linter Failed

examples/aes_decrypt/aes.h:176: #endif line should be #endif

CI Message

Your results will arrive shortly

@onvm
Copy link
Copy Markdown

onvm commented Apr 20, 2019

@onvm make sure we're all good

CI Message

Run successful see results:
[Results from nimbnode30]
Median TX pps for Speed Tester: 35165829

Linter Failed

examples/aes_decrypt/aes.h:176: #endif line should be #endif

CI Message

Run successful see results:
[Results from nimbnode30]
Median TX pps for Speed Tester: 35174025

Linter Failed

examples/aes_decrypt/aes.h:176: #endif line should be "#endif // AES_H" [build/header_guard] [5]
Total errors found: 1
examples/aes_encrypt/aes.h:185: #endif line should be "#endif // AES_H" [build/header_guard] [5]
Total errors found: 1
examples/flow_table/flow_table.h:63: #endif line should be "#endif // FLOW_TABLE_H" [build/header_guard] [5]
Total errors found: 1
examples/flow_table/msgbuf.h:71: #endif line should be "#endif // MSGBUF_H" [build/header_guard] [5]
Total errors found: 1
examples/flow_table/openflow.h:969: #endif line should be "#endif // OPENFLOW_H" [build/header_guard] [5]
examples/flow_table/openflow.h:50: Using deprecated casting style. Use static_cast(...) instead [readability/casting] [4]
examples/flow_table/openflow.h:569: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:634: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:771: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:804: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:865: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:926: Extra space before ( in function call [whitespace/parens] [4]
Total errors found: 8
examples/flow_table/sdn.c:334: { should almost always be at the end of the previous line [whitespace/braces] [4]
examples/flow_table/sdn.c:365: Should have a space between // and comment [whitespace/comments] [4]
Total errors found: 2
examples/flow_table/sdn.h:104: #endif line should be "#endif // SDN_H" [build/header_guard] [5]
Total errors found: 1
examples/flow_table/sdn_pkt_list.h:122: #endif line should be "#endif // SDN_PKT_LIST_H" [build/header_guard] [5]
Total errors found: 1
examples/flow_table/setupconn.h:53: #endif line should be "#endif // SETUPCONN_H" [build/header_guard] [5]
Total errors found: 1
onvm/onvm_mgr/onvm_init.c:107: { should almost always be at the end of the previous line [whitespace/braces] [4]
onvm/onvm_mgr/onvm_init.c:114: { should almost always be at the end of the previous line [whitespace/braces] [4]
onvm/onvm_mgr/onvm_init.c:116: { should almost always be at the end of the previous line [whitespace/braces] [4]
Total errors found: 3
onvm/onvm_mgr/onvm_pkt.c:68: Are you taking an address of a cast? This is dangerous: could be a temp var. Take the address before doing the cast, rather than after [runtime/casting] [4]
Total errors found: 1
onvm/onvm_mgr/onvm_stats.c:240: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
Total errors found: 1
onvm/onvm_nflib/onvm_common.h:367: #endif line should be "#endif // ONVM_COMMON_H" [build/header_guard] [5]
Total errors found: 1
onvm/onvm_nflib/onvm_config_common.h:208: #endif line should be "#endif // ONVM_CONFIG_COMMON_H" [build/header_guard] [5]
Total errors found: 1
onvm/onvm_nflib/onvm_msg_common.h:61: #endif line should be "#endif // ONVM_MSG_COMMON_H" [build/header_guard] [5]
Total errors found: 1
onvm/onvm_nflib/onvm_nflib.c:523: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
Total errors found: 1
onvm/onvm_nflib/onvm_pkt_common.c:98: Are you taking an address of a cast? This is dangerous: could be a temp var. Take the address before doing the cast, rather than after [runtime/casting] [4]
Total errors found: 1
onvm/onvm_nflib/onvm_sc_common.h:70: #endif line should be "#endif // ONVM_SC_COMMON_H" [build/header_guard] [5]
onvm/onvm_nflib/onvm_sc_common.h:70: Should have a space between // and comment [whitespace/comments] [4]
Total errors found: 2
onvm/onvm_nflib/onvm_sc_mgr.h:79: #endif line should be "#endif // ONVM_SC_MGR_H" [build/header_guard] [5]
Total errors found: 1

Comment thread onvm/onvm_mgr/onvm_stats.c Outdated
void
onvm_stats_add_event(const char *msg, struct onvm_nf_info *nf_info) {
if (msg == NULL || stats_destination != ONVM_STATS_WEB) {
gen_event_info(const char *msg, uint8_t type, void *data) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

public api funcs should be prefixed by filename, onvm_stats_gen_event_info

Comment thread onvm/onvm_mgr/onvm_stats.c Outdated
}

void
gen_event_nf_info(const char *msg, struct onvm_nf_info *nf_info) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same as above

Comment thread onvm/onvm_mgr/onvm_stats.h
Copy link
Copy Markdown
Member

@koolzz koolzz left a comment

Choose a reason for hiding this comment

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

Looks a lot better, pointed out some naming nits. Also never use magic numbers, if you defined the ONVM_EVENT_WITH_CORE to 0 and then use the gen_event function, always use the macro and not 0 when passing in args `gen_event_info("name thingy", ONVM_EVENT_WITH_CORE , &core)

Comment thread onvm/onvm_mgr/onvm_nf.c Outdated
gen_event_nf_info("NF Stopping", nf);

/* Cleanup the allocated tag */
if (nf->tag) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

tag cleanup is already in onvm_nf_stop, remove this

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

well at least in the nf tag pr, not sure why its removed here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed it from onvm_nf_stop. The reason is because when calling the json for the react app, on cleanup, when you call onvm_nf_stop, nf->tag is NULL. Thus, there is no way of knowing which nf (on the web side) needs to be removed from the display. So I just called it after the event info, as the only time onvm_nf_stop is called, is here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure if I understand, why would the tag be required? you have the data from the onvm_nf_info right? How did we stop this before because tags were broken

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also is actually dangerous anyway as we're freeing the memory and then trying to use it again.

I propose we rewrite this a little, add a new event macro ONVM_EVENT_NF_STOPPING, and do the message will just have the instance_id value of the NF that was stopped(save instance id as a temp value before calling stop). Does that make sense?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's because Aaron's code assumes that there is no tag at all. So in the code, NF <instance_id> is just passed around in the js. But now, I fixed the javascript so that we pass around the tag, so we can see it on every page (like a new id). But when we're cleaning up, in Stats NF conditonal, we pass the javascript NF as the name, instead of nf->tag if tag doesn't exist. So on start, an NF with tag will get a custom type, but on termination, it will be falsely called with NF <instance_id>, so we can't find it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tag for id seems like a bad idea though, its not unique

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The uniqueness comes with <tag> <instance_id>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah but tag is just a pretty name, instance id is what we should actually use. Is there a benefit of including the tag there that I'm missing? Should we just pass it as extra data?

And as this usage in unsafe we need to rewrite this a little, do you agree with my earlier comment on that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ya I agree and I'm working on changing it now. I'll figure out a way to fix the js code to work with it

Comment thread onvm/onvm_mgr/onvm_stats.c Outdated
return;
}

event->type = 2;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

magic number 2 replace with macro

Comment thread onvm/onvm_mgr/onvm_stats.c Outdated
cJSON_AddNumberToObject(source, "service_id", (int16_t)nf_info->service_id);
cJSON_AddNumberToObject(source, "core", (int16_t)nf_info->core);
} else {
perror("Invalid stats event type");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

rte_exit is what we typically use

@kevindweb
Copy link
Copy Markdown
Contributor Author

@koolzz We should be good now. I made a fix in the javascript so we don't even need a nf stopping flag in onvm_stats.c. I updated the style nits you asked for as well.

Comment thread onvm/onvm_mgr/onvm_nf.c Outdated
nf = (struct onvm_nf_info *)msg->msg_data;
if (onvm_nf_stop(nf) == 0) {
onvm_stats_add_event("NF Stopping", nf);
onvm_stats_gen_event_nf_info("NF Stopping", nf);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not safe as memory might be cleaned up, can we create a custom event and only pass an instance_id value?

Comment thread onvm/onvm_mgr/onvm_nf.c
nf_status = nf_info->status;

/* Cleanup the allocated tag */
if (nf_info->tag) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure why this is an addition its already in the dev branch. Can you pull upstream dev?

Comment thread onvm/onvm_mgr/onvm_stats.h Outdated
#define ONVM_STATS_FILE ONVM_STATS_PATH_BASE "onvm_stats.txt"

/*
* Handle types of web stats events
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A bit overkill, for short comments (not method stub comments)
/* Handle types of web stats events */

Comment thread onvm/onvm_mgr/onvm_stats.h Outdated
/*
* Interface called by manager when a new event should be created.
* Interfaces called by manager when a new event should be created.
*
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

extra line

Comment thread onvm/onvm_mgr/onvm_nf.c Outdated
break;

/* Get instance_id before tearing down nf */
stop_nf_id = (void *)&(nf->instance_id);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah we can't do this, the assumption is the nf memory can be freed, thus we need to save instance_id in a temp value, you're pointing to a value which doesn't quite cut it as it might get freed.

Instead just try doing

/* Saved as onvm_nf_stop frees the memory*/
uint16_t stop_nf_id = (nf->instance_id);
onvm_stats_gen_event_info("NF Stopping", ONVM_EVENT_NF_STOP, &stop_nf_id);

I'm assuming that will work although double check

@koolzz
Copy link
Copy Markdown
Member

koolzz commented Apr 26, 2019

@kevindweb Tested, core page is nice. Everything seems to work as expected. MGR thread proly needs to be set to something like mgr aux(stats) or something. Might be cool to actually show cores allocated from the onvm_mgr and say that they are idle rn. Also we would want to know which cpu socket the core is on (basically a few future improvements, probably not in this pr)

Also noticed possibly a small js bug (the highlight under the 3 different tabs isn't under the right tab) See screenschot
image

(See some of my code comments above)

@kevindweb
Copy link
Copy Markdown
Contributor Author

Thanks for reviewing, ya we can work on some of those functionality updates this summer. I've looked into the tab issue before when testing the old web stats. You need to click somewhere else and it will update. I'll see if there is an easy fix. Also, I'm making the updates you requested and pulling develop so I'll push again in a minute.

Copy link
Copy Markdown
Member

@koolzz koolzz left a comment

Choose a reason for hiding this comment

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

Approving, good work

@koolzz
Copy link
Copy Markdown
Member

koolzz commented Apr 27, 2019

@onvm Sanity check

@onvm
Copy link
Copy Markdown

onvm commented Apr 27, 2019

@onvm Sanity check

CI Message

Your results will arrive shortly

@onvm
Copy link
Copy Markdown

onvm commented Apr 27, 2019

@onvm Sanity check

CI Message

Run successful see results:
[Results from nimbnode30]
Median TX pps for Speed Tester: 35184823

Linter Failed

examples/arp_response/arp_response.c:284: Lines should be <= 120 characters long [whitespace/line_length] [5]
Total errors found: 1
examples/flow_table/openflow.h:50: Using deprecated casting style. Use static_cast(...) instead [readability/casting] [4]
examples/flow_table/openflow.h:569: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:634: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:771: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:804: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:865: Extra space before ( in function call [whitespace/parens] [4]
examples/flow_table/openflow.h:926: Extra space before ( in function call [whitespace/parens] [4]
Total errors found: 7
examples/nf_router/nf_router.c:173: Lines should be <= 120 characters long [whitespace/line_length] [5]
Total errors found: 1
onvm/onvm_mgr/onvm_pkt.c:68: Are you taking an address of a cast? This is dangerous: could be a temp var. Take the address before doing the cast, rather than after [runtime/casting] [4]
Total errors found: 1
onvm/onvm_mgr/onvm_stats.c:306: If an else has a brace on one side, it should have it on both [readability/braces] [5]
Total errors found: 1
onvm/onvm_nflib/onvm_pkt_common.c:98: Are you taking an address of a cast? This is dangerous: could be a temp var. Take the address before doing the cast, rather than after [runtime/casting] [4]
Total errors found: 1

@koolzz koolzz merged commit 4dd40a9 into sdnfv:develop Apr 27, 2019
@koolzz koolzz added this to the ONVM 19.05 Release milestone May 26, 2019
@kevindweb kevindweb deleted the core_page branch June 1, 2019 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants