os.analysis: Fix default thread state when syscall are not traced
authorFrancis Giraldeau <francis.giraldeau@gmail.com>
Wed, 9 Mar 2016 16:44:39 +0000 (11:44 -0500)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Fri, 11 Mar 2016 15:15:42 +0000 (10:15 -0500)
The current behavior is to assign sys_clone to a new thread where the parent's
system call is unknown. When system calls are not traced, the sys_clone exit
event does not occurs, and therefore the thread stays in syscall state, which
is incorrect. In fact, a thread should not enter the system call state when no
syscalls are traced.

For this reason, this patch does not speculate about the state of the
parent, and the child inherit whatever value is set for the parent.

Change-Id: Ic4a3ea8cab7d487a8effe3df282e134292ff8ec1
Signed-off-by: Francis Giraldeau <francis.giraldeau@gmail.com>
Reviewed-on: https://git.eclipse.org/r/68076
Reviewed-by: Hudson CI
Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
analysis/org.eclipse.tracecompass.analysis.os.linux.core.tests/src/org/eclipse/tracecompass/analysis/os/linux/core/tests/kernelanalysis/KernelThreadInformationProviderTest.java
analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/kernel/KernelStateProvider.java
analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/kernel/handlers/ProcessForkHandler.java

index 024f4748c79c06852f4ae1c393167244ba602de8..64a95d550dc7fb80aec1d5e0e7e9e6a4cf4833d3 100644 (file)
@@ -264,18 +264,18 @@ public class KernelThreadInformationProviderTest {
 
         /* Check different time ranges and resolutions */
         ITmfStateValue[] values = { TmfStateValue.nullValue(), StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE,
-                StateValues.PROCESS_STATUS_RUN_SYSCALL_VALUE, StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE,
-                StateValues.PROCESS_STATUS_RUN_SYSCALL_VALUE };
+                StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE, StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE,
+                StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE };
         intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process21, 0, 70L, 3, monitor);
         testIntervals("tid 21 [0,70,3]", intervals, values);
 
-        ITmfStateValue[] values2 = { TmfStateValue.nullValue(), StateValues.PROCESS_STATUS_RUN_SYSCALL_VALUE,
-                StateValues.PROCESS_STATUS_RUN_SYSCALL_VALUE };
+        ITmfStateValue[] values2 = { TmfStateValue.nullValue(), StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE,
+                StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE };
         intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process21, 1, 70L, 30, monitor);
         testIntervals("tid 21 [0,70,30]", intervals, values2);
 
         ITmfStateValue[] values3 = { StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE,
-                StateValues.PROCESS_STATUS_RUN_SYSCALL_VALUE };
+                StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE };
         intervals = KernelThreadInformationProvider.getStatusIntervalsForThread(module, process21, 25, 50L, 3, monitor);
         testIntervals("tid 21 [25,50,3]", intervals, values3);
 
index 3783768660897a26430e215346611236cf04bb37..808784877c5dfd83b4165dcd35e06afe21595172 100644 (file)
@@ -59,7 +59,7 @@ public class KernelStateProvider extends AbstractTmfStateProvider {
      * Version number of this state provider. Please bump this if you modify the
      * contents of the generated state history in some way.
      */
-    private static final int VERSION = 12;
+    private static final int VERSION = 13;
 
     // ------------------------------------------------------------------------
     // Fields
index f6e37b4c6a820bef38dfaac0a1cebe5225f46bb3..4e56a452c8bbd1db89ef96493deebb44c844829b 100644 (file)
@@ -67,14 +67,10 @@ public class ProcessForkHandler extends KernelEventHandler {
         /* Set the process' syscall name, to be the same as the parent's */
         quark = ss.getQuarkRelativeAndAdd(parentTidNode, Attributes.SYSTEM_CALL);
         value = ss.queryOngoingState(quark);
-        if (value.isNull()) {
-            /*
-             * Maybe we were missing info about the parent? At least we will set
-             * the child right. Let's suppose "sys_clone".
-             */
-            value = TmfStateValue.newValueString(getLayout().eventSyscallEntryPrefix() + IKernelAnalysisEventLayout.INITIAL_SYSCALL_NAME);
+        if (!value.isNull()) {
+            quark = ss.getQuarkRelativeAndAdd(childTidNode, Attributes.SYSTEM_CALL);
+            ss.modifyAttribute(timestamp, value, quark);
         }
-        quark = ss.getQuarkRelativeAndAdd(childTidNode, Attributes.SYSTEM_CALL);
-        ss.modifyAttribute(timestamp, value, quark);
+
     }
 }
This page took 0.029197 seconds and 5 git commands to generate.