Skip to content

Aod#1

Open
meetakshi253 wants to merge 7 commits into
masterfrom
aod
Open

Aod#1
meetakshi253 wants to merge 7 commits into
masterfrom
aod

Conversation

@meetakshi253

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces AOD (Always-On-Diagnostics) functionality by adding SMB and NFS monitoring tools with shared memory communication capabilities. The changes include new eBPF programs for tracing network file system operations and a Python event dispatcher for processing collected data.

Key changes:

  • Added SMB and NFS latency monitoring tools (smbsloweraod.c, nfssloweraod.c)
  • Implemented shared memory ring buffer for inter-process communication between C and Python programs
  • Updated libbpf subproject commit and modified build system to support new tools

Reviewed Changes

Copilot reviewed 21 out of 25 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
vmlinux/vmlinux.h Removed reference to x86/vmlinux.h
libbpf Updated subproject commit hash
examples/c/smbsloweraod.c New SMB latency monitoring tool with shared memory integration
examples/c/smbsloweraod.bpf.c eBPF program for SMB operation tracing
examples/c/nfssloweraod.c New NFS latency monitoring tool
examples/c/nfssloweraod.bpf.c eBPF program for NFS operation tracing
examples/c/shm_writer.c Shared memory ring buffer implementation
examples/c/event_dispatcher.py Python event processor for shared memory data
examples/c/Makefile Build system updates for new tools

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread examples/c/smbsloweraod.c
count++;
token = strtok(NULL, ",");
}
token = strtok(NULL, ",");

Copilot AI Sep 16, 2025

Copy link

Choose a reason for hiding this comment

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

Double call to strtok on line 59 and 60 causes tokens to be skipped. The second call on line 60 should be removed as the loop already advances the token on line 57.

Suggested change
token = strtok(NULL, ",");

Copilot uses AI. Check for mistakes.
Comment thread examples/c/smbsloweraod.c
Comment on lines +110 to +111
err = parse_cmd_list(arg, MAX_SMB_COMMANDS);
if (err < 0) {

Copilot AI Sep 16, 2025

Copy link

Choose a reason for hiding this comment

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

Variable 'err' is declared inside the 'c' case block but used in the 'x' case block without declaration, causing a compilation error.

Copilot uses AI. Check for mistakes.
Comment thread examples/c/smbsloweraod.c

if (end_time.tv_nsec >= NSEC_PER_SEC) {
end_time.tv_sec += 1;
end_time.tv_sec -= NSEC_PER_SEC;

Copilot AI Sep 16, 2025

Copy link

Choose a reason for hiding this comment

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

This should subtract from tv_nsec, not tv_sec. The line should be: end_time.tv_nsec -= NSEC_PER_SEC;

Suggested change
end_time.tv_sec -= NSEC_PER_SEC;
end_time.tv_nsec -= NSEC_PER_SEC;

Copilot uses AI. Check for mistakes.
Comment thread examples/c/nfssloweraod.c
count++;
token = strtok(NULL, ",");
}
token = strtok(NULL, ",");

Copilot AI Sep 16, 2025

Copy link

Choose a reason for hiding this comment

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

Double call to strtok on line 57 and 58 causes tokens to be skipped. The second call on line 58 should be removed as the loop already advances the token on line 55.

Suggested change
token = strtok(NULL, ",");

Copilot uses AI. Check for mistakes.
Comment thread examples/c/nfssloweraod.c
Comment on lines +109 to +110
err = parse_cmd_list(arg, MAX_NFS_COMMANDS);
if (err < 0) {

Copilot AI Sep 16, 2025

Copy link

Choose a reason for hiding this comment

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

Variable 'err' is declared inside the 'c' case block but used in the 'x' case block without declaration, causing a compilation error.

Copilot uses AI. Check for mistakes.
Comment thread examples/c/nfssloweraod.c

if (end_time.tv_nsec >= NSEC_PER_SEC) {
end_time.tv_sec += 1;
end_time.tv_sec -= NSEC_PER_SEC;

Copilot AI Sep 16, 2025

Copy link

Choose a reason for hiding this comment

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

This should subtract from tv_nsec, not tv_sec. The line should be: end_time.tv_nsec -= NSEC_PER_SEC;

Suggested change
end_time.tv_sec -= NSEC_PER_SEC;
end_time.tv_nsec -= NSEC_PER_SEC;

Copilot uses AI. Check for mistakes.
Comment thread examples/c/nfssloweraod.c
else if (include_mode && !cmd_filter[cmd]) deny = true;

if (deny) {
printf("Denying command %d (%s)\n", cmd, get_smb_command(cmd));

Copilot AI Sep 16, 2025

Copy link

Choose a reason for hiding this comment

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

Wrong function called for NFS commands. This should call get_nfs_command(cmd) instead of get_smb_command(cmd).

Suggested change
printf("Denying command %d (%s)\n", cmd, get_smb_command(cmd));
printf("Denying command %d (%s)\n", cmd, get_nfs_command(cmd));

Copilot uses AI. Check for mistakes.
Comment thread examples/c/pybpf.c
static PyObject *libbpf_ring_buffer__init(PyObject *self, PyObject *args) {
const char* pinned_map_path;

if (!PyArg_ParseTuple(args, "s", &pinned_map_path));

Copilot AI Sep 16, 2025

Copy link

Choose a reason for hiding this comment

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

Incorrect semicolon after if statement causes the return NULL to execute unconditionally. Remove the semicolon after the if condition.

Suggested change
if (!PyArg_ParseTuple(args, "s", &pinned_map_path));
if (!PyArg_ParseTuple(args, "s", &pinned_map_path))

Copilot uses AI. Check for mistakes.
Comment thread examples/c/pybpf.c
Comment on lines +47 to +48
perror("bpf_obj_get");
return -1;

Copilot AI Sep 16, 2025

Copy link

Choose a reason for hiding this comment

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

Function is declared to return PyObject* but is returning -1. Should return NULL or a proper Python exception object.

Suggested change
perror("bpf_obj_get");
return -1;
PyErr_SetString(PyExc_OSError, "bpf_obj_get failed");
return NULL;

Copilot uses AI. Check for mistakes.
Comment thread examples/c/shm_writer.c
size_t len = sizeof(struct event);
size_t head = buf->head;
size_t tail = buf->tail;
size_t free_space = (tail + SHM_DATA_SIZE - head - 1);

Copilot AI Sep 16, 2025

Copy link

Choose a reason for hiding this comment

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

Ring buffer free space calculation is incorrect. Should be: size_t free_space = (tail + SHM_DATA_SIZE - head - 1) % SHM_DATA_SIZE;

Suggested change
size_t free_space = (tail + SHM_DATA_SIZE - head - 1);
size_t free_space = (tail + SHM_DATA_SIZE - head - 1) % SHM_DATA_SIZE;

Copilot uses AI. Check for mistakes.
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.

2 participants