[dpdk-dev,5/5] vhost: add reconnect thread name for client mode.
Checks
Commit Message
This patch adds the name for vhost-user reconnect thread.
It can help us to know whether the thread is running.
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
lib/librte_vhost/socket.c | 8 ++++++++
1 file changed, 8 insertions(+)
Comments
On Fri, Jan 05, 2018 at 06:10:39AM -0800, Tonghao Zhang wrote:
> This patch adds the name for vhost-user reconnect thread.
> It can help us to know whether the thread is running.
>
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> ---
> lib/librte_vhost/socket.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
> index d44a0f1..c2e34e0 100644
> --- a/lib/librte_vhost/socket.c
> +++ b/lib/librte_vhost/socket.c
> @@ -433,6 +433,7 @@ struct vhost_user_reconnect_list {
> vhost_user_reconnect_init(void)
> {
> int ret;
> + char thread_name[RTE_MAX_THREAD_NAME_LEN];
>
> ret = pthread_mutex_init(&reconn_list.mutex, NULL);
> if (ret < 0) {
> @@ -449,6 +450,13 @@ struct vhost_user_reconnect_list {
> RTE_LOG(ERR, VHOST_CONFIG,
> "failed to destroy reconnect mutex");
> }
> + } else {
> + snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN,
> + "vhost-reconn");
> +
> + if (rte_thread_setname(reconn_tid, thread_name))
> + RTE_LOG(DEBUG, VHOST_CONFIG,
> + "Failed to set thread name for vhost-user reconnect");
Applied to dpdk-next-virtio, with the intendation fixed.
I have also shortten the log a bit "failed to set reconnect thread name".
There is no need to specify "vhost-user" again since VHOST_CONFIG tells
you it comes from vhost-user.
Thanks.
--yliu
On Tue, Jan 09, 2018 at 09:12:43PM +0800, Yuanhan Liu wrote:
> On Fri, Jan 05, 2018 at 06:10:39AM -0800, Tonghao Zhang wrote:
> > This patch adds the name for vhost-user reconnect thread.
> > It can help us to know whether the thread is running.
> >
> > Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > ---
> > lib/librte_vhost/socket.c | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
> > index d44a0f1..c2e34e0 100644
> > --- a/lib/librte_vhost/socket.c
> > +++ b/lib/librte_vhost/socket.c
> > @@ -433,6 +433,7 @@ struct vhost_user_reconnect_list {
> > vhost_user_reconnect_init(void)
> > {
> > int ret;
> > + char thread_name[RTE_MAX_THREAD_NAME_LEN];
> >
> > ret = pthread_mutex_init(&reconn_list.mutex, NULL);
> > if (ret < 0) {
> > @@ -449,6 +450,13 @@ struct vhost_user_reconnect_list {
> > RTE_LOG(ERR, VHOST_CONFIG,
> > "failed to destroy reconnect mutex");
> > }
> > + } else {
> > + snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN,
> > + "vhost-reconn");
> > +
> > + if (rte_thread_setname(reconn_tid, thread_name))
> > + RTE_LOG(DEBUG, VHOST_CONFIG,
> > + "Failed to set thread name for vhost-user reconnect");
>
> Applied to dpdk-next-virtio, with the intendation fixed.
Note that I have just applied this patch only. The rest of this patchset
belongs to the ixgbe PMD driver, which need another maintainer for review.
That also means, it's better if you could send them sperately next time
when they are not related. More specifically, in this case, one patch
for vhost-user, another patchset for all the rest ixgbe changes.
--yliu
Thanks for your review.
On Tue, Jan 9, 2018 at 9:40 PM, Yuanhan Liu <yliu@fridaylinux.org> wrote:
> On Tue, Jan 09, 2018 at 09:12:43PM +0800, Yuanhan Liu wrote:
>> On Fri, Jan 05, 2018 at 06:10:39AM -0800, Tonghao Zhang wrote:
>> > This patch adds the name for vhost-user reconnect thread.
>> > It can help us to know whether the thread is running.
>> >
>> > Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
>> > ---
>> > lib/librte_vhost/socket.c | 8 ++++++++
>> > 1 file changed, 8 insertions(+)
>> >
>> > diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c
>> > index d44a0f1..c2e34e0 100644
>> > --- a/lib/librte_vhost/socket.c
>> > +++ b/lib/librte_vhost/socket.c
>> > @@ -433,6 +433,7 @@ struct vhost_user_reconnect_list {
>> > vhost_user_reconnect_init(void)
>> > {
>> > int ret;
>> > + char thread_name[RTE_MAX_THREAD_NAME_LEN];
>> >
>> > ret = pthread_mutex_init(&reconn_list.mutex, NULL);
>> > if (ret < 0) {
>> > @@ -449,6 +450,13 @@ struct vhost_user_reconnect_list {
>> > RTE_LOG(ERR, VHOST_CONFIG,
>> > "failed to destroy reconnect mutex");
>> > }
>> > + } else {
>> > + snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN,
>> > + "vhost-reconn");
>> > +
>> > + if (rte_thread_setname(reconn_tid, thread_name))
>> > + RTE_LOG(DEBUG, VHOST_CONFIG,
>> > + "Failed to set thread name for vhost-user reconnect");
>>
>> Applied to dpdk-next-virtio, with the intendation fixed.
>
> Note that I have just applied this patch only. The rest of this patchset
> belongs to the ixgbe PMD driver, which need another maintainer for review.
>
> That also means, it's better if you could send them sperately next time
> when they are not related. More specifically, in this case, one patch
> for vhost-user, another patchset for all the rest ixgbe changes.
>
> --yliu
@@ -433,6 +433,7 @@ struct vhost_user_reconnect_list {
vhost_user_reconnect_init(void)
{
int ret;
+ char thread_name[RTE_MAX_THREAD_NAME_LEN];
ret = pthread_mutex_init(&reconn_list.mutex, NULL);
if (ret < 0) {
@@ -449,6 +450,13 @@ struct vhost_user_reconnect_list {
RTE_LOG(ERR, VHOST_CONFIG,
"failed to destroy reconnect mutex");
}
+ } else {
+ snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN,
+ "vhost-reconn");
+
+ if (rte_thread_setname(reconn_tid, thread_name))
+ RTE_LOG(DEBUG, VHOST_CONFIG,
+ "Failed to set thread name for vhost-user reconnect");
}
return ret;