On 2019/5/8 16:04, Thomas Monjalon wrote:
Hi,
I try to suggest some rewording below.
Thanks very much.
First, let me explain what is the patch work for.
As we all know, the pdump tool works as the secondary process.
When the primary process exits, if the secondary process keeps running
there, it will make the primary process can't start up again.
Since the ex-fbarry files are still attached by the secondary process
pdump, the 'new' primary process can't get these files locked.
The patch is just to set up an alarm which runs every 0.5s periodically
to monitor the primary process in the pdump.
Once the primary exits, so will the pdump.
03/05/2019 07:48, Suanming. Mou:
+/* Enough to set it to 500ms for exiting. */
+#define MONITOR_INTERVAL (500 * 1000)
What is "enough"?
The 'enough' here means it will be fine to make the alarm to run
periodically in every 500ms to check if the primary process exits.
(Yes, someone can also suggest, "Well , I think xxxms will be better.")
What is "it"?
So, the "it" here means the MONITOR_INTERVAL...
What is the relation between MONITOR_INTERVAL and exiting?
Once the primary exits, as the alarm runs every 500ms, the alarm will
help the pdump to exit, the worst case will take 500ms for the pudmp to
exit.
[...]
+ /*
+ * Don't worry about it is primary exit case. The alarm cancel
+ * function will take care about that. Ignore the ENOENT case.
+ */
I don't understand the comment.
Maybe you can explicit what is "it" and "that".
It would be probably simpler if you just describe why you cancel
this alarm.
How is it related to ENOENT?
The 'it' and 'that' both means the pdump 'monitor_primary' recognises
the primary process exited and set the 'quit_signal' case.
In that case, the 'monitor_primary' is not readd to the alarm. I add the
comment in case someone want to say that "You are canceling a
non-existent alarm."
It's OK to cancel a non-existent alarm. The 'rte_eal_alarm_cancel' just
return 0 and set the ENOENT errno.
+ ret = rte_eal_alarm_cancel(monitor_primary, NULL);
+ if (ret < 0)
+ printf("Fail to disable monitor:%d\n", ret);
[...]
- /* create mempool, ring and vdevs info */
+ /* create mempool, ring, vdevs info and primary monitor */
I don't see any value to this comment.
You may just drop it.
That's OK.
create_mp_ring_vdev();
enable_pdump();
+ enable_primary_monitor();
And one more word, the 'app' in the git log means 'application'.
Maybe it's better to change it to 'process' to make it describes more
clearly.
Thanks again for the suggestions.
BR,
Mou