Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

iousagetop not working due to net_if_receive_skb #91

Open
thburghout opened this issue Oct 8, 2019 · 1 comment
Open

iousagetop not working due to net_if_receive_skb #91

thburghout opened this issue Oct 8, 2019 · 1 comment

Comments

@thburghout
Copy link

thburghout commented Oct 8, 2019

The current project uses net_dev_xmit and netif_receive_skb to trace network usage. However; my machine (4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64 GNU/Linux) reports net_if_receive_skb.

I've solved this for my self by replacing all string occurrences of netif_receive_skb by net_if_receive_skb.

diff --git a/lttnganalyses/core/io.py b/lttnganalyses/core/io.py
index 1337ab9..bb7297a 100644
--- a/lttnganalyses/core/io.py
+++ b/lttnganalyses/core/io.py
@@ -36,7 +36,7 @@ class IoAnalysis(Analysis):
     def __init__(self, state, conf):
         notification_cbs = {
             'net_dev_xmit': self._process_net_dev_xmit,
-            'netif_receive_skb': self._process_netif_receive_skb,
+            'net_if_receive_skb': self._process_netif_receive_skb,
             'block_rq_complete': self._process_block_rq_complete,
             'io_rq_exit': self._process_io_rq_exit,
             'create_fd': self._process_create_fd,
diff --git a/lttnganalyses/linuxautomaton/net.py b/lttnganalyses/linuxautomaton/net.py
index 9517422..6249159 100644
--- a/lttnganalyses/linuxautomaton/net.py
+++ b/lttnganalyses/linuxautomaton/net.py
@@ -28,7 +28,7 @@ class NetStateProvider(sp.StateProvider):
     def __init__(self, state):
         cbs = {
             'net_dev_xmit': self._process_net_dev_xmit,
-            'netif_receive_skb': self._process_netif_receive_skb,
+            'net_if_receive_skb': self._process_netif_receive_skb,
         }
 
         super().__init__(state, cbs)
@@ -63,7 +63,7 @@ class NetStateProvider(sp.StateProvider):
                 proc.fds[fd].fd_type = sv.FDType.maybe_net
 
     def _process_netif_receive_skb(self, event):
-        self._state.send_notification_cb('netif_receive_skb',
+        self._state.send_notification_cb('net_if_receive_skb',
                                          iface_name=event['name'],
                                          recv_bytes=event['len'],
                                          cpu_id=event['cpu_id'])
diff --git a/tests/integration/trace_writer.py b/tests/integration/trace_writer.py
index dc69051..a949d9b 100644
--- a/tests/integration/trace_writer.py
+++ b/tests/integration/trace_writer.py
@@ -261,7 +261,7 @@ class TraceWriter():
         self.add_event(self.net_dev_xmit)
 
     def define_netif_receive_skb(self):
-        self.netif_receive_skb = CTFWriter.EventClass("netif_receive_skb")
+        self.netif_receive_skb = CTFWriter.EventClass("net_if_receive_skb")
         self.netif_receive_skb.add_field(self.uint64_type, "_skbaddr")
         self.netif_receive_skb.add_field(self.uint32_type, "_len")
         self.netif_receive_skb.add_field(self.string_type, "_name")

I think it would be desired to fix this in this repo as well. Is this solution sufficient? Would all functions need to be renamed as well?

@jgalar
Copy link
Member

jgalar commented Oct 9, 2019

I'm not entirely sure what the policy is to handle those types of changes.

The notification_cbs should probably target both event names to preserve compatibility with older kernels.

As for the function names themselves, I don't think renaming them is necessary if both event names are targeted.

Maybe @eepp and/or @jdesfossez would care to comment here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants