Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1457662 > unrolled thread

Re: [PATCH 2/7] staging/android: display sync_pt name on debugfs

Started byMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
First post2016-08-08 11:40 +0200
Last post2016-08-09 16:50 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 2/7] staging/android: display sync_pt name on debugfs Maarten Lankhorst <maarten.lankhorst@linux.intel.com> - 2016-08-08 11:40 +0200
    Re: [PATCH 2/7] staging/android: display sync_pt name on debugfs Gustavo Padovan <gustavo.padovan@collabora.com> - 2016-08-08 22:00 +0200
      Re: [PATCH 2/7] staging/android: display sync_pt name on debugfs Maarten Lankhorst <maarten.lankhorst@linux.intel.com> - 2016-08-09 12:10 +0200
        Re: [PATCH 2/7] staging/android: display sync_pt name on debugfs Gustavo Padovan <gustavo@padovan.org> - 2016-08-09 16:50 +0200

#1457662 — Re: [PATCH 2/7] staging/android: display sync_pt name on debugfs

FromMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Date2016-08-08 11:40 +0200
SubjectRe: [PATCH 2/7] staging/android: display sync_pt name on debugfs
Message-ID<s3Pcm-82a-21@gated-at.bofh.it>
Op 20-06-16 om 17:53 schreef Gustavo Padovan:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
> When creating a sync_pt the name received wasn't used anywhere.
> Now we add it to the sync info debug output to make it easier to indetify
> the userspace name of that sync pt.
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> ---
>  drivers/staging/android/sw_sync.c    | 16 ++++------------
>  drivers/staging/android/sync_debug.c |  5 +++--
>  drivers/staging/android/sync_debug.h |  9 +++++++++
>  3 files changed, 16 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
> index b4ae092..ea27512 100644
> --- a/drivers/staging/android/sw_sync.c
> +++ b/drivers/staging/android/sw_sync.c
> @@ -37,15 +37,6 @@ struct sw_sync_create_fence_data {
>  		struct sw_sync_create_fence_data)
>  #define SW_SYNC_IOC_INC			_IOW(SW_SYNC_IOC_MAGIC, 1, __u32)
>  
> -static const struct fence_ops timeline_fence_ops;
> -
> -static inline struct sync_pt *fence_to_sync_pt(struct fence *fence)
> -{
> -	if (fence->ops != &timeline_fence_ops)
> -		return NULL;
> -	return container_of(fence, struct sync_pt, base);
> -}
> -
>  struct sync_timeline *sync_timeline_create(const char *name)
>  {
>  	struct sync_timeline *obj;
> @@ -108,7 +99,7 @@ static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc)
>  }
>  
>  static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size,
> -			     unsigned int value)
> +			     unsigned int value, char *name)
>  {
>  	unsigned long flags;
>  	struct sync_pt *pt;
> @@ -120,6 +111,7 @@ static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size,
>  	if (!pt)
>  		return NULL;
>  
> +	strlcpy(pt->name, name, sizeof(pt->name));
>  	spin_lock_irqsave(&obj->child_list_lock, flags);
>  	sync_timeline_get(obj);
>  	fence_init(&pt->base, &timeline_fence_ops, &obj->child_list_lock,
> @@ -191,7 +183,7 @@ static void timeline_fence_timeline_value_str(struct fence *fence,
>  	snprintf(str, size, "%d", parent->value);
>  }
>  
> -static const struct fence_ops timeline_fence_ops = {
> +const struct fence_ops timeline_fence_ops = {
>  	.get_driver_name = timeline_fence_get_driver_name,
>  	.get_timeline_name = timeline_fence_get_timeline_name,
>  	.enable_signaling = timeline_fence_enable_signaling,
> @@ -252,7 +244,7 @@ static long sw_sync_ioctl_create_fence(struct sync_timeline *obj,
>  		goto err;
>  	}
>  
> -	pt = sync_pt_create(obj, sizeof(*pt), data.value);
> +	pt = sync_pt_create(obj, sizeof(*pt), data.value, data.name);
>  	if (!pt) {
>  		err = -ENOMEM;
>  		goto err;
> diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c
> index 4c5a855..b732ea3 100644
> --- a/drivers/staging/android/sync_debug.c
> +++ b/drivers/staging/android/sync_debug.c
> @@ -75,13 +75,14 @@ static void sync_print_fence(struct seq_file *s, struct fence *fence, bool show)
>  {
>  	int status = 1;
>  	struct sync_timeline *parent = fence_parent(fence);
> +	struct sync_pt *pt = fence_to_sync_pt(fence);
>  
>  	if (fence_is_signaled_locked(fence))
>  		status = fence->status;
>  
> -	seq_printf(s, "  %s%sfence %s",
> +	seq_printf(s, "  %s%sfence %s %s",
>  		   show ? parent->name : "",
> -		   show ? "_" : "",
> +		   show ? "_" : "", pt->name,
>  		   sync_status_str(status));
>  
NAK,
A fence in sync_print_fence can be of any type. If you want to print the name, use the fence_value_str callback.

~Maarten

[toc] | [next] | [standalone]


#1458193

FromGustavo Padovan <gustavo.padovan@collabora.com>
Date2016-08-08 22:00 +0200
Message-ID<s3YSm-5KE-11@gated-at.bofh.it>
In reply to#1457662
2016-08-08 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>:

> Op 20-06-16 om 17:53 schreef Gustavo Padovan:
> > From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> >
> > When creating a sync_pt the name received wasn't used anywhere.
> > Now we add it to the sync info debug output to make it easier to indetify
> > the userspace name of that sync pt.
> >
> > Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> > ---
> >  drivers/staging/android/sw_sync.c    | 16 ++++------------
> >  drivers/staging/android/sync_debug.c |  5 +++--
> >  drivers/staging/android/sync_debug.h |  9 +++++++++
> >  3 files changed, 16 insertions(+), 14 deletions(-)
> >
> > diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
> > index b4ae092..ea27512 100644
> > --- a/drivers/staging/android/sw_sync.c
> > +++ b/drivers/staging/android/sw_sync.c
> > @@ -37,15 +37,6 @@ struct sw_sync_create_fence_data {
> >  		struct sw_sync_create_fence_data)
> >  #define SW_SYNC_IOC_INC			_IOW(SW_SYNC_IOC_MAGIC, 1, __u32)
> >  
> > -static const struct fence_ops timeline_fence_ops;
> > -
> > -static inline struct sync_pt *fence_to_sync_pt(struct fence *fence)
> > -{
> > -	if (fence->ops != &timeline_fence_ops)
> > -		return NULL;
> > -	return container_of(fence, struct sync_pt, base);
> > -}
> > -
> >  struct sync_timeline *sync_timeline_create(const char *name)
> >  {
> >  	struct sync_timeline *obj;
> > @@ -108,7 +99,7 @@ static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc)
> >  }
> >  
> >  static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size,
> > -			     unsigned int value)
> > +			     unsigned int value, char *name)
> >  {
> >  	unsigned long flags;
> >  	struct sync_pt *pt;
> > @@ -120,6 +111,7 @@ static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size,
> >  	if (!pt)
> >  		return NULL;
> >  
> > +	strlcpy(pt->name, name, sizeof(pt->name));
> >  	spin_lock_irqsave(&obj->child_list_lock, flags);
> >  	sync_timeline_get(obj);
> >  	fence_init(&pt->base, &timeline_fence_ops, &obj->child_list_lock,
> > @@ -191,7 +183,7 @@ static void timeline_fence_timeline_value_str(struct fence *fence,
> >  	snprintf(str, size, "%d", parent->value);
> >  }
> >  
> > -static const struct fence_ops timeline_fence_ops = {
> > +const struct fence_ops timeline_fence_ops = {
> >  	.get_driver_name = timeline_fence_get_driver_name,
> >  	.get_timeline_name = timeline_fence_get_timeline_name,
> >  	.enable_signaling = timeline_fence_enable_signaling,
> > @@ -252,7 +244,7 @@ static long sw_sync_ioctl_create_fence(struct sync_timeline *obj,
> >  		goto err;
> >  	}
> >  
> > -	pt = sync_pt_create(obj, sizeof(*pt), data.value);
> > +	pt = sync_pt_create(obj, sizeof(*pt), data.value, data.name);
> >  	if (!pt) {
> >  		err = -ENOMEM;
> >  		goto err;
> > diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c
> > index 4c5a855..b732ea3 100644
> > --- a/drivers/staging/android/sync_debug.c
> > +++ b/drivers/staging/android/sync_debug.c
> > @@ -75,13 +75,14 @@ static void sync_print_fence(struct seq_file *s, struct fence *fence, bool show)
> >  {
> >  	int status = 1;
> >  	struct sync_timeline *parent = fence_parent(fence);
> > +	struct sync_pt *pt = fence_to_sync_pt(fence);
> >  
> >  	if (fence_is_signaled_locked(fence))
> >  		status = fence->status;
> >  
> > -	seq_printf(s, "  %s%sfence %s",
> > +	seq_printf(s, "  %s%sfence %s %s",
> >  		   show ? parent->name : "",
> > -		   show ? "_" : "",
> > +		   show ? "_" : "", pt->name,
> >  		   sync_status_str(status));
> >  
> NAK,
> A fence in sync_print_fence can be of any type. If you want to print the name, use the fence_value_str callback.

Indeed. But fence_value_str doesn't return the sync_pt name, but the
seqno of that fence. I'll keep this change out for the de-staging and
then try to come with something that works better.

	Gustavo

[toc] | [prev] | [next] | [standalone]


#1458568

FromMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Date2016-08-09 12:10 +0200
Message-ID<s4c8V-6b7-21@gated-at.bofh.it>
In reply to#1458193
Op 08-08-16 om 21:59 schreef Gustavo Padovan:
> 2016-08-08 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>:
>
>> Op 20-06-16 om 17:53 schreef Gustavo Padovan:
>>> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>>
>>> When creating a sync_pt the name received wasn't used anywhere.
>>> Now we add it to the sync info debug output to make it easier to indetify
>>> the userspace name of that sync pt.
>>>
>>> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>> ---
>>>  drivers/staging/android/sw_sync.c    | 16 ++++------------
>>>  drivers/staging/android/sync_debug.c |  5 +++--
>>>  drivers/staging/android/sync_debug.h |  9 +++++++++
>>>  3 files changed, 16 insertions(+), 14 deletions(-)
>>>
>>> diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
>>> index b4ae092..ea27512 100644
>>> --- a/drivers/staging/android/sw_sync.c
>>> +++ b/drivers/staging/android/sw_sync.c
>>> @@ -37,15 +37,6 @@ struct sw_sync_create_fence_data {
>>>  		struct sw_sync_create_fence_data)
>>>  #define SW_SYNC_IOC_INC			_IOW(SW_SYNC_IOC_MAGIC, 1, __u32)
>>>  
>>> -static const struct fence_ops timeline_fence_ops;
>>> -
>>> -static inline struct sync_pt *fence_to_sync_pt(struct fence *fence)
>>> -{
>>> -	if (fence->ops != &timeline_fence_ops)
>>> -		return NULL;
>>> -	return container_of(fence, struct sync_pt, base);
>>> -}
>>> -
>>>  struct sync_timeline *sync_timeline_create(const char *name)
>>>  {
>>>  	struct sync_timeline *obj;
>>> @@ -108,7 +99,7 @@ static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc)
>>>  }
>>>  
>>>  static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size,
>>> -			     unsigned int value)
>>> +			     unsigned int value, char *name)
>>>  {
>>>  	unsigned long flags;
>>>  	struct sync_pt *pt;
>>> @@ -120,6 +111,7 @@ static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size,
>>>  	if (!pt)
>>>  		return NULL;
>>>  
>>> +	strlcpy(pt->name, name, sizeof(pt->name));
>>>  	spin_lock_irqsave(&obj->child_list_lock, flags);
>>>  	sync_timeline_get(obj);
>>>  	fence_init(&pt->base, &timeline_fence_ops, &obj->child_list_lock,
>>> @@ -191,7 +183,7 @@ static void timeline_fence_timeline_value_str(struct fence *fence,
>>>  	snprintf(str, size, "%d", parent->value);
>>>  }
>>>  
>>> -static const struct fence_ops timeline_fence_ops = {
>>> +const struct fence_ops timeline_fence_ops = {
>>>  	.get_driver_name = timeline_fence_get_driver_name,
>>>  	.get_timeline_name = timeline_fence_get_timeline_name,
>>>  	.enable_signaling = timeline_fence_enable_signaling,
>>> @@ -252,7 +244,7 @@ static long sw_sync_ioctl_create_fence(struct sync_timeline *obj,
>>>  		goto err;
>>>  	}
>>>  
>>> -	pt = sync_pt_create(obj, sizeof(*pt), data.value);
>>> +	pt = sync_pt_create(obj, sizeof(*pt), data.value, data.name);
>>>  	if (!pt) {
>>>  		err = -ENOMEM;
>>>  		goto err;
>>> diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c
>>> index 4c5a855..b732ea3 100644
>>> --- a/drivers/staging/android/sync_debug.c
>>> +++ b/drivers/staging/android/sync_debug.c
>>> @@ -75,13 +75,14 @@ static void sync_print_fence(struct seq_file *s, struct fence *fence, bool show)
>>>  {
>>>  	int status = 1;
>>>  	struct sync_timeline *parent = fence_parent(fence);
>>> +	struct sync_pt *pt = fence_to_sync_pt(fence);
>>>  
>>>  	if (fence_is_signaled_locked(fence))
>>>  		status = fence->status;
>>>  
>>> -	seq_printf(s, "  %s%sfence %s",
>>> +	seq_printf(s, "  %s%sfence %s %s",
>>>  		   show ? parent->name : "",
>>> -		   show ? "_" : "",
>>> +		   show ? "_" : "", pt->name,
>>>  		   sync_status_str(status));
>>>  
>> NAK,
>> A fence in sync_print_fence can be of any type. If you want to print the name, use the fence_value_str callback.
> Indeed. But fence_value_str doesn't return the sync_pt name, but the
> seqno of that fence. I'll keep this change out for the de-staging and
> then try to come with something that works better.
>
> 	Gustavo

This will probably cause a kernel panic if you keep it like it is and you look at
debugfs for non sync_pt fences, it should definitely be fixed before destaging.
Ignoring sync_pt name would be better than crashing.

~Maarten

[toc] | [prev] | [next] | [standalone]


#1458807

FromGustavo Padovan <gustavo@padovan.org>
Date2016-08-09 16:50 +0200
Message-ID<s4gvT-qL-13@gated-at.bofh.it>
In reply to#1458568
2016-08-09 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>:

> Op 08-08-16 om 21:59 schreef Gustavo Padovan:
> > 2016-08-08 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>:
> >
> >> Op 20-06-16 om 17:53 schreef Gustavo Padovan:
> >>> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> >>>
> >>> When creating a sync_pt the name received wasn't used anywhere.
> >>> Now we add it to the sync info debug output to make it easier to indetify
> >>> the userspace name of that sync pt.
> >>>
> >>> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> >>> ---
> >>>  drivers/staging/android/sw_sync.c    | 16 ++++------------
> >>>  drivers/staging/android/sync_debug.c |  5 +++--
> >>>  drivers/staging/android/sync_debug.h |  9 +++++++++
> >>>  3 files changed, 16 insertions(+), 14 deletions(-)
> >>>
> >>> diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
> >>> index b4ae092..ea27512 100644
> >>> --- a/drivers/staging/android/sw_sync.c
> >>> +++ b/drivers/staging/android/sw_sync.c
> >>> @@ -37,15 +37,6 @@ struct sw_sync_create_fence_data {
> >>>  		struct sw_sync_create_fence_data)
> >>>  #define SW_SYNC_IOC_INC			_IOW(SW_SYNC_IOC_MAGIC, 1, __u32)
> >>>  
> >>> -static const struct fence_ops timeline_fence_ops;
> >>> -
> >>> -static inline struct sync_pt *fence_to_sync_pt(struct fence *fence)
> >>> -{
> >>> -	if (fence->ops != &timeline_fence_ops)
> >>> -		return NULL;
> >>> -	return container_of(fence, struct sync_pt, base);
> >>> -}
> >>> -
> >>>  struct sync_timeline *sync_timeline_create(const char *name)
> >>>  {
> >>>  	struct sync_timeline *obj;
> >>> @@ -108,7 +99,7 @@ static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc)
> >>>  }
> >>>  
> >>>  static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size,
> >>> -			     unsigned int value)
> >>> +			     unsigned int value, char *name)
> >>>  {
> >>>  	unsigned long flags;
> >>>  	struct sync_pt *pt;
> >>> @@ -120,6 +111,7 @@ static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size,
> >>>  	if (!pt)
> >>>  		return NULL;
> >>>  
> >>> +	strlcpy(pt->name, name, sizeof(pt->name));
> >>>  	spin_lock_irqsave(&obj->child_list_lock, flags);
> >>>  	sync_timeline_get(obj);
> >>>  	fence_init(&pt->base, &timeline_fence_ops, &obj->child_list_lock,
> >>> @@ -191,7 +183,7 @@ static void timeline_fence_timeline_value_str(struct fence *fence,
> >>>  	snprintf(str, size, "%d", parent->value);
> >>>  }
> >>>  
> >>> -static const struct fence_ops timeline_fence_ops = {
> >>> +const struct fence_ops timeline_fence_ops = {
> >>>  	.get_driver_name = timeline_fence_get_driver_name,
> >>>  	.get_timeline_name = timeline_fence_get_timeline_name,
> >>>  	.enable_signaling = timeline_fence_enable_signaling,
> >>> @@ -252,7 +244,7 @@ static long sw_sync_ioctl_create_fence(struct sync_timeline *obj,
> >>>  		goto err;
> >>>  	}
> >>>  
> >>> -	pt = sync_pt_create(obj, sizeof(*pt), data.value);
> >>> +	pt = sync_pt_create(obj, sizeof(*pt), data.value, data.name);
> >>>  	if (!pt) {
> >>>  		err = -ENOMEM;
> >>>  		goto err;
> >>> diff --git a/drivers/staging/android/sync_debug.c b/drivers/staging/android/sync_debug.c
> >>> index 4c5a855..b732ea3 100644
> >>> --- a/drivers/staging/android/sync_debug.c
> >>> +++ b/drivers/staging/android/sync_debug.c
> >>> @@ -75,13 +75,14 @@ static void sync_print_fence(struct seq_file *s, struct fence *fence, bool show)
> >>>  {
> >>>  	int status = 1;
> >>>  	struct sync_timeline *parent = fence_parent(fence);
> >>> +	struct sync_pt *pt = fence_to_sync_pt(fence);
> >>>  
> >>>  	if (fence_is_signaled_locked(fence))
> >>>  		status = fence->status;
> >>>  
> >>> -	seq_printf(s, "  %s%sfence %s",
> >>> +	seq_printf(s, "  %s%sfence %s %s",
> >>>  		   show ? parent->name : "",
> >>> -		   show ? "_" : "",
> >>> +		   show ? "_" : "", pt->name,
> >>>  		   sync_status_str(status));
> >>>  
> >> NAK,
> >> A fence in sync_print_fence can be of any type. If you want to print the name, use the fence_value_str callback.
> > Indeed. But fence_value_str doesn't return the sync_pt name, but the
> > seqno of that fence. I'll keep this change out for the de-staging and
> > then try to come with something that works better.
> >
> > 	Gustavo
> 
> This will probably cause a kernel panic if you keep it like it is and you look at
> debugfs for non sync_pt fences, it should definitely be fixed before destaging.
> Ignoring sync_pt name would be better than crashing.

No, I meant ignoring sync_pt name for now. I've already sent v2 without
it.

Gustavo

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web